[][src]Struct rtable::prefix::Prefix

pub struct Prefix<T> { /* fields omitted */ }

IP Prefix.

Methods

impl<T: AddressLen + FromStr> Prefix<T>[src]

Abstract IPv4 and IPv6 both.

pub fn new() -> Self[src]

Construct empty prefix.

pub fn from(address: T, len: u8) -> Self[src]

Construct a prefix from an address and prefix length.

pub fn from_slice(slice: &[u8], prefix_len: u8) -> Self[src]

Construct a prefix from address and prefix length.

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

Construct prefix from string slice.

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

Return address part of prefix.

impl Prefix<Ipv4Addr>[src]

Impl IPv4 Prefix.

pub fn apply_mask(&mut self)[src]

Apply network mask to address part.

impl Prefix<Ipv6Addr>[src]

Impl IPv6 Prefix.

pub fn apply_mask(&mut self)[src]

Apply network mask to address part.

Trait Implementations

impl<T: Clone> Clone for Prefix<T>[src]

impl<T: Copy> Copy for Prefix<T>[src]

impl<T: Debug> Debug for Prefix<T>[src]

impl<T: AddressLen + ToString> Display for Prefix<T>[src]

impl<T: Eq> Eq for Prefix<T>[src]

impl<T: Ord> Ord for Prefix<T>[src]

impl<T: PartialEq> PartialEq<Prefix<T>> for Prefix<T>[src]

impl<T: PartialOrd> PartialOrd<Prefix<T>> for Prefix<T>[src]

impl<T: AddressLen + Clone> Prefixable for Prefix<T>[src]

fn from_prefix(p: &Self) -> Self[src]

Construct a prefix from given prefix.

fn from_common(prefix1: &Self, prefix2: &Self) -> Self[src]

Construct a prefix from common parts of two prefixes, assuming p1 is shorter than p2.

fn len(&self) -> u8[src]

Return prefix length.

fn octets(&self) -> &[u8][src]

Return reference of slice to address.

fn octets_mut(&mut self) -> &mut [u8][src]

Return mutable reference of slice to address.

impl<T> StructuralEq for Prefix<T>[src]

impl<T> StructuralPartialEq for Prefix<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Prefix<T> where
    T: RefUnwindSafe

impl<T> Send for Prefix<T> where
    T: Send

impl<T> Sync for Prefix<T> where
    T: Sync

impl<T> Unpin for Prefix<T> where
    T: Unpin

impl<T> UnwindSafe for Prefix<T> where
    T: UnwindSafe

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.