Skip to main content

DeclKind

Enum DeclKind 

Source
pub enum DeclKind {
Show 26 variants Use { path: Vec<Name>, items: Vec<Name>, alias: Option<Name>, }, Mod { name: Name, props: Vec<Prop>, }, Fn(FnDecl), Let { pattern: Pattern, ty: Option<Type>, value: Expr, }, Var(VarDecl), Const { name: Name, ty: Option<Type>, value: Expr, }, Val { name: Name, ty: Option<Type>, value: Expr, }, Unit { name: Name, value: Option<Expr>, }, Type { name: Name, generics: Vec<Generic>, ty: Type, }, Record { name: Name, generics: Vec<Generic>, fields: Vec<Param>, body: Vec<Decl>, }, Union { name: Name, generics: Vec<Generic>, variants: Vec<Variant>, body: Vec<Decl>, }, Enum { name: Name, cases: Vec<Name>, body: Vec<Decl>, }, Extend { ty: Type, adds: Option<Type>, body: Vec<Decl>, }, Content { kind: Name, name: Name, base: Option<Type>, body: Vec<Decl>, }, Recipe { result: Type, kind: Name, rows: Vec<String>, keys: Vec<Prop>, }, Prop(Prop), Slots { name: Name, size: Expr, of: Option<Type>, }, State { scope: Name, body: Vec<Decl>, }, Screen { name: Name, params: Vec<Param>, ui: String, body: Vec<Decl>, }, Action(FnDecl), Command { name: String, body: Vec<Decl>, }, On { event: Vec<Name>, params: Vec<Name>, body: Block, }, Test { name: String, body: Block, }, Version { cond: VersionCond, then: Vec<Decl>, otherwise: Option<Vec<Decl>>, }, Native { library: String, fns: Vec<FnDecl>, }, Patch(Patch),
}

Variants§

§

Use

use a.b.{c, d} / use a.b as e.

Fields

§path: Vec<Name>
§items: Vec<Name>
§alias: Option<Name>
§

Mod

mod charge { version = "1.0.0" … }.

Fields

§name: Name
§props: Vec<Prop>
§

Fn(FnDecl)

§

Let

Fields

§pattern: Pattern
§value: Expr
§

Var(VarDecl)

§

Const

Fields

§name: Name
§value: Expr
§

Val

val x => expr: computed on every read.

Fields

§name: Name
§value: Expr
§

Unit

unit Energy / unit FE = Energy * 1.

Fields

§name: Name
§value: Option<Expr>
§

Type

Fields

§name: Name
§generics: Vec<Generic>
§ty: Type
§

Record

Fields

§name: Name
§generics: Vec<Generic>
§fields: Vec<Param>
§body: Vec<Decl>
§

Union

Fields

§name: Name
§generics: Vec<Generic>
§variants: Vec<Variant>
§body: Vec<Decl>
§

Enum

Fields

§name: Name
§cases: Vec<Name>
§body: Vec<Decl>
§

Extend

Fields

§ty: Type
§adds: Option<Type>
§body: Vec<Decl>
§

Content

block Charger { … }, item Battery { … }, a mod’s own kinds.

Fields

§kind: Name
§name: Name
§base: Option<Type>
§body: Vec<Decl>
§

Recipe

recipe Battery shaped { "RIR" … R = @item:… }.

Fields

§result: Type
§kind: Name
§rows: Vec<String>
§keys: Vec<Prop>
§

Prop(Prop)

A property in a content or mod body: hardness = 2.0, tooltip => ….

§

Slots

slots inventory[4] of Battery.

Fields

§name: Name
§size: Expr
§

State

player state { … }.

Fields

§scope: Name
§body: Vec<Decl>
§

Screen

Fields

§name: Name
§params: Vec<Param>
§body: Vec<Decl>
§

Action(FnDecl)

action dump() { … } in a screen: runs on the server.

§

Command

Fields

§name: String
§body: Vec<Decl>
§

On

on player.join(p) { … }, on use(p) { … }.

Fields

§event: Vec<Name>
§params: Vec<Name>
§body: Block
§

Test

Fields

§name: String
§body: Block
§

Version

Fields

§then: Vec<Decl>
§otherwise: Option<Vec<Decl>>
§

Native

Fields

§library: String
§

Patch(Patch)

Trait Implementations§

Source§

impl Clone for DeclKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeclKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DeclKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DeclKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.