| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#; |
| 2 | |
| 3 | use ipnetworkrust-analyzer cargo ipnetwork 0.21.1 crate/::IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#; |
| 4 | |
| 5 | 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#; |
| 6 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::encoderust-analyzer cargo sqlx-core 0.8.3 encode/::{Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#, IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#}; |
| 7 | 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#; |
| 8 | 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#; |
| 9 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::{PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#, 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#}; |
| 10 | |
| 11 | impl Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#<Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# |
| 12 | where |
| 13 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#: Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#<Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#>, |
| 14 | { |
| 15 | fn type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Type<Postgres>`]type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 16 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::type_inforust-analyzer cargo sqlx-core 0.8.3 types/Type#type_info().() |
| 17 | } |
| 18 | |
| 19 | fn compatiblerust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Type<Postgres>`]compatible().(ty: &PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#) -> bool { |
| 20 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::compatiblerust-analyzer cargo sqlx-core 0.8.3 types/Type#compatible().(ty) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | impl PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType# for IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# { |
| 25 | fn array_type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][PgHasArrayType]array_type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 26 | <IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# as PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType#>::array_type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][PgHasArrayType]array_type_info().() |
| 27 | } |
| 28 | |
| 29 | fn array_compatiblerust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][PgHasArrayType]array_compatible().(ty: &PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#) -> bool { |
| 30 | <IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# as PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType#>::array_compatiblerust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][PgHasArrayType]array_compatible().(ty) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | impl<'db> Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#<'db, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# |
| 35 | where |
| 36 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#: Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#<'db, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#>, |
| 37 | { |
| 38 | fn encode_by_refrust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Encode<'db, Postgres>`]encode_by_ref().(&self, buf: &mut PgArgumentBufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArgumentBuffer#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#, BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 39 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::fromrust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork][`From<IpAddr>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).encode_by_refrust-analyzer cargo sqlx-core 0.8.3 encode/Encode#encode_by_ref().(buf) |
| 40 | } |
| 41 | |
| 42 | fn size_hintrust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Encode<'db, Postgres>`]size_hint().(&self) -> usize { |
| 43 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::fromrust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork][`From<IpAddr>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).size_hintrust-analyzer cargo sqlx-core 0.8.3 encode/Encode#size_hint().() |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | impl<'db> Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#<'db, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# |
| 48 | where |
| 49 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#: Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#<'db, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#>, |
| 50 | { |
| 51 | fn decoderust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Decode<'db, Postgres>`]decode().(value: PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#<'db>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 types/ipaddr/impl#[IpAddr][`Decode<'db, Postgres>`], BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 52 | let ipnetwork = IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#decode().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 53 | |
| 54 | if ipnetwork.is_ipv4rust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork]is_ipv4().() && ipnetwork.prefixrust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork]prefix().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().32 |
| 55 | || ipnetwork.is_ipv6rust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork]is_ipv6().() && ipnetwork.prefixrust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork]prefix().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().128 |
| 56 | { |
| 57 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("lossy decode from inet/cidr")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 58 | } |
| 59 | |
| 60 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ipnetwork.iprust-analyzer cargo ipnetwork 0.21.1 impl#[IpNetwork]ip().()) |
| 61 | } |
| 62 | } |