Macro tylisp::defun [−][src]
macro_rules! defun { {$id:ty { $($body:tt)* }} => { ... }; {@$self: tt ($($id_gen:tt)*) $id:ty { $( ($($generics:tt)*) $(calc where ($($calcbound:tt)*))? { $($args:tt)* } $({$($preamble:stmt;)*})? => { $($out:tt)* }; )* }} => { ... }; }
Expand description
Setup a new function, and some match arms for implementation
This is really a cross between a macro and a traditional Lisp function. It takes evaluated arguments as input (which means bounds can easily be placed on the result), but builds syntax that, when evaluated, produces the correct result.
In more complicated situations, it may be beneficial (or necessary) to write some or all of the trait implementations directly.