pub trait IpPrefix: Debug + Clone + Copy {
type Slot: BitSlot;
type Addr: Display + Clone + Copy + Eq + Hash;
const MAX_LEN: u8;
// Required methods
fn root() -> Self;
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 Types§
Required Associated Constants§
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)