net_types

Struct MulticastAddr

Source
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>

Source

pub fn new(addr: A) -> Option<MulticastAddr<A>>

Constructs a new MulticastAddr.

new returns None if !addr.is_multicast().

Source

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>

Source

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>

Source

pub fn into_specified(self) -> SpecifiedAddr<A>

Converts this MulticastAddr into a SpecifiedAddr.

MulticastAddress::is_multicast implies SpecifiedAddress::is_specified, so all MulticastAddrs are guaranteed to be specified, so this conversion is infallible.

Source§

impl<A: MulticastAddress + MappedAddress> MulticastAddr<A>

Source

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>

Source§

fn as_ref(&self) -> &A

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: MulticastAddress + LinkLocalAddress> AsRef<A> for MulticastAddr<LinkLocalAddr<A>>

Source§

fn as_ref(&self) -> &A

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: MulticastAddress + MappedAddress> AsRef<A> for MulticastAddr<NonMappedAddr<A>>

Source§

fn as_ref(&self) -> &A

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: MulticastAddress> AsRef<MulticastAddr<A>> for MulticastAddr<A>

Source§

fn as_ref(&self) -> &MulticastAddr<A>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: BroadcastAddress> BroadcastAddress for MulticastAddr<A>

Source§

fn is_broadcast(&self) -> bool

Is this a broadcast address? Read more
Source§

impl<A: Clone> Clone for MulticastAddr<A>

Source§

fn clone(&self) -> MulticastAddr<A>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug> Debug for MulticastAddr<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: MulticastAddress> Deref for MulticastAddr<A>

Source§

type Target = A

The resulting type after dereferencing.
Source§

fn deref(&self) -> &A

Dereferences the value.
Source§

impl<A: Display> Display for MulticastAddr<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, A: IpAddress> From<&'a MulticastAddr<A>> for Mac

Source§

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>

Source§

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>

Source§

fn from( addr: IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>, ) -> MulticastAddr<IpAddr>

Converts to this type from the input type.
Source§

impl<A: IpAddress> From<MulticastAddr<A>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>

Source§

