enum Typed<T> {
Reference(T),
Plain(T),
}
Expand description
WGSL type annotations on expressions, types, values, etc.
Naga and WGSL types are very close, but Naga lacks WGSL’s ref
types, which
we need to know to apply the Load Rule. This enum carries some WGSL or Naga
datum along with enough information to determine its corresponding WGSL
type.
The T
type parameter can be any expression-like thing:
-
Typed<Handle<crate::Type>>
can represent a full WGSL type. For example, given some NagaPointer
typeptr
, a WGSL reference type is aTyped::Reference(ptr)
whereas a WGSL pointer type is aTyped::Plain(ptr)
. -
Typed<crate::Expression>
orTyped<Handle<crate::Expression>>
can represent references similarly.
Use the map
and try_map
methods to convert from one expression
representation to another.
Variants§
Implementations§
Trait Implementations§
impl<T: Copy> Copy for Typed<T>
Auto Trait Implementations§
impl<T> Freeze for Typed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Typed<T>where
T: RefUnwindSafe,
impl<T> Send for Typed<T>where
T: Send,
impl<T> Sync for Typed<T>where
T: Sync,
impl<T> Unpin for Typed<T>where
T: Unpin,
impl<T> UnwindSafe for Typed<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more