pub struct MulticastAddr<A>(/* private fields */);
Expand description
An address which is guaranteed to be multicast.
MulticastAddr
wraps an address of type A
and guarantees that it is
a multicast address. Note that this guarantee is contingent on a correct
implementation of the MulticastAddress
trait. Since that trait is
not unsafe
, unsafe
code may NOT rely on this guarantee for its soundness.
Implementations§
Source§impl<A: MulticastAddress> MulticastAddr<A>
impl<A: MulticastAddress> MulticastAddr<A>
Sourcepub fn new(addr: A) -> Option<MulticastAddr<A>>
pub fn new(addr: A) -> Option<MulticastAddr<A>>
Constructs a new MulticastAddr
.
new
returns None
if !addr.is_multicast()
.
Sourcepub fn from_witness<W: Witness<A>>(addr: W) -> Option<MulticastAddr<A>>
pub fn from_witness<W: Witness<A>>(addr: W) -> Option<MulticastAddr<A>>
Constructs a new MulticastAddr
from a
witness type.
from_witness(witness)
is equivalent to new(witness.into_addr())
.
Source§impl<A> MulticastAddr<A>
impl<A> MulticastAddr<A>
Sourcepub const unsafe fn new_unchecked(addr: A) -> MulticastAddr<A>
pub const unsafe fn new_unchecked(addr: A) -> MulticastAddr<A>
Constructs a new MulticastAddr
without
checking to see if addr
is actually multicast.
§Safety
It is up to the caller to make sure that addr
is multicast to avoid breaking
the guarantees of MulticastAddr
. See MulticastAddr
for
more details.
Source§impl<A: MulticastAddress + SpecifiedAddress> MulticastAddr<A>
impl<A: MulticastAddress + SpecifiedAddress> MulticastAddr<A>
Sourcepub fn into_specified(self) -> SpecifiedAddr<A>
pub fn into_specified(self) -> SpecifiedAddr<A>
Converts this MulticastAddr
into a
SpecifiedAddr
.
MulticastAddress::is_multicast
implies
SpecifiedAddress::is_specified
, so all MulticastAddr
s are
guaranteed to be specified, so this conversion is infallible.
Source§impl<A: MulticastAddress + MappedAddress> MulticastAddr<A>
impl<A: MulticastAddress + MappedAddress> MulticastAddr<A>
Sourcepub fn non_mapped(self) -> NonMappedAddr<MulticastAddr<A>>
pub fn non_mapped(self) -> NonMappedAddr<MulticastAddr<A>>
Wraps self
in the NonMappedAddr
witness type.
Trait Implementations§
Source§impl<A: MulticastAddress> AsRef<A> for MulticastAddr<A>
impl<A: MulticastAddress> AsRef<A> for MulticastAddr<A>
Source§impl<A: MulticastAddress + LinkLocalAddress> AsRef<A> for MulticastAddr<LinkLocalAddr<A>>
impl<A: MulticastAddress + LinkLocalAddress> AsRef<A> for MulticastAddr<LinkLocalAddr<A>>
Source§impl<A: MulticastAddress + MappedAddress> AsRef<A> for MulticastAddr<NonMappedAddr<A>>
impl<A: MulticastAddress + MappedAddress> AsRef<A> for MulticastAddr<NonMappedAddr<A>>
Source§impl<A: MulticastAddress> AsRef<MulticastAddr<A>> for MulticastAddr<A>
impl<A: MulticastAddress> AsRef<MulticastAddr<A>> for MulticastAddr<A>
Source§fn as_ref(&self) -> &MulticastAddr<A>
fn as_ref(&self) -> &MulticastAddr<A>
Source§impl<A: BroadcastAddress> BroadcastAddress for MulticastAddr<A>
impl<A: BroadcastAddress> BroadcastAddress for MulticastAddr<A>
Source§fn is_broadcast(&self) -> bool
fn is_broadcast(&self) -> bool
Source§impl<A: Clone> Clone for MulticastAddr<A>
impl<A: Clone> Clone for MulticastAddr<A>
Source§fn clone(&self) -> MulticastAddr<A>
fn clone(&self) -> MulticastAddr<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 MulticastAddr<A>
impl<A: Debug> Debug for MulticastAddr<A>
Source§impl<A: MulticastAddress> Deref for MulticastAddr<A>
impl<A: MulticastAddress> Deref for MulticastAddr<A>
Source§impl<A: Display> Display for MulticastAddr<A>
impl<A: Display> Display for MulticastAddr<A>
Source§impl<'a, A: IpAddress> From<&'a MulticastAddr<A>> for Mac
impl<'a, A: IpAddress> From<&'a MulticastAddr<A>> for Mac
Source§fn from(addr: &'a MulticastAddr<A>) -> Mac
fn from(addr: &'a MulticastAddr<A>) -> Mac
Converts a multicast IP address to a MAC address.
This method is equivalent to MulticastAddr::<Mac>::from(addr).get()
.
Source§impl<'a, A: IpAddress> From<&'a MulticastAddr<A>> for MulticastAddr<Mac>
impl<'a, A: IpAddress> From<&'a MulticastAddr<A>> for MulticastAddr<Mac>
Source§fn from(addr: &'a MulticastAddr<A>) -> MulticastAddr<Mac>
fn from(addr: &'a MulticastAddr<A>) -> MulticastAddr<Mac>
Converts a multicast IP address to a multicast MAC address.
When a multicast IP packet is sent over an Ethernet link, the frame’s destination MAC address is a multicast MAC address that is derived from the destination IP address. This function performs that conversion.
See RFC 7042 Section 2.1.1 and Section 2.3.1 for details on how IPv4 and IPv6 addresses are mapped, respectively.
Source§impl From<IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>> for MulticastAddr<IpAddr>
impl From<IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>> for MulticastAddr<IpAddr>
Source§fn from(
addr: IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>,
) -> MulticastAddr<IpAddr>
fn from( addr: IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>, ) -> MulticastAddr<IpAddr>
Source§impl<A: IpAddress> From<MulticastAddr<A>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
impl<A: IpAddress> From<MulticastAddr<A>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§fn from(
addr: MulticastAddr<A>,
) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
fn from( addr: MulticastAddr<A>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§impl<A: Into<Ipv4Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv4Addr
impl<A: Into<Ipv4Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv4Addr
Source§fn from(addr: MulticastAddr<A>) -> Ipv4Addr
fn from(addr: MulticastAddr<A>) -> Ipv4Addr
Source§impl<A: Into<Ipv6Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv6Addr
impl<A: Into<Ipv6Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv6Addr
Source§fn from(addr: MulticastAddr<A>) -> Ipv6Addr
fn from(addr: MulticastAddr<A>) -> Ipv6Addr
Source§impl<A: IpAddress> From<MulticastAddr<A>> for Mac
impl<A: IpAddress> From<MulticastAddr<A>> for Mac
Source§fn from(addr: MulticastAddr<A>) -> Mac
fn from(addr: MulticastAddr<A>) -> Mac
Converts a multicast IP address to a MAC address.
This method is equivalent to (&addr).into()
.
Source§impl<A: IpAddress> From<MulticastAddr<A>> for MulticastAddr<IpAddr>
impl<A: IpAddress> From<MulticastAddr<A>> for MulticastAddr<IpAddr>
Source§fn from(addr: MulticastAddr<A>) -> MulticastAddr<IpAddr>
fn from(addr: MulticastAddr<A>) -> MulticastAddr<IpAddr>
Source§impl<A: IpAddress> From<MulticastAddr<A>> for MulticastAddr<Mac>
impl<A: IpAddress> From<MulticastAddr<A>> for MulticastAddr<Mac>
Source§fn from(addr: MulticastAddr<A>) -> MulticastAddr<Mac>
fn from(addr: MulticastAddr<A>) -> MulticastAddr<Mac>
Source§impl<A: MulticastAddress + SpecifiedAddress> From<MulticastAddr<A>> for SpecifiedAddr<A>
impl<A: MulticastAddress + SpecifiedAddress> From<MulticastAddr<A>> for SpecifiedAddr<A>
Source§fn from(addr: MulticastAddr<A>) -> SpecifiedAddr<A>
fn from(addr: MulticastAddr<A>) -> SpecifiedAddr<A>
Source§impl From<MulticastAddr<IpAddr>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
impl From<MulticastAddr<IpAddr>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§fn from(
addr: MulticastAddr<IpAddr>,
) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
fn from( addr: MulticastAddr<IpAddr>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§impl From<MulticastAddr<Ipv6Addr>> for UnicastOrMulticastIpv6Addr
impl From<MulticastAddr<Ipv6Addr>> for UnicastOrMulticastIpv6Addr
Source§fn from(addr: MulticastAddr<Ipv6Addr>) -> UnicastOrMulticastIpv6Addr
fn from(addr: MulticastAddr<Ipv6Addr>) -> UnicastOrMulticastIpv6Addr
Source§impl<A: MulticastAddress + LinkLocalAddress + SpecifiedAddress> From<MulticastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>
impl<A: MulticastAddress + LinkLocalAddress + SpecifiedAddress> From<MulticastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>
Source§fn from(addr: MulticastAddr<LinkLocalAddr<A>>) -> SpecifiedAddr<A>
fn from(addr: MulticastAddr<LinkLocalAddr<A>>) -> SpecifiedAddr<A>
Source§impl<A: MulticastAddress + MappedAddress + SpecifiedAddress> From<MulticastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>
impl<A: MulticastAddress + MappedAddress + SpecifiedAddress> From<MulticastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>
Source§fn from(addr: MulticastAddr<NonMappedAddr<A>>) -> SpecifiedAddr<A>
fn from(addr: MulticastAddr<NonMappedAddr<A>>) -> SpecifiedAddr<A>
Source§impl<A: IpAddress, I: Ip> GenericOverIp<I> for MulticastAddr<A>
impl<A: IpAddress, I: Ip> GenericOverIp<I> for MulticastAddr<A>
Source§impl<A: Hash> Hash for MulticastAddr<A>
impl<A: Hash> Hash for MulticastAddr<A>
Source§impl IpAddrWitness for MulticastAddr<IpAddr>
impl IpAddrWitness for MulticastAddr<IpAddr>
Source§impl<A: IpAddress> IpAddressWitness<A> for MulticastAddr<A>
impl<A: IpAddress> IpAddressWitness<A> for MulticastAddr<A>
Source§type IpAddrWitness = MulticastAddr<IpAddr>
type IpAddrWitness = MulticastAddr<IpAddr>
Self
. Read moreSource§impl<A: LinkLocalAddress> LinkLocalAddress for MulticastAddr<A>
impl<A: LinkLocalAddress> LinkLocalAddress for MulticastAddr<A>
Source§fn is_link_local(&self) -> bool
fn is_link_local(&self) -> bool
Source§impl<A: MappedAddress> MappedAddress for MulticastAddr<A>
impl<A: MappedAddress> MappedAddress for MulticastAddr<A>
Source§fn is_non_mapped(&self) -> bool
fn is_non_mapped(&self) -> bool
Source§impl<A: Ord> Ord for MulticastAddr<A>
impl<A: Ord> Ord for MulticastAddr<A>
Source§fn cmp(&self, other: &MulticastAddr<A>) -> Ordering
fn cmp(&self, other: &MulticastAddr<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 MulticastAddr<A>
impl<A: PartialEq> PartialEq for MulticastAddr<A>
Source§impl<A: PartialOrd> PartialOrd for MulticastAddr<A>
impl<A: PartialOrd> PartialOrd for MulticastAddr<A>
Source§impl<A: ScopeableAddress> ScopeableAddress for MulticastAddr<A>
impl<A: ScopeableAddress> ScopeableAddress for MulticastAddr<A>
Source§impl<A: SpecifiedAddress> SpecifiedAddress for MulticastAddr<A>
impl<A: SpecifiedAddress> SpecifiedAddress for MulticastAddr<A>
Source§fn is_specified(&self) -> bool
fn is_specified(&self) -> bool
Source§impl<A: MulticastAddress> TransposableWitness<A> for MulticastAddr<A>
impl<A: MulticastAddress> TransposableWitness<A> for MulticastAddr<A>
Source§type Map<T> = MulticastAddr<T>
type Map<T> = MulticastAddr<T>
Source§impl<A: BroadcastAddress + MulticastAddress> TryFrom<BroadcastAddr<A>> for MulticastAddr<A>
impl<A: BroadcastAddress + MulticastAddress> TryFrom<BroadcastAddr<A>> for MulticastAddr<A>
Source§impl<A: LinkLocalAddress + MulticastAddress> TryFrom<LinkLocalAddr<A>> for MulticastAddr<A>
impl<A: LinkLocalAddress + MulticastAddress> TryFrom<LinkLocalAddr<A>> for MulticastAddr<A>
Source§impl<A: LinkLocalBroadcastAddress + MulticastAddress> TryFrom<LinkLocalAddr<BroadcastAddr<A>>> for MulticastAddr<A>
impl<A: LinkLocalBroadcastAddress + MulticastAddress> TryFrom<LinkLocalAddr<BroadcastAddr<A>>> for MulticastAddr<A>
Source§impl<A: LinkLocalMulticastAddress + MulticastAddress> TryFrom<LinkLocalAddr<MulticastAddr<A>>> for MulticastAddr<A>
impl<A: LinkLocalMulticastAddress + MulticastAddress> TryFrom<LinkLocalAddr<MulticastAddr<A>>> for MulticastAddr<A>
Source§impl<A: LinkLocalUnicastAddress + MulticastAddress> TryFrom<LinkLocalAddr<UnicastAddr<A>>> for MulticastAddr<A>
impl<A: LinkLocalUnicastAddress + MulticastAddress> TryFrom<LinkLocalAddr<UnicastAddr<A>>> for MulticastAddr<A>
Source§impl<A: MulticastAddress + BroadcastAddress> TryFrom<MulticastAddr<A>> for BroadcastAddr<A>
impl<A: MulticastAddress + BroadcastAddress> TryFrom<MulticastAddr<A>> for BroadcastAddr<A>
Source§impl<A: MulticastAddress + LinkLocalAddress> TryFrom<MulticastAddr<A>> for LinkLocalAddr<A>
impl<A: MulticastAddress + LinkLocalAddress> TryFrom<MulticastAddr<A>> for LinkLocalAddr<A>
Source§impl<A: MulticastAddress + LinkLocalBroadcastAddress> TryFrom<MulticastAddr<A>> for LinkLocalBroadcastAddr<A>
impl<A: MulticastAddress + LinkLocalBroadcastAddress> TryFrom<MulticastAddr<A>> for LinkLocalBroadcastAddr<A>
Source§impl<A: MulticastAddress + LinkLocalUnicastAddress> TryFrom<MulticastAddr<A>> for LinkLocalUnicastAddr<A>
impl<A: MulticastAddress + LinkLocalUnicastAddress> TryFrom<MulticastAddr<A>> for LinkLocalUnicastAddr<A>
Source§impl<A: MulticastAddress + MappedAddress> TryFrom<MulticastAddr<A>> for NonMappedAddr<A>
impl<A: MulticastAddress + MappedAddress> TryFrom<MulticastAddr<A>> for NonMappedAddr<A>
Source§impl<A: MulticastAddress + UnicastAddress> TryFrom<MulticastAddr<A>> for UnicastAddr<A>
impl<A: MulticastAddress + UnicastAddress> TryFrom<MulticastAddr<A>> for UnicastAddr<A>
Source§impl<A: MappedAddress + MulticastAddress> TryFrom<NonMappedAddr<A>> for MulticastAddr<A>
impl<A: MappedAddress + MulticastAddress> TryFrom<NonMappedAddr<A>> for MulticastAddr<A>
Source§impl<A: SpecifiedAddress + MulticastAddress> TryFrom<SpecifiedAddr<A>> for MulticastAddr<A>
impl<A: SpecifiedAddress + MulticastAddress> TryFrom<SpecifiedAddr<A>> for MulticastAddr<A>
Source§impl<A: UnicastAddress + MulticastAddress> TryFrom<UnicastAddr<A>> for MulticastAddr<A>
impl<A: UnicastAddress + MulticastAddress> TryFrom<UnicastAddr<A>> for MulticastAddr<A>
Source§impl<A: UnicastAddress> UnicastAddress for MulticastAddr<A>
impl<A: UnicastAddress> UnicastAddress for MulticastAddr<A>
Source§fn is_unicast(&self) -> bool
fn is_unicast(&self) -> bool
Source§impl<A: MulticastAddress> Witness<A> for MulticastAddr<A>
impl<A: MulticastAddress> Witness<A> for MulticastAddr<A>
Source§unsafe fn new_unchecked(addr: A) -> MulticastAddr<A>
unsafe fn new_unchecked(addr: A) -> MulticastAddr<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: MulticastAddress + LinkLocalAddress> Witness<A> for MulticastAddr<LinkLocalAddr<A>>
impl<A: MulticastAddress + LinkLocalAddress> Witness<A> for MulticastAddr<LinkLocalAddr<A>>
Source§fn new(addr: A) -> Option<MulticastAddr<LinkLocalAddr<A>>>
fn new(addr: A) -> Option<MulticastAddr<LinkLocalAddr<A>>>
Source§unsafe fn new_unchecked(addr: A) -> MulticastAddr<LinkLocalAddr<A>>
unsafe fn new_unchecked(addr: A) -> MulticastAddr<LinkLocalAddr<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: MulticastAddress + MappedAddress> Witness<A> for MulticastAddr<NonMappedAddr<A>>
impl<A: MulticastAddress + MappedAddress> Witness<A> for MulticastAddr<NonMappedAddr<A>>
Source§fn new(addr: A) -> Option<MulticastAddr<NonMappedAddr<A>>>
fn new(addr: A) -> Option<MulticastAddr<NonMappedAddr<A>>>
Source§unsafe fn new_unchecked(addr: A) -> MulticastAddr<NonMappedAddr<A>>
unsafe fn new_unchecked(addr: A) -> MulticastAddr<NonMappedAddr<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>>,
impl<A: Copy> Copy for MulticastAddr<A>
impl<A: Eq> Eq for MulticastAddr<A>
impl<A> StructuralPartialEq for MulticastAddr<A>
Auto Trait Implementations§
impl<A> Freeze for MulticastAddr<A>where
A: Freeze,
impl<A> RefUnwindSafe for MulticastAddr<A>where
A: RefUnwindSafe,
impl<A> Send for MulticastAddr<A>where
A: Send,
impl<A> Sync for MulticastAddr<A>where
A: Sync,
impl<A> Unpin for MulticastAddr<A>where
A: Unpin,
impl<A> UnwindSafe for MulticastAddr<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)