fn from( addr: MulticastAddr<A>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>

Converts to this type from the input type.
Source§

impl<A: Into<Ipv4Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv4Addr

Source§

fn from(addr: MulticastAddr<A>) -> Ipv4Addr

Converts to this type from the input type.
Source§

impl<A: Into<Ipv6Addr> + MulticastAddress + Copy> From<MulticastAddr<A>> for Ipv6Addr

Source§

fn from(addr: MulticastAddr<A>) -> Ipv6Addr

Converts to this type from the input type.
Source§

impl<A: IpAddress> From<MulticastAddr<A>> for Mac

Source§

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>

Source§

fn from(addr: MulticastAddr<A>) -> MulticastAddr<IpAddr>

Converts to this type from the input type.
Source§

impl<A: IpAddress> From<MulticastAddr<A>> for MulticastAddr<Mac>

Source§

fn from(addr: MulticastAddr<A>) -> MulticastAddr<Mac>

Converts to this type from the input type.
Source§

impl<A: MulticastAddress + SpecifiedAddress> From<MulticastAddr<A>> for SpecifiedAddr<A>

Source§

fn from(addr: MulticastAddr<A>) -> SpecifiedAddr<A>

Converts to this type from the input type.
Source§

impl From<MulticastAddr<IpAddr>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>

Source§

fn from( addr: MulticastAddr<IpAddr>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>

Converts to this type from the input type.
Source§

impl From<MulticastAddr<Ipv6Addr>> for UnicastOrMulticastIpv6Addr

Source§

fn from(addr: MulticastAddr<Ipv6Addr>) -> UnicastOrMulticastIpv6Addr

Converts to this type from the input type.
Source§

impl<A: MulticastAddress + LinkLocalAddress + SpecifiedAddress> From<MulticastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>

Source§

fn from(addr: MulticastAddr<LinkLocalAddr<A>>) -> SpecifiedAddr<A>

Converts to this type from the input type.
Source§

impl From<MulticastAddr<Mac>> for Mac

Source§

fn from(addr: MulticastAddr<Mac>) -> Mac

Converts to this type from the input type.
Source§

impl<A: MulticastAddress + MappedAddress + SpecifiedAddress> From<MulticastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>

Source§

fn from(addr: MulticastAddr<NonMappedAddr<A>>) -> SpecifiedAddr<A>

Converts to this type from the input type.
Source§

impl<A: IpAddress, I: Ip> GenericOverIp<I> for MulticastAddr<A>

Source§

type Type = MulticastAddr<<I as Ip>::Addr>

The type of Self when its IP-generic parameter is replaced with the type NewIp.
Source§

impl<A: Hash> Hash for MulticastAddr<A>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IpAddrWitness for MulticastAddr<IpAddr>

Source§

type V4 = MulticastAddr<Ipv4Addr>

The IPv4-specific version of Self. Read more
Source§

type V6 = MulticastAddr<Ipv6Addr>

The IPv6-specific version of Self. Read more
Source§

fn from_v4(addr: Self::V4) -> Self

Converts an IPv4-specific witness into a general witness.
Source§

fn from_v6(addr: Self::V6) -> Self

Converts an IPv6-specific witness into a general witness.
Source§

impl<A: IpAddress> IpAddressWitness<A> for MulticastAddr<A>

Source§

type IpAddrWitness = MulticastAddr<IpAddr>

The type-erased version of Self. Read more
Source§

impl<A: LinkLocalAddress> LinkLocalAddress for MulticastAddr<A>

Is this a link-local address? Read more
Source§

impl<A: MappedAddress> MappedAddress for MulticastAddr<A>

Source§

fn is_non_mapped(&self) -> bool

Is this a non-mapped address?
Source§

impl<A: Ord> Ord for MulticastAddr<A>

Source§

fn cmp(&self, other: &MulticastAddr<A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<A: PartialEq> PartialEq for MulticastAddr<A>

Source§

fn eq(&self, other: &MulticastAddr<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: PartialOrd> PartialOrd for MulticastAddr<A>

Source§

fn partial_cmp(&self, other: &MulticastAddr<A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<A: ScopeableAddress> ScopeableAddress for MulticastAddr<A>

Source§

type Scope = <A as ScopeableAddress>::Scope

The type of all non-global scopes.
Source§

fn scope(&self) -> Self::Scope

The scope of this address. Read more
Source§

impl<A: SpecifiedAddress> SpecifiedAddress for MulticastAddr<A>

Source§

fn is_specified(&self) -> bool

Is this a specified address? Read more
Source§

impl<A: MulticastAddress> TransposableWitness<A> for MulticastAddr<A>

Source§

type Map<T> = MulticastAddr<T>

Maps the type wrapped by this witness.
Source§

impl<A: BroadcastAddress + MulticastAddress> TryFrom<BroadcastAddr<A>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: BroadcastAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl TryFrom<Ipv4Addr> for MulticastAddr<Ipv4Addr>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: Ipv4Addr) -> Result<MulticastAddr<Ipv4Addr>, ()>

Performs the conversion.
Source§

impl TryFrom<Ipv6Addr> for MulticastAddr<Ipv6Addr>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: Ipv6Addr) -> Result<MulticastAddr<Ipv6Addr>, ()>

Performs the conversion.
Source§

impl<A: LinkLocalAddress + MulticastAddress> TryFrom<LinkLocalAddr<A>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: LinkLocalAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: LinkLocalBroadcastAddress + MulticastAddress> TryFrom<LinkLocalAddr<BroadcastAddr<A>>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: LinkLocalBroadcastAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: LinkLocalMulticastAddress + MulticastAddress> TryFrom<LinkLocalAddr<MulticastAddr<A>>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: LinkLocalMulticastAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: LinkLocalUnicastAddress + MulticastAddress> TryFrom<LinkLocalAddr<UnicastAddr<A>>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: LinkLocalUnicastAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + BroadcastAddress> TryFrom<MulticastAddr<A>> for BroadcastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<BroadcastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + LinkLocalAddress> TryFrom<MulticastAddr<A>> for LinkLocalAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<LinkLocalAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + LinkLocalBroadcastAddress> TryFrom<MulticastAddr<A>> for LinkLocalBroadcastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<LinkLocalBroadcastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + LinkLocalUnicastAddress> TryFrom<MulticastAddr<A>> for LinkLocalUnicastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<LinkLocalUnicastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + MappedAddress> TryFrom<MulticastAddr<A>> for NonMappedAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<NonMappedAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MulticastAddress + UnicastAddress> TryFrom<MulticastAddr<A>> for UnicastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: MulticastAddr<A>) -> Result<UnicastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: MappedAddress + MulticastAddress> TryFrom<NonMappedAddr<A>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: NonMappedAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: SpecifiedAddress + MulticastAddress> TryFrom<SpecifiedAddr<A>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: SpecifiedAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: UnicastAddress + MulticastAddress> TryFrom<UnicastAddr<A>> for MulticastAddr<A>

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(addr: UnicastAddr<A>) -> Result<MulticastAddr<A>, ()>

Performs the conversion.
Source§

impl<A: UnicastAddress> UnicastAddress for MulticastAddr<A>

Source§

fn is_unicast(&self) -> bool

Is this a unicast address? Read more
Source§

impl<A: MulticastAddress> Witness<A> for MulticastAddr<A>

Source§

fn new(addr: A) -> Option<MulticastAddr<A>>

Constructs a new witness type. Read more
Source§

unsafe fn new_unchecked(addr: A) -> MulticastAddr<A>

Constructs a new witness type without checking to see if addr actually satisfies the required property. Read more
Source§

fn into_addr(self) -> A

Consumes this witness and returns the contained A. Read more
Source§

fn from_witness<W: Witness<A>>(addr: W) -> Option<Self>

Constructs a new witness type from an existing witness type. Read more
Source§

fn get(&self) -> A
where A: Copy,

Gets a copy of the address.
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>>,

Transposes this witness type with another witness type layered inside of it. (e.g. UnicastAddr<SpecifiedAddr> -> SpecifiedAddr<UnicastAddr>)
Source§

impl<A: MulticastAddress + LinkLocalAddress> Witness<A> for MulticastAddr<LinkLocalAddr<A>>

Source§

fn new(addr: A) -> Option<MulticastAddr<LinkLocalAddr<A>>>

Constructs a new witness type. Read more
Source§

unsafe fn new_unchecked(addr: A) -> MulticastAddr<LinkLocalAddr<A>>

Constructs a new witness type without checking to see if addr actually satisfies the required property. Read more
Source§

fn into_addr(self) -> A

Consumes this witness and returns the contained A. Read more
Source§

fn from_witness<W: Witness<A>>(addr: W) -> Option<Self>

Constructs a new witness type from an existing witness type. Read more
Source§

fn get(&self) -> A
where A: Copy,

Gets a copy of the address.
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>>,

Transposes this witness type with another witness type layered inside of it. (e.g. UnicastAddr<SpecifiedAddr> -> SpecifiedAddr<UnicastAddr>)
Source§

impl<A: MulticastAddress + MappedAddress> Witness<A> for MulticastAddr<NonMappedAddr<A>>

Source§

fn new(addr: A) -> Option<MulticastAddr<NonMappedAddr<A>>>

Constructs a new witness type. Read more
Source§

unsafe fn new_unchecked(addr: A) -> MulticastAddr<NonMappedAddr<A>>

Constructs a new witness type without checking to see if addr actually satisfies the required property. Read more
Source§

fn into_addr(self) -> A

Consumes this witness and returns the contained A. Read more
Source§

fn from_witness<W: Witness<A>>(addr: W) -> Option<Self>

Constructs a new witness type from an existing witness type. Read more
Source§

fn get(&self) -> A
where A: Copy,

Gets a copy of the address.
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>>,

Transposes this witness type with another witness type layered inside of it. (e.g. UnicastAddr<SpecifiedAddr> -> SpecifiedAddr<UnicastAddr>)
Source§

impl<A: Copy> Copy for MulticastAddr<A>

Source§

impl<A: Eq> Eq for MulticastAddr<A>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<A> LinkLocalBroadcastAddress for A

Source§

impl<A> LinkLocalUnicastAddress for A