pub trait PadLedgerStore: Send + Sync {
// Required method
fn update(
&self,
change: &mut dyn FnMut(&mut PadLedger) -> bool,
) -> Result<PadLedger, LedgerError>;
}Expand description
The durable record of a pad’s position — the state whose loss would be catastrophic, because reissuing a byte the send half has handed out is a two-time pad.
Required Methods§
Sourcefn update(
&self,
change: &mut dyn FnMut(&mut PadLedger) -> bool,
) -> Result<PadLedger, LedgerError>
fn update( &self, change: &mut dyn FnMut(&mut PadLedger) -> bool, ) -> Result<PadLedger, LedgerError>
Read the ledger, let change change it, and record the change durably before returning, all
under one exclusive hold: no other holder of this ledger reads it between the read and the
record. change answers false to leave the ledger as it was. Returns the ledger as it now
stands.
Implementors§
impl PadLedgerStore for FileLedger
Available on non-WebAssembly only.