[−][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 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]
content: &mut Content<S>
) -> Result<Self, S::Err>
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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[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,
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]
fn encode(self) -> Primitive<Self>
[src]
fn encode_as(self, tag: Tag) -> Primitive<Self>
[src]
fn encode_ref(&self) -> Primitive<&Self>
[src]
fn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>
[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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,