Skip to content

Commit 1a641c7

Browse files
committed
Updating docs and comments around builtins
1 parent 77f57fb commit 1a641c7

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

USAGE.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,15 @@ pub struct CompileTimeEnv {
226226
Builtins are functions provided by the compiler/VM and the only functions available.
227227

228228
```rust
229-
pub struct BuiltinFn {
230-
// Needs to follow identifier naming rules
231-
pub name: String,
232-
// Arguments the function expects
233-
pub args: Vec<FnArg>,
229+
pub struct BuiltinFn<'a> {
230+
/// Needs to follow identifier naming rules
231+
pub name: &'static str,
232+
/// Arguments the function expects
233+
pub args: &'a [FnArg],
234+
/// Type returned by the function
234235
pub return_type: Type,
235-
// Function used at runtime
236-
pub func: std::rc::Rc<dyn Fn(Vec<Value>) -> Value>,
236+
/// Function used at runtime
237+
pub func: fn(Vec<Value>) -> ExprResult<Value>,
237238
}
238239

239240
pub struct FnArg {

src/builtins.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ impl FnArg {
3131
#[derive(Clone)]
3232
/// Builtin function used in expressions
3333
pub struct BuiltinFn<'a> {
34-
// Needs to follow identifier naming rules
34+
/// Needs to follow identifier naming rules
3535
pub name: &'static str,
36-
// Arguments the function expects
36+
/// Arguments the function expects
3737
pub args: &'a [FnArg],
38+
/// Type returned by the function
3839
pub return_type: Type,
39-
// Function used at runtime
40+
/// Function used at runtime
4041
pub func: fn(Vec<Value>) -> ExprResult<Value>,
4142
}
4243

0 commit comments

Comments
 (0)