Skip to main content

LispMacro

Trait LispMacro 

Source
pub trait LispMacro: Send + Sync {
    // Required methods
    fn symbol(&self) -> Symbol;
    fn syntax_shape(&self) -> Arc<dyn Shape>;
    fn expand(
        &self,
        cx: &mut MacroCx<'_>,
        input: Expr,
        captures: Bindings,
    ) -> Result<Expr>;
}
Expand description

Contract for an expandable macro: its name, its syntax shape, and the expansion that rewrites a matched form into a new expression.

Required Methods§

Source

fn symbol(&self) -> Symbol

Returns the symbol the macro is registered under.

Source

fn syntax_shape(&self) -> Arc<dyn Shape>

Returns the shape the macro’s call syntax must match.

Source

fn expand( &self, cx: &mut MacroCx<'_>, input: Expr, captures: Bindings, ) -> Result<Expr>

Expands a matched input form into a replacement expression.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§