pub struct Network { /* private fields */ }Expand description
An IP network with its host bits cleared, displayed as addr/prefix
(e.g. 10.0.0.0/8, 2001:db8::/32).
Implementations§
Source§impl Network
impl Network
Sourcepub fn new(addr: IpAddr, prefix: u8) -> Result<Self, Error>
pub fn new(addr: IpAddr, prefix: u8) -> Result<Self, Error>
Builds the network of length prefix containing addr.
IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) are treated as IPv4, so
a client reaching a dual-stack listener is matched against IPv4
networks: ::ffff:192.0.2.0/120 is 192.0.2.0/24. A mapped network
shorter than /96 spans more than IPv4 and is refused.
Trait Implementations§
impl Copy for Network
impl Eq for Network
impl StructuralPartialEq for Network
Auto Trait Implementations§
impl Forget for Network
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnsafeUnpin for Network
impl UnwindSafe for Network
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