Skip to main content

VectorViewMut2

Type Alias VectorViewMut2 

Source
pub type VectorViewMut2<'a, T, RStride = U1, CStride = U2> = Matrix<T, U2, U1, ViewStorageMut<'a, T, U2, U1, RStride, CStride>>;
Expand description

A mutable 2D column vector view.

See VectorView2 for an immutable version of this type.

Because this is an alias, not all its methods are listed here. See the Matrix type too.

Aliased Type§

pub struct VectorViewMut2<'a, T, RStride = U1, CStride = U2> {
    pub data: ViewStorageMut<'a, T, Const<2>, Const<1>, RStride, CStride>,
    /* private fields */
}

Fields§

§data: ViewStorageMut<'a, T, Const<2>, Const<1>, RStride, CStride>

The data storage that contains all the matrix components. Disappointed?

Well, if you came here to see how you can access the matrix components, you may be in luck: you can access the individual components of all vectors with compile-time dimensions <= 6 using field notation like this: vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:

let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);

Similarly, for matrices with compile-time dimensions <= 6, you can use field notation like this: mat.m11, mat.m42, etc. The first digit identifies the row to address and the second digit identifies the column to address. So mat.m13 identifies the component at the first row and third column (note that the count of rows and columns start at 1 instead of 0 here. This is so we match the mathematical notation).

For all matrices and vectors, independently from their size, individual components can be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing starts at 0 as you would expect.

Trait Implementations§

Source§

impl<T> CreateFrom for VectorViewMut2<'_, T>
where Self: FromVectorParts<T, 2>, T: VectorScalar + CreateFrom,

Available on crate feature encase only.
Source§

fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self

Source§

impl<T> ReadFrom for VectorViewMut2<'_, T>
where Self: AsMutVectorParts<T, 2>, T: VectorScalar + ReadFrom,

Available on crate feature encase only.
Source§

fn read_from<B: BufferRef>(&mut self, reader: &mut Reader<B>)

Source§

impl<T> ShaderSize for VectorViewMut2<'_, T>
where T: ShaderSize,

Available on crate feature encase only.
Source§

const SHADER_SIZE: NonZero<u64> = _

Represents WGSL Size (equivalent to ShaderType::min_size)
Source§

impl<T> ShaderType for VectorViewMut2<'_, T>
where T: ShaderSize,

Available on crate feature encase only.
Source§

fn min_size() -> NonZero<u64>

Represents the minimum size of Self (equivalent to GPUBufferBindingLayout.minBindingSize) Read more
Source§

fn size(&self) -> NonZero<u64>

Returns the size of Self at runtime Read more
Source§

fn assert_uniform_compat()

Source§

impl<T> WriteInto for VectorViewMut2<'_, T>
where Self: AsRefVectorParts<T, 2>, T: VectorScalar + WriteInto,

Available on crate feature encase only.
Source§

fn write_into<B: BufferMut>(&self, writer: &mut Writer<B>)