Lines Matching defs:from

1 //! The following is derived from Rust's
95 /// To assist in the transition from IPv4 to IPv6 two types of IPv6 addresses that embed an IPv4 address were defined:
116 /// To convert from an IPv4 address to an IPv4-compatible IPv6 address, use [`Ipv4Addr::to_ipv6_compatible`].
134 /// To convert from an IPv4 address to an IPv4-mapped IPv6 address, use [`Ipv4Addr::to_ipv6_mapped`].
467 /// Creates a new IPv4 address from four eight-bit octets.
1021 /// IpAddr::from(addr)
1025 fn from(ipv4: Ipv4Addr) -> IpAddr {
1043 /// IpAddr::from(addr)
1047 fn from(ipv6: Ipv6Addr) -> IpAddr {
1122 /// assert_eq!(0x12345678, u32::from(addr));
1125 fn from(ip: Ipv4Addr) -> u32 {
1139 /// let addr = Ipv4Addr::from(0x12345678);
1143 fn from(ip: u32) -> Ipv4Addr {
1152 /// Creates an `Ipv4Addr` from a four element byte array.
1159 /// let addr = Ipv4Addr::from([13u8, 12u8, 11u8, 10u8]);
1163 fn from(octets: [u8; 4]) -> Ipv4Addr {
1170 /// Creates an `IpAddr::V4` from a four element byte array.
1177 /// let addr = IpAddr::from([13u8, 12u8, 11u8, 10u8]);
1181 fn from(octets: [u8; 4]) -> IpAddr {
1182 IpAddr::V4(Ipv4Addr::from(octets))
1187 /// Creates a new IPv6 address from eight 16-bit segments.
1913 /// assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, u128::from(addr));
1916 fn from(ip: Ipv6Addr) -> u128 {
1929 /// let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128);
1938 fn from(ip: u128) -> Ipv6Addr {
1939 Ipv6Addr::from(ip.to_be_bytes())
1945 /// Creates an `Ipv6Addr` from a sixteen element byte array.
1952 /// let addr = Ipv6Addr::from([
1967 fn from(octets: [u8; 16]) -> Ipv6Addr {
1974 /// Creates an `Ipv6Addr` from an eight element 16-bit array.
1981 /// let addr = Ipv6Addr::from([
1996 fn from(segments: [u16; 8]) -> Ipv6Addr {
2004 /// Creates an `IpAddr::V6` from a sixteen element byte array.
2011 /// let addr = IpAddr::from([
2026 fn from(octets: [u8; 16]) -> IpAddr {
2027 IpAddr::V6(Ipv6Addr::from(octets))
2033 /// Creates an `IpAddr::V6` from an eight element 16-bit array.
2040 /// let addr = IpAddr::from([
2055 fn from(segments: [u16; 8]) -> IpAddr {
2056 IpAddr::V6(Ipv6Addr::from(segments))