Enum Decl

Source
pub enum Decl<'a, 'f> {
    Const {
        name: Ident<'a, 'f>,
        value: Option<Spanned<'f, Expr<'a, 'f>>>,
        ty: Option<TyExpr<'a, 'f>>,
    },
    Ty {
        name: Spanned<'f, Ident<'a, 'f>>,
        value: Spanned<'f, TyDecl<'a, 'f>>,
    },
    ExternalNode {
        is_unsafe: bool,
        is_function: bool,
        name: Spanned<'f, Ident<'a, 'f>>,
        static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>,
        params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
    },
    Node {
        is_unsafe: bool,
        is_function: bool,
        name: Spanned<'f, Ident<'a, 'f>>,
        static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>,
        params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        vars: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        consts: Vec<Spanned<'f, Decl<'a, 'f>>>,
        body: Vec<Spanned<'f, BodyItem<'a, 'f>>>,
    },
    AliasNode {
        is_unsafe: bool,
        is_function: bool,
        name: Spanned<'f, Ident<'a, 'f>>,
        static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>,
        params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>,
        effective_node: Spanned<'f, (Spanned<'f, Ident<'a, 'f>>, Vec<StaticArg<'a, 'f>>)>,
    },
    Model {
        name: Spanned<'f, Ident<'a, 'f>>,
        uses: Vec<Spanned<'f, Ident<'a, 'f>>>,
        needs: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>,
        provides: Vec<Spanned<'f, AbstractDecl<'a, 'f>>>,
        body: Vec<Spanned<'f, Decl<'a, 'f>>>,
    },
    PackageAlias {
        name: Spanned<'f, Ident<'a, 'f>>,
        model: Spanned<'f, Ident<'a, 'f>>,
        static_params: Vec<(Spanned<'f, Ident<'a, 'f>>, StaticArg<'a, 'f>)>,
    },
    Package {
        name: Spanned<'f, Ident<'a, 'f>>,
        uses: Vec<Spanned<'f, Ident<'a, 'f>>>,
        provides: Vec<Spanned<'f, AbstractDecl<'a, 'f>>>,
        body: Vec<Spanned<'f, Decl<'a, 'f>>>,
    },
}
Expand description

A single declaration

Variants§

§

Const

Constant declaration

Fields

§name: Ident<'a, 'f>

Name of the constant

§value: Option<Spanned<'f, Expr<'a, 'f>>>

The value of the constant.

May be None for external constants

§ty: Option<TyExpr<'a, 'f>>

The type of the constant, if specified.

§

Ty

Type declaration

Fields

§name: Spanned<'f, Ident<'a, 'f>>

Name of the type

§value: Spanned<'f, TyDecl<'a, 'f>>

Value of the type

§

ExternalNode

An external node.

Fields

§is_unsafe: bool

Is it unsafe

§is_function: bool

Is it a functional node

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>

The static parameters it takes

§params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

The dynamic parameters it takes

§outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

Its outputs

§

Node

A local node

Fields

§is_unsafe: bool

Is it unsafe

§is_function: bool

Is it a functional node

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>

The static parameters it takes

§params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

The dynamic parameters it takes

§outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

Its outputs

§vars: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

The local variables of this node

§consts: Vec<Spanned<'f, Decl<'a, 'f>>>

The local constants of this node

§body: Vec<Spanned<'f, BodyItem<'a, 'f>>>

The body of the node.

It is a list of assertions and equations.

§

AliasNode

An alias node

Fields

§is_unsafe: bool

Is it unsafe

§is_function: bool

Is it a functional node

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§static_params: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>

The static parameters it takes

§params: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

The dynamic parameters it takes

§outputs: Vec<Spanned<'f, VariableDecl<'a, 'f>>>

Its outputs

§effective_node: Spanned<'f, (Spanned<'f, Ident<'a, 'f>>, Vec<StaticArg<'a, 'f>>)>

The value of the aliasing

§

Model

A package model

Fields

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§uses: Vec<Spanned<'f, Ident<'a, 'f>>>

What packages this model uses

§needs: Vec<Spanned<'f, StaticParamDecl<'a, 'f>>>

What functions/nodes/types/constants this model needs

§provides: Vec<Spanned<'f, AbstractDecl<'a, 'f>>>

What functions/nodes/types/constants this model should provides

§body: Vec<Spanned<'f, Decl<'a, 'f>>>

The body of the model

§

PackageAlias

A package alias

Fields

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§model: Spanned<'f, Ident<'a, 'f>>

The model this package is based on

§static_params: Vec<(Spanned<'f, Ident<'a, 'f>>, StaticArg<'a, 'f>)>

The parameters of the model

§

Package

A package definition

Fields

§name: Spanned<'f, Ident<'a, 'f>>

Its name

§uses: Vec<Spanned<'f, Ident<'a, 'f>>>

What packages it uses

§provides: Vec<Spanned<'f, AbstractDecl<'a, 'f>>>

What definitions it provides

§body: Vec<Spanned<'f, Decl<'a, 'f>>>

Its body, which is a collection of declarations

Trait Implementations§

Source§

impl<'a, 'f> Debug for Decl<'a, 'f>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'f> Freeze for Decl<'a, 'f>

§

impl<'a, 'f> RefUnwindSafe for Decl<'a, 'f>

§

impl<'a, 'f> Send for Decl<'a, 'f>

§

impl<'a, 'f> Sync for Decl<'a, 'f>

§

impl<'a, 'f> Unpin for Decl<'a, 'f>

§

impl<'a, 'f> UnwindSafe for Decl<'a, 'f>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.