Function wgpu::core::id::as_option_slice

pub fn as_option_slice<T>(ids: &[Id<T>]) -> &[Option<Id<T>>]
where T: Marker,
Available on wgpu_core only.
Expand description

Coerce a slice of identifiers into a slice of optional raw identifiers.

There’s two reasons why we know this is correct:

  • Option<T> is guaranteed to be niche-filled to 0’s.
  • The T in Option<T> can inhabit any representation except 0’s, since its underlying representation is NonZero*.