| 1 | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT |
| 2 | // file at the top-level directory of this distribution and at |
| 3 | // http://rust-lang.org/COPYRIGHT. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | // option. This file may not be copied, modified, or distributed |
| 9 | // except according to those terms. |
| 10 | |
| 11 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 12 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 13 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/; |
| 14 | 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#, SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#, SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#, SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#}; |
| 15 | #[cfg(any(unix, target_os = "wasi"))] |
| 16 | use libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 17 | #[cfg(windows)] |
| 18 | use winapi::ctypes::c_int; |
| 19 | |
| 20 | use sysrust-analyzer cargo net2 0.2.39 sys/; |
| 21 | use sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/; |
| 22 | |
| 23 | pub struct Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 24 | innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner.: sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#, |
| 25 | } |
| 26 | |
| 27 | impl Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 28 | pub fn newrust-analyzer cargo net2 0.2.39 socket/impl#[Socket]new().(family: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, ty: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Socketrust-analyzer cargo net2 0.2.39 socket/Socket#> { |
| 29 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner.: tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#::newrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]new().(family, ty)) }) |
| 30 | } |
| 31 | |
| 32 | pub fn bindrust-analyzer cargo net2 0.2.39 socket/impl#[Socket]bind().(&self, addr: &SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 33 | let (addr, len) = addr2rawrust-analyzer cargo net2 0.2.39 socket/addr2raw().(addr); |
| 34 | unsafe { |
| 35 | ::cvtrust-analyzer cargo net2 0.2.39 cvt().(crust-analyzer cargo net2 0.2.39 sys/c/::bindrust-analyzer cargo libc 0.2.189 bind().(self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner..rawrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]raw().(), addr.as_ptrrust-analyzer cargo net2 0.2.39 socket/impl#[SocketAddrCRepr]as_ptr().(), len as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| ()) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | pub fn listenrust-analyzer cargo net2 0.2.39 socket/impl#[Socket]listen().(&self, backlog: i32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 40 | unsafe { |
| 41 | ::cvtrust-analyzer cargo net2 0.2.39 cvt().(crust-analyzer cargo net2 0.2.39 sys/c/::listenrust-analyzer cargo libc 0.2.189 listen().(self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner..rawrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]raw().(), backlog)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| ()) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | pub fn connectrust-analyzer cargo net2 0.2.39 socket/impl#[Socket]connect().(&self, addr: &SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 46 | let (addr, len) = addr2rawrust-analyzer cargo net2 0.2.39 socket/addr2raw().(addr); |
| 47 | unsafe { |
| 48 | ::cvtrust-analyzer cargo net2 0.2.39 cvt().(crust-analyzer cargo net2 0.2.39 sys/c/::connectrust-analyzer cargo libc 0.2.189 connect().(self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner..rawrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]raw().(), addr.as_ptrrust-analyzer cargo net2 0.2.39 socket/impl#[SocketAddrCRepr]as_ptr().(), len)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| ()) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | pub fn getsocknamerust-analyzer cargo net2 0.2.39 socket/impl#[Socket]getsockname().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#> { |
| 53 | unsafe { |
| 54 | let mut storage: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_storagerust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_storage# = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().(); |
| 55 | let mut len = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&storage) as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#; |
| 56 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(::cvtrust-analyzer cargo net2 0.2.39 cvt().(crust-analyzer cargo net2 0.2.39 sys/c/::getsocknamerust-analyzer cargo libc 0.2.189 getsockname().(self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner..rawrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]raw().(), |
| 57 | &mut storage as *mut _ as *mut _, |
| 58 | &mut len))); |
| 59 | raw2addrrust-analyzer cargo net2 0.2.39 socket/raw2addr().(&storage, len) |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 65 | fn fmtrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 66 | self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner..rawrust-analyzer cargo net2 0.2.39 sys/impl#[Socket]raw().().fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/num/impl#[i32][Debug]fmt().(f) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | impl ::AsInnerrust-analyzer cargo net2 0.2.39 AsInner# for Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 71 | type Innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][AsInner]Inner# = sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#; |
| 72 | fn as_innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][AsInner]as_inner().(&self) -> &sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket# { &self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner. } |
| 73 | } |
| 74 | |
| 75 | impl ::FromInnerrust-analyzer cargo net2 0.2.39 FromInner# for Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 76 | type Innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][FromInner]Inner# = sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#; |
| 77 | fn from_innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][FromInner]from_inner().(sock: sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#) -> Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 78 | Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner.: sock } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | impl ::IntoInnerrust-analyzer cargo net2 0.2.39 IntoInner# for Socketrust-analyzer cargo net2 0.2.39 socket/Socket# { |
| 83 | type Innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][IntoInner]Inner# = sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#; |
| 84 | fn into_innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][IntoInner]into_inner().(self) -> sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket# { self.innerrust-analyzer cargo net2 0.2.39 socket/Socket#inner. } |
| 85 | } |
| 86 | |
| 87 | /// A type with the same memory layout as `c::sockaddr`. Used in converting Rust level |
| 88 | /// SocketAddr* types into their system representation. The benefit of this specific |
| 89 | /// type over using `c::sockaddr_storage` is that this type is exactly as large as it |
| 90 | /// needs to be and not a lot larger. |
| 91 | #[repr(C)] |
| 92 | pub(craterust-analyzer cargo net2 0.2.39 crate/) union SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 93 | v4rust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#v4.: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#, |
| 94 | v6rust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#v6.: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#, |
| 95 | } |
| 96 | |
| 97 | impl SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 98 | pub(craterust-analyzer cargo net2 0.2.39 crate/) fn as_ptrrust-analyzer cargo net2 0.2.39 socket/impl#[SocketAddrCRepr]as_ptr().(&self) -> *const crust-analyzer cargo net2 0.2.39 sys/c/::sockaddrrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr# { |
| 99 | self as *const _ as *const crust-analyzer cargo net2 0.2.39 sys/c/::sockaddrrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr# |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | fn addr2rawrust-analyzer cargo net2 0.2.39 socket/addr2raw().(addr: &SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#) -> (SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#, crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) { |
| 104 | match addr { |
| 105 | &SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#::V4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#V4#(ref v4) => addr2raw_v4rust-analyzer cargo net2 0.2.39 socket/addr2raw_v4().(v4), |
| 106 | &SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#::V6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#V6#(ref v6) => addr2raw_v6rust-analyzer cargo net2 0.2.39 socket/addr2raw_v6().(v6), |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | #[cfg(unix)] |
| 111 | fn addr2raw_v4rust-analyzer cargo net2 0.2.39 socket/addr2raw_v4().(addr: &SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#) -> (SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#, crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) { |
| 112 | let sin_addr = crust-analyzer cargo net2 0.2.39 sys/c/::in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr# { |
| 113 | s_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr#s_addr.: u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[u32][`From<Ipv4Addr>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().addr.iprust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]ip().()).to_berust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_be().(), |
| 114 | }; |
| 115 | |
| 116 | let sockaddr = SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 117 | v4rust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#v4.: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in# { |
| 118 | sin_familyrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_family.: crust-analyzer cargo net2 0.2.39 sys/c/::AF_INETrust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET. as crust-analyzer cargo net2 0.2.39 sys/c/::sa_family_trust-analyzer cargo libc 0.2.189 unix/linux_like/sa_family_t#, |
| 119 | sin_portrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_port.: addr.portrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]port().().to_berust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_be().(), |
| 120 | sin_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_addr., |
| 121 | #[cfg(not(target_os = "haiku"))] |
| 122 | sin_zerorust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_zero.: [0; 8], |
| 123 | #[cfg(target_os = "haiku")] |
| 124 | sin_zerorust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_zero.: [0; 24], |
| 125 | #[cfg(any( |
| 126 | target_os = "dragonfly", |
| 127 | target_os = "freebsd", |
| 128 | target_os = "ios", |
| 129 | target_os = "macos", |
| 130 | target_os = "netbsd", |
| 131 | target_os = "openbsd", |
| 132 | target_os = "haiku", |
| 133 | target_os = "nto", |
| 134 | ))] |
| 135 | sin_len: 0, |
| 136 | }, |
| 137 | }; |
| 138 | (sockaddr, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#>() as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) |
| 139 | } |
| 140 | |
| 141 | #[cfg(windows)] |
| 142 | fn addr2raw_v4(addr: &SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#) -> (SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#, crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) { |
| 143 | let sin_addr = unsafe { |
| 144 | let mut s_un = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().::<crust-analyzer cargo net2 0.2.39 sys/c/::in_addr_S_un>(); |
| 145 | *s_un.S_addr_mut() = u32::from(*addr.ip()).to_be(); |
| 146 | crust-analyzer cargo net2 0.2.39 sys/c/::IN_ADDR { S_un: s_un } |
| 147 | }; |
| 148 | |
| 149 | let sockaddr = SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 150 | v4: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in# { |
| 151 | sin_family: crust-analyzer cargo net2 0.2.39 sys/c/::AF_INETrust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET. as crust-analyzer cargo net2 0.2.39 sys/c/::sa_family_trust-analyzer cargo libc 0.2.189 unix/linux_like/sa_family_t#, |
| 152 | sin_port: addr.port().to_be(), |
| 153 | sin_addr, |
| 154 | sin_zero: [0; 8], |
| 155 | }, |
| 156 | }; |
| 157 | (sockaddr, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#>() as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) |
| 158 | } |
| 159 | |
| 160 | #[cfg(unix)] |
| 161 | fn addr2raw_v6rust-analyzer cargo net2 0.2.39 socket/addr2raw_v6().(addr: &SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#) -> (SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#, crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) { |
| 162 | let sin6_addr = { |
| 163 | let mut sin6_addr = unsafe { memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().::<crust-analyzer cargo net2 0.2.39 sys/c/::in6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr#>() }; |
| 164 | sin6_addr.s6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr#s6_addr. = addr.iprust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]ip().().octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]octets().(); |
| 165 | sin6_addr |
| 166 | }; |
| 167 | |
| 168 | let sockaddr = SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 169 | v6rust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#v6.: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6# { |
| 170 | sin6_familyrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_family.: crust-analyzer cargo net2 0.2.39 sys/c/::AF_INET6rust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET6. as crust-analyzer cargo net2 0.2.39 sys/c/::sa_family_trust-analyzer cargo libc 0.2.189 unix/linux_like/sa_family_t#, |
| 171 | sin6_portrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_port.: addr.portrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]port().().to_berust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]to_be().(), |
| 172 | sin6_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_addr., |
| 173 | sin6_flowinforust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_flowinfo.: addr.flowinforust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]flowinfo().(), |
| 174 | sin6_scope_idrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_scope_id.: addr.scope_idrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]scope_id().(), |
| 175 | #[cfg(any( |
| 176 | target_os = "dragonfly", |
| 177 | target_os = "freebsd", |
| 178 | target_os = "ios", |
| 179 | target_os = "macos", |
| 180 | target_os = "netbsd", |
| 181 | target_os = "openbsd", |
| 182 | target_os = "haiku", |
| 183 | target_os = "nto", |
| 184 | ))] |
| 185 | sin6_len: 0, |
| 186 | #[cfg(any(target_os = "solaris", target_os = "illumos"))] |
| 187 | __sin6_src_id: 0, |
| 188 | }, |
| 189 | }; |
| 190 | (sockaddr, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#>() as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) |
| 191 | } |
| 192 | |
| 193 | #[cfg(windows)] |
| 194 | fn addr2raw_v6(addr: &SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#) -> (SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr#, crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) { |
| 195 | let sin6_addr = unsafe { |
| 196 | let mut u = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().::<crust-analyzer cargo net2 0.2.39 sys/c/::in6_addr_u>(); |
| 197 | *u.Byte_mut() = addr.ip().octets(); |
| 198 | crust-analyzer cargo net2 0.2.39 sys/c/::IN6_ADDR { u } |
| 199 | }; |
| 200 | let scope_id = unsafe { |
| 201 | let mut u = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().::<crust-analyzer cargo net2 0.2.39 sys/c/::SOCKADDR_IN6_LH_u>(); |
| 202 | *u.sin6_scope_id_mut() = addr.scope_id(); |
| 203 | u |
| 204 | }; |
| 205 | |
| 206 | let sockaddr = SocketAddrCReprrust-analyzer cargo net2 0.2.39 socket/SocketAddrCRepr# { |
| 207 | v6: crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6# { |
| 208 | sin6_family: crust-analyzer cargo net2 0.2.39 sys/c/::AF_INET6rust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET6. as crust-analyzer cargo net2 0.2.39 sys/c/::sa_family_trust-analyzer cargo libc 0.2.189 unix/linux_like/sa_family_t#, |
| 209 | sin6_port: addr.port().to_be(), |
| 210 | sin6_addr, |
| 211 | sin6_flowinfo: addr.flowinfo(), |
| 212 | u: scope_id, |
| 213 | }, |
| 214 | }; |
| 215 | (sockaddr, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#>() as crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) |
| 216 | } |
| 217 | |
| 218 | fn raw2addrrust-analyzer cargo net2 0.2.39 socket/raw2addr().(storage: &crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_storagerust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_storage#, len: crust-analyzer cargo net2 0.2.39 sys/c/::socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#> { |
| 219 | match storage.ss_familyrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_storage#ss_family. as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 220 | crust-analyzer cargo net2 0.2.39 sys/c/::AF_INETrust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET. => { |
| 221 | unsafe { |
| 222 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(len as usize >= memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#>()); |
| 223 | let sa = storage as *const _ as *const crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_inrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#; |
| 224 | let bits = crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in_u32rust-analyzer cargo net2 0.2.39 sys/c/sockaddr_in_u32().(&(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa)); |
| 225 | let ip = 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().((bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().24) as u8, |
| 226 | (bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().16) as u8, |
| 227 | (bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().8) as u8, |
| 228 | bits as u8); |
| 229 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#::V4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#V4#(SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(ip, ::ntohrust-analyzer cargo net2 0.2.39 ntoh().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa).sin_portrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in#sin_port.)))) |
| 230 | } |
| 231 | } |
| 232 | crust-analyzer cargo net2 0.2.39 sys/c/::AF_INET6rust-analyzer cargo libc 0.2.189 unix/linux_like/AF_INET6. => { |
| 233 | unsafe { |
| 234 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(len as usize >= memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#>()); |
| 235 | |
| 236 | let sa = storage as *const _ as *const crust-analyzer cargo net2 0.2.39 sys/c/::sockaddr_in6rust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#; |
| 237 | #[cfg(windows)] let arr = (*sa).sin6_addr.u.Byte(); |
| 238 | #[cfg(not(windows))] let arr = (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa).sin6_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_addr..s6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr#s6_addr.; |
| 239 | |
| 240 | let ip = Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]new().( |
| 241 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 242 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 243 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 244 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 245 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 246 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().10]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 247 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().12]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 248 | (arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().14]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOr<Self>`]bitor().(arr[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().15]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u16), |
| 249 | ); |
| 250 | |
| 251 | #[cfg(windows)] let sin6_scope_id = *(*sa).u.sin6_scope_id(); |
| 252 | #[cfg(not(windows))] let sin6_scope_id = (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa).sin6_scope_idrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_scope_id.; |
| 253 | |
| 254 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#::V6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#V6#(SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]new().(ip, |
| 255 | ::ntohrust-analyzer cargo net2 0.2.39 ntoh().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa).sin6_portrust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_port.), |
| 256 | (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().sa).sin6_flowinforust-analyzer cargo libc 0.2.189 unix/linux_like/sockaddr_in6#sin6_flowinfo., |
| 257 | sin6_scope_id))) |
| 258 | } |
| 259 | } |
| 260 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidInputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidInput#, "invalid argument")), |
| 261 | } |
| 262 | } |