pub struct InferredState { /* private fields */ }Expand description
Complete inferred state across multiple axes.
Implementations§
Source§impl InferredState
impl InferredState
Sourcepub fn update(&mut self, estimate: AxisEstimate)
pub fn update(&mut self, estimate: AxisEstimate)
Add or update an axis estimate.
If an estimate already exists, the new one wins if:
- It’s self-report (always wins), or
- It has higher confidence than existing non-self-report
Sourcepub fn get(&self, axis: &str) -> Option<&AxisEstimate>
pub fn get(&self, axis: &str) -> Option<&AxisEstimate>
Get estimate for an axis.
Sourcepub fn all(&self) -> impl Iterator<Item = &AxisEstimate>
pub fn all(&self) -> impl Iterator<Item = &AxisEstimate>
Get all estimates.
Sourcepub fn override_with_self_report(&mut self, axis: impl Into<String>, value: f32)
pub fn override_with_self_report(&mut self, axis: impl Into<String>, value: f32)
Apply an override from self-report.
This sets the axis to the self-reported value with confidence 1.0, regardless of any existing inference.
Sourcepub fn prune_stale(&mut self, max_age_seconds: i64)
pub fn prune_stale(&mut self, max_age_seconds: i64)
Remove stale estimates.
Sourcepub fn merge(&mut self, other: InferredState)
pub fn merge(&mut self, other: InferredState)
Merge another state into this one.
Self-report always wins. For inference vs inference, higher confidence wins.
Trait Implementations§
Source§impl Clone for InferredState
impl Clone for InferredState
Source§fn clone(&self) -> InferredState
fn clone(&self) -> InferredState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InferredState
impl Debug for InferredState
Source§impl Default for InferredState
impl Default for InferredState
Source§fn default() -> InferredState
fn default() -> InferredState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for InferredState
impl<'de> Deserialize<'de> for InferredState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InferredState
impl RefUnwindSafe for InferredState
impl Send for InferredState
impl Sync for InferredState
impl Unpin for InferredState
impl UnsafeUnpin for InferredState
impl UnwindSafe for InferredState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more