pub trait PushVariadic<Item, Meta>: Variadic + Sealed<Item, Meta>where
Meta: Copy,{
type Ctx<'ctx>: Context<'ctx>;
type CanPend: Toggle;
// Required methods
fn poll_ready(
self: Pin<&mut Self>,
ctx: &mut Self::Ctx<'_>,
) -> PushStep<Self::CanPend>;
fn start_send(self: Pin<&mut Self>, idx: usize, item: Item, meta: Meta);
fn poll_flush(
self: Pin<&mut Self>,
ctx: &mut Self::Ctx<'_>,
) -> PushStep<Self::CanPend>;
fn size_hint(self: Pin<&mut Self>, hint: (usize, Option<usize>));
}variadics only.Expand description
A variadic of Pushes for use with DemuxVar.
This sealed trait is implemented recursively for variadic tuples (P, Rest)
where P: Push and Rest: PushVariadic, with the base case ().
The Ctx GAT is built by recursively merging each
push’s context type: for (P0, (P1, (P2, ()))), the merged context is
<P0::Ctx as Context>::Merged<<P1::Ctx as Context>::Merged<P2::Ctx>>.
The CanPend type is built by recursively OR-ing
each push’s CanPend via Toggle::Or.
Required Associated Types§
Sourcetype Ctx<'ctx>: Context<'ctx>
type Ctx<'ctx>: Context<'ctx>
The merged context type for all pushes in this variadic.
Built recursively via Context::Merged so that each downstream push’s
context can be extracted with Context::unmerge_self and
Context::unmerge_other.
Sourcetype CanPend: Toggle
type CanPend: Toggle
Whether any downstream push can return PushStep::Pending.
Built recursively via Toggle::Or: if any downstream push has
CanPend = Yes, then the variadic also has CanPend = Yes.
Required Methods§
Sourcefn poll_ready(
self: Pin<&mut Self>,
ctx: &mut Self::Ctx<'_>,
) -> PushStep<Self::CanPend>
fn poll_ready( self: Pin<&mut Self>, ctx: &mut Self::Ctx<'_>, ) -> PushStep<Self::CanPend>
Poll readiness of all downstream pushes.
Calls Push::poll_ready on each push, passing the appropriate
unmerged context slice. All pushes are polled even if one returns
pending, so that all wakers are registered.
Sourcefn start_send(self: Pin<&mut Self>, idx: usize, item: Item, meta: Meta)
fn start_send(self: Pin<&mut Self>, idx: usize, item: Item, meta: Meta)
Send an item to the push at index idx.
§Panics
Panics if idx is out of bounds (greater than or equal to the number of pushes).
Sourcefn poll_flush(
self: Pin<&mut Self>,
ctx: &mut Self::Ctx<'_>,
) -> PushStep<Self::CanPend>
fn poll_flush( self: Pin<&mut Self>, ctx: &mut Self::Ctx<'_>, ) -> PushStep<Self::CanPend>
Flush all downstream pushes.
Calls Push::poll_flush on each push, passing the appropriate
unmerged context slice. All pushes are flushed even if one returns
pending, so that all wakers are registered.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<Item, Meta> PushVariadic<Item, Meta> for ()where
Meta: Copy,
Base case: the empty variadic. Always ready, panics on send.
impl<Item, Meta> PushVariadic<Item, Meta> for ()where
Meta: Copy,
Base case: the empty variadic. Always ready, panics on send.
type Ctx<'ctx> = ()
type CanPend = Infallible
fn poll_ready(self: Pin<&mut Self>, _ctx: &mut Self::Ctx<'_>) -> PushStep<No>
fn start_send(self: Pin<&mut Self>, idx: usize, _item: Item, _meta: Meta)
fn poll_flush(self: Pin<&mut Self>, _ctx: &mut Self::Ctx<'_>) -> PushStep<No>
fn size_hint(self: Pin<&mut Self>, _hint: (usize, Option<usize>))
Source§impl<P, Item, Meta: Copy, Rest> PushVariadic<Item, Meta> for (P, Rest)where
P: Push<Item, Meta>,
Rest: PushVariadic<Item, Meta>,
Recursive case: a push P followed by the rest of the variadic Rest.
impl<P, Item, Meta: Copy, Rest> PushVariadic<Item, Meta> for (P, Rest)where
P: Push<Item, Meta>,
Rest: PushVariadic<Item, Meta>,
Recursive case: a push P followed by the rest of the variadic Rest.