[][src]Enum smoltcp::wire::IpCidr

#[non_exhaustive]pub enum IpCidr {
    Ipv4(Ipv4Cidr),
    Ipv6(Ipv6Cidr),
}

A specification of a CIDR block, containing an address and a variable-length subnet masking prefix length.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Ipv4(Ipv4Cidr)
Ipv6(Ipv6Cidr)

Implementations

impl Cidr[src]

pub fn new(addr: Address, prefix_len: u8) -> Cidr[src]

Create a CIDR block from the given address and prefix length.

Panics

This function panics if the given address is unspecified, or the given prefix length is invalid for the given address.

pub fn address(&self) -> Address[src]

Return the IP address of this CIDR block.

pub fn prefix_len(&self) -> u8[src]

Return the prefix length of this CIDR block.

pub fn contains_addr(&self, addr: &Address) -> bool[src]

Query whether the subnetwork described by this CIDR block contains the given address.

pub fn contains_subnet(&self, subnet: &Cidr) -> bool[src]

Query whether the subnetwork described by this CIDR block contains the subnetwork described by the given CIDR block.

Trait Implementations

impl Clone for Cidr[src]

impl Copy for Cidr[src]

impl Debug for Cidr[src]

impl Display for Cidr[src]

impl Eq for Cidr[src]

impl From<Cidr> for Cidr[src]

impl From<Cidr> for Cidr[src]

impl FromStr for IpCidr[src]

type Err = ()

The associated error which can be returned from parsing.

pub fn from_str(s: &str) -> Result<IpCidr, ()>[src]

Parse a string representation of an IP CIDR.

impl Hash for Cidr[src]

impl Ord for Cidr[src]

impl PartialEq<Cidr> for Cidr[src]

impl PartialOrd<Cidr> for Cidr[src]

impl StructuralEq for Cidr[src]

impl StructuralPartialEq for Cidr[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.