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>
impl<A: Clone + IpAddrWitness> Clone for AddrSubnetEither<A>
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>
impl<A: Debug + IpAddrWitness> Debug for AddrSubnetEither<A>
Source§impl<A> Display for AddrSubnetEither<A>
impl<A> Display for AddrSubnetEither<A>
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>
impl<A: Hash + IpAddrWitness> Hash for AddrSubnetEither<A>
Source§impl<A: PartialEq + IpAddrWitness> PartialEq for AddrSubnetEither<A>
impl<A: PartialEq + IpAddrWitness> PartialEq for AddrSubnetEither<A>
impl<A: Copy + IpAddrWitness> Copy for AddrSubnetEither<A>
impl<A: Eq + IpAddrWitness> Eq for AddrSubnetEither<A>
impl<A: IpAddrWitness> StructuralPartialEq for AddrSubnetEither<A>
Auto Trait Implementations§
impl<A> Freeze for AddrSubnetEither<A>
impl<A> RefUnwindSafe for AddrSubnetEither<A>
impl<A> Send for AddrSubnetEither<A>
impl<A> Sync for AddrSubnetEither<A>
impl<A> Unpin for AddrSubnetEither<A>
impl<A> UnwindSafe for AddrSubnetEither<A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)