Add example to function pointer.

This commit is contained in:
Stephen Chung
2020-10-15 20:05:23 +08:00
parent a6fa94d946
commit ea9ef1091a
4 changed files with 62 additions and 10 deletions

View File

@@ -114,7 +114,8 @@ Any custom syntax must include an _implementation_ of it.
The function signature of an implementation is:
> `Fn(scope: &mut Scope, context: &mut EvalContext, inputs: &[Expression]) -> Result<Dynamic, Box<EvalAltResult>>`
> `Fn(scope: &mut Scope, context: &mut EvalContext, inputs: &[Expression])`
> `-> Result<Dynamic, Box<EvalAltResult>>`
where:

View File

@@ -62,7 +62,8 @@ Function Signature
The function signature passed to `Engine::on_var` takes the following form:
> `Fn(name: &str, index: usize, scope: &Scope, context: &EvalContext) -> Result<Option<Dynamic>, Box<EvalAltResult>> + 'static`
> `Fn(name: &str, index: usize, scope: &Scope, context: &EvalContext)`
> `-> Result<Option<Dynamic>, Box<EvalAltResult>> + 'static`
where: