Enum net_types::ip::AddrSubnetEither
source · pub enum AddrSubnetEither<A: IpAddrWitness = SpecifiedAddr<IpAddr>> {
V4(AddrSubnet<Ipv4Addr, A::V4>),
V6(AddrSubnet<Ipv6Addr, A::V6>),
}
Expand description
An address and that address’s subnet, either IPv4 or IPv6.
AddrSubnetEither
is an enum of AddrSubnet<Ipv4Addr>
and
AddrSubnet<Ipv6Addr>
.
Variants§
V4(AddrSubnet<Ipv4Addr, A::V4>)
V6(AddrSubnet<Ipv6Addr, A::V6>)
Implementations§
source§impl<A: IpAddrWitness> AddrSubnetEither<A>
impl<A: IpAddrWitness> AddrSubnetEither<A>
sourcepub fn new(
addr: IpAddr,
prefix: u8
) -> Result<AddrSubnetEither<A>, AddrSubnetError>
pub fn new( addr: IpAddr, prefix: u8 ) -> Result<AddrSubnetEither<A>, AddrSubnetError>
Creates a new AddrSubnetEither
.
new
creates a new AddrSubnetEither
with the given address and prefix
length. It returns Err
under the same conditions as
AddrSubnet::new
.
sourcepub unsafe fn new_unchecked(addr: IpAddr, prefix: u8) -> Self
pub unsafe fn new_unchecked(addr: IpAddr, prefix: u8) -> Self
sourcepub fn addr_prefix(&self) -> (A, u8)
pub fn addr_prefix(&self) -> (A, u8)
Gets the IP address and prefix.
sourcepub fn addr_subnet(&self) -> (A, SubnetEither)
pub fn addr_subnet(&self) -> (A, SubnetEither)
Gets the IP address and subnet.
Trait Implementations§
source§impl<A: Clone + IpAddrWitness> Clone for AddrSubnetEither<A>where
A::V4: Clone,
A::V6: Clone,
impl<A: Clone + IpAddrWitness> Clone for AddrSubnetEither<A>where A::V4: Clone, A::V6: Clone,
source§fn clone(&self) -> AddrSubnetEither<A>
fn clone(&self) -> AddrSubnetEither<A>
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<A: Debug + IpAddrWitness> Debug for AddrSubnetEither<A>where
A::V4: Debug,
A::V6: Debug,
impl<A: Debug + IpAddrWitness> Debug for AddrSubnetEither<A>where A::V4: Debug, A::V6: Debug,
source§impl<A> Display for AddrSubnetEither<A>where
A: IpAddrWitness,
A::V4: Display,
A::V6: Display,
impl<A> Display for AddrSubnetEither<A>where A: IpAddrWitness, A::V4: Display, A::V6: Display,
source§impl<S: IpAddress, A: IpAddressWitness<S> + Copy> From<AddrSubnet<S, A>> for AddrSubnetEither<A::IpAddrWitness>
impl<S: IpAddress, A: IpAddressWitness<S> + Copy> From<AddrSubnet<S, A>> for AddrSubnetEither<A::IpAddrWitness>
source§fn from(addr_sub: AddrSubnet<S, A>) -> AddrSubnetEither<A::IpAddrWitness>
fn from(addr_sub: AddrSubnet<S, A>) -> AddrSubnetEither<A::IpAddrWitness>
Converts to this type from the input type.
source§impl<A: Hash + IpAddrWitness> Hash for AddrSubnetEither<A>where
A::V4: Hash,
A::V6: Hash,
impl<A: Hash + IpAddrWitness> Hash for AddrSubnetEither<A>where A::V4: Hash, A::V6: Hash,
source§impl<A: PartialEq + IpAddrWitness> PartialEq for AddrSubnetEither<A>where
A::V4: PartialEq,
A::V6: PartialEq,
impl<A: PartialEq + IpAddrWitness> PartialEq for AddrSubnetEither<A>where A::V4: PartialEq, A::V6: PartialEq,
source§fn eq(&self, other: &AddrSubnetEither<A>) -> bool
fn eq(&self, other: &AddrSubnetEither<A>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<A: Copy + IpAddrWitness> Copy for AddrSubnetEither<A>where A::V4: Copy, A::V6: Copy,
impl<A: Eq + IpAddrWitness> Eq for AddrSubnetEither<A>where A::V4: Eq, A::V6: Eq,
impl<A: IpAddrWitness> StructuralEq for AddrSubnetEither<A>
impl<A: IpAddrWitness> StructuralPartialEq for AddrSubnetEither<A>
Auto Trait Implementations§
impl<A> RefUnwindSafe for AddrSubnetEither<A>where <A as IpAddrWitness>::V4: RefUnwindSafe, <A as IpAddrWitness>::V6: RefUnwindSafe,
impl<A> Send for AddrSubnetEither<A>where <A as IpAddrWitness>::V4: Send, <A as IpAddrWitness>::V6: Send,
impl<A> Sync for AddrSubnetEither<A>where <A as IpAddrWitness>::V4: Sync, <A as IpAddrWitness>::V6: Sync,
impl<A> Unpin for AddrSubnetEither<A>where <A as IpAddrWitness>::V4: Unpin, <A as IpAddrWitness>::V6: Unpin,
impl<A> UnwindSafe for AddrSubnetEither<A>where <A as IpAddrWitness>::V4: UnwindSafe, <A as IpAddrWitness>::V6: UnwindSafe,
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