git.delta.rocks / jrsonnet / refs/commits / 1178a0b35409

difftreelog

doc: builtin trait

Yaroslav Bolyukin2022-10-11parent: #420d09a.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/function/builtin.rsdiffbeforeafterboth
13 pub has_default: bool,13 pub has_default: bool,
14}14}
1515
16/// Do not implement it directly, instead use #[builtin] macro16/// Description of function defined by native code
17///
18/// Prefer to use #[builtin] macro, instead of manual implementation of this trait
17pub trait Builtin: Trace {19pub trait Builtin: Trace {
20 /// Function name to be used in stack traces
18 fn name(&self) -> &str;21 fn name(&self) -> &str;
22 /// Parameter names for named calls
19 fn params(&self) -> &[BuiltinParam];23 fn params(&self) -> &[BuiltinParam];
24 /// Call the builtin
20 fn call(&self, s: State, ctx: Context, loc: CallLocation, args: &dyn ArgsLike) -> Result<Val>;25 fn call(&self, s: State, ctx: Context, loc: CallLocation, args: &dyn ArgsLike) -> Result<Val>;
21}26}
2227