[−][src]Enum rcgen::CidrSubnet
CIDR subnet, as per RFC 4632
You might know CIDR subnets better by their textual representation
where they consist of an ip address followed by a slash and a prefix
number, for example 192.168.99.0/24
.
The first field in the enum is the address, the second is the mask. Both are specified in network byte order.
Variants
Methods
impl CidrSubnet
[src]
pub fn from_str(s: &str) -> Result<Self, ()>
[src]
Obtains the CidrSubnet from the well-known addr/prefix notation.
// The "192.0.2.0/24" example from // https://tools.ietf.org/html/rfc5280#page-42 let subnet = CidrSubnet::from_str("192.0.2.0/24").unwrap(); assert_eq!(subnet, CidrSubnet::V4([0xC0, 0x00, 0x02, 0x00], [0xFF, 0xFF, 0xFF, 0x00]));
pub fn from_addr_prefix(addr: IpAddr, prefix: u8) -> Self
[src]
Obtains the CidrSubnet from an ip address as well as the specified prefix number.
// The "192.0.2.0/24" example from // https://tools.ietf.org/html/rfc5280#page-42 let addr = IpAddr::from_str("192.0.2.0").unwrap(); let subnet = CidrSubnet::from_addr_prefix(addr, 24); assert_eq!(subnet, CidrSubnet::V4([0xC0, 0x00, 0x02, 0x00], [0xFF, 0xFF, 0xFF, 0x00]));
pub fn from_v4_prefix(addr: [u8; 4], prefix: u8) -> Self
[src]
Obtains the CidrSubnet from an IPv4 address in network byte order as well as the specified prefix.
pub fn from_v6_prefix(addr: [u8; 16], prefix: u8) -> Self
[src]
Obtains the CidrSubnet from an IPv6 address in network byte order as well as the specified prefix.
Trait Implementations
impl Eq for CidrSubnet
[src]
impl Clone for CidrSubnet
[src]
fn clone(&self) -> CidrSubnet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<CidrSubnet> for CidrSubnet
[src]
fn eq(&self, other: &CidrSubnet) -> bool
[src]
fn ne(&self, other: &CidrSubnet) -> bool
[src]
impl Hash for CidrSubnet
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Debug for CidrSubnet
[src]
Auto Trait Implementations
impl Send for CidrSubnet
impl Unpin for CidrSubnet
impl Sync for CidrSubnet
impl UnwindSafe for CidrSubnet
impl RefUnwindSafe for CidrSubnet
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,