pub enum MaybeDualStack<DS, NDS> {
DualStack(DS),
NotDualStack(NDS),
}
Expand description
Control flow type containing either a dual-stack or non-dual-stack context.
This type exists to provide nice names to the result of
[BoundStateContext::dual_stack_context
], and to allow generic code to
match on when checking whether a socket protocol and IP version support
dual-stack operation. If dual-stack operation is supported, a
MaybeDualStack::DualStack
value will be held, otherwise a NonDualStack
value.
Note that the templated types to not have trait bounds; those are provided
by the trait with the dual_stack_context
function.
In monomorphized code, this type frequently has exactly one template
parameter that is uninstantiable (it contains an instance of
core::convert::Infallible
or some other empty enum, or a reference to
the same)! That lets the compiler optimize it out completely, creating no
actual runtime overhead.
Variants§
Trait Implementations§
Source§impl<I: DualStackIpExt, DS: GenericOverIp<I>, NDS: GenericOverIp<I>> GenericOverIp<I> for MaybeDualStack<DS, NDS>
impl<I: DualStackIpExt, DS: GenericOverIp<I>, NDS: GenericOverIp<I>> GenericOverIp<I> for MaybeDualStack<DS, NDS>
Source§type Type = MaybeDualStack<<DS as GenericOverIp<I>>::Type, <NDS as GenericOverIp<I>>::Type>
type Type = MaybeDualStack<<DS as GenericOverIp<I>>::Type, <NDS as GenericOverIp<I>>::Type>
Self
when its IP-generic parameter is replaced with the
type NewIp
.Auto Trait Implementations§
impl<DS, NDS> Freeze for MaybeDualStack<DS, NDS>
impl<DS, NDS> RefUnwindSafe for MaybeDualStack<DS, NDS>where
DS: RefUnwindSafe,
NDS: RefUnwindSafe,
impl<DS, NDS> Send for MaybeDualStack<DS, NDS>
impl<DS, NDS> Sync for MaybeDualStack<DS, NDS>
impl<DS, NDS> Unpin for MaybeDualStack<DS, NDS>
impl<DS, NDS> UnwindSafe for MaybeDualStack<DS, NDS>where
DS: UnwindSafe,
NDS: 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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more