Skip to main content

StreamMap

Struct StreamMap 

Source
pub struct StreamMap<ID, O> { /* private fields */ }
Expand description

Represents a map of Streams.

Each stream must finish within the specified time and the map never outgrows its capacity.

Implementations§

Source§

impl<ID, O> StreamMap<ID, O>
where ID: Clone + Unpin,

Source

pub fn new( make_delay: impl Fn() -> Delay + Send + Sync + 'static, capacity: usize, ) -> Self

Source§

impl<ID, O> StreamMap<ID, O>
where ID: Clone + PartialEq + Send + Unpin + 'static, O: Send + 'static,

Source

pub fn try_push<F>( &mut self, id: ID, stream: F, ) -> Result<(), PushError<Pin<Box<dyn AnyStream<Item = O> + Send>>>>
where F: AnyStream<Item = O>,

Push a stream into the map.

Source

pub fn remove( &mut self, id: ID, ) -> Option<Pin<Box<dyn AnyStream<Item = O> + Send>>>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn poll_ready_unpin(&mut self, cx: &mut Context<'_>) -> Poll<()>

Source

pub fn poll_next_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<(ID, Option<Result<O, Timeout>>)>

Source

pub fn iter_of_type<T>(&self) -> impl Iterator<Item = (&ID, Pin<&T>)>
where T: 'static,

Returns an iterator over all streams of type T pushed via StreamMap::try_push. This iterator returns streams in an arbitrary order, which may change.

If downcasting a stream to T fails it will be skipped in the iterator.

Source

pub fn iter_mut_of_type<T>( &mut self, ) -> impl Iterator<Item = (&ID, Pin<&mut T>)>
where T: 'static,

Returns an iterator with mutable access over all streams of type T pushed via StreamMap::try_push. This iterator returns streams in an arbitrary order, which may change.

If downcasting a stream to T fails it will be skipped in the iterator.

Auto Trait Implementations§

§

impl<ID, O> !Freeze for StreamMap<ID, O>

§

impl<ID, O> !RefUnwindSafe for StreamMap<ID, O>

§

impl<ID, O> !Sync for StreamMap<ID, O>

§

impl<ID, O> !UnwindSafe for StreamMap<ID, O>

§

impl<ID, O> Send for StreamMap<ID, O>
where SelectAll<TaggedStream<ID, TimeoutStream<Pin<Box<dyn AnyStream<Item = O> + Send>>>>>: Send,

§

impl<ID, O> Unpin for StreamMap<ID, O>
where SelectAll<TaggedStream<ID, TimeoutStream<Pin<Box<dyn AnyStream<Item = O> + Send>>>>>: Unpin,

§

impl<ID, O> UnsafeUnpin for StreamMap<ID, O>
where SelectAll<TaggedStream<ID, TimeoutStream<Pin<Box<dyn AnyStream<Item = O> + Send>>>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.