Skip to main content

PowerCutRig

Trait PowerCutRig 

Source
pub trait PowerCutRig {
    // Required methods
    fn storage(&mut self) -> &mut dyn Storage;
    fn cut_after(&mut self, ops: u32);
    fn restart(&mut self);
}
Expand description

A Storage over a fake of its medium, which can lose the power: what a backend writes to run power_cut_suite.

Required Methods§

Source

fn storage(&mut self) -> &mut dyn Storage

The storage as the game sees it.

Source

fn cut_after(&mut self, ops: u32)

The power goes after ops more operations on the medium (a file written, renamed or removed, a folder synced; a flash sector erased), and every operation after that fails.

Source

fn restart(&mut self)

The power comes back. The medium keeps only what it had made durable, the storage is opened again over it, as at the game’s next start, and no cut is pending.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§