New Procedural Macros Crate v0.1

This commit is contained in:
J Henry Waugh
2020-08-01 11:52:26 -05:00
parent 99d56b8f81
commit d01203cb5d
28 changed files with 2230 additions and 5 deletions

View File

@@ -43,7 +43,7 @@ pub trait RegisterPlugin<PL: crate::plugin::Plugin> {
/// fn is_method_call(&self) -> bool { false }
/// fn is_varadic(&self) -> bool { false }
///
/// fn call(&self, args: &[&mut Dynamic], pos: Position) -> Result<Dynamic, Box<EvalAltResult>> {
/// fn call(&self, args: &mut[&mut Dynamic], pos: Position) -> Result<Dynamic, Box<EvalAltResult>> {
/// let x1: &FLOAT = args[0].downcast_ref::<FLOAT>().unwrap();
/// let y1: &FLOAT = args[1].downcast_ref::<FLOAT>().unwrap();
/// let x2: &FLOAT = args[2].downcast_ref::<FLOAT>().unwrap();
@@ -55,6 +55,13 @@ pub trait RegisterPlugin<PL: crate::plugin::Plugin> {
/// fn clone_boxed(&self) -> Box<dyn PluginFunction> {
/// Box::new(DistanceFunction())
/// }
///
/// fn input_types(&self) -> Box<[std::any::TypeId]> {
/// vec![std::any::TypeId::of::<FLOAT>(),
/// std::any::TypeId::of::<FLOAT>(),
/// std::any::TypeId::of::<FLOAT>(),
/// std::any::TypeId::of::<FLOAT>()].into_boxed_slice()
/// }
/// }
///
/// // A simple custom plugin. This should not usually be done with hand-written code.