Skip to main content

PressureSource

Trait PressureSource 

Source
pub trait PressureSource: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn sample(&self) -> Pressure;

    // Provided methods
    fn weight(&self) -> f64 { ... }
    fn is_hard(&self) -> bool { ... }
}
Available on crate feature governor only.
Expand description

A source of normalised pressure feeding the unified governor.

Implementors are wrappers over the real signal (memory guard, and later CPU, queue depth, etc.). Keeping the trait here – not in the signal’s own module – keeps memory a leaf with no governor dependency.

Required Methods§

Source

fn name(&self) -> &'static str

Stable identifier for diagnostics (e.g. "memory").

Source

fn sample(&self) -> Pressure

Sample the current pressure.

Provided Methods§

Source

fn weight(&self) -> f64

Sensitivity weight applied to SOFT signals in the combine. HARD signals ignore this (they are never down-weighted). Default 1.0.

Source

fn is_hard(&self) -> bool

HARD signals are never masked or down-weighted – their raw reading always competes for the combined level. Default false.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§