[−][src]Struct rpki::resources::Addr
An adddress.
This can be both an IPv4 and IPv6 address. It keeps the address internally as a 128 bit unsigned integer. IPv6 address are kept in there in host byte order while IPv4 addresses are kept in the upper four bytes. This makes it possible to count prefix lengths the same way for both addresses, i.e., starting from the top of the raw integer.
Methods
impl Addr
[src]
pub fn from_bits(bits: u128) -> Self
[src]
Creates a new address from 128 raw bits in host byte order.
pub fn from_v4(addr: Ipv4Addr) -> Self
[src]
Creates a new address value for an IPv4 address.
pub fn from_v6(addr: Ipv6Addr) -> Self
[src]
Creates a new address value for an IPv4 address.
pub fn to_bits(self) -> u128
[src]
Returns the raw bits of the underlying integer.
pub fn to_v4(self) -> Ipv4Addr
[src]
Converts the address value into an IPv4 address.
The methods disregards the lower twelve bytes of the value.
pub fn to_v6(self) -> Ipv6Addr
[src]
Converts the address value into an IPv6 address.
pub fn to_bytes(self) -> [u8; 16]
[src]
Returns a byte array for the address.
pub fn to_min(self, prefix_len: u8) -> Self
[src]
Returns an address with all but the first prefix_len
bits cleared.
The first prefix_len
bits are retained. Thus, the returned address
is the smallest address in a prefix of this length.
pub fn to_max(self, prefix_len: u8) -> Self
[src]
Returns an address with all but the first prefix_len
bits set.
The first prefix_len
bits are retained. Thus, the returned address
is the largest address in a prefix of this length.
Trait Implementations
impl PartialOrd<Addr> for Addr
[src]
fn partial_cmp(&self, other: &Addr) -> Option<Ordering>
[src]
fn lt(&self, other: &Addr) -> bool
[src]
fn le(&self, other: &Addr) -> bool
[src]
fn gt(&self, other: &Addr) -> bool
[src]
fn ge(&self, other: &Addr) -> bool
[src]
impl Copy for Addr
[src]
impl PartialEq<Addr> for Addr
[src]
impl From<u128> for Addr
[src]
impl From<Ipv4Addr> for Addr
[src]
impl From<Ipv6Addr> for Addr
[src]
impl From<IpAddr> for Addr
[src]
impl From<Addr> for u128
[src]
impl From<Addr> for Ipv4Addr
[src]
impl From<Addr> for Ipv6Addr
[src]
impl Clone for Addr
[src]
fn clone(&self) -> Addr
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for Addr
[src]
fn cmp(&self, other: &Addr) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more
impl Eq for Addr
[src]
impl Debug for Addr
[src]
impl Hash for Addr
[src]
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>,