wgpu_core::id

Function as_option_slice

Source
pub fn as_option_slice<T: Marker>(ids: &[Id<T>]) -> &[Option<Id<T>>]
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*.