[][src]Struct crndm::ptr::FatPtr

pub struct FatPtr<T: PSafe, A: MemPool> { /* fields omitted */ }

A persistent fat pointer with offset and capacity

Implementations

impl<T: PSafe, A: MemPool> FatPtr<T, A>[src]

pub unsafe fn new(x: &[T]) -> Self[src]

Creates a new fat pointer given a slice

pub fn empty() -> Self[src]

Sets the capacity to zero

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

Returns true if the capacity is zero

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

Returns a reference to the object at index i

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

Returns a mutable reference to the object at index i

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

Returns a mutable reference to the object at index i without checking the boundaries

pub fn off(&self) -> u64[src]

Returns the offset

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

Returns the capacity of the fat pointer

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

Converts the fat pointer into a slice of type &[T]

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

Divides one slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len.

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

Divides one mutable slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len.

pub unsafe fn dup(&self, len: usize) -> FatPtr<T, A>[src]

Creates a new copy of data and returns a FatPtr pointer

Safety

The compiler would not drop the copied data. Developer has the responsibility of deallocating inner value. Also, it does not clone the inner value. Instead, it just copies the memory.

Trait Implementations

impl<A: MemPool, T: PSafe> Clone for FatPtr<T, A>[src]

impl<A: MemPool + Copy, T: PSafe + Copy> Copy for FatPtr<T, A>[src]

impl<A: MemPool, T: PSafe> Default for FatPtr<T, A>[src]

impl<T: Eq + PSafe, A: Eq + MemPool> Eq for FatPtr<T, A>[src]

impl<A: MemPool, T: PSafe, '_> From<&'_ [T]> for FatPtr<T, A>[src]

impl<A: MemPool, T: PSafe, '_> From<&'_ mut [T]> for FatPtr<T, A>[src]

impl<T: PSafe, A: MemPool> Index<usize> for FatPtr<T, A>[src]

type Output = T

The returned type after indexing.

impl<T: PSafe, A: MemPool> PSafe for FatPtr<T, A>[src]

impl<A: MemPool, T: PSafe> PartialEq<FatPtr<T, A>> for FatPtr<T, A>[src]

impl<A: MemPool, T: PSafe> PmemUsage for FatPtr<T, A>[src]

impl<A: MemPool, T> !Send for FatPtr<T, A>[src]

Ptr pointers are not Send because the data they reference may be aliased.

impl<T: PSafe, A: MemPool> StructuralEq for FatPtr<T, A>[src]

impl<A: MemPool, T> !Sync for FatPtr<T, A>[src]

Ptr pointers are not Sync because the data they reference may be aliased.

impl<A: MemPool, T> !TxOutSafe for FatPtr<T, A>[src]

Auto Trait Implementations

impl<T, A> LooseTxInUnsafe for FatPtr<T, A> where
    A: LooseTxInUnsafe,
    T: LooseTxInUnsafe
[src]

impl<T, A> RefUnwindSafe for FatPtr<T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, A> TxInSafe for FatPtr<T, A> where
    A: TxInSafe,
    T: TxInSafe
[src]

impl<T, A> Unpin for FatPtr<T, A> where
    A: Unpin,
    T: Unpin
[src]

impl<T, A> UnwindSafe for FatPtr<T, A> where
    A: UnwindSafe,
    T: UnwindSafe
[src]

impl<T, A> VSafe for FatPtr<T, A> where
    A: VSafe,
    T: VSafe
[src]

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> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,