pub struct Cidr {
pub ip: IpAddr,
pub prefix: u8,
}Expand description
Represents an IP network prefix using Classless Inter-Domain Routing (CIDR) notation.
This struct is used to define a range of IP addresses (a subnet) by combining a base IP address with a routing prefix length.
§Example
let network = Cidr {
ip: "192.168.1.0".parse()?,
prefix: 24,
};Fields§
§ip: IpAddrThe base IP address of the network.
prefix: u8The routing prefix length (the number of leading bits in the subnet mask).
For IPv4, this should be in the range 0..=32. For IPv6, this should be in the range 0..=128.
Implementations§
Trait Implementations§
impl Eq for Cidr
impl StructuralPartialEq for Cidr
Auto Trait Implementations§
impl Freeze for Cidr
impl RefUnwindSafe for Cidr
impl Send for Cidr
impl Sync for Cidr
impl Unpin for Cidr
impl UnwindSafe for Cidr
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