pub trait IpPrefix:
IpPrivatePrefix
+ Debug
+ Clone
+ Copy {
type Slot: BitSlot;
type Addr: Display + Clone + Copy + Eq + Hash;
const MAX_LEN: u8;
// Required methods
fn bitslot(&self) -> Self::Slot;
fn bitslot_trunc(&self) -> Self::Slot;
fn len(&self) -> u8;
fn network(&self) -> Self::Addr;
// Provided method
fn bitmask(&self) -> Self::Slot { ... }
}Expand description
Ip prefix (as bit prefix)
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn bitslot(&self) -> Self::Slot
fn bitslot(&self) -> Self::Slot
The inner slot as is
Depending of the implementation, there is no warranty that the masked bits (i.e. with position greater than the length) are set to 0.
For a version of a slot with masked bits set to 0,
see Self::bitslot_trunc.
Sourcefn bitslot_trunc(&self) -> Self::Slot
fn bitslot_trunc(&self) -> Self::Slot
The inner slot with all the masked bits set to 0.
The result always equals self.bitslot() & self.bitmask()
but it is usually faster to compute (depending on the prefix structure)
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.