[][src]Struct pinvec::buf::PinBuffer

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

Wraps Vec<T> and disallows re-allocation.

Methods

impl<T> PinBuffer<T>[src]

pub fn new(capacity: usize) -> Self[src]

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

Current element length.

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

Current element capacity.

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

Whether capacity allows to push another element.

pub fn push(&mut self, elem: T)[src]

Push an element. Panics if at capacity.

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

Pop and drop the top element.

Return false if already empty.

Returning element would violate Pin variants.

pub fn pop(&mut self) -> Option<T> where
    T: Unpin
[src]

Pop and return the top element.

Only possible if the element type is Unpin.

pub unsafe fn pop_unchecked(&mut self) -> Option<T>[src]

Pop and return the top element, ignoring Pin invariants.

pub fn set(&mut self, index: usize, elem: T)[src]

Override an existing element.

Quoting std::pin::Pin:

This overwrites pinned data, but that is okay: its destructor gets run before being overwritten, so no pinning guarantee is violated.

pub fn replace(&mut self, index: usize, repl: T) -> T where
    T: Unpin
[src]

Take and replace an existing element.

Only possible if the element type is Unpin.

Panics on failure.

pub fn idx_ref(&self, index: usize) -> Pin<&T>[src]

Get by index as pinned shared ref, or panic.

pub fn idx_mut(&mut self, index: usize) -> Pin<&mut T>[src]

Get by index as pinned mutable ref, or panic.

pub fn get_ref(&self, index: usize) -> Option<Pin<&T>>[src]

Get by index as pinned shared ref.

pub fn get_mut(&mut self, index: usize) -> Option<Pin<&mut T>>[src]

Get by index as pinned mutable ref.

Auto Trait Implementations

impl<T> RefUnwindSafe for PinBuffer<T> where
    T: RefUnwindSafe

impl<T> Send for PinBuffer<T> where
    T: Send

impl<T> Sync for PinBuffer<T> where
    T: Sync

impl<T> Unpin for PinBuffer<T> where
    T: Unpin

impl<T> UnwindSafe for PinBuffer<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

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.