pub trait Backend: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn constant(&self, code: &Core) -> Result<Value, ExecError>;
fn function(&self, code: &Core) -> Result<Callable, ExecError>;
// Provided methods
fn intercepting(
&self,
_by: Arc<dyn Interceptor>,
) -> Option<Arc<dyn Backend>> { ... }
fn stack_bytes(&self) -> usize { ... }
}Expand description
A way to execute Core.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
What to call this in a diagnostic or on a dashboard. Two backends running differentially need to be distinguishable in the report that says they disagreed.
Provided Methods§
Sourcefn intercepting(&self, _by: Arc<dyn Interceptor>) -> Option<Arc<dyn Backend>>
fn intercepting(&self, _by: Arc<dyn Interceptor>) -> Option<Arc<dyn Backend>>
The same program, executed with an Interceptor consulted at every call of a top-level
definition. None — the default — means this backend cannot do it.
Defaulted rather than required because it is not part of executing a program: a backend that only ever runs an application in production has no reason to carry it, and the seam should not grow a method every host must implement to serve one command.
Sourcefn stack_bytes(&self) -> usize
fn stack_bytes(&self) -> usize
How much host stack a thread must have before it calls into this backend.
Zero — the default — means “whatever the caller has”, which is the honest answer for a
backend that compiles to a machine-code loop and never nests host frames on the program’s
recursion. A tree-walker does nest, and needs to say so: docs/31 §31.3 records what
leaving it unsaid cost, which was a SIGSEGV where a diagnostic belonged.
It is part of the seam rather than of one crate because the runtime is what spawns
threads and the runtime may not name a backend crate (docs/19 §19.9). Asking the backend
it was handed is how it finds out without one.