From 1178a0b35409ec6a45d586b5e41db7acb119187f Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 11 Oct 2022 17:17:50 +0000 Subject: [PATCH] doc: builtin trait --- --- a/crates/jrsonnet-evaluator/src/function/builtin.rs +++ b/crates/jrsonnet-evaluator/src/function/builtin.rs @@ -13,10 +13,15 @@ pub has_default: bool, } -/// Do not implement it directly, instead use #[builtin] macro +/// Description of function defined by native code +/// +/// Prefer to use #[builtin] macro, instead of manual implementation of this trait pub trait Builtin: Trace { + /// Function name to be used in stack traces fn name(&self) -> &str; + /// Parameter names for named calls fn params(&self) -> &[BuiltinParam]; + /// Call the builtin fn call(&self, s: State, ctx: Context, loc: CallLocation, args: &dyn ArgsLike) -> Result; } -- gitstuff