Enum std::net::IpAddr 1.7.0
[−]
[src]
pub enum IpAddr { V4(Ipv4Addr), V6(Ipv6Addr), }
An IP address, either an IPv4 or IPv6 address.
Examples
Constructing an IPv4 address:
fn main() { use std::net::{IpAddr, Ipv4Addr}; IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); }use std::net::{IpAddr, Ipv4Addr}; IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));Run
Constructing an IPv6 address:
fn main() { use std::net::{IpAddr, Ipv6Addr}; IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); }use std::net::{IpAddr, Ipv6Addr}; IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));Run
Variants
V4(Ipv4Addr)
Representation of an IPv4 address.
V6(Ipv6Addr)
Representation of an IPv6 address.
Methods
impl IpAddr
[src]
fn is_unspecified(&self) -> bool
1.12.0
fn is_loopback(&self) -> bool
1.12.0
fn is_global(&self) -> bool
ip
#27709): extra functionality has not been scrutinized to the level that it should be stable
fn is_multicast(&self) -> bool
1.12.0
fn is_documentation(&self) -> bool
ip
#27709): extra functionality has not been scrutinized to the level that it should be stable
Trait Implementations
impl Copy for IpAddr
[src]
impl Clone for IpAddr
[src]
fn clone(&self) -> IpAddr
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Eq for IpAddr
[src]
impl PartialEq for IpAddr
[src]
fn eq(&self, __arg_0: &IpAddr) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &IpAddr) -> bool
This method tests for !=
.
impl Debug for IpAddr
[src]
impl Hash for IpAddr
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl PartialOrd for IpAddr
[src]
fn partial_cmp(&self, __arg_0: &IpAddr) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &IpAddr) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &IpAddr) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &IpAddr) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &IpAddr) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for IpAddr
[src]
fn cmp(&self, __arg_0: &IpAddr) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Display for IpAddr
1.0.0[src]
impl FromStr for IpAddr
1.0.0[src]
type Err = AddrParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<IpAddr, AddrParseError>
Parses a string s
to return a value of this type. Read more