Struct slice_cell::ArrayCell

source ·
#[repr(transparent)]
pub struct ArrayCell<T, const N: usize> { /* private fields */ }
Expand description

A Cell<[T; N]>-like type that has some additional slice-like API.

This type dereferences to SliceCell<T>.

Under the assume_cell_layout cargo feature, this type can be converted to and from Cell<[T; N]> and [Cell<T>; N] in several ways.

Implementations§

View this ArrayCell as a Cell of an array of N elements.

View this ArrayCell as an array of N Cells.

View a Cell of an array of N elements as an ArrayCell.

View an array of N Cells as an ArrayCell.

View this ArrayCell as a Cell of an array of N elements.

View this ArrayCell as an array of N Cells.

View a Cell of an array of N elements as an ArrayCell.

View an array of N Cells as an ArrayCell.

View this ArrayCell as a Cell of an array of N elements.

View this ArrayCell as an array of N Cells.

View a Cell of an array of N elements as an ArrayCell.

View an array of N Cells as an ArrayCell.

View this ArrayCell as a Cell of an array of N elements.

View this ArrayCell as an array of N Cells.

View a Cell of an array of N elements as an ArrayCell.

View an array of N Cells as an ArrayCell.

Returns a raw pointer to the underlying data in this ArrayCell.

Consumes the ArrayCell, returning the wrapped array.

Wraps an array in an ArrayCell.

Wraps a boxed array in an ArrayCell.

Wraps a reference-counted array in an ArrayCell, if it is uniquely owned.

Unwraps a reference-counted ArrayCell into an array, if it is uniquely owned.

Replacement for From impl, since Rc is not fundamental

Unwraps a uniquely borrowed ArrayCell into an array.

Wraps a uniquely borrowed array in an ArrayCell.

Returns the length of the ArrayCell.

Methods from Deref<Target = SliceCell<T>>§

View this SliceCell as a Cell of a slice.

View this SliceCell as a slice of Cells.

View this SliceCell as a Cell of a slice.

View this SliceCell as a slice of Cells.

View this SliceCell as a Cell of a slice.

View this SliceCell as a slice of Cells.

Returns a raw pointer to the underlying data in this SliceCell.

Unwraps a reference-counted SliceCell into an slice, if it is uniquely owned.

Unwraps a uniquely borrowed SliceCell into a slice.

Returns the length of the SliceCell.

Divide one SliceCell into two at an index.

Panics if mid > self.len().

See slice::split_at

Divide one mutable SliceCell into two at an index.

Panics if mid > self.len().

See slice::split_at_mut

Returns the first and all the rest of the elements of the SliceCell, or None if it is empty.

See slice::split_first

Returns the first and all the rest of the elements of the SliceCell, or None if it is empty.

See slice::split_first_mut

Returns the last and all the rest of the elements of the SliceCell, or None if it is empty.

See slice::split_last

Returns the last and all the rest of the elements of the SliceCell, or None if it is empty.

See slice::split_last_mut

Copies all elements from src into self, using a memcpy.

The length of src must be the same as self.

See slice::copy_from_slice.

Clones all elements from src into self.

The length of src must be the same as self.

See slice::copy_from_slice.

Take all elements from this SliceCell into a mutable slice, leaving T::default() in each cell

Take all elements from this SliceCell into a newly allocated Vec<T>, leaving T::default() in each cell.

Copy all elements from this SliceCell into a mutable slice.

Copy all elements from this SliceCell into a newly allocated Vec<T>.

Swaps two elements in the slice.

See <[T]>::swap.

Fills self with elements by cloning value.

See also: <[T]>::fill.

Fills self with elements returned by calling a closure repeatedly.

See also: <[T]>::fill_with.

Replacement for TryFrom impl, since Rc is not fundamental

N should not be 0.

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

N should not be 0.

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

N should not be 0.

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

N should not be 0.

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Converts to this type from the input type.
Converts to this type from the input type.
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. 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.
The type returned in the event of a conversion error.
Performs the conversion.

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 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.