pub enum PullStep<Item, Meta, CanPend: Toggle, CanEnd: Toggle> {
Ready(Item, Meta),
Pending(CanPend),
Ended(CanEnd),
}Expand description
The result of polling a Pull.
PullStep represents the three possible outcomes when pulling from a stream:
Ready(item, meta): An item is available along with associated metadata.Pending(can_pend): No item is available yet, but more may come (async).Ended(can_end): The stream has terminated and will produce no more items.
The CanPend and CanEnd type parameters use Toggle to statically encode
which variants are possible. When a variant is impossible (e.g., CanPend = No),
its payload type becomes No, making it a compile error to construct.
Variants§
Ready(Item, Meta)
An item is ready with associated metadata.
Pending(CanPend)
The pull is not ready yet (only possible when CanPend = Yes).
Ended(CanEnd)
The pull has ended (only possible when CanEnd = Yes).
Implementations§
Source§impl<Item, Meta, CanPend: Toggle, CanEnd: Toggle> PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend: Toggle, CanEnd: Toggle> PullStep<Item, Meta, CanPend, CanEnd>
Sourcepub const fn is_ready(&self) -> bool
pub const fn is_ready(&self) -> bool
Returns true if the step is a PullStep::Ready.
Sourcepub const fn is_pending(&self) -> bool
pub const fn is_pending(&self) -> bool
Returns true if the step is a PullStep::Pending.
Sourcepub const fn is_ended(&self) -> bool
pub const fn is_ended(&self) -> bool
Returns true if the step is a PullStep::Ended.
Sourcepub fn try_convert_into<NewPend: Toggle, NewEnd: Toggle>(
self,
) -> Option<PullStep<Item, Meta, NewPend, NewEnd>>
pub fn try_convert_into<NewPend: Toggle, NewEnd: Toggle>( self, ) -> Option<PullStep<Item, Meta, NewPend, NewEnd>>
Tries to convert the CanPend and CanEnd type parameters, returning None if the conversion is invalid.
Sourcepub fn convert_into<NewPend: Toggle, NewEnd: Toggle>(
self,
) -> PullStep<Item, Meta, NewPend, NewEnd>
pub fn convert_into<NewPend: Toggle, NewEnd: Toggle>( self, ) -> PullStep<Item, Meta, NewPend, NewEnd>
Converts the CanPend and CanEnd type parameters, panicking if the conversion is invalid.
Trait Implementations§
Source§impl<Item: Clone, Meta: Clone, CanPend: Clone + Toggle, CanEnd: Clone + Toggle> Clone for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Clone, Meta: Clone, CanPend: Clone + Toggle, CanEnd: Clone + Toggle> Clone for PullStep<Item, Meta, CanPend, CanEnd>
Source§impl<Item: Debug, Meta: Debug, CanPend: Debug + Toggle, CanEnd: Debug + Toggle> Debug for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Debug, Meta: Debug, CanPend: Debug + Toggle, CanEnd: Debug + Toggle> Debug for PullStep<Item, Meta, CanPend, CanEnd>
Source§impl<Item: Hash, Meta: Hash, CanPend: Hash + Toggle, CanEnd: Hash + Toggle> Hash for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Hash, Meta: Hash, CanPend: Hash + Toggle, CanEnd: Hash + Toggle> Hash for PullStep<Item, Meta, CanPend, CanEnd>
Source§impl<Item: Ord, Meta: Ord, CanPend: Ord + Toggle, CanEnd: Ord + Toggle> Ord for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Ord, Meta: Ord, CanPend: Ord + Toggle, CanEnd: Ord + Toggle> Ord for PullStep<Item, Meta, CanPend, CanEnd>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<Item: PartialEq, Meta: PartialEq, CanPend: PartialEq + Toggle, CanEnd: PartialEq + Toggle> PartialEq for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: PartialEq, Meta: PartialEq, CanPend: PartialEq + Toggle, CanEnd: PartialEq + Toggle> PartialEq for PullStep<Item, Meta, CanPend, CanEnd>
Source§impl<Item: PartialOrd, Meta: PartialOrd, CanPend: PartialOrd + Toggle, CanEnd: PartialOrd + Toggle> PartialOrd for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: PartialOrd, Meta: PartialOrd, CanPend: PartialOrd + Toggle, CanEnd: PartialOrd + Toggle> PartialOrd for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Copy, Meta: Copy, CanPend: Copy + Toggle, CanEnd: Copy + Toggle> Copy for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item: Eq, Meta: Eq, CanPend: Eq + Toggle, CanEnd: Eq + Toggle> Eq for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend: Toggle, CanEnd: Toggle> StructuralPartialEq for PullStep<Item, Meta, CanPend, CanEnd>
Auto Trait Implementations§
impl<Item, Meta, CanPend, CanEnd> Freeze for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> RefUnwindSafe for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> Send for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> Sync for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> Unpin for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> UnsafeUnpin for PullStep<Item, Meta, CanPend, CanEnd>
impl<Item, Meta, CanPend, CanEnd> UnwindSafe for PullStep<Item, Meta, CanPend, CanEnd>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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