[−][src]Struct pinvec::buf::PinBuffer
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]
T: Unpin,
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]
T: Unpin,
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,
T: RefUnwindSafe,
impl<T> Send for PinBuffer<T> where
T: Send,
T: Send,
impl<T> Sync for PinBuffer<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PinBuffer<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PinBuffer<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,