pub trait TypedEffect {
const EFFECT: Effect;
// Required methods
fn kind(&self) -> &str;
fn input_hash(&self) -> &str;
// Provided methods
fn idempotency_key(&self) -> Option<&str> { ... }
fn effect_id(&self, scope: &str) -> EffectId { ... }
}Expand description
The typed half of the effect taxonomy: an effect type’s contract with the kernel.
Implement this trait plus exactly one marker trait (PureEffect,
ReadOnlyEffect, IdempotentEffect, CompensatableEffect,
IrreversibleEffect) to declare an effect’s safety class. The marker is
the compile-time claim; TypedEffect::EFFECT is the wire-level class it
must agree with — every admission helper checks the two against each
other, so a type whose marker and declared class disagree is rejected at
the enforcement point, not silently misclassified.
Required Associated Constants§
Required Methods§
Sourcefn kind(&self) -> &str
fn kind(&self) -> &str
The effect kind: a stable, application-chosen identifier
("charge_card", "index_document"). Part of the effect id and the
key under which rollback handlers are registered, so it must not
change between deployments that share a journal.
Sourcefn input_hash(&self) -> &str
fn input_hash(&self) -> &str
Lowercase hex SHA-256 of the effect’s canonical input. Two calls with
equal inputs must hash equal — use the canonical serde_json
serialization, as crate::record::PayloadRef::content_hash does.
Provided Methods§
Sourcefn idempotency_key(&self) -> Option<&str>
fn idempotency_key(&self) -> Option<&str>
The idempotency key the effect commits under, when it has one. The
key participates in the effect id, so retried derivation under the
same key converges on the id a recovery pass looks up. None is
honest only for effects that are freely repeatable without a key.
Sourcefn effect_id(&self, scope: &str) -> EffectId
fn effect_id(&self, scope: &str) -> EffectId
This effect’s deterministic id within scope (usually the run id) —
derive_effect_id over the type’s own contract fields.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".