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
.