pub struct StateSnapshot {
pub user_id: String,
pub updated_at_unix_ms: i64,
pub source: Source,
pub confidence: f32,
pub axes: BTreeMap<String, f32>,
}Expand description
A snapshot of user state at a point in time.
State is represented as values along named axes, where each axis is a value in [0.0, 1.0] with defined semantics.
§PII Redaction
The Debug implementation redacts the user_id field to prevent
accidental logging of personally identifiable information. Only
the first 4 characters are shown, followed by ....
Fields§
§user_id: StringUnique identifier for the user.
updated_at_unix_ms: i64Unix timestamp in milliseconds when this snapshot was created/updated.
source: SourceHow this state was obtained.
confidence: f32Confidence in the accuracy of this snapshot [0.0, 1.0].
axes: BTreeMap<String, f32>Axis values as a map from axis name to value. Values must be in [0.0, 1.0].
Implementations§
Source§impl StateSnapshot
impl StateSnapshot
Sourcepub fn builder() -> StateSnapshotBuilder
pub fn builder() -> StateSnapshotBuilder
Create a new builder for constructing a StateSnapshot.
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Validate the snapshot, returning errors if invalid.
Sourcepub fn get_axis(&self, name: &str) -> f32
pub fn get_axis(&self, name: &str) -> f32
Get an axis value, returning the default (0.5) if not present.
Sourcepub fn get_axis_opt(&self, name: &str) -> Option<f32>
pub fn get_axis_opt(&self, name: &str) -> Option<f32>
Get an axis value if present.
Trait Implementations§
Source§impl Clone for StateSnapshot
impl Clone for StateSnapshot
Source§fn clone(&self) -> StateSnapshot
fn clone(&self) -> StateSnapshot
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StateSnapshot
impl Debug for StateSnapshot
Source§impl Default for StateSnapshot
impl Default for StateSnapshot
Source§impl<'de> Deserialize<'de> for StateSnapshot
impl<'de> Deserialize<'de> for StateSnapshot
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>,
Auto Trait Implementations§
impl Freeze for StateSnapshot
impl RefUnwindSafe for StateSnapshot
impl Send for StateSnapshot
impl Sync for StateSnapshot
impl Unpin for StateSnapshot
impl UnwindSafe for StateSnapshot
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)