rustpool 0.0.1-beta

A data and thread pool library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Traits for buffers

pub trait RPBuffer<'a, T> {
    /// Adds an item to the buffer returning the total number of items in the buffer
    fn add(&mut self, item: T) -> usize;

    /// Returns the maximum allowed number of items in the buffer
    fn capacity(&self) -> usize;

    /// Returns the number of available items in the buffer
    fn available(&self) -> usize;

    /// Puts back an existing item to the buffer, returning the number of items available
    fn offer(&self, item: &'a T) -> usize;

    /// Removes one item from the buffer returning None if the buffer is empty
    fn take(&self) -> Option<&'a mut T>;
}