Struct ArrayBox

Source
#[repr(C)]
pub struct ArrayBox<T> { pub data: *mut T, pub length: usize, pub capacity: usize, pub owned: bool, }

Fields§

§data: *mut T§length: usize§capacity: usize§owned: bool

Implementations§

Source§

impl<T> ArrayBox<T>

Source

pub fn new() -> Self

Source

pub fn from_vector(vector: Vec<T>) -> Self

Source

pub fn from_array(array_buffer: &[T]) -> Self
where T: Clone,

I create a copy of a given array

Source

pub fn from_data(data: *mut T, length: usize) -> Self

Create an array assuming that I don’t own the data

Source

pub fn set_vector(&mut self, vector: Vec<T>)

Mutate me to hold a given vector

Source

pub fn set_array(&mut self, array_buffer: &[T])
where T: Clone,

Mutate me to hold a given vector

Source

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

Source

pub fn copy_into(&self, another_array: &mut ArrayBox<T>)

Source

pub fn to_vector(self) -> Vec<T>
where T: Clone,

Source

pub fn at_put(&mut self, index: usize, object: T)

Source

pub fn at(&self, index: usize) -> T
where T: Clone,

Source§

impl<T> ArrayBox<T>
where T: Default + Copy,

Source

pub fn byte_size(count: usize) -> usize

Source

pub fn new_with(element: T, amount: usize) -> ArrayBox<T>

Trait Implementations§

Source§

impl<T: Debug> Debug for ArrayBox<T>

Source§

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

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

impl<T> Default for ArrayBox<T>

Source§

fn default() -> Self

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

impl<T> Drop for ArrayBox<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ArrayBox<T>

§

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

§

impl<T> !Send for ArrayBox<T>

§

impl<T> !Sync for ArrayBox<T>

§

impl<T> Unpin for ArrayBox<T>

§

impl<T> UnwindSafe for ArrayBox<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.