| 1 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::decoderust-analyzer cargo sqlx-core 0.8.3 decode/::Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#; |
| 2 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 0.8.3 error/::BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#; |
| 3 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::typesrust-analyzer cargo sqlx-postgres 0.8.3 types/::PgRecordDecoderrust-analyzer cargo sqlx-postgres 0.8.3 types/record/PgRecordDecoder#; |
| 4 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::typesrust-analyzer cargo sqlx-postgres 0.8.3 types/::Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#; |
| 5 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::{PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType#, PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#, PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#}; |
| 6 | |
| 7 | macro_rules! impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple! { |
| 8 | ($( $idx:ident : $T:ident ),*) => { |
| 9 | impl<$($T,)*> Type<Postgres> for ($($T,)*) { |
| 10 | |
| 11 | |
| 12 | #[inline] |
| 13 | fn type_info() -> PgTypeInfo { |
| 14 | PgTypeInfo::RECORD |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | impl<$($T,)*> PgHasArrayType for ($($T,)*) { |
| 19 | |
| 20 | |
| 21 | #[inline] |
| 22 | fn array_type_info() -> PgTypeInfo { |
| 23 | PgTypeInfo::RECORD_ARRAY |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl<'r, $($T,)*> Decode<'r, Postgres> for ($($T,)*) |
| 28 | where |
| 29 | $($T: 'r,)* |
| 30 | $($T: Type<Postgres>,)* |
| 31 | $($T: for<'a> Decode<'a, Postgres>,)* |
| 32 | { |
| 33 | |
| 34 | |
| 35 | fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError> { |
| 36 | #[allow(unused)] |
| 37 | let mut decoder = PgRecordDecoder::new(value)?; |
| 38 | |
| 39 | $(let $idx: $T = decoder.try_decode()?;)* |
| 40 | |
| 41 | Ok(($($idx,)*)) |
| 42 | } |
| 43 | } |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1); |
| 48 | |
| 49 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2); |
| 50 | |
| 51 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2, _3: T3); |
| 52 | |
| 53 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2, _3: T3, _4: T4); |
| 54 | |
| 55 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2, _3: T3, _4: T4, _5: T5); |
| 56 | |
| 57 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6); |
| 58 | |
| 59 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!(_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7); |
| 60 | |
| 61 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!( |
| 62 | _1: T1, |
| 63 | _2: T2, |
| 64 | _3: T3, |
| 65 | _4: T4, |
| 66 | _5: T5, |
| 67 | _6: T6, |
| 68 | _7: T7, |
| 69 | _8: T8 |
| 70 | ); |
| 71 | |
| 72 | impl_type_for_tuplerust-analyzer cargo sqlx-postgres 0.8.3 types/tuple/impl_type_for_tuple!!( |
| 73 | _1: T1, |
| 74 | _2: T2, |
| 75 | _3: T3, |
| 76 | _4: T4, |
| 77 | _5: T5, |
| 78 | _6: T6, |
| 79 | _7: T7, |
| 80 | _8: T8, |
| 81 | _9: T9 |
| 82 | ); |