Skip to main content

Bounded

Struct Bounded 

Source
pub struct Bounded<T> { /* private fields */ }
Expand description

Keeps at most capacity items, in order, and applies an Overflow rule beyond that. This is onBackpressureBuffer with a capacity of other ReactiveX stacks.

The capacity is a NonZeroUsize: a buffer that holds nothing would yield nothing. Latest is Bounded::drop_oldest with a capacity of one.

Implementations§

Source§

impl<T> Bounded<T>

Source

pub fn new(capacity: NonZeroUsize, overflow: Overflow) -> Self

Keeps at most capacity items and applies overflow beyond that.

Source

pub fn drop_oldest(capacity: NonZeroUsize) -> Self

Keeps the newest capacity items; see Overflow::DropOldest.

Source

pub fn drop_newest(capacity: NonZeroUsize) -> Self

Keeps the oldest capacity items; see Overflow::DropNewest.

Trait Implementations§

Source§

impl<T> Debug for Bounded<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> StreamBuffer<T> for Bounded<T>

Source§

type Item = T

What the stream yields.
Source§

fn push(&mut self, item: T) -> Option<T>

Stores an item the source pushed. Read more
Source§

fn pop(&mut self) -> Option<T>

Takes the next item to yield, or None when the stream has to wait for the source.

Auto Trait Implementations§

§

impl<T> Freeze for Bounded<T>
where VecDeque<T>: Freeze,

§

impl<T> RefUnwindSafe for Bounded<T>

§

impl<T> Send for Bounded<T>
where VecDeque<T>: Send,

§

impl<T> Sync for Bounded<T>
where VecDeque<T>: Sync,

§

impl<T> Unpin for Bounded<T>
where VecDeque<T>: Unpin,

§

impl<T> UnsafeUnpin for Bounded<T>

§

impl<T> UnwindSafe for Bounded<T>
where VecDeque<T>: UnwindSafe,

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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

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.