pub struct ApprovalToken { /* private fields */ }Expand description
An explicit, scoped approval to execute one irreversible effect occurrence.
The token is the approval boundary made into a value: constructing one
is the decision, and admit_irreversible accepts it only for the exact
EffectId it was minted against, so an approval for one charge cannot
launder another. Within a process this is a proof of explicit decision —
it cannot stop code that is determined to forge one, and it is not meant
to; cross-process attestation is R0.9’s signed-receipt work. What it does
guarantee is structural: there is no code path through the typed kernel
that executes an irreversible effect on a defaulted or forgotten
approval.
Tokens ride the run via crate::executor::RunConfig::with_effect_approvals
so the approval set travels with the run’s configuration.
Implementations§
Source§impl ApprovalToken
impl ApprovalToken
Sourcepub fn approve(effect_id: EffectId, approved_by: impl Into<String>) -> Self
pub fn approve(effect_id: EffectId, approved_by: impl Into<String>) -> Self
Mint an approval for exactly one effect id. This constructor is the
approval act: call sites should read as decisions (let approval = ApprovalToken::approve(id, "ops:amjad")), not as plumbing.
Sourcepub fn for_effect<E: IrreversibleEffect>(
effect: &E,
scope: &str,
approved_by: impl Into<String>,
) -> Self
pub fn for_effect<E: IrreversibleEffect>( effect: &E, scope: &str, approved_by: impl Into<String>, ) -> Self
Mint an approval scoped to effect’s derived id within scope — the
common case, approving the occurrence a run is about to execute.
Sourcepub fn approved_by(&self) -> &str
pub fn approved_by(&self) -> &str
Who approved.
Trait Implementations§
Source§impl Clone for ApprovalToken
impl Clone for ApprovalToken
Source§fn clone(&self) -> ApprovalToken
fn clone(&self) -> ApprovalToken
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more