[][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 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 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 Copy for Prefix[src]

impl PartialEq<Prefix> for Prefix[src]

impl Clone for Prefix[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Prefix[src]

impl Debug for Prefix[src]

impl Hash for Prefix[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PrimitiveContent for Prefix[src]

fn to_encoded_bytes(&self, mode: Mode) -> Bytes[src]

Encodes the value to bytes (useful when you need to sign a structure)

fn encode(self) -> Primitive<Self>[src]

Returns a value encoder for this content using the natural tag. Read more

fn encode_as(self, tag: Tag) -> Primitive<Self>[src]

Returns a value encoder for this content using the given tag. Read more

fn encode_ref(&self) -> Primitive<&Self>[src]

Returns a value encoder for a reference using the natural tag.

fn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>[src]

Returns a value encoder for a reference using the given tag.

Auto Trait Implementations

impl Send for Prefix

impl Sync for Prefix

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.