pub struct Slice<T: PSafe, A: MemPool> { /* private fields */ }
Expand description

A persistent fat pointer with offset and capacity

Implementations

Creates a new fat pointer given a slice

Create an empty slice

Creates a new fat pointer given a slice

Returns true if the capacity is zero

Returns a reference to the object at index i

Returns a mutable reference to the object at index i

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

Returns the offset

Returns the capacity of the fat pointer

Converts the fat pointer into a slice of type &[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.

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.

Creates a new copy of data and returns a Slice 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs copy-assignment from source. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.