pub enum ZonedAddr<A, Z> {
Unzoned(A),
Zoned(AddrAndZone<A, Z>),
}
Expand description
An address that may have an associated scope zone.
Variants§
Unzoned(A)
Zoned(AddrAndZone<A, Z>)
Implementations§
Source§impl<A, Z> ZonedAddr<A, Z>
impl<A, Z> ZonedAddr<A, Z>
Sourcepub fn into_addr_zone(self) -> (A, Option<Z>)
pub fn into_addr_zone(self) -> (A, Option<Z>)
Decomposes this ZonedAddr
into an addr and an optional scope zone.
Sourcepub fn map_zone<Y>(self, f: impl FnOnce(Z) -> Y) -> ZonedAddr<A, Y>
pub fn map_zone<Y>(self, f: impl FnOnce(Z) -> Y) -> ZonedAddr<A, Y>
Translates the zone identifier using the provided function.
Source§impl<A: ScopeableAddress, Z> ZonedAddr<A, Z>
impl<A: ScopeableAddress, Z> ZonedAddr<A, Z>
Sourcepub fn new(addr: A, zone: Option<Z>) -> Option<Self>
pub fn new(addr: A, zone: Option<Z>) -> Option<Self>
Creates a new ZonedAddr
with the provided optional scope zone.
If zone
is None
, ZonedAddr::Unzoned
is returned. Otherwise, a
ZonedAddr::Zoned
is returned only if the provided addr
’s scope can
have a zone (addr.scope().can_have_zone()
).
Source§impl<A: IpAddress + ScopeableAddress, Z: Clone> ZonedAddr<A, Z>
impl<A: IpAddress + ScopeableAddress, Z: Clone> ZonedAddr<A, Z>
Sourcepub fn new_zoned_if_necessary(addr: A, get_zone: impl FnOnce() -> Z) -> Self
pub fn new_zoned_if_necessary(addr: A, get_zone: impl FnOnce() -> Z) -> Self
Creates a ZonedAddr::Zoned
iff addr
can have a zone and is not
loopback.
get_zone
is only called if the address needs a zone.
Source§impl<A: ScopeableAddress<Scope = ()>, Z> ZonedAddr<A, Z>
impl<A: ScopeableAddress<Scope = ()>, Z> ZonedAddr<A, Z>
Sourcepub fn into_unzoned(self) -> A
pub fn into_unzoned(self) -> A
Retrieves the addr for this ZonedAddr
when the Scope
is ()
.
()
is a known implementation that never allows AddrAndZone
to be
constructed so we can safely drop the zone information.
Trait Implementations§
Source§impl<A, Z> From<AddrAndZone<A, Z>> for ZonedAddr<A, Z>
impl<A, Z> From<AddrAndZone<A, Z>> for ZonedAddr<A, Z>
Source§fn from(a: AddrAndZone<A, Z>) -> Self
fn from(a: AddrAndZone<A, Z>) -> Self
Converts to this type from the input type.
Source§impl<A: SpecifiedAddress, Z> From<ZonedAddr<SpecifiedAddr<A>, Z>> for ZonedAddr<A, Z>
impl<A: SpecifiedAddress, Z> From<ZonedAddr<SpecifiedAddr<A>, Z>> for ZonedAddr<A, Z>
Source§fn from(zoned_addr: ZonedAddr<SpecifiedAddr<A>, Z>) -> Self
fn from(zoned_addr: ZonedAddr<SpecifiedAddr<A>, Z>) -> Self
Converts to this type from the input type.
Source§impl<A: GenericOverIp<I>, I: Ip, Z> GenericOverIp<I> for ZonedAddr<A, Z>
impl<A: GenericOverIp<I>, I: Ip, Z> GenericOverIp<I> for ZonedAddr<A, Z>
impl<A: Copy, Z: Copy> Copy for ZonedAddr<A, Z>
impl<A: Eq, Z: Eq> Eq for ZonedAddr<A, Z>
impl<A, Z> StructuralPartialEq for ZonedAddr<A, Z>
Auto Trait Implementations§
impl<A, Z> Freeze for ZonedAddr<A, Z>
impl<A, Z> RefUnwindSafe for ZonedAddr<A, Z>where
A: RefUnwindSafe,
Z: RefUnwindSafe,
impl<A, Z> Send for ZonedAddr<A, Z>
impl<A, Z> Sync for ZonedAddr<A, Z>
impl<A, Z> Unpin for ZonedAddr<A, Z>
impl<A, Z> UnwindSafe for ZonedAddr<A, Z>where
A: UnwindSafe,
Z: 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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)