[−][src]Struct rpki::resources::Prefix
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]
content: &mut Content<S>
) -> Result<Self, S::Err>
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(&self) -> 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<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PrimitiveContent for Prefix
[src]
const TAG: Tag
[src]
fn encoded_len(&self, _: Mode) -> usize
[src]
fn write_encoded<W: Write>(&self, _: Mode, target: &mut W) -> Result<(), Error>
[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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,