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

Buffer limited by elements count.

Implementations§

source§

impl<T> LimitedBuffer<T>

source

pub fn new(limit: usize) -> Self

Creates a new buffer instance.

Arguments
  • limit - Buffer elements count limit
source

pub fn with_capacity(limit: usize) -> Self

Creates a new buffer instance with provided capacity.

Arguments
  • limit - Buffer elements count limit

Trait Implementations§

source§

impl<T: Send> ChunkBuffer<T> for LimitedBuffer<T>

source§

fn push(&mut self, item: T)

Adds a new element to the buffer. Read more
source§

fn len(&self) -> usize

Returns the buffer length.
source§

fn is_full(&self) -> bool

Checks if the buffer reached the limit.
source§

impl<T> IntoIterator for LimitedBuffer<T>

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = <Vec<T, Global> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T: Send> ParallelSliceMut<T> for LimitedBuffer<T>

source§

fn as_parallel_slice_mut(&mut self) -> &mut [T]

Returns a plain mutable slice, which is used to implement the rest of the parallel methods.
source§

fn par_split_mut<P>(&mut self, separator: P) -> SplitMut<'_, T, P>where P: Fn(&T) -> bool + Sync + Send,

Returns a parallel iterator over mutable subslices separated by elements that match the separator. Read more
source§

fn par_chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T>

Returns a parallel iterator over at most chunk_size elements of self at a time. The chunks are mutable and do not overlap. Read more
source§

fn par_chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T>

Returns a parallel iterator over chunk_size elements of self at a time. The chunks are mutable and do not overlap. Read more
source§

fn par_rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T>

Returns a parallel iterator over at most chunk_size elements of self at a time, starting at the end. The chunks are mutable and do not overlap. Read more
source§

fn par_rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T>

Returns a parallel iterator over chunk_size elements of self at a time, starting at the end. The chunks are mutable and do not overlap. Read more
source§

fn par_sort_by<F>(&mut self, compare: F)where F: Fn(&T, &T) -> Ordering + Sync,

Sorts the slice in parallel with a comparator function. Read more
source§

fn par_sort_by_key<K, F>(&mut self, f: F)where K: Ord, F: Fn(&T) -> K + Sync,

Sorts the slice in parallel with a key extraction function. Read more
source§

fn par_sort_by_cached_key<K, F>(&mut self, f: F)where F: Fn(&T) -> K + Sync, K: Ord + Send,

Sorts the slice in parallel with a key extraction function. Read more
source§

fn par_sort_unstable_by<F>(&mut self, compare: F)where F: Fn(&T, &T) -> Ordering + Sync,

Sorts the slice in parallel with a comparator function, but might not preserve the order of equal elements. Read more
source§

fn par_sort_unstable_by_key<K, F>(&mut self, f: F)where K: Ord, F: Fn(&T) -> K + Sync,

Sorts the slice in parallel with a key extraction function, but might not preserve the order of equal elements. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for LimitedBuffer<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.