Struct encase::ArrayLength
source · [−]pub struct ArrayLength;
Expand description
Helper type meant to be used together with the ShaderType
derive macro
This type should be interpreted as an u32
in the shader
Problem
There are cases where the use of the WGSL function arrayLength()
might be inadequate because of its return value
-
being a minimum of 1 due to how
minBindingSize
is calculated -
possibly being higher than expected due to padding at the end of a struct or buffer being interpreted as array elements
-
representing the capacity of the array for usecaseses that require oversized buffers
Solution
Using this type on a field of a struct with the ShaderType
derive macro will automatically:
Trait Implementations
sourceimpl Clone for ArrayLength
impl Clone for ArrayLength
sourcefn clone(&self) -> ArrayLength
fn clone(&self) -> ArrayLength
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl CreateFrom for ArrayLength
impl CreateFrom for ArrayLength
fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self
sourceimpl Debug for ArrayLength
impl Debug for ArrayLength
sourceimpl Default for ArrayLength
impl Default for ArrayLength
sourcefn default() -> ArrayLength
fn default() -> ArrayLength
Returns the “default value” for a type. Read more
sourceimpl Ord for ArrayLength
impl Ord for ArrayLength
sourceimpl PartialEq<ArrayLength> for ArrayLength
impl PartialEq<ArrayLength> for ArrayLength
sourceimpl PartialOrd<ArrayLength> for ArrayLength
impl PartialOrd<ArrayLength> for ArrayLength
sourcefn partial_cmp(&self, other: &ArrayLength) -> Option<Ordering>
fn partial_cmp(&self, other: &ArrayLength) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl ReadFrom for ArrayLength
impl ReadFrom for ArrayLength
sourceimpl ShaderType for ArrayLength
impl ShaderType for ArrayLength
sourcefn min_size() -> NonZeroU64
fn min_size() -> NonZeroU64
Represents the minimum size of Self
(equivalent to GPUBufferBindingLayout.minBindingSize) Read more
sourcefn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Returns the size of Self
at runtime Read more
sourcefn assert_uniform_compat()
fn assert_uniform_compat()
Asserts that Self
meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read more
sourceimpl Size for ArrayLength
impl Size for ArrayLength
sourceconst SIZE: NonZeroU64 = Self::METADATA.min_size().0
const SIZE: NonZeroU64 = Self::METADATA.min_size().0
Represents WGSL Size (equivalent to ShaderType::min_size
)
sourceimpl WriteInto for ArrayLength
impl WriteInto for ArrayLength
fn write_into<B: BufferMut>(&self, writer: &mut Writer<B>)
impl Copy for ArrayLength
impl Eq for ArrayLength
impl StructuralEq for ArrayLength
impl StructuralPartialEq for ArrayLength
Auto Trait Implementations
impl RefUnwindSafe for ArrayLength
impl Send for ArrayLength
impl Sync for ArrayLength
impl Unpin for ArrayLength
impl UnwindSafe for ArrayLength
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.