[−][src]Trait gluon_vm::macros::Macro
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(
&self,
env: &mut MacroExpander,
args: Vec<SpannedExpr<Symbol>>
) -> MacroFuture
&self,
env: &mut MacroExpander,
args: Vec<SpannedExpr<Symbol>>
) -> MacroFuture
Methods
impl dyn Macro
pub fn is<T: Macro>(&self) -> bool
Returns true if the boxed type is the same as T
pub fn downcast_ref<T: Macro>(&self) -> Option<&T>
Returns some reference to the boxed value if it is of type T
, or
None
if it isn't.
pub unsafe fn downcast_ref_unchecked<T: Macro>(&self) -> &T
Returns a reference to the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
pub fn downcast_mut<T: Macro>(&mut self) -> Option<&mut T>
Returns some mutable reference to the boxed value if it is of type T
, or
None
if it isn't.
pub unsafe fn downcast_mut_unchecked<T: Macro>(&mut self) -> &mut T
Returns a mutable reference to the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
impl dyn Macro
pub fn downcast<T: Macro>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
Returns the boxed value if it is of type T
, or Err(Self)
if it isn't.
pub unsafe fn downcast_unchecked<T: Macro>(self: Box<Self>) -> Box<T>
Returns the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
Implementors
impl<F: Any + Clone + Send + Sync> Macro for F where
F: Fn(&mut MacroExpander, Vec<SpannedExpr<Symbol>>) -> Box<dyn Future<Item = SpannedExpr<Symbol>, Error = Error> + Send>,
[src]
F: Fn(&mut MacroExpander, Vec<SpannedExpr<Symbol>>) -> Box<dyn Future<Item = SpannedExpr<Symbol>, Error = Error> + Send>,
fn expand(
&self,
env: &mut MacroExpander,
args: Vec<SpannedExpr<Symbol>>
) -> Box<dyn Future<Item = SpannedExpr<Symbol>, Error = Error> + Send>
[src]
&self,
env: &mut MacroExpander,
args: Vec<SpannedExpr<Symbol>>
) -> Box<dyn Future<Item = SpannedExpr<Symbol>, Error = Error> + Send>