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