Lines Matching defs:IpAddr
495 pub fn new(ip: IpAddr, port: u16) -> InetAddr {
497 IpAddr::V4(ref ip) => {
505 IpAddr::V6(ref ip) => {
516 pub const fn ip(&self) -> IpAddr {
518 InetAddr::V4(ref sa) => IpAddr::V4(Ipv4Addr(sa.sin_addr)),
519 InetAddr::V6(ref sa) => IpAddr::V6(Ipv6Addr(sa.sin6_addr)),
564 * ===== IpAddr =====
572 note = "Use std::net::IpAddr instead"
574 pub enum IpAddr {
581 impl IpAddr {
582 /// Create a new IpAddr that contains an IPv4 address.
585 pub const fn new_v4(a: u8, b: u8, c: u8, d: u8) -> IpAddr {
586 IpAddr::V4(Ipv4Addr::new(a, b, c, d))
589 /// Create a new IpAddr that contains an IPv6 address.
594 pub const fn new_v6(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> IpAddr {
595 IpAddr::V6(Ipv6Addr::new(a, b, c, d, e, f, g, h))
598 pub fn from_std(std: &net::IpAddr) -> IpAddr {
600 net::IpAddr::V4(ref std) => IpAddr::V4(Ipv4Addr::from_std(std)),
601 net::IpAddr::V6(ref std) => IpAddr::V6(Ipv6Addr::from_std(std)),
605 pub const fn to_std(&self) -> net::IpAddr {
607 IpAddr::V4(ref ip) => net::IpAddr::V4(ip.to_std()),
608 IpAddr::V6(ref ip) => net::IpAddr::V6(ip.to_std()),
614 impl fmt::Display for IpAddr {
617 IpAddr::V4(ref v4) => v4.fmt(f),
618 IpAddr::V6(ref v6) => v6.fmt(f)