Expand description
A persistent fat pointer with offset and capacity
Implementations
sourceimpl<T: PSafe, A: MemPool> Slice<T, A>
impl<T: PSafe, A: MemPool> Slice<T, A>
sourcepub unsafe fn from_raw_parts(x: *const u8, len: usize) -> Self
pub unsafe fn from_raw_parts(x: *const u8, len: usize) -> Self
Creates a new fat pointer given a slice
sourcepub unsafe fn get_unchecked(&self, i: usize) -> &mut T
pub unsafe fn get_unchecked(&self, i: usize) -> &mut T
Returns a mutable reference to the object at index i
without checking
the boundaries
sourcepub fn as_slice(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn as_slice(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Converts the fat pointer into a slice of type &[T]
sourcepub unsafe fn split_at(&mut self, mid: usize) -> (&[T], &[T])
pub unsafe fn split_at(&mut self, mid: usize) -> (&[T], &[T])
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
.
sourcepub unsafe fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T])
pub unsafe fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T])
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
.
Trait Implementations
sourceimpl<A: MemPool, T: PSafe> PmemUsage for Slice<T, A>
impl<A: MemPool, T: PSafe> PmemUsage for Slice<T, A>
sourcefn size_of() -> usize
fn size_of() -> usize
Size of the object on Persistent Memory Assuming that self is not on PM, or considered else were, the size of allocated persistent memory is the sum of all persistent objects pointed by this object. Read more
sourcefn size_of_pmem() -> usize
fn size_of_pmem() -> usize
Size of the object on Persistent Memory including Self
Assuming that self is also on PM (e.g. the root object), the size of allocated persistent memory
includes the size of all objects pointed by this object and the size Self
. Read more
impl<A: MemPool, T: PSafe + Copy> Copy for Slice<T, A>
impl<T: Eq + PSafe, A: Eq + MemPool> Eq for Slice<T, A>
impl<T: PSafe, A: MemPool> PSafe for Slice<T, A>
impl<A: MemPool, T> !Send for Slice<T, A>
Ptr
pointers are not Send
because the data they reference may be aliased.
impl<T: PSafe, A: MemPool> StructuralEq for Slice<T, A>
impl<A: MemPool, T> !Sync for Slice<T, A>
Ptr
pointers are not Sync
because the data they reference may be aliased.
impl<A: MemPool, T> !TxOutSafe for Slice<T, A>
Auto Trait Implementations
impl<T, A> LooseTxInUnsafe for Slice<T, A> where
T: LooseTxInUnsafe,
impl<T, A> PSend for Slice<T, A> where
A: PSend,
T: PSend,
impl<T, A> RefUnwindSafe for Slice<T, A> where
T: RefUnwindSafe,
impl<T, A> TxInSafe for Slice<T, A> where
T: TxInSafe,
impl<T, A> Unpin for Slice<T, A> where
T: Unpin,
impl<T, A> UnwindSafe for Slice<T, A> where
T: UnwindSafe,
impl<T, A> VSafe for Slice<T, A> where
T: VSafe,
Blanket Implementations
sourceimpl<T, P> Allocatable<T, P> for T where
T: Default,
P: MemPool,
impl<T, P> Allocatable<T, P> for T where
T: Default,
P: MemPool,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more