Skip to main content

Observer

Trait Observer 

Source
pub trait Observer {
    // Required methods
    fn name(&self) -> &str;
    fn about(&self) -> &str;
    fn handles(&self, locator: &str) -> bool;
    fn observe(&self, locator: &str) -> Result<WorldState>;
}
Expand description

Something that can turn a locator into a world state.

Required Methods§

Source

fn name(&self) -> &str

Stable name; recorded in WorldState::observer and hashed into the decision record.

Source

fn about(&self) -> &str

One sentence for scema observe --list.

Source

fn handles(&self, locator: &str) -> bool

Could this observer handle the locator? Cheap and syntactic — a true here is a claim about the shape of the string, not a promise the target exists.

Source

fn observe(&self, locator: &str) -> Result<WorldState>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§