Observable

Trait Observable 

Source
pub trait Observable: Debug + Identifiable {
    // Required methods
    fn observation(&self) -> NumericalValue;
    fn observed_effect(&self) -> NumericalValue;

    // Provided method
    fn effect_observed(
        &self,
        target_threshold: NumericalValue,
        target_effect: NumericalValue,
    ) -> bool { ... }
}
Expand description

Observable trait for objects that can be observed.

Requires:

  • Debug - for debug printing
  • Identifiable - for unique identification

Provides methods:

  • observation() - gets the numerical observation value
  • observed_effect() - gets the observed effect value
  • effect_observed() - checks if observation meets threshold and matches effect

effect_observed() checks:

  • observation >= target_threshold
  • observed_effect == target_effect

Required Methods§

Provided Methods§

Source

fn effect_observed( &self, target_threshold: NumericalValue, target_effect: NumericalValue, ) -> bool

Checks if the observed effect meets the target threshold and effect.

Returns true if:

  • observation() >= target_threshold
  • observed_effect() == target_effect

Otherwise returns false.

Implementors§