[][src]Struct slice_deque::Buffer

pub struct Buffer<T> { /* fields omitted */ }

Mirrored memory buffer of length len.

The buffer elements in range [0, len/2) are mirrored into the range [len/2, len).

Methods

impl<T> Buffer<T>[src]

pub fn len(&self) -> usize[src]

Number of elements in the buffer.

pub fn is_empty(&self) -> bool[src]

Is the buffer empty?

pub unsafe fn ptr(&self) -> *mut T[src]

Pointer to the first element in the buffer.

pub unsafe fn as_slice(&self) -> &[T][src]

Interprets contents as a slice.

Warning: Some memory might be uninitialized.

pub unsafe fn as_mut_slice(&mut self) -> &mut [T][src]

Interprets contents as a mut slice.

Warning: Some memory might be uninitialized.

pub unsafe fn get(&self, i: usize) -> &T[src]

Interprets content as a slice and access the i-th element.

Warning: The memory of the i-th element might be uninitialized.

pub unsafe fn get_mut(&mut self, i: usize) -> &mut T[src]

Interprets content as a mut slice and access the i-th element.

Warning: The memory of the i-th element might be uninitialized.

pub fn new() -> Self[src]

Creates a new empty Buffer.

pub unsafe fn from_raw_parts(ptr: *mut T, len: usize) -> Self[src]

Creates a new empty Buffer from a ptr and a len.

Panics

If ptr is null.

pub fn size_in_bytes(len: usize) -> usize[src]

Total number of bytes in the buffer.

pub fn uninitialized(len: usize) -> Result<Self, AllocError>[src]

Create a mirrored buffer containing len Ts where the first half of the buffer is mirrored into the second half.

Trait Implementations

impl<T> Sync for Buffer<T> where
    T: Sync
[src]

impl<T> Send for Buffer<T> where
    T: Send
[src]

impl<T> Clone for Buffer<T> where
    T: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T> Drop for Buffer<T>[src]

impl<T> Default for Buffer<T>[src]

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]