Skip to main content

Checked

Trait Checked 

Source
pub trait Checked {
    // Required methods
    fn check(&self) -> Result<()>;
    fn carry_forward(&mut self);
}
Expand description

A state that can say whether it is one a provider may act on, and what it becomes when it arrived at an older version.

Shape is what serde proves, and shape is not enough for a document that came off a disk: a session token names a file under the state root and a branch name goes on to spell a ref, so a seeded state that carries an unusable one is refused where it is read rather than wherever it first happens to be used.

Both halves belong to the same boundary — the read — which is why they are one trait. A document is refused or it is the current shape; nothing past here has to ask which version it came in as.

Required Methods§

Source

fn check(&self) -> Result<()>

Refuse this state, naming what is wrong with it.

Source

fn carry_forward(&mut self)

Carry a document that declared an older readable version forward to the one this build writes.

Called on every read, after check has decided the version is one this build reads at all. It has no default: a state type that says nothing about what an older document becomes is one whose next field addition writes a document declaring a version it is not.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Checked for HostState

A seeded host side is refused if it holds a change nothing could address.

Source§

impl Checked for VcsState

A seeded repository side is refused if it holds a session nothing could act on.