Skip to main content

VecMut

Struct VecMut 

Source
pub struct VecMut<'a, T> { /* private fields */ }
Expand description

mutable vector type

Implementations§

Source§

impl<'a, T> VecMut<'a, T>

Source

pub fn new(buffer: &'a mut [T]) -> Self

constructs VecMut with given slice

Source

pub fn length(&self) -> usize

returns length of internal slice

Source

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

accesses full internal slice as immutable

Source

pub fn slice(&self, range: Range<usize>) -> &[T]

accesses internal immutable slice over a given index range

Source

pub fn slice_mut(&mut self, range: Range<usize>) -> &mut [T]

accesses internal mutable slice over a given index range

Source

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

accesses full internal slice as mutable

Source

pub fn has_equal_length(&self, length: usize) -> bool

checks whether internal length is equal to given length parameter

Source

pub fn reborrow(&mut self) -> VecMut<'_, T>

used for calling routines over and over again on the stored internal mutable slice

borrows self mutably

example:

use lak::l1::scal;
use lak::types::VecMut;

let mut x = [1.0, 2.0, 3.0];
let mut x = VecMut::new(&mut x);

scal(2.0, x.reborrow());
scal(3.0, x.reborrow());

Trait Implementations§

Source§

impl<'a, T: Debug> Debug for VecMut<'a, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> !UnwindSafe for VecMut<'a, T>

§

impl<'a, T> Freeze for VecMut<'a, T>

§

impl<'a, T> RefUnwindSafe for VecMut<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for VecMut<'a, T>
where T: Send,

§

impl<'a, T> Sync for VecMut<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for VecMut<'a, T>

§

impl<'a, T> UnsafeUnpin for VecMut<'a, T>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V