pub trait ConsumedEnvelopeLedger {
// Required method
fn spend(&mut self, envelope_id: &str) -> bool;
}Expand description
The single-use record §8.3’s final step obliges a recipient to keep
(RFC 0003 §2): id is spent at ACCEPTANCE, and a second presentation
of the same id is refused with APH_E018.
The protocol states the obligation, not the storage — a single process
may use a set, a cluster needs shared state, a notary MAY offer a burn
endpoint — so this is a port. The retention contract an implementor
signs up for: an id MUST be retained at least until its envelope’s
validUntil has passed, and MAY be discarded thereafter, because
verify_envelope_window already refuses the envelope from then on.
Required Methods§
Sourcefn spend(&mut self, envelope_id: &str) -> bool
fn spend(&mut self, envelope_id: &str) -> bool
Records envelope_id as spent iff it was not already; returns whether
this call was the one that spent it. One atomic question, because
separate “seen?” and “record!” calls are a check-then-act race — two
concurrent presentations would both pass the check.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".