Struct net_types::UnicastAddr
source · pub struct UnicastAddr<A>(/* private fields */);
Expand description
An address which is guaranteed to be unicast.
UnicastAddr
wraps an address of type A
and guarantees that it is
a unicast address. Note that this guarantee is contingent on a correct
implementation of the UnicastAddress
trait. Since that trait is
not unsafe
, unsafe
code may NOT rely on this guarantee for its soundness.
Implementations§
source§impl<A: UnicastAddress> UnicastAddr<A>
impl<A: UnicastAddress> UnicastAddr<A>
sourcepub fn new(addr: A) -> Option<UnicastAddr<A>>
pub fn new(addr: A) -> Option<UnicastAddr<A>>
Constructs a new UnicastAddr
.
new
returns None
if !addr.is_unicast()
.
sourcepub fn from_witness<W: Witness<A>>(addr: W) -> Option<UnicastAddr<A>>
pub fn from_witness<W: Witness<A>>(addr: W) -> Option<UnicastAddr<A>>
Constructs a new UnicastAddr
from a
witness type.
from_witness(witness)
is equivalent to new(witness.into_addr())
.
source§impl<A> UnicastAddr<A>
impl<A> UnicastAddr<A>
sourcepub const unsafe fn new_unchecked(addr: A) -> UnicastAddr<A>
pub const unsafe fn new_unchecked(addr: A) -> UnicastAddr<A>
Constructs a new UnicastAddr
without
checking to see if addr
is actually unicast.
§Safety
It is up to the caller to make sure that addr
is unicast to avoid breaking
the guarantees of UnicastAddr
. See UnicastAddr
for
more details.
source§impl<A: UnicastAddress + SpecifiedAddress> UnicastAddr<A>
impl<A: UnicastAddress + SpecifiedAddress> UnicastAddr<A>
sourcepub fn into_specified(self) -> SpecifiedAddr<A>
pub fn into_specified(self) -> SpecifiedAddr<A>
Converts this UnicastAddr
into a
SpecifiedAddr
.
UnicastAddress::is_unicast
implies
SpecifiedAddress::is_specified
, so all UnicastAddr
s are
guaranteed to be specified, so this conversion is infallible.
Trait Implementations§
source§impl<A: UnicastAddress> AsRef<A> for UnicastAddr<A>
impl<A: UnicastAddress> AsRef<A> for UnicastAddr<A>
source§impl<A: UnicastAddress + LinkLocalAddress> AsRef<A> for UnicastAddr<LinkLocalAddr<A>>
impl<A: UnicastAddress + LinkLocalAddress> AsRef<A> for UnicastAddr<LinkLocalAddr<A>>
source§impl<A: UnicastAddress + MappedAddress> AsRef<A> for UnicastAddr<NonMappedAddr<A>>
impl<A: UnicastAddress + MappedAddress> AsRef<A> for UnicastAddr<NonMappedAddr<A>>
source§impl<A: UnicastAddress> AsRef<UnicastAddr<A>> for UnicastAddr<A>
impl<A: UnicastAddress> AsRef<UnicastAddr<A>> for UnicastAddr<A>
source§fn as_ref(&self) -> &UnicastAddr<A>
fn as_ref(&self) -> &UnicastAddr<A>
source§impl<A: BroadcastAddress> BroadcastAddress for UnicastAddr<A>
impl<A: BroadcastAddress> BroadcastAddress for UnicastAddr<A>
source§fn is_broadcast(&self) -> bool
fn is_broadcast(&self) -> bool
source§impl<A: Clone> Clone for UnicastAddr<A>
impl<A: Clone> Clone for UnicastAddr<A>
source§fn clone(&self) -> UnicastAddr<A>
fn clone(&self) -> UnicastAddr<A>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<A: Debug> Debug for UnicastAddr<A>
impl<A: Debug> Debug for UnicastAddr<A>
source§impl<A: UnicastAddress> Deref for UnicastAddr<A>
impl<A: UnicastAddress> Deref for UnicastAddr<A>
source§impl<A: Display> Display for UnicastAddr<A>
impl<A: Display> Display for UnicastAddr<A>
source§impl<A: Into<Ipv6Addr> + UnicastAddress + Copy> From<UnicastAddr<A>> for Ipv6Addr
impl<A: Into<Ipv6Addr> + UnicastAddress + Copy> From<UnicastAddr<A>> for Ipv6Addr
source§fn from(addr: UnicastAddr<A>) -> Ipv6Addr
fn from(addr: UnicastAddr<A>) -> Ipv6Addr
source§impl<A: UnicastAddress + SpecifiedAddress> From<UnicastAddr<A>> for SpecifiedAddr<A>
impl<A: UnicastAddress + SpecifiedAddress> From<UnicastAddr<A>> for SpecifiedAddr<A>
source§fn from(addr: UnicastAddr<A>) -> SpecifiedAddr<A>
fn from(addr: UnicastAddr<A>) -> SpecifiedAddr<A>
source§impl From<UnicastAddr<Ipv6Addr>> for UnicastAddr<IpAddr>
impl From<UnicastAddr<Ipv6Addr>> for UnicastAddr<IpAddr>
source§fn from(addr: UnicastAddr<Ipv6Addr>) -> UnicastAddr<IpAddr>
fn from(addr: UnicastAddr<Ipv6Addr>) -> UnicastAddr<IpAddr>
source§impl From<UnicastAddr<Ipv6Addr>> for UnicastOrMulticastIpv6Addr
impl From<UnicastAddr<Ipv6Addr>> for UnicastOrMulticastIpv6Addr
source§fn from(addr: UnicastAddr<Ipv6Addr>) -> UnicastOrMulticastIpv6Addr
fn from(addr: UnicastAddr<Ipv6Addr>) -> UnicastOrMulticastIpv6Addr
source§impl<A: UnicastAddress + LinkLocalAddress + SpecifiedAddress> From<UnicastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>
impl<A: UnicastAddress + LinkLocalAddress + SpecifiedAddress> From<UnicastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>
source§fn from(addr: UnicastAddr<LinkLocalAddr<A>>) -> SpecifiedAddr<A>
fn from(addr: UnicastAddr<LinkLocalAddr<A>>) -> SpecifiedAddr<A>
source§impl<A: UnicastAddress + MappedAddress + SpecifiedAddress> From<UnicastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>
impl<A: UnicastAddress + MappedAddress + SpecifiedAddress> From<UnicastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>
source§fn from(addr: UnicastAddr<NonMappedAddr<A>>) -> SpecifiedAddr<A>
fn from(addr: UnicastAddr<NonMappedAddr<A>>) -> SpecifiedAddr<A>
source§impl<A: Hash> Hash for UnicastAddr<A>
impl<A: Hash> Hash for UnicastAddr<A>
source§impl<A: LinkLocalAddress> LinkLocalAddress for UnicastAddr<A>
impl<A: LinkLocalAddress> LinkLocalAddress for UnicastAddr<A>
source§fn is_link_local(&self) -> bool
fn is_link_local(&self) -> bool
source§impl<A: MappedAddress> MappedAddress for UnicastAddr<A>
impl<A: MappedAddress> MappedAddress for UnicastAddr<A>
source§fn is_non_mapped(&self) -> bool
fn is_non_mapped(&self) -> bool
source§impl<A: MulticastAddress> MulticastAddress for UnicastAddr<A>
impl<A: MulticastAddress> MulticastAddress for UnicastAddr<A>
source§fn is_multicast(&self) -> bool
fn is_multicast(&self) -> bool
source§fn is_non_multicast(&self) -> bool
fn is_non_multicast(&self) -> bool
is_multicast()
.source§impl<A: Ord> Ord for UnicastAddr<A>
impl<A: Ord> Ord for UnicastAddr<A>
source§fn cmp(&self, other: &UnicastAddr<A>) -> Ordering
fn cmp(&self, other: &UnicastAddr<A>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<A: PartialEq> PartialEq for UnicastAddr<A>
impl<A: PartialEq> PartialEq for UnicastAddr<A>
source§fn eq(&self, other: &UnicastAddr<A>) -> bool
fn eq(&self, other: &UnicastAddr<A>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<A: PartialOrd> PartialOrd for UnicastAddr<A>
impl<A: PartialOrd> PartialOrd for UnicastAddr<A>
source§fn partial_cmp(&self, other: &UnicastAddr<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &UnicastAddr<A>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<A: ScopeableAddress> ScopeableAddress for UnicastAddr<A>
impl<A: ScopeableAddress> ScopeableAddress for UnicastAddr<A>
source§impl<A: SpecifiedAddress> SpecifiedAddress for UnicastAddr<A>
impl<A: SpecifiedAddress> SpecifiedAddress for UnicastAddr<A>
source§fn is_specified(&self) -> bool
fn is_specified(&self) -> bool
source§impl<A: UnicastAddress> TransposableWitness<A> for UnicastAddr<A>
impl<A: UnicastAddress> TransposableWitness<A> for UnicastAddr<A>
§type Map<T> = UnicastAddr<T>
type Map<T> = UnicastAddr<T>
source§impl<A: BroadcastAddress + UnicastAddress> TryFrom<BroadcastAddr<A>> for UnicastAddr<A>
impl<A: BroadcastAddress + UnicastAddress> TryFrom<BroadcastAddr<A>> for UnicastAddr<A>
source§fn try_from(addr: BroadcastAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: BroadcastAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: LinkLocalAddress + UnicastAddress> TryFrom<LinkLocalAddr<A>> for UnicastAddr<A>
impl<A: LinkLocalAddress + UnicastAddress> TryFrom<LinkLocalAddr<A>> for UnicastAddr<A>
source§fn try_from(addr: LinkLocalAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: LinkLocalAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: LinkLocalBroadcastAddress + UnicastAddress> TryFrom<LinkLocalAddr<BroadcastAddr<A>>> for UnicastAddr<A>
impl<A: LinkLocalBroadcastAddress + UnicastAddress> TryFrom<LinkLocalAddr<BroadcastAddr<A>>> for UnicastAddr<A>
source§fn try_from(addr: LinkLocalBroadcastAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: LinkLocalBroadcastAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: LinkLocalMulticastAddress + UnicastAddress> TryFrom<LinkLocalAddr<MulticastAddr<A>>> for UnicastAddr<A>
impl<A: LinkLocalMulticastAddress + UnicastAddress> TryFrom<LinkLocalAddr<MulticastAddr<A>>> for UnicastAddr<A>
source§fn try_from(addr: LinkLocalMulticastAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: LinkLocalMulticastAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: LinkLocalUnicastAddress + UnicastAddress> TryFrom<LinkLocalAddr<UnicastAddr<A>>> for UnicastAddr<A>
impl<A: LinkLocalUnicastAddress + UnicastAddress> TryFrom<LinkLocalAddr<UnicastAddr<A>>> for UnicastAddr<A>
source§fn try_from(addr: LinkLocalUnicastAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: LinkLocalUnicastAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: MulticastAddress + UnicastAddress> TryFrom<MulticastAddr<A>> for UnicastAddr<A>
impl<A: MulticastAddress + UnicastAddress> TryFrom<MulticastAddr<A>> for UnicastAddr<A>
source§fn try_from(addr: MulticastAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: MulticastAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: MappedAddress + UnicastAddress> TryFrom<NonMappedAddr<A>> for UnicastAddr<A>
impl<A: MappedAddress + UnicastAddress> TryFrom<NonMappedAddr<A>> for UnicastAddr<A>
source§fn try_from(addr: NonMappedAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: NonMappedAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: SpecifiedAddress + UnicastAddress> TryFrom<SpecifiedAddr<A>> for UnicastAddr<A>
impl<A: SpecifiedAddress + UnicastAddress> TryFrom<SpecifiedAddr<A>> for UnicastAddr<A>
source§fn try_from(addr: SpecifiedAddr<A>) -> Result<UnicastAddr<A>, ()>
fn try_from(addr: SpecifiedAddr<A>) -> Result<UnicastAddr<A>, ()>
source§impl<A: UnicastAddress + BroadcastAddress> TryFrom<UnicastAddr<A>> for BroadcastAddr<A>
impl<A: UnicastAddress + BroadcastAddress> TryFrom<UnicastAddr<A>> for BroadcastAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<BroadcastAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<BroadcastAddr<A>, ()>
source§impl<A: UnicastAddress + LinkLocalAddress> TryFrom<UnicastAddr<A>> for LinkLocalAddr<A>
impl<A: UnicastAddress + LinkLocalAddress> TryFrom<UnicastAddr<A>> for LinkLocalAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalAddr<A>, ()>
source§impl<A: UnicastAddress + LinkLocalBroadcastAddress> TryFrom<UnicastAddr<A>> for LinkLocalBroadcastAddr<A>
impl<A: UnicastAddress + LinkLocalBroadcastAddress> TryFrom<UnicastAddr<A>> for LinkLocalBroadcastAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalBroadcastAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalBroadcastAddr<A>, ()>
source§impl<A: UnicastAddress + LinkLocalMulticastAddress> TryFrom<UnicastAddr<A>> for LinkLocalMulticastAddr<A>
impl<A: UnicastAddress + LinkLocalMulticastAddress> TryFrom<UnicastAddr<A>> for LinkLocalMulticastAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalMulticastAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<LinkLocalMulticastAddr<A>, ()>
source§impl<A: UnicastAddress + MulticastAddress> TryFrom<UnicastAddr<A>> for MulticastAddr<A>
impl<A: UnicastAddress + MulticastAddress> TryFrom<UnicastAddr<A>> for MulticastAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<MulticastAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<MulticastAddr<A>, ()>
source§impl<A: UnicastAddress + MappedAddress> TryFrom<UnicastAddr<A>> for NonMappedAddr<A>
impl<A: UnicastAddress + MappedAddress> TryFrom<UnicastAddr<A>> for NonMappedAddr<A>
source§fn try_from(addr: UnicastAddr<A>) -> Result<NonMappedAddr<A>, ()>
fn try_from(addr: UnicastAddr<A>) -> Result<NonMappedAddr<A>, ()>
source§impl<A: UnicastAddress> Witness<A> for UnicastAddr<A>
impl<A: UnicastAddress> Witness<A> for UnicastAddr<A>
source§unsafe fn new_unchecked(addr: A) -> UnicastAddr<A>
unsafe fn new_unchecked(addr: A) -> UnicastAddr<A>
addr
actually
satisfies the required property. Read moresource§fn from_witness<W: Witness<A>>(addr: W) -> Option<Self>
fn from_witness<W: Witness<A>>(addr: W) -> Option<Self>
source§fn transpose<T>(self) -> A::Map<Self::Map<T>>where
Self: TransposableWitness<A>,
A: TransposableWitness<T>,
Self::Map<T>: Witness<T>,
A::Map<Self::Map<T>>: Witness<Self::Map<T>>,
fn transpose<T>(self) -> A::Map<Self::Map<T>>where
Self: TransposableWitness<A>,
A: TransposableWitness<T>,
Self::Map<T>: Witness<T>,
A::Map<Self::Map<T>>: Witness<Self::Map<T>>,
source§impl<A: UnicastAddress + LinkLocalAddress> Witness<A> for UnicastAddr<LinkLocalAddr<A>>
impl<A: UnicastAddress + LinkLocalAddress> Witness<A> for UnicastAddr<LinkLocalAddr<A>>
source§fn new(addr: A) -> Option<UnicastAddr<LinkLocalAddr<A>>>
fn new(addr: A) -> Option<UnicastAddr<LinkLocalAddr<A>>>
source§unsafe fn new_unchecked(addr: A) -> UnicastAddr<LinkLocalAddr<A>>
unsafe fn new_unchecked(addr: A) -> UnicastAddr<LinkLocalAddr<A>>
addr
actually
satisfies the required property. Read moresource§impl<A: UnicastAddress + MappedAddress> Witness<A> for UnicastAddr<NonMappedAddr<A>>
impl<A: UnicastAddress + MappedAddress> Witness<A> for UnicastAddr<NonMappedAddr<A>>
source§fn new(addr: A) -> Option<UnicastAddr<NonMappedAddr<A>>>
fn new(addr: A) -> Option<UnicastAddr<NonMappedAddr<A>>>
source§unsafe fn new_unchecked(addr: A) -> UnicastAddr<NonMappedAddr<A>>
unsafe fn new_unchecked(addr: A) -> UnicastAddr<NonMappedAddr<A>>
addr
actually
satisfies the required property. Read moreimpl<A: Copy> Copy for UnicastAddr<A>
impl<A: Eq> Eq for UnicastAddr<A>
impl<A> StructuralPartialEq for UnicastAddr<A>
Auto Trait Implementations§
impl<A> Freeze for UnicastAddr<A>where
A: Freeze,
impl<A> RefUnwindSafe for UnicastAddr<A>where
A: RefUnwindSafe,
impl<A> Send for UnicastAddr<A>where
A: Send,
impl<A> Sync for UnicastAddr<A>where
A: Sync,
impl<A> Unpin for UnicastAddr<A>where
A: Unpin,
impl<A> UnwindSafe for UnicastAddr<A>where
A: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)