Struct iptrie::Ipv6Prefix
source · pub struct Ipv6Prefix { /* private fields */ }Expand description
An Ipv4 prefix similar to Ipv6Net but with trailing bits
guaranteed to equal 0
Implementations§
source§impl Ipv6Prefix
impl Ipv6Prefix
sourcepub fn new(addr: Ipv6Addr, len: u8) -> Result<Self, IpPrefixError>
pub fn new(addr: Ipv6Addr, len: u8) -> Result<Self, IpPrefixError>
Build a new prefix.
All the bits greater than the prefix length are set to `0``. If the specified length is greater than the maximum allowed, an error is returned.
Example
use std::net::{Ipv4Addr, Ipv6Addr};
use ipnet::PrefixLenError;
let ipv4 = "1.2.3.4".parse::<Ipv4Addr>().unwrap();
let ipv6 = "1:2:3:4::".parse::<Ipv6Addr>().unwrap();
assert!( Ipv6Prefix::new(ipv6, 78).is_ok());
assert_eq!( Ipv6Prefix::new(ipv6, 133), Err(IpPrefixError::PrefixLenError));Trait Implementations§
source§impl Clone for Ipv6Prefix
impl Clone for Ipv6Prefix
source§fn clone(&self) -> Ipv6Prefix
fn clone(&self) -> Ipv6Prefix
Returns a copy 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 Default for Ipv6Prefix
impl Default for Ipv6Prefix
source§fn default() -> Ipv6Prefix
fn default() -> Ipv6Prefix
Returns the “default value” for a type. Read more
source§impl Display for Ipv6Prefix
impl Display for Ipv6Prefix
source§impl From<Ipv6Addr> for Ipv6Prefix
impl From<Ipv6Addr> for Ipv6Prefix
source§impl From<Ipv6Net> for Ipv6Prefix
impl From<Ipv6Net> for Ipv6Prefix
source§impl From<Ipv6Prefix> for Ipv6Net
impl From<Ipv6Prefix> for Ipv6Net
source§fn from(value: Ipv6Prefix) -> Self
fn from(value: Ipv6Prefix) -> Self
Converts to this type from the input type.
source§impl From<Ipv6Prefix120> for Ipv6Prefix
impl From<Ipv6Prefix120> for Ipv6Prefix
source§fn from(value: Ipv6Prefix120) -> Self
fn from(value: Ipv6Prefix120) -> Self
Converts to this type from the input type.
source§impl From<Ipv6Prefix56> for Ipv6Prefix
impl From<Ipv6Prefix56> for Ipv6Prefix
source§fn from(value: Ipv6Prefix56) -> Self
fn from(value: Ipv6Prefix56) -> Self
Converts to this type from the input type.
source§impl FromStr for Ipv6Prefix
impl FromStr for Ipv6Prefix
source§impl Hash for Ipv6Prefix
impl Hash for Ipv6Prefix
source§impl IpPrefix for Ipv6Prefix
impl IpPrefix for Ipv6Prefix
source§fn bitslot_trunc(&self) -> Self::Slot
fn bitslot_trunc(&self) -> Self::Slot
The inner slot with all the masked bits set to 0. Read more
source§impl IpPrefixCovering<Ipv6Addr> for Ipv6Prefix
impl IpPrefixCovering<Ipv6Addr> for Ipv6Prefix
source§impl IpPrefixCovering<Ipv6Net> for Ipv6Prefix
impl IpPrefixCovering<Ipv6Net> for Ipv6Prefix
source§impl IpPrefixCovering<Ipv6Prefix> for Ipv6Net
impl IpPrefixCovering<Ipv6Prefix> for Ipv6Net
source§impl IpPrefixCovering<Ipv6Prefix> for Ipv6Prefix120
impl IpPrefixCovering<Ipv6Prefix> for Ipv6Prefix120
source§impl IpPrefixCovering<Ipv6Prefix> for Ipv6Prefix56
impl IpPrefixCovering<Ipv6Prefix> for Ipv6Prefix56
source§impl IpPrefixCovering<Ipv6Prefix120> for Ipv6Prefix
impl IpPrefixCovering<Ipv6Prefix120> for Ipv6Prefix
source§impl IpPrefixCovering<Ipv6Prefix56> for Ipv6Prefix
impl IpPrefixCovering<Ipv6Prefix56> for Ipv6Prefix
source§impl PartialEq<Ipv6Prefix> for Ipv6Prefix
impl PartialEq<Ipv6Prefix> for Ipv6Prefix
source§fn eq(&self, other: &Ipv6Prefix) -> bool
fn eq(&self, other: &Ipv6Prefix) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl TryFrom<Ipv6Prefix> for Ipv6Prefix120
impl TryFrom<Ipv6Prefix> for Ipv6Prefix120
§type Error = IpPrefixError
type Error = IpPrefixError
The type returned in the event of a conversion error.
source§impl TryFrom<Ipv6Prefix> for Ipv6Prefix56
impl TryFrom<Ipv6Prefix> for Ipv6Prefix56
§type Error = IpPrefixError
type Error = IpPrefixError
The type returned in the event of a conversion error.
impl Copy for Ipv6Prefix
impl Eq for Ipv6Prefix
impl StructuralEq for Ipv6Prefix
impl StructuralPartialEq for Ipv6Prefix
Auto Trait Implementations§
impl RefUnwindSafe for Ipv6Prefix
impl Send for Ipv6Prefix
impl Sync for Ipv6Prefix
impl Unpin 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