pub struct Ipv6Prefix {
pub addr: Ipv6Addr,
pub len: u8,
}Expand description
An IPv6 prefix (network address + prefix length).
Stored in canonical form: host bits are always zero.
Fields§
§addr: Ipv6AddrNetwork address (host bits zeroed).
len: u8Prefix length in bits (0–128).
Implementations§
Source§impl Ipv6Prefix
impl Ipv6Prefix
Sourcepub fn new(addr: Ipv6Addr, len: u8) -> Self
pub fn new(addr: Ipv6Addr, len: u8) -> Self
Create a new prefix, masking off host bits.
Prefix length is clamped to 128 (values above 128 are silently reduced). This is intentional: wire decoders validate prefix lengths before construction, and clamping is safer than panicking for internal callers that may compute lengths arithmetically.
Trait Implementations§
Source§impl Clone for Ipv6Prefix
impl Clone for Ipv6Prefix
Source§fn clone(&self) -> Ipv6Prefix
fn clone(&self) -> Ipv6Prefix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Ipv6Prefix
impl Debug for Ipv6Prefix
Source§impl Display for Ipv6Prefix
impl Display for Ipv6Prefix
Source§impl Hash for Ipv6Prefix
impl Hash for Ipv6Prefix
Source§impl Ord for Ipv6Prefix
impl Ord for Ipv6Prefix
Source§fn cmp(&self, other: &Ipv6Prefix) -> Ordering
fn cmp(&self, other: &Ipv6Prefix) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Ipv6Prefix
impl PartialEq for Ipv6Prefix
Source§impl PartialOrd for Ipv6Prefix
impl PartialOrd for Ipv6Prefix
impl Copy for Ipv6Prefix
impl Eq for Ipv6Prefix
impl StructuralPartialEq for Ipv6Prefix
Auto Trait Implementations§
impl Freeze for Ipv6Prefix
impl RefUnwindSafe for Ipv6Prefix
impl Send for Ipv6Prefix
impl Sync for Ipv6Prefix
impl Unpin for Ipv6Prefix
impl UnsafeUnpin for Ipv6Prefix
impl UnwindSafe for Ipv6Prefix
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