pub enum Decl {
Const(Type, String, Option<Expr>),
Var(Type, String, Option<Expr>),
Stack(Vec<Decl>),
Func(Type, String, Option<Box<Stmt>>),
}Expand description
A declaration.
Example: int x = 4;
Variants§
Const(Type, String, Option<Expr>)
A declaration of a constant, optionally with assignment.
Example:
const int x; is Const(Int, x, None)
const int x = 4; is Const(Int, x, Some(Int(4)))
Var(Type, String, Option<Expr>)
A declaration of a variable, optionally with assignment.
Example:
int x; is Var(Int, x, None)
int x = 4; is Var(Int, x, Some(Int(4)))
Stack(Vec<Decl>)
Stacked declarations.
Example:
int x = 1, y = 2; is Stack([Var(Int, x, Some(Int(1))), Var(Int, y, Some(Int(2)))])
Func(Type, String, Option<Box<Stmt>>)
A declaration of a function, optionally with implementation.
Example:
void f(int x) is Func(Void, "f", [(Int, (Some("x"))], None)
void f() { ... } is Func(Void, "f", [], Some(...))
Trait Implementations§
impl StructuralPartialEq for Decl
Auto Trait Implementations§
impl Freeze for Decl
impl RefUnwindSafe for Decl
impl Send for Decl
impl Sync for Decl
impl Unpin for Decl
impl UnwindSafe for Decl
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more