Skip to main content

AST

Trait AST 

Source
pub trait AST: Sized + Debug {
    type Generous;

    // Required method
    fn validate(
        report: &mut impl FnMut(Location, &str),
        tree: &Self::Generous,
    ) -> Result<Self, Invalid>;
}
Expand description

Represents a valid abstract syntax tree of some valid Welly source code.

Required Associated Types§

Source

type Generous

The parser type that turns into Self.

Required Methods§

Source

fn validate( report: &mut impl FnMut(Location, &str), tree: &Self::Generous, ) -> Result<Self, Invalid>

Attempt to construct a Self given its parse tree.

If you return Invalid, you must first report() at least one error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: AST> AST for Box<T>

Source§

type Generous = Box<<T as AST>::Generous>

Source§

fn validate( report: &mut impl FnMut(Location, &str), tree: &Self::Generous, ) -> Result<Self, Invalid>

Source§

impl<T: AST> AST for Option<T>

Source§

type Generous = Option<<T as AST>::Generous>

Source§

fn validate( report: &mut impl FnMut(Location, &str), tree: &Self::Generous, ) -> Result<Self, Invalid>

Implementors§