Struct leo_asg::Ast[][src]

pub struct Ast { /* fields omitted */ }

The abstract syntax tree (AST) for a Leo program.

The Ast type represents a Leo program as a series of recursive data types. These data types form a tree that begins from a Program type root.

A new Ast can be created from a [Grammar] generated by the pest parser in the grammar module.


impl Ast[src]

pub fn new(program: Program) -> Ast[src]

Creates a new AST from a given program tree.

pub fn canonicalize(&mut self) -> Result<(), CanonicalizeError>[src]

Mutates the program ast by preforming canonicalization on it.

pub fn as_repr(&self) -> &Program[src]

Returns a reference to the inner program AST representation.

pub fn into_repr(self) -> Program[src]

pub fn to_json_string(&self) -> Result<String, Error>[src]

Serializes the ast into a JSON string.

pub fn from_json_string(json: &str) -> Result<Ast, Error>[src]

Deserializes the JSON string into a ast.

Trait Implementations

impl AsRef<Program> for Ast[src]

impl Debug for Ast[src]

impl Eq for Ast[src]

impl PartialEq<Ast> for Ast[src]

impl StructuralEq for Ast[src]

impl StructuralPartialEq for Ast[src]

Auto Trait Implementations

impl !RefUnwindSafe for Ast

impl !Send for Ast

impl !Sync for Ast

impl Unpin for Ast

impl UnwindSafe for Ast

Blanket Implementations

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

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.