pub type AssetHash = [u8; 32];
Trait Implementations§
§impl<T, const N: usize> Array for [T; N]where
T: Reflect + TypePath,
impl<T, const N: usize> Array for [T; N]where T: Reflect + TypePath,
§fn get(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
fn get(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
Returns a reference to the element at
index
, or None
if out of bounds.§fn get_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn get_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
Returns a mutable reference to the element at
index
, or None
if out of bounds.§fn drain(self: Box<[T; N], Global>) -> Vec<Box<dyn Reflect, Global>, Global>
fn drain(self: Box<[T; N], Global>) -> Vec<Box<dyn Reflect, Global>, Global>
Drain the elements of this array to get a vector of owned values.
§fn clone_dynamic(&self) -> DynamicArray
fn clone_dynamic(&self) -> DynamicArray
Clones the list, producing a
DynamicArray
.§impl<T, const N: usize> CreateFrom for [T; N]where
T: CreateFrom,
[T; N]: ShaderType<ExtraMetadata = ArrayMetadata>,
impl<T, const N: usize> CreateFrom for [T; N]where T: CreateFrom, [T; N]: ShaderType<ExtraMetadata = ArrayMetadata>,
fn create_from<B>(reader: &mut Reader<B>) -> [T; N]where B: BufferRef,
source§impl<'de, T> Deserialize<'de> for [T; 32]where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for [T; 32]where T: Deserialize<'de>,
source§fn deserialize<D>(
deserializer: D
) -> Result<[T; 32], <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<[T; 32], <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> From<GenericArray<T, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>> for [T; 32]
impl<T> From<GenericArray<T, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>> for [T; 32]
source§impl<T, const N: usize> From<Simd<T, N>> for [T; N]where
LaneCount<N>: SupportedLaneCount,
T: SimdElement,
impl<T, const N: usize> From<Simd<T, N>> for [T; N]where LaneCount<N>: SupportedLaneCount, T: SimdElement,
§impl<T, const N: usize> FromReflect for [T; N]where
T: FromReflect + TypePath,
impl<T, const N: usize> FromReflect for [T; N]where T: FromReflect + TypePath,
§fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<[T; N]>
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<[T; N]>
Constructs a concrete instance of
Self
from a reflected value.§impl<T> GetTypeRegistration for [T; 32]where
T: Reflect + TypePath,
impl<T> GetTypeRegistration for [T; 32]where T: Reflect + TypePath,
§impl<T, const N: usize> ReadFrom for [T; N]where
T: ReadFrom,
[T; N]: ShaderType<ExtraMetadata = ArrayMetadata>,
impl<T, const N: usize> ReadFrom for [T; N]where T: ReadFrom, [T; N]: ShaderType<ExtraMetadata = ArrayMetadata>,
§impl<T, const N: usize> Reflect for [T; N]where
T: Reflect + TypePath,
impl<T, const N: usize> Reflect for [T; N]where T: Reflect + TypePath,
§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Returns the value as a
&mut dyn Any
.§fn into_reflect(self: Box<[T; N], Global>) -> Box<dyn Reflect, Global>
fn into_reflect(self: Box<[T; N], Global>) -> Box<dyn Reflect, Global>
Casts this type to a boxed reflected value.
§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Casts this type to a reflected value.
§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Casts this type to a mutable reflected value.
§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
Applies a reflected value to this value. Read more
§fn set(
&mut self,
value: Box<dyn Reflect, Global>
) -> Result<(), Box<dyn Reflect, Global>>
fn set( &mut self, value: Box<dyn Reflect, Global> ) -> Result<(), Box<dyn Reflect, Global>>
Performs a type-checked assignment of a reflected value to this value. Read more
§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Returns an enumeration of “kinds” of type. Read more
§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Returns a mutable enumeration of “kinds” of type. Read more
§fn reflect_owned(self: Box<[T; N], Global>) -> ReflectOwned
fn reflect_owned(self: Box<[T; N], Global>) -> ReflectOwned
Returns an owned enumeration of “kinds” of type. Read more
§fn clone_value(&self) -> Box<dyn Reflect, Global>
fn clone_value(&self) -> Box<dyn Reflect, Global>
Clones the value as a
Reflect
trait object. Read more§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type). Read more
§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
Returns a “partial equality” comparison result. Read more
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Debug formatter for the value. Read more
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Returns a serializable version of the value. Read more
§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Indicates whether or not this type is a dynamic type. Read more
source§impl<T> Serialize for [T; 32]where
T: Serialize,
impl<T> Serialize for [T; 32]where T: Serialize,
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<T, const N: usize> ShaderSize for [T; N]where
T: ShaderSize,
impl<T, const N: usize> ShaderSize for [T; N]where T: ShaderSize,
§const SHADER_SIZE: NonZeroU64 = _
const SHADER_SIZE: NonZeroU64 = _
Represents WGSL Size (equivalent to
ShaderType::min_size
)§impl<T, const N: usize> ShaderType for [T; N]where
T: ShaderType + ShaderSize,
impl<T, const N: usize> ShaderType for [T; N]where T: ShaderType + ShaderSize,
§fn min_size() -> NonZeroU64
fn min_size() -> NonZeroU64
§fn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Returns the size of
Self
at runtime Read more§fn 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 more1.34.0 · source§impl<T, const N: usize> TryFrom<&[T]> for [T; N]where
T: Copy,
impl<T, const N: usize> TryFrom<&[T]> for [T; N]where T: Copy,
Tries to create an array [T; N]
by copying from a slice &[T]
. Succeeds if
slice.len() == N
.
let bytes: [u8; 3] = [1, 0, 2];
let bytes_head: [u8; 2] = <[u8; 2]>::try_from(&bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(bytes_head));
let bytes_tail: [u8; 2] = bytes[1..3].try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(bytes_tail));
§type Error = TryFromSliceError
type Error = TryFromSliceError
The type returned in the event of a conversion error.
1.59.0 · source§impl<T, const N: usize> TryFrom<&mut [T]> for [T; N]where
T: Copy,
impl<T, const N: usize> TryFrom<&mut [T]> for [T; N]where T: Copy,
Tries to create an array [T; N]
by copying from a mutable slice &mut [T]
.
Succeeds if slice.len() == N
.
let mut bytes: [u8; 3] = [1, 0, 2];
let bytes_head: [u8; 2] = <[u8; 2]>::try_from(&mut bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(bytes_head));
let bytes_tail: [u8; 2] = (&mut bytes[1..3]).try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(bytes_tail));
§type Error = TryFromSliceError
type Error = TryFromSliceError
The type returned in the event of a conversion error.
1.48.0 · source§impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]where
A: Allocator,
impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]where A: Allocator,
source§fn try_from(vec: Vec<T, A>) -> Result<[T; N], Vec<T, A>>
fn try_from(vec: Vec<T, A>) -> Result<[T; N], Vec<T, A>>
Gets the entire contents of the Vec<T>
as an array,
if its size exactly matches that of the requested array.
Examples
assert_eq!(vec![1, 2, 3].try_into(), Ok([1, 2, 3]));
assert_eq!(<Vec<i32>>::new().try_into(), Ok([]));
If the length doesn’t match, the input comes back in Err
:
let r: Result<[i32; 4], _> = (0..10).collect::<Vec<_>>().try_into();
assert_eq!(r, Err(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));
If you’re fine with just getting a prefix of the Vec<T>
,
you can call .truncate(N)
first.
let mut v = String::from("hello world").into_bytes();
v.sort();
v.truncate(2);
let [a, b]: [_; 2] = v.try_into().unwrap();
assert_eq!(a, b' ');
assert_eq!(b, b'd');
§impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]where
A: Allocator,
impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]where A: Allocator,
§fn try_from(vec: Vec<T, A>) -> Result<[T; N], Vec<T, A>>
fn try_from(vec: Vec<T, A>) -> Result<[T; N], Vec<T, A>>
Gets the entire contents of the Vec<T>
as an array,
if its size exactly matches that of the requested array.
Examples
assert_eq!(vec![1, 2, 3].try_into(), Ok([1, 2, 3]));
assert_eq!(<Vec<i32>>::new().try_into(), Ok([]));
If the length doesn’t match, the input comes back in Err
:
let r: Result<[i32; 4], _> = (0..10).collect::<Vec<_>>().try_into();
assert_eq!(r, Err(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));
If you’re fine with just getting a prefix of the Vec<T>
,
you can call .truncate(N)
first.
let mut v = String::from("hello world").into_bytes();
v.sort();
v.truncate(2);
let [a, b]: [_; 2] = v.try_into().unwrap();
assert_eq!(a, b' ');
assert_eq!(b, b'd');
§impl<T, const N: usize> TypePath for [T; N]where
T: TypePath,
impl<T, const N: usize> TypePath for [T; N]where T: TypePath,
§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Returns a short, pretty-print enabled path to the type. Read more