pub trait Sensor: Send {
// Required methods
fn descriptor(&self) -> SensorDescriptor;
fn bind(&mut self, ctx: &mut BindContext<'_>) -> Result<()>;
fn observe(&mut self, out: &mut StateWriter<'_>) -> SensorOutcome;
}Expand description
A passive source of observations.
Implementors must be honest about Perturbation. The reflector checks
that no registered sensor declares Perturbation::Material, but it cannot
check that a sensor declaring Negligible is telling the truth. That is a
review obligation, and it is why each sensor’s module documentation states
the physical basis for its claim.
Required Methods§
fn descriptor(&self) -> SensorDescriptor
Sourcefn bind(&mut self, ctx: &mut BindContext<'_>) -> Result<()>
fn bind(&mut self, ctx: &mut BindContext<'_>) -> Result<()>
Resolve everything resolvable once: which entities exist, which files to read, which descriptors to open, which columns to fill.
This is where CoreScout earns its keep as a normalisation layer. Path
construction, parsing setup and capability probing happen here, once per
epoch, so that Sensor::observe is close to pure I/O.
Returning Err means the sensor is unavailable on this machine, which
is a normal outcome. The error’s kind decides what the mirror reports:
permission denied, unsupported, or merely unavailable.
Sourcefn observe(&mut self, out: &mut StateWriter<'_>) -> SensorOutcome
fn observe(&mut self, out: &mut StateWriter<'_>) -> SensorOutcome
Sample the machine once.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".