pub fn embedding(reviews: Reviews, grants: &[&str], limits: Limits) -> EmbeddingExpand description
Registers reviews, grants grants, imposes limits, and watches the
boundary.
Registering a module does not grant it: a capability missing from grants
makes every call into the module a refusal, which is one of the cases the
tests beside this file pin.
limits is what bounds the session: it is installed on the registry
before anything runs, and every invocation the session makes spends out of
the one budget. That is what an application wants for the limits that are
about the process rather than about a request.
It is no longer the only choice, which it was when this example was
written. A limit that belongs to one request is what a rule engine actually
wants – a rule package is somebody else’s code, and an application running
one wants to be told when a rule loops rather than to stop serving – and
Session::evaluate_within is that: the same compiled package, the same
Vm, and a Budget per invocation. Issue #152 was the gap, and
examples/rules/README.md says what it used to cost.
Pass Limits::default here for a session that is bounded per request and
not otherwise, which is what the cases beside this file do.