ArrayPtr

Struct ArrayPtr 

Source
pub struct ArrayPtr<T>(/* private fields */);
Expand description

A dynamically allocated array of T

Implementations§

Source§

impl<T> ArrayPtr<T>

Source

pub fn new_uninit(count: usize) -> ArrayPtr<MaybeUninit<T>>

Allocate a new ArrayPtr<T> without initializing the memory

The number of elements is given by the input parameter count

Source

pub fn shift_once(&mut self)
where T: Copy,

Source

pub fn from_raw_parts(data: *mut T, len: usize) -> ArrayPtr<T>

Create a new ArrayPtr<T> from a pointer an an element-count

§Safety

The caller must ensure that the pointer is non-null, and points to the number of elements specified.

Source§

impl<T> ArrayPtr<MaybeUninit<T>>

Source

pub unsafe fn assume_init(self) -> ArrayPtr<T>

§Safety

Caller must guarantee each member of the ArrayPtr has been written to with a valid instance of T

Source§

impl<T> ArrayPtr<T>
where T: Zero,

Source

pub fn new_zeroed(count: usize) -> ArrayPtr<T>

Create a new ArrayPtr<T> by initializing it with T’s Zero implementation.

This function is feature-gated behind the num-traits feature.

Source§

impl<T> ArrayPtr<T>
where T: Default,

Source

pub fn new_default(count: usize) -> ArrayPtr<T>

Create a new ArrayPtr<T> by initializing it with T’s Default implementation.

Source§

impl<T> ArrayPtr<T>

Source

pub fn from_fn(count: usize, idx_map: impl Fn(usize) -> T) -> ArrayPtr<T>

Create a new ArrayPtr<T> from a provided closure and element-count

The closure will be invoked as an index-mapping from 0 up to the specified element-count.

Source

pub const fn is_empty(&self) -> bool

Returns true if the underlying ArrayPtr<T> is empty

This should never happen.

Source

pub const fn len(&self) -> usize

Returns the number of elements pointed to the ArrayPtr<T>

Source

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

Returns a shared slice-reference to the underlying data

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Returns a mutable slice-reference to the underlying data

Source

pub fn iter(&self) -> Iter<'_, T>

Returns an immutable iterator over underlying data

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over underlying data

Trait Implementations§

Source§

impl<T> AsMut<[T]> for ArrayPtr<T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<[T]> for ArrayPtr<T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Debug> Debug for ArrayPtr<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for ArrayPtr<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> From<ArrayPtr<T>> for CircularBuffer<T>

Source§

fn from(value: ArrayPtr<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<T> for ArrayPtr<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> Index<usize> for ArrayPtr<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

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

impl<T> IndexMut<usize> for ArrayPtr<T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

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

Auto Trait Implementations§

§

impl<T> Freeze for ArrayPtr<T>

§

impl<T> RefUnwindSafe for ArrayPtr<T>
where T: RefUnwindSafe,

§

impl<T> !Send for ArrayPtr<T>

§

impl<T> !Sync for ArrayPtr<T>

§

impl<T> Unpin for ArrayPtr<T>

§

impl<T> UnwindSafe for ArrayPtr<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.