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 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 BitString for Ipv6Inet
Available on crate feature bitstring
only.
impl BitString for Ipv6Inet
Available on crate feature
bitstring
only.source§impl<'de> Deserialize<'de> for Ipv6Inet
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Ipv6Inet
Available on crate feature
serde
only.source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for Ipv6Inet
impl FromStr for Ipv6Inet
§type Err = NetworkParseError
type Err = NetworkParseError
The associated error which can be returned from parsing.
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>
Create new host within a network from address and prefix length.
If the network length exceeds the address length an error is
returned.
source§fn new_host(addr: Ipv6Addr) -> Self
fn new_host(addr: Ipv6Addr) -> Self
Create a network containing a single address as host and the
network (network length = address length).
source§fn increment(&mut self) -> bool
fn increment(&mut self) -> bool
increments host part (without changing the network part);
returns true on wrap around
source§fn next(self) -> Option<Self>
fn next(self) -> Option<Self>
Returns next address in network or
None
if it was the last address in the networksource§fn first_address(&self) -> Ipv6Addr
fn first_address(&self) -> Ipv6Addr
first address in the network as plain address
source§fn last_address(&self) -> Ipv6Addr
fn last_address(&self) -> Ipv6Addr
last address in the network as plain address
source§fn network_length(&self) -> u8
fn network_length(&self) -> u8
length in bits of the shared prefix of the contained addresses
source§fn is_host_address(&self) -> bool
fn is_host_address(&self) -> bool
whether network represents a single host address
source§impl Ord for Ipv6Inet
impl Ord for Ipv6Inet
source§impl PartialEq<Ipv6Inet> for Ipv6Inet
impl PartialEq<Ipv6Inet> for Ipv6Inet
source§impl PartialOrd<Ipv6Inet> for Ipv6Inet
impl PartialOrd<Ipv6Inet> for Ipv6Inet
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Ipv6Inet
impl Eq for Ipv6Inet
impl StructuralEq for Ipv6Inet
impl StructuralPartialEq for Ipv6Inet
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more