net_types

Struct SpecifiedAddr

Source
pub struct SpecifiedAddr<A>(/* private fields */);
Expand description

An address which is guaranteed to be specified.

SpecifiedAddr wraps an address of type A and guarantees that it is a specified address. Note that this guarantee is contingent on a correct implementation of the SpecifiedAddress trait. Since that trait is not unsafe, unsafe code may NOT rely on this guarantee for its soundness.

Implementations§

Source§

impl<A: SpecifiedAddress> SpecifiedAddr<A>

Source

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

Constructs a new SpecifiedAddr.

new returns None if !addr.is_specified().

Source

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

Constructs a new SpecifiedAddr from a witness type.

from_witness(witness) is equivalent to new(witness.into_addr()).

Source§

impl<A> SpecifiedAddr<A>

Source

pub const unsafe fn new_unchecked(addr: A) -> SpecifiedAddr<A>

Constructs a new SpecifiedAddr without checking to see if addr is actually specified.

§Safety

It is up to the caller to make sure that addr is specified to avoid breaking the guarantees of SpecifiedAddr. See SpecifiedAddr for more details.

Trait Implementations§

Source§

impl<A: SpecifiedAddress> AsRef<A> for SpecifiedAddr<A>

Source§

fn as_ref(&self) -> &A

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

impl<A: SpecifiedAddress> AsRef<SpecifiedAddr<A>> for SpecifiedAddr<A>

Source§

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

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

impl<A: BroadcastAddress> BroadcastAddress for SpecifiedAddr<A>

Source§

fn is_broadcast(&self) -> bool

Is this a broadcast address? Read more
Source§

impl<A: Clone> Clone for SpecifiedAddr<A>

Source§

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

Source§

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

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

impl<A: SpecifiedAddress> Deref for SpecifiedAddr<A>

Source§

type Target = A

The resulting type after dereferencing.
Source§

fn deref(&self) -> &A

Dereferences the value.
Source§

impl<A: Display> Display for SpecifiedAddr<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<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 From<IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>> for SpecifiedAddr<IpAddr>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<A: LinkLocalAddress + MappedAddress + SpecifiedAddress> From<LinkLocalAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

impl<A: LinkLocalAddress + UnicastAddress + SpecifiedAddress> From<LinkLocalAddr<UnicastAddr<A>>> for SpecifiedAddr<A>

Source§

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

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

Source§

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

Converts to this type from the input type.
Source§

impl<A: MappedAddress + LinkLocalAddress + SpecifiedAddress> From<NonMappedAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<A: MappedAddress + UnicastAddress + SpecifiedAddress> From<NonMappedAddr<UnicastAddr<A>>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<A: Into<Ipv4Addr> + SpecifiedAddress + Copy> From<SpecifiedAddr<A>> for Ipv4Addr

Source§

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

Converts to this type from the input type.
Source§

impl<A: Into<Ipv6Addr> + SpecifiedAddress + Copy> From<SpecifiedAddr<A>> for Ipv6Addr

Source§

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

Converts to this type from the input type.
Source§

impl<A: IpAddress> From<SpecifiedAddr<A>> for SpecifiedAddr<IpAddr>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<A: UnicastAddress + SpecifiedAddress> From<UnicastAddr<A>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

impl<A: UnicastAddress + LinkLocalAddress + SpecifiedAddress> From<UnicastAddr<LinkLocalAddr<A>>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

impl<A: UnicastAddress + MappedAddress + SpecifiedAddress> From<UnicastAddr<NonMappedAddr<A>>> for SpecifiedAddr<A>

Source§

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

Converts to this type from the input type.
Source§

impl<A, I: Ip> GenericOverIp<I> for SpecifiedAddr<A>

Source§

type Type = SpecifiedAddr<<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 SpecifiedAddr<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 SpecifiedAddr<IpAddr>

Source§

type V4 = SpecifiedAddr<Ipv4Addr>

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

type V6 = SpecifiedAddr<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 SpecifiedAddr<A>

Source§

type IpAddrWitness = SpecifiedAddr<IpAddr>

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

impl<A: LinkLocalAddress> LinkLocalAddress for SpecifiedAddr<A>

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

impl<A: MappedAddress> MappedAddress for SpecifiedAddr<A>

Source§

fn is_non_mapped(&self) -> bool

Is this a non-mapped address?
Source§

impl<A: MulticastAddress> MulticastAddress for SpecifiedAddr<A>

Source§

fn is_multicast(&self) -> bool

Is this a multicast address? Read more
Source§

fn is_non_multicast(&self) -> bool

Is this a non-multicast address? The inverse of is_multicast().
Source§

impl<A: Ord> Ord for SpecifiedAddr<A>

Source§

fn cmp(&self, other: &SpecifiedAddr<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 SpecifiedAddr<A>

Source§

fn eq(&self, other: &SpecifiedAddr<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 SpecifiedAddr<A>

Source§

fn partial_cmp(&self, other: &SpecifiedAddr<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 SpecifiedAddr<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> TransposableWitness<A> for SpecifiedAddr<A>

Source§

type Map<T> = SpecifiedAddr<T>

Maps the type wrapped by this witness.
Source§

impl TryFrom<Ipv4Addr> for SpecifiedAddr<Ipv4Addr>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl TryFrom<Ipv6Addr> for SpecifiedAddr<Ipv6Addr>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: MappedAddress + SpecifiedAddress> TryFrom<NonMappedAddr<A>> for SpecifiedAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

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

Source§

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: SpecifiedAddress + LinkLocalAddress> TryFrom<SpecifiedAddr<A>> for LinkLocalAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: SpecifiedAddress + LinkLocalBroadcastAddress> TryFrom<SpecifiedAddr<A>> for LinkLocalBroadcastAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: SpecifiedAddress + LinkLocalMulticastAddress> TryFrom<SpecifiedAddr<A>> for LinkLocalMulticastAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: SpecifiedAddress + LinkLocalUnicastAddress> TryFrom<SpecifiedAddr<A>> for LinkLocalUnicastAddr<A>

Source§

type Error = ()

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

fn try_from(addr: SpecifiedAddr<A>) -> Result<LinkLocalUnicastAddr<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: SpecifiedAddress + MappedAddress> TryFrom<SpecifiedAddr<A>> for NonMappedAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: SpecifiedAddress + UnicastAddress> TryFrom<SpecifiedAddr<A>> for UnicastAddr<A>

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl<A: UnicastAddress> UnicastAddress for SpecifiedAddr<A>

Source§

fn is_unicast(&self) -> bool

Is this a unicast address? Read more
Source§

impl<A: SpecifiedAddress> Witness<A> for SpecifiedAddr<A>

Source§

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

Constructs a new witness type. Read more
Source§

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

Source§

impl<A: Eq> Eq for SpecifiedAddr<A>

Source§

impl<A> StructuralPartialEq for SpecifiedAddr<A>

Auto Trait Implementations§

§

impl<A> Freeze for SpecifiedAddr<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for SpecifiedAddr<A>
where A: RefUnwindSafe,

§

impl<A> Send for SpecifiedAddr<A>
where A: Send,

§

impl<A> Sync for SpecifiedAddr<A>
where A: Sync,

§

impl<A> Unpin for SpecifiedAddr<A>
where A: Unpin,

§

impl<A> UnwindSafe for SpecifiedAddr<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> LinkLocalMulticastAddress for A

Source§

impl<A> LinkLocalUnicastAddress for A