@@ -346,7 +346,8 @@ impl RawFromSql for json::Json {
346
346
}
347
347
348
348
macro_rules! from_map_impl(
349
- ( $( $expected: pat) |+, $t: ty, $blk: expr) => (
349
+ ( $( $expected: pat) |+, $t: ty, $blk: expr $( , $a: meta) * ) => (
350
+ $( #[ $a] ) *
350
351
impl FromSql for Option <$t> {
351
352
fn from_sql( ty: & Type , raw: & Option <Vec <u8 >>)
352
353
-> Result <Option <$t>> {
@@ -358,6 +359,7 @@ macro_rules! from_map_impl(
358
359
}
359
360
}
360
361
362
+ $( #[ $a] ) *
361
363
impl FromSql for $t {
362
364
fn from_sql( ty: & Type , raw: & Option <Vec <u8 >>)
363
365
-> Result <$t> {
@@ -374,11 +376,11 @@ macro_rules! from_map_impl(
374
376
)
375
377
376
378
macro_rules! from_raw_from_impl(
377
- ( $( $expected: pat) |+, $t: ty) => (
379
+ ( $( $expected: pat) |+, $t: ty $ ( , $a : meta ) * ) => (
378
380
from_map_impl!( $( $expected) |+, $t, |buf: & Vec <u8 >| {
379
381
let mut reader = BufReader :: new( buf[ ] ) ;
380
382
RawFromSql :: raw_from_sql( & mut reader)
381
- } )
383
+ } $ ( , $a ) * )
382
384
)
383
385
)
384
386
@@ -392,7 +394,7 @@ from_raw_from_impl!(Int8, i64)
392
394
from_raw_from_impl ! ( Float4 , f32 )
393
395
from_raw_from_impl ! ( Float8 , f64 )
394
396
#[ cfg( feature = "uuid_type" ) ]
395
- from_raw_from_impl ! ( Uuid , uuid:: Uuid )
397
+ from_raw_from_impl ! ( Uuid , uuid:: Uuid , doc = "requires the \" uuid_type \" feature" )
396
398
from_raw_from_impl ! ( Json , json:: Json )
397
399
398
400
from_raw_from_impl ! ( Timestamp | TimestampTZ , Timespec )
@@ -401,7 +403,7 @@ from_raw_from_impl!(Int8Range, Range<i64>)
401
403
from_raw_from_impl ! ( TsRange | TstzRange , Range <Timespec >)
402
404
403
405
macro_rules! from_array_impl(
404
- ( $( $oid: ident) |+, $t: ty) => (
406
+ ( $( $oid: ident) |+, $t: ty $ ( , $a : meta ) * ) => (
405
407
from_map_impl!( $( $oid) |+, ArrayBase <Option <$t>>, |buf: & Vec <u8 >| {
406
408
let mut rdr = BufReader :: new( buf[ ] ) ;
407
409
@@ -431,7 +433,7 @@ macro_rules! from_array_impl(
431
433
}
432
434
433
435
Ok ( ArrayBase :: from_raw( elements, dim_info) )
434
- } )
436
+ } $ ( , $a ) * )
435
437
)
436
438
)
437
439
@@ -444,7 +446,7 @@ from_array_impl!(TextArray | CharNArray | VarcharArray | NameArray, String)
444
446
from_array_impl ! ( Int8Array , i64 )
445
447
from_array_impl ! ( TimestampArray | TimestampTZArray , Timespec )
446
448
#[ cfg( feature = "uuid_type" ) ]
447
- from_array_impl ! ( UuidArray , uuid:: Uuid )
449
+ from_array_impl ! ( UuidArray , uuid:: Uuid , doc = "requires the \" uuid_type \" feature" )
448
450
from_array_impl ! ( JsonArray , json:: Json )
449
451
from_array_impl ! ( Float4Array , f32 )
450
452
from_array_impl ! ( Float8Array , f64 )
@@ -630,7 +632,8 @@ impl RawToSql for json::Json {
630
632
}
631
633
632
634
macro_rules! to_option_impl(
633
- ( $( $oid: pat) |+, $t: ty) => (
635
+ ( $( $oid: pat) |+, $t: ty $( , $a: meta) * ) => (
636
+ $( #[ $a] ) *
634
637
impl ToSql for Option <$t> {
635
638
fn to_sql( & self , ty: & Type ) -> Result <Option <Vec <u8 >>> {
636
639
check_types!( $( $oid) |+, ty)
@@ -660,7 +663,8 @@ macro_rules! to_option_impl_lifetime(
660
663
)
661
664
662
665
macro_rules! to_raw_to_impl(
663
- ( $( $oid: ident) |+, $t: ty) => (
666
+ ( $( $oid: ident) |+, $t: ty $( , $a: meta) * ) => (
667
+ $( #[ $a] ) *
664
668
impl ToSql for $t {
665
669
fn to_sql( & self , ty: & Type ) -> Result <Option <Vec <u8 >>> {
666
670
check_types!( $( $oid) |+, ty)
@@ -671,15 +675,15 @@ macro_rules! to_raw_to_impl(
671
675
}
672
676
}
673
677
674
- to_option_impl!( $( $oid) |+, $t)
678
+ to_option_impl!( $( $oid) |+, $t $ ( , $a ) * )
675
679
)
676
680
)
677
681
678
682
to_raw_to_impl ! ( Bool , bool )
679
683
to_raw_to_impl ! ( ByteA , Vec <u8 >)
680
684
to_raw_to_impl ! ( Varchar | Text | CharN | Name , String )
681
685
#[ cfg( feature = "uuid_type" ) ]
682
- to_raw_to_impl ! ( Uuid , uuid:: Uuid )
686
+ to_raw_to_impl ! ( Uuid , uuid:: Uuid , doc = "requires the \" uuid_type \" feature" )
683
687
to_raw_to_impl ! ( Json , json:: Json )
684
688
to_raw_to_impl ! ( Char , i8 )
685
689
to_raw_to_impl ! ( Int2 , i16 )
@@ -712,7 +716,8 @@ to_option_impl_lifetime!(ByteA, &'a [u8])
712
716
to_raw_to_impl ! ( Timestamp | TimestampTZ , Timespec )
713
717
714
718
macro_rules! to_array_impl(
715
- ( $( $oid: ident) |+, $t: ty) => (
719
+ ( $( $oid: ident) |+, $t: ty $( , $a: meta) * ) => (
720
+ $( #[ $a] ) *
716
721
impl ToSql for ArrayBase <Option <$t>> {
717
722
fn to_sql( & self , ty: & Type ) -> Result <Option <Vec <u8 >>> {
718
723
check_types!( $( $oid) |+, ty)
@@ -744,7 +749,7 @@ macro_rules! to_array_impl(
744
749
}
745
750
}
746
751
747
- to_option_impl!( $( $oid) |+, ArrayBase <Option <$t>>)
752
+ to_option_impl!( $( $oid) |+, ArrayBase <Option <$t>> $ ( , $a ) * )
748
753
)
749
754
)
750
755
@@ -762,7 +767,7 @@ to_array_impl!(Int4RangeArray, Range<i32>)
762
767
to_array_impl ! ( TsRangeArray | TstzRangeArray , Range <Timespec >)
763
768
to_array_impl ! ( Int8RangeArray , Range <i64 >)
764
769
#[ cfg( feature = "uuid_type" ) ]
765
- to_array_impl ! ( UuidArray , uuid:: Uuid )
770
+ to_array_impl ! ( UuidArray , uuid:: Uuid , doc = "requires the \" uuid_type \" feature" )
766
771
to_array_impl ! ( JsonArray , json:: Json )
767
772
768
773
impl ToSql for HashMap < String , Option < String > > {
0 commit comments