pub struct Ipv6Inet { /* private fields */ }
Expand description
Inet
type representing an IPv6 host within a network
Derived ordering, i.e. first sort by address, then by network length.
Implementations§
source§impl Ipv6Inet
impl Ipv6Inet
sourcepub const fn new(
addr: Ipv6Addr,
len: u8,
) -> Result<Self, NetworkLengthTooLongError>
pub const fn new( addr: Ipv6Addr, len: u8, ) -> Result<Self, NetworkLengthTooLongError>
Create new host within a network from address and prefix length. If the network length exceeds the address length an error is returned.
sourcepub const fn new_host(addr: Ipv6Addr) -> Self
pub const fn new_host(addr: Ipv6Addr) -> Self
Create a network containing a single address as host and the network (network length = address length).
sourcepub fn increment(&mut self) -> bool
pub fn increment(&mut self) -> bool
increments host part (without changing the network part); returns true on wrap around
sourcepub const fn next(self) -> Option<Self>
pub const fn next(self) -> Option<Self>
Returns next address in network or None
if it was the last address in the network
sourcepub fn decrement(&mut self) -> bool
pub fn decrement(&mut self) -> bool
decrements host part (without changing the network part); returns true on wrap around
sourcepub const fn previous(self) -> Option<Self>
pub const fn previous(self) -> Option<Self>
Returns previous address in network or None
if it was the first address in the network
sourcepub const fn overflowing_add(self, step: u128) -> (Self, bool)
pub const fn overflowing_add(self, step: u128) -> (Self, bool)
Find the nth host after the current one in the current network
Returned boolean indicates whether an overflow occured.
sourcepub const fn overflowing_sub(self, step: u128) -> (Self, bool)
pub const fn overflowing_sub(self, step: u128) -> (Self, bool)
Find the nth host before the current one in the current network
Returned boolean indicates whether an overflow occured.
sourcepub const fn first_address(&self) -> Ipv6Addr
pub const fn first_address(&self) -> Ipv6Addr
first address in the network as plain address
sourcepub const fn last_address(&self) -> Ipv6Addr
pub const fn last_address(&self) -> Ipv6Addr
last address in the network as plain address
sourcepub const fn network_length(&self) -> u8
pub const fn network_length(&self) -> u8
length in bits of the shared prefix of the contained addresses
sourcepub const fn is_host_address(&self) -> bool
pub const fn is_host_address(&self) -> bool
whether network represents a single host address
Trait Implementations§
source§impl Inet for Ipv6Inet
impl Inet for Ipv6Inet
source§fn new(addr: Ipv6Addr, len: u8) -> Result<Self, NetworkLengthTooLongError>
fn new(addr: Ipv6Addr, len: u8) -> Result<Self, NetworkLengthTooLongError>
source§fn new_host(addr: Ipv6Addr) -> Self
fn new_host(addr: Ipv6Addr) -> Self
source§fn increment(&mut self) -> bool
fn increment(&mut self) -> bool
source§fn next(self) -> Option<Self>
fn next(self) -> Option<Self>
None
if it was the last address in the networksource§fn decrement(&mut self) -> bool
fn decrement(&mut self) -> bool
source§fn previous(self) -> Option<Self>
fn previous(self) -> Option<Self>
None
if it was the first address in the networksource§fn overflowing_add(self, step: u128) -> (Self, bool)
fn overflowing_add(self, step: u128) -> (Self, bool)
source§fn overflowing_sub(self, step: u128) -> (Self, bool)
fn overflowing_sub(self, step: u128) -> (Self, bool)
source§fn first_address(&self) -> Ipv6Addr
fn first_address(&self) -> Ipv6Addr
source§fn last_address(&self) -> Ipv6Addr
fn last_address(&self) -> Ipv6Addr
source§fn network_length(&self) -> u8
fn network_length(&self) -> u8
source§fn is_host_address(&self) -> bool
fn is_host_address(&self) -> bool
source§impl Ord for Ipv6Inet
impl Ord for Ipv6Inet
source§impl PartialOrd for Ipv6Inet
impl PartialOrd for Ipv6Inet
impl Copy for Ipv6Inet
impl Eq for Ipv6Inet
impl StructuralPartialEq for Ipv6Inet
Auto Trait Implementations§
impl Freeze for Ipv6Inet
impl RefUnwindSafe for Ipv6Inet
impl Send for Ipv6Inet
impl Sync for Ipv6Inet
impl Unpin for Ipv6Inet
impl UnwindSafe for Ipv6Inet
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)