Function Library (Fn)
Linked with the "fn" type.
Example Usage
#[main]
fn main() {
const f = ():str => 'hello';
assert_eq(Fn.call(f), 'hello');
assert_eq(f.call(), 'hello');
assert_eq(f(), 'hello');
}Fn.attributes(func: fn) -> map
const func: fn = self.hi; // #[hi] fn hi() {}
assert_eq(func.attributes(), {"hi": null});Fn.call(func: fn, ..) -> unknown
const func: fn = (name: str):str => "Hi, " + name;
assert_eq(func.call("Bob"), "Hi, Bob");Fn.call_expanded(func: fn, ..) -> unknown
Fn.data(func: fn) -> data
Fn.has_attribute(func: fn, name: str) -> bool
Fn.id(func: fn) -> str
Fn.is_async(func: fn) -> bool
Fn.name(func: fn) -> str
Fn.obj(func: fn) -> obj
Fn.objs(func: fn) -> list
Fn.params(func: fn) -> list
Fn.return_type(func: fn) -> str
Last updated