pub struct PrefixPolicy { /* private fields */ }Expand description
The prefix lengths used to group addresses.
IPv6 hosts usually own a whole /64, so the default groups IPv6 at /64 and IPv4 at /32.
§Examples
use net_io::PrefixPolicy;
assert_eq!(PrefixPolicy::DEFAULT.v6(), 64);
assert!(PrefixPolicy::new(33, 64).is_err());Implementations§
Source§impl PrefixPolicy
impl PrefixPolicy
Sourcepub const HOST: PrefixPolicy
pub const HOST: PrefixPolicy
Every address on its own: /32 and /128.
Sourcepub const DEFAULT: PrefixPolicy
pub const DEFAULT: PrefixPolicy
/32 for IPv4 and /64 for IPv6.
Sourcepub const fn new(v4: u8, v6: u8) -> Result<PrefixPolicy, AddrError>
pub const fn new(v4: u8, v6: u8) -> Result<PrefixPolicy, AddrError>
A policy with the given lengths.
§Errors
AddrError::PrefixTooLong above 32 or 128.
let wide = net_io::PrefixPolicy::new(24, 48)?;
assert_eq!(wide.v4(), 24);Trait Implementations§
Source§impl Clone for PrefixPolicy
impl Clone for PrefixPolicy
impl Copy for PrefixPolicy
Source§impl Debug for PrefixPolicy
impl Debug for PrefixPolicy
Source§impl Default for PrefixPolicy
impl Default for PrefixPolicy
Source§fn default() -> PrefixPolicy
fn default() -> PrefixPolicy
Returns the “default value” for a type. Read more
impl Eq for PrefixPolicy
Source§impl Hash for PrefixPolicy
impl Hash for PrefixPolicy
Source§impl PartialEq for PrefixPolicy
impl PartialEq for PrefixPolicy
impl StructuralPartialEq for PrefixPolicy
Auto Trait Implementations§
impl Freeze for PrefixPolicy
impl RefUnwindSafe for PrefixPolicy
impl Send for PrefixPolicy
impl Sync for PrefixPolicy
impl Unpin for PrefixPolicy
impl UnsafeUnpin for PrefixPolicy
impl UnwindSafe for PrefixPolicy
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