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>

source

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

Constructs a new BroadcastAddr.

new returns None if !addr.is_broadcast().

source

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>

source

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>

source

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

Converts this BroadcastAddr into a SpecifiedAddr.

BroadcastAddress::is_broadcast implies SpecifiedAddress::is_specified, so all BroadcastAddrs are guaranteed to be specified, so this conversion is infallible.

source§

impl<A: BroadcastAddress + LinkLocalAddress> BroadcastAddr<LinkLocalAddr<A>>

Constructs a new BroadcastAddr<LinkLocalAddr<A>>.

new_link_local(addr) is equivalent to LinkLocalAddr::new(addr).and_then(BroadcastAddr::new)).

source§

impl<A: BroadcastAddress + MappedAddress> BroadcastAddr<NonMappedAddr<A>>

source

pub fn new_non_mapped(addr: A) -> Option<BroadcastAddr<NonMappedAddr<A>>>

Constructs a new BroadcastAddr<NonMappedAddr<A>>.

new_non_mapped(addr) is equivalent to NonMappedAddr::new(addr).and_then(BroadcastAddr::new)).

Trait Implementations§

source§

impl<A: BroadcastAddress> AsRef<A> for BroadcastAddr<A>

source§

fn as_ref(&self) -> &A

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

impl<A: BroadcastAddress + LinkLocalAddress> AsRef<A> for BroadcastAddr<LinkLocalAddr<A>>

source§

fn as_ref(&self) -> &A

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

impl<A: BroadcastAddress + MappedAddress> AsRef<A> for BroadcastAddr<NonMappedAddr<A>>

source§

fn as_ref(&self) -> &A

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

impl<A: BroadcastAddress> AsRef<BroadcastAddr<A>> for BroadcastAddr<A>

source§

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

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

impl<A: Clone> Clone for BroadcastAddr<A>

source§

fn clone(&self) -> BroadcastAddr<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 BroadcastAddr<A>

source§

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

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

impl<A: BroadcastAddress> Deref for BroadcastAddr<A>

§

type Target = A

The resulting type after dereferencing.
source§

fn deref(&self) -> &A

Dereferences the value.
source§

impl<A: Display> Display for BroadcastAddr<A>

source§

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

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

impl<A: BroadcastAddress + SpecifiedAddress> From<BroadcastAddr<A>> for SpecifiedAddr<A>

source§

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

Converts to this type from the input type.
source§

impl<A: BroadcastAddress + LinkLocalAddress + SpecifiedAddress> From<BroadcastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>

source§

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

Converts to this type from the input type.
source§

impl From<BroadcastAddr<Mac>> for Mac

source§

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

Converts to this type from the input type.
source§

impl<A: BroadcastAddress + MappedAddress + SpecifiedAddress> From<BroadcastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>

source§

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

Converts to this type from the input type.
source§

impl<A: Hash> Hash for BroadcastAddr<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<A: LinkLocalAddress> LinkLocalAddress for BroadcastAddr<A>

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

impl<A: MappedAddress> MappedAddress for BroadcastAddr<A>

source§

fn is_non_mapped(&self) -> bool

Is this a non-mapped address?
source§

impl<A: MulticastAddress> MulticastAddress for BroadcastAddr<A>

source§

fn is_multicast(&self) -> bool

Is this a unicast address? Read more
source§

impl<A: Ord> Ord for BroadcastAddr<A>

source§

fn cmp(&self, other: &BroadcastAddr<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 + PartialOrd,

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

impl<A: PartialEq> PartialEq for BroadcastAddr<A>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A: PartialOrd> PartialOrd for BroadcastAddr<A>

source§

fn partial_cmp(&self, other: &BroadcastAddr<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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<A: ScopeableAddress> ScopeableAddress for BroadcastAddr<A>

§

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 BroadcastAddr<A>

source§

fn is_specified(&self) -> bool

Is this a specified address? Read more
source§

impl<A: BroadcastAddress> TransposableWitness<A> for BroadcastAddr<A>

§

type Map<T> = BroadcastAddr<T>

Maps the type wrapped by this witness.
source§

impl<A: BroadcastAddress + LinkLocalAddress> TryFrom<BroadcastAddr<A>> for BroadcastAddr<LinkLocalAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + MappedAddress> TryFrom<BroadcastAddr<A>> for BroadcastAddr<NonMappedAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + LinkLocalAddress> TryFrom<BroadcastAddr<A>> for LinkLocalAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: LinkLocalAddress + BroadcastAddress> TryFrom<BroadcastAddr<A>> for LinkLocalAddr<BroadcastAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + LinkLocalMulticastAddress> TryFrom<BroadcastAddr<A>> for LinkLocalMulticastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + LinkLocalUnicastAddress> TryFrom<BroadcastAddr<A>> for LinkLocalUnicastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

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

§

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<A: BroadcastAddress + MappedAddress> TryFrom<BroadcastAddr<A>> for NonMappedAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: MappedAddress + BroadcastAddress> TryFrom<BroadcastAddr<A>> for NonMappedAddr<BroadcastAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + UnicastAddress> TryFrom<BroadcastAddr<A>> for UnicastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: LinkLocalAddress + BroadcastAddress> TryFrom<LinkLocalAddr<A>> for BroadcastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + LinkLocalAddress> TryFrom<LinkLocalAddr<A>> for BroadcastAddr<LinkLocalAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

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

§

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: MappedAddress + BroadcastAddress> TryFrom<NonMappedAddr<A>> for BroadcastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: BroadcastAddress + MappedAddress> TryFrom<NonMappedAddr<A>> for BroadcastAddr<NonMappedAddr<A>>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: SpecifiedAddress + BroadcastAddress> TryFrom<SpecifiedAddr<A>> for BroadcastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: UnicastAddress + BroadcastAddress> TryFrom<UnicastAddr<A>> for BroadcastAddr<A>

§

type Error = ()

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

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

Performs the conversion.
source§

impl<A: UnicastAddress> UnicastAddress for BroadcastAddr<A>

source§

fn is_unicast(&self) -> bool

Is this a unicast address? Read more
source§

impl<A: BroadcastAddress> Witness<A> for BroadcastAddr<A>

source§

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

Constructs a new witness type. Read more
source§

unsafe fn new_unchecked(addr: A) -> BroadcastAddr<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 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: BroadcastAddress + LinkLocalAddress> Witness<A> for BroadcastAddr<LinkLocalAddr<A>>

source§

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

Constructs a new witness type. Read more
source§

unsafe fn new_unchecked(addr: A) -> BroadcastAddr<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§

impl<A: BroadcastAddress + MappedAddress> Witness<A> for BroadcastAddr<NonMappedAddr<A>>

source§

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

Constructs a new witness type. Read more
source§

unsafe fn new_unchecked(addr: A) -> BroadcastAddr<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§

impl<A: Copy> Copy for BroadcastAddr<A>

source§

impl<A: Eq> Eq for BroadcastAddr<A>

source§

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> 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> 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<T> ToOwned for T
where T: Clone,

§

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

§

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

§

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> LinkLocalMulticastAddress for A

source§

impl<A> LinkLocalUnicastAddress for A