[][src]Struct rpki::resources::Prefix

pub struct Prefix { /* fields omitted */ }

An IP address prefix.

Methods

impl Prefix[src]

pub fn new<A: Into<Addr>>(addr: A, len: u8) -> Self[src]

Creates a new prefix from an address and a length.

Panics

This function panics of len is larger than 128.

pub fn from_bit_string(src: &BitString) -> Result<Self, Error>[src]

Creates a new prefix from its encoding as a BIT STRING.

pub fn from_v4_str(s: &str) -> Result<Self, FromStrError>[src]

Creates a prefix from an IPv4 string.

pub fn from_v6_str(s: &str) -> Result<Self, FromStrError>[src]

Creates a prefix from an IPv6 string.

pub fn addr(self) -> Addr[src]

Returns the raw address of the prefix.

pub fn addr_len(self) -> u8[src]

Returns the length of the prefix.

pub fn to_v4(self) -> Ipv4Addr[src]

Converts the prefix into an IPv4 address.

pub fn to_v6(self) -> Ipv6Addr[src]

Converts the prefix into an IPv6 address.

pub fn fmt_v4(self, f: &mut Formatter) -> Result[src]

Formats the prefix as an IPv4 prefix.

pub fn fmt_v6(self, f: &mut Formatter) -> Result[src]

Formats the prefix as an IPv4 prefix.

pub fn range(self) -> (Addr, Addr)[src]

Returns the range of addresses covered by this prefix.

The first element of the returned pair is the smallest covered address, the second element is the largest.

pub fn min(self) -> Addr[src]

Returns the smallest address covered by the prefix.

pub fn max(self) -> Addr[src]

Returns the largest address convered by the prefix.

pub fn take_from<S: Source>(cons: &mut Constructed<S>) -> Result<Self, S::Err>[src]

Takes an encoded prefix from a source.

pub fn parse_content<S: Source>(
    content: &mut Content<S>
) -> Result<Self, S::Err>
[src]

Parses the content of a prefix.

Trait Implementations

impl From<Prefix> for IpBlock[src]

impl Clone for Prefix[src]

impl Copy for Prefix[src]

impl Eq for Prefix[src]

impl PartialEq<Prefix> for Prefix[src]

impl Debug for Prefix[src]

impl FromStr for Prefix[src]

type Err = FromStrError

The associated error which can be returned from parsing.

impl Hash for Prefix[src]

impl PrimitiveContent for Prefix[src]

Auto Trait Implementations

impl Send for Prefix

impl Sync for Prefix

impl Unpin for Prefix

impl UnwindSafe for Prefix

impl RefUnwindSafe for Prefix

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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