pub struct CidrAddress {
pub address: Ipv4Address,
pub prefix_len: u8,
}Expand description
IPv4 address with CIDR prefix length for subnet matching
Fields§
§address: Ipv4AddressBase address
prefix_len: u8Prefix length (0-32)
Implementations§
Source§impl CidrAddress
impl CidrAddress
Sourcepub const fn new(address: Ipv4Address, prefix_len: u8) -> Self
pub const fn new(address: Ipv4Address, prefix_len: u8) -> Self
Create a CIDR address
Sourcepub const fn host(address: Ipv4Address) -> Self
pub const fn host(address: Ipv4Address) -> Self
Create a CIDR that matches a single host (/32)
Sourcepub fn matches(&self, addr: &Ipv4Address) -> bool
pub fn matches(&self, addr: &Ipv4Address) -> bool
Check if an address matches this CIDR block
Trait Implementations§
Source§impl Clone for CidrAddress
impl Clone for CidrAddress
Source§fn clone(&self) -> CidrAddress
fn clone(&self) -> CidrAddress
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CidrAddress
impl Debug for CidrAddress
Source§impl Default for CidrAddress
impl Default for CidrAddress
Source§impl PartialEq for CidrAddress
impl PartialEq for CidrAddress
impl Copy for CidrAddress
impl Eq for CidrAddress
impl StructuralPartialEq for CidrAddress
Auto Trait Implementations§
impl Freeze for CidrAddress
impl RefUnwindSafe for CidrAddress
impl Send for CidrAddress
impl Sync for CidrAddress
impl Unpin for CidrAddress
impl UnwindSafe for CidrAddress
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)