futures_intrusive::buffer

Struct GrowingHeapBuf

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

A Ring Buffer which stores all items on the heap but grows dynamically.

A GrowingHeapBuf does not allocate the capacity ahead of time, as opposed to the FixedHeapBuf. This makes it a good fit when you have unpredictable latency between two components, when you want to amortize your allocation costs or when you are using an external back-pressure mechanism.

Trait Implementations§

Source§

impl<T> Debug for GrowingHeapBuf<T>

Source§

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

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

impl<T> RingBuf for GrowingHeapBuf<T>

Source§

type Item = T

The type of stored items inside the Ring Buffer
Source§

fn new() -> Self

Creates a new instance of the Ring Buffer
Source§

fn with_capacity(limit: usize) -> Self

Creates a new instance of the Ring Buffer with the given capacity. RingBuf implementations are allowed to ignore the capacity hint and utilize their default capacity.
Source§

fn capacity(&self) -> usize

The capacity of the buffer
Source§

fn len(&self) -> usize

The amount of stored items in the buffer
Source§

fn can_push(&self) -> bool

Returns true if there is enough space in the buffer to store another item.
Source§

fn push(&mut self, value: Self::Item)

Stores the item at the end of the buffer. Panics if there is not enough free space.
Source§

fn pop(&mut self) -> Self::Item

Returns the oldest item inside the buffer. Panics if there is no available item.
Source§

fn is_empty(&self) -> bool

Returns true if no item is stored inside the buffer.

Auto Trait Implementations§

§

impl<T> Freeze for GrowingHeapBuf<T>

§

impl<T> RefUnwindSafe for GrowingHeapBuf<T>
where T: RefUnwindSafe,

§

impl<T> Send for GrowingHeapBuf<T>
where T: Send,

§

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

§

impl<T> Unpin for GrowingHeapBuf<T>
where T: Unpin,

§

impl<T> UnwindSafe for GrowingHeapBuf<T>
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.