pub enum Item {
Function(FunctionDef),
SamplerDecl(SamplerDecl),
GlobalVar(GlobalVar),
}Expand description
Top-level item in the translation unit.
Variants§
Function(FunctionDef)
<type> <name>(<params>) { <body> }
SamplerDecl(SamplerDecl)
sampler <name>; or sampler2D <name>; or
sampler <name> = sampler_state { ... }; (the state block is
kept as opaque text — MD2 never inspects it).
GlobalVar(GlobalVar)
[static] [const] <type> <name>[<array>] [= <expr>]; — file-scope
variable. The qualifier flags carry whether the original source
said static/const so emitters can preserve immutability hints
when round-tripping. The regex pipeline collapses everything into
var NAME: TYPE at WGSL emit time today; the AST is richer so a
future emitter has more to work with.
Multi-name declarations (float3 a, b, c;) flatten at parse time
into multiple GlobalVar items, one per name.
Trait Implementations§
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
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