pub struct Ipv4Cidr { /* private fields */ }
Expand description
Cidr
type representing an IPv4 network
Ordering based on lexicographic bitstring representation.
Implementations§
source§impl Ipv4Cidr
impl Ipv4Cidr
sourcepub const fn new(addr: Ipv4Addr, len: u8) -> Result<Self, NetworkParseError>
pub const fn new(addr: Ipv4Addr, len: u8) -> Result<Self, NetworkParseError>
Create new network from address and prefix length. If the network length exceeds the address length or the address is not the first address in the network (“host part not zero”) an error is returned.
sourcepub const fn new_host(addr: Ipv4Addr) -> Self
pub const fn new_host(addr: Ipv4Addr) -> Self
Create a network containing a single address (network length = address length).
sourcepub const fn iter(&self) -> InetIterator<Ipv4Addr> ⓘ
pub const fn iter(&self) -> InetIterator<Ipv4Addr> ⓘ
Iterate over all addresses in the range. With IPv6 addresses this can produce really long iterations (up to 2128 addresses).
sourcepub const fn first_address(&self) -> Ipv4Addr
pub const fn first_address(&self) -> Ipv4Addr
first address in the network as plain address
sourcepub const fn last_address(&self) -> Ipv4Addr
pub const fn last_address(&self) -> Ipv4Addr
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 Cidr for Ipv4Cidr
impl Cidr for Ipv4Cidr
source§fn new(addr: Ipv4Addr, len: u8) -> Result<Self, NetworkParseError>
fn new(addr: Ipv4Addr, len: u8) -> Result<Self, NetworkParseError>
Create new network from address and prefix length. If the
network length exceeds the address length or the address is not
the first address in the network (“host part not zero”) an
error is returned.
source§fn new_host(addr: Ipv4Addr) -> Self
fn new_host(addr: Ipv4Addr) -> Self
Create a network containing a single address (network length =
address length).
source§fn iter(&self) -> InetIterator<Ipv4Addr> ⓘ
fn iter(&self) -> InetIterator<Ipv4Addr> ⓘ
Iterate over all addresses in the range. With IPv6 addresses
this can produce really long iterations (up to 2128
addresses).
source§fn first_address(&self) -> Ipv4Addr
fn first_address(&self) -> Ipv4Addr
first address in the network as plain address
source§fn last_address(&self) -> Ipv4Addr
fn last_address(&self) -> Ipv4Addr
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 IntoIterator for Ipv4Cidr
impl IntoIterator for Ipv4Cidr
Iterate over all the addresses in the CIDR.
source§impl Ord for Ipv4Cidr
impl Ord for Ipv4Cidr
source§impl PartialOrd for Ipv4Cidr
impl PartialOrd for Ipv4Cidr
impl Copy for Ipv4Cidr
impl Eq for Ipv4Cidr
impl StructuralPartialEq for Ipv4Cidr
Auto Trait Implementations§
impl Freeze for Ipv4Cidr
impl RefUnwindSafe for Ipv4Cidr
impl Send for Ipv4Cidr
impl Sync for Ipv4Cidr
impl Unpin for Ipv4Cidr
impl UnwindSafe for Ipv4Cidr
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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)