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§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Stable name; recorded in WorldState::observer and hashed into the decision record.
Sourcefn handles(&self, locator: &str) -> bool
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.
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".