[][src]Trait gluon_vm::macros::Macro

pub trait Macro: Trace + DowncastArc + Send + Sync {
    fn expand<'r, 'a: 'r, 'b: 'r, 'ast: 'r>(
        &self,
        env: &'b mut MacroExpander<'a>,
        arena: &'b mut OwnedArena<'ast, Symbol>,
        args: &'b mut [SpannedExpr<'ast, Symbol>]
    ) -> MacroFuture<'r, 'ast>; fn get_capability<T>(
        &self,
        thread: &Thread,
        arc_self: &Arc<dyn Macro>
    ) -> Option<T>
    where
        Self: Sized,
        T: Any
, { ... }
fn get_capability_impl(
        &self,
        thread: &Thread,
        arc_self: &Arc<dyn Macro>,
        id: TypeId
    ) -> Option<Box<dyn Any>> { ... } }

A trait which abstracts over macros.

A macro is similiar to a function call but is run at compile time instead of at runtime.

Required methods

fn expand<'r, 'a: 'r, 'b: 'r, 'ast: 'r>(
    &self,
    env: &'b mut MacroExpander<'a>,
    arena: &'b mut OwnedArena<'ast, Symbol>,
    args: &'b mut [SpannedExpr<'ast, Symbol>]
) -> MacroFuture<'r, 'ast>

Loading content...

Provided methods

fn get_capability<T>(
    &self,
    thread: &Thread,
    arc_self: &Arc<dyn Macro>
) -> Option<T> where
    Self: Sized,
    T: Any

fn get_capability_impl(
    &self,
    thread: &Thread,
    arc_self: &Arc<dyn Macro>,
    id: TypeId
) -> Option<Box<dyn Any>>

Loading content...

Implementations

impl dyn Macro[src]

pub fn is<__T: Macro>(&self) -> bool[src]

Returns true if the trait object wraps an object of type __T.

pub fn downcast<__T: Macro>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>[src]

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn't.

pub fn downcast_rc<__T: Macro>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>[src]

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn't.

pub fn downcast_ref<__T: Macro>(&self) -> Option<&__T>[src]

Returns a reference to the object within the trait object if it is of type __T, or None if it isn't.

pub fn downcast_mut<__T: Macro>(&mut self) -> Option<&mut __T>[src]

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn't.

impl dyn Macro[src]

pub fn downcast_arc<T: Macro>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> where
    Self: Send + Sync
[src]

Implementations on Foreign Types

impl<M: ?Sized> Macro for Box<M> where
    M: Macro
[src]

impl<M: ?Sized> Macro for Arc<M> where
    M: Macro
[src]

Loading content...

Implementors

Loading content...