| 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/::{Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#}; |
| 2 | |
| 3 | use ipnetworkrust-analyzer cargo ipnetwork 0.21.1 crate/::{IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#, Ipv4Networkrust-analyzer cargo ipnetwork 0.21.1 ipv4/Ipv4Network#, Ipv6Networkrust-analyzer cargo ipnetwork 0.21.1 ipv6/Ipv6Network#}; |
| 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#, PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#, PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#}; |
| 10 | |
| 11 | // https://github.com/postgres/postgres/blob/574925bfd0a8175f6e161936ea11d9695677ba09/src/include/utils/inet.h#L39 |
| 12 | |
| 13 | // Technically this is a magic number here but it doesn't make sense to drag in the whole of `libc` |
| 14 | // just for one constant. |
| 15 | const PGSQL_AF_INETrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET.: u8 = 2; // AF_INET |
| 16 | const PGSQL_AF_INET6rust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET6.: u8 = PGSQL_AF_INETrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().1; |
| 17 | |
| 18 | impl Typerust-analyzer cargo sqlx-core 0.8.3 types/Type#<Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# { |
| 19 | fn type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Type<Postgres>`]type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 20 | PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::INETrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]INET. |
| 21 | } |
| 22 | |
| 23 | fn compatiblerust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Type<Postgres>`]compatible().(ty: &PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#) -> bool { |
| 24 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ty rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::CIDRrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]CIDR. || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ty rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::INETrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]INET. |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | impl PgHasArrayTyperust-analyzer cargo sqlx-postgres 0.8.3 types/array/PgHasArrayType# for IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# { |
| 29 | fn array_type_inforust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][PgHasArrayType]array_type_info().() -> PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo# { |
| 30 | PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::INET_ARRAYrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]INET_ARRAY. |
| 31 | } |
| 32 | |
| 33 | fn array_compatiblerust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][PgHasArrayType]array_compatible().(ty: &PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#) -> bool { |
| 34 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ty rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::CIDR_ARRAYrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]CIDR_ARRAY. || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().ty rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo][`PartialEq<Self>`]eq().PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#::INET_ARRAYrust-analyzer cargo sqlx-postgres 0.8.3 type_info/impl#[PgTypeInfo]INET_ARRAY. |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | impl Encoderust-analyzer cargo sqlx-core 0.8.3 encode/Encode#<'_, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# { |
| 39 | fn encode_by_refrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Encode<'_, 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#> { |
| 40 | // https://github.com/postgres/postgres/blob/574925bfd0a8175f6e161936ea11d9695677ba09/src/backend/utils/adt/network.c#L293 |
| 41 | // https://github.com/postgres/postgres/blob/574925bfd0a8175f6e161936ea11d9695677ba09/src/backend/utils/adt/network.c#L271 |
| 42 | |
| 43 | match self { |
| 44 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V4rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V4#(net) => { |
| 45 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(PGSQL_AF_INETrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET.); // ip_family |
| 46 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(net.prefixrust-analyzer cargo ipnetwork 0.21.1 ipv4/impl#[Ipv4Network]prefix().()); // ip_bits |
| 47 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(0); // is_cidr |
| 48 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(4); // nb (number of bytes) |
| 49 | buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&net.iprust-analyzer cargo ipnetwork 0.21.1 ipv4/impl#[Ipv4Network]ip().().octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]octets().()) // address |
| 50 | } |
| 51 | |
| 52 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V6rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V6#(net) => { |
| 53 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(PGSQL_AF_INET6rust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET6.); // ip_family |
| 54 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(net.prefixrust-analyzer cargo ipnetwork 0.21.1 ipv6/impl#[Ipv6Network]prefix().()); // ip_bits |
| 55 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(0); // is_cidr |
| 56 | buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(16); // nb (number of bytes) |
| 57 | buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&net.iprust-analyzer cargo ipnetwork 0.21.1 ipv6/impl#[Ipv6Network]ip().().octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]octets().()); // address |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IsNullrust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#::Norust-analyzer cargo sqlx-core 0.8.3 encode/IsNull#No#) |
| 62 | } |
| 63 | |
| 64 | fn size_hintrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Encode<'_, Postgres>`]size_hint().(&self) -> usize { |
| 65 | match self { |
| 66 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V4rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V4#(_) => 8, |
| 67 | IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V6rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V6#(_) => 20, |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | impl Decoderust-analyzer cargo sqlx-core 0.8.3 decode/Decode#<'_, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#> for IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork# { |
| 73 | fn decoderust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Decode<'_, Postgres>`]decode().(value: PgValueRefrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueRef#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/impl#[IpNetwork][`Decode<'_, Postgres>`], BoxDynErrorrust-analyzer cargo sqlx-core 0.8.3 error/BoxDynError#> { |
| 74 | let bytes = match value.formatrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]format().() { |
| 75 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Binaryrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Binary# => value.as_bytesrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]as_bytes().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 76 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Textrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Text# => { |
| 77 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value.as_strrust-analyzer cargo sqlx-postgres 0.8.3 value/impl#[`PgValueRef<'r>`]as_str().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 78 | } |
| 79 | }; |
| 80 | |
| 81 | if bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().8 { |
| 82 | let family = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 83 | let prefix = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 84 | let _is_cidr = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). 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().0; |
| 85 | let len = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 86 | |
| 87 | match family { |
| 88 | PGSQL_AF_INETrust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET. => { |
| 89 | if bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().8 && len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().4 { |
| 90 | let inet = Ipv4Networkrust-analyzer cargo ipnetwork 0.21.1 ipv4/Ipv4Network#::newrust-analyzer cargo ipnetwork 0.21.1 ipv4/impl#[Ipv4Network]new().( |
| 91 | Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 92 | prefix, |
| 93 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 94 | |
| 95 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V4rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V4#(inet)); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | PGSQL_AF_INET6rust-analyzer cargo sqlx-postgres 0.8.3 types/ipnetwork/PGSQL_AF_INET6. => { |
| 100 | if bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().20 && len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().16 { |
| 101 | let inet = Ipv6Networkrust-analyzer cargo ipnetwork 0.21.1 ipv6/Ipv6Network#::newrust-analyzer cargo ipnetwork 0.21.1 ipv6/impl#[Ipv6Network]new().( |
| 102 | Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr][`From<[u8; 16]>`]from().([ |
| 103 | bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 104 | bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 105 | bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().16]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().17]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().18]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().19]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 106 | ]), |
| 107 | prefix, |
| 108 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 109 | |
| 110 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IpNetworkrust-analyzer cargo ipnetwork 0.21.1 IpNetwork#::V6rust-analyzer cargo ipnetwork 0.21.1 IpNetwork#V6#(inet)); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | _ => { |
| 115 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unknown ip family {family}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()); |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("invalid data received when expecting an INET".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 121 | } |
| 122 | } |