1.0.0[][src]Struct validators::prelude::validators_prelude::Ipv4Addr

pub struct Ipv4Addr { /* fields omitted */ }

An IPv4 address.

IPv4 addresses are defined as 32-bit integers in IETF RFC 791. They are usually represented as four octets.

See IpAddr for a type encompassing both IPv4 and IPv6 addresses.

The size of an Ipv4Addr struct may vary depending on the target operating system.

Textual representation

Ipv4Addr provides a FromStr implementation. The four octets are in decimal notation, divided by . (this is called "dot-decimal notation").

Examples

use std::net::Ipv4Addr;

let localhost = Ipv4Addr::new(127, 0, 0, 1);
assert_eq!("127.0.0.1".parse(), Ok(localhost));
assert_eq!(localhost.is_loopback(), true);

Trait Implementations

impl Clone for Ipv4Addr[src]

impl Copy for Ipv4Addr[src]

impl Debug for Ipv4Addr[src]

impl<'de> Deserialize<'de> for Ipv4Addr[src]

impl Display for Ipv4Addr[src]

impl Eq for Ipv4Addr[src]

impl From<[u8; 4]> for Ipv4Addr1.9.0[src]

fn from(octets: [u8; 4]) -> Ipv4Addr[src]

Creates an Ipv4Addr from a four element byte array.

Examples

use std::net::Ipv4Addr;

let addr = Ipv4Addr::from([13u8, 12u8, 11u8, 10u8]);
assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);

impl From<Ipv4Addr> for IpAddr1.16.0[src]

fn from(ipv4: Ipv4Addr) -> IpAddr[src]

Copies this address to a new IpAddr::V4.

Examples

use std::net::{IpAddr, Ipv4Addr};

let addr = Ipv4Addr::new(127, 0, 0, 1);

assert_eq!(
    IpAddr::V4(addr),
    IpAddr::from(addr)
)

impl From<u32> for Ipv4Addr1.1.0[src]

fn from(ip: u32) -> Ipv4Addr[src]

Converts a host byte order u32 into an Ipv4Addr.

Examples

use std::net::Ipv4Addr;

let addr = Ipv4Addr::from(0x0d0c0b0au32);
assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);

impl<'v> FromFormValue<'v> for Ipv4Addr[src]

type Error = &'v RawStr

The associated error which can be returned from parsing. It is a good idea to have the return type be or contain an &'v str so that the unparseable string can be examined after a bad parse. Read more

impl<'a> FromParam<'a> for Ipv4Addr[src]

type Error = &'a RawStr

The associated error to be returned if parsing/validation fails.

impl FromStr for Ipv4Addr[src]

type Err = AddrParseError

The associated error which can be returned from parsing.

impl<'x, P> FromUriParam<P, &'x Ipv4Addr> for Ipv4Addr where
    P: UriPart, 

type Target = &'x Ipv4Addr

The resulting type of this conversion.

impl<'x, P> FromUriParam<P, &'x mut Ipv4Addr> for Ipv4Addr where
    P: UriPart, 

type Target = &'x mut Ipv4Addr

The resulting type of this conversion.

impl<P> FromUriParam<P, Ipv4Addr> for Ipv4Addr where
    P: UriPart, 

type Target = Ipv4Addr

The resulting type of this conversion.

impl Hash for Ipv4Addr[src]

impl Ord for Ipv4Addr[src]

impl PartialEq<IpAddr> for Ipv4Addr1.16.0[src]

impl PartialEq<Ipv4Addr> for IpAddr1.16.0[src]

impl PartialEq<Ipv4Addr> for Ipv4Addr[src]

impl PartialOrd<IpAddr> for Ipv4Addr1.16.0[src]

impl PartialOrd<Ipv4Addr> for IpAddr1.16.0[src]

impl PartialOrd<Ipv4Addr> for Ipv4Addr[src]

impl Serialize for Ipv4Addr[src]

impl<P> UriDisplay<P> for Ipv4Addr where
    P: UriPart, 

This implementation is identical to the Display implementation.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, I> AsResult<T, I> for T where
    I: Input, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoCollection<T> for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,