Trait sc_rpc::utils::Buffer

source ·
pub trait Buffer {
    type Item;

    // Required methods
    fn push(&mut self, item: Self::Item) -> Result<(), ()>;
    fn pop(&mut self) -> Option<Self::Item>;
}
Expand description

A trait representing a buffer which may or may not support to replace items when the buffer is full.

Required Associated Types§

source

type Item

The item type that the buffer holds.

Required Methods§

source

fn push(&mut self, item: Self::Item) -> Result<(), ()>

Push an item to the buffer.

Returns Err if the buffer doesn’t support replacing older items

source

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

Pop the next item from the buffer.

Implementors§

source§

impl<T> Buffer for BoundedVecDeque<T>

§

type Item = T

source§

impl<T> Buffer for RingBuffer<T>

§

type Item = T