Skip to main content

Module callback

Module callback 

Source
Expand description

Thread-local eval context for Rust→Clojure callbacks.

When a native (Rust) builtin needs to call a Clojure function — for example, a comparator passed to sort-by — it can use invoke to do so. The eval context is pushed automatically before every native function call and popped afterward, so invoke is always available inside builtins.

Structs§

EvalContextGuard
RAII guard that pops one eval context on drop (including on unwind).

Functions§

capture_eval_context
Capture the current eval context so it can be installed on another thread.
current_is_async
True when the innermost active eval context is inside an ^:async function body. Returns false when there is no active context.
install_eval_context
Install a previously captured eval context on the current thread.
install_eval_context_guard
Like install_eval_context, but returns a guard that pops the context when dropped.
invoke
pop_eval_context
Pop the eval context after a native function returns.
push_eval_context
Push the current eval context before calling a native function.
with_eval_context
Call a Clojure-callable Value with the given arguments.