pub struct MeasurementContext {
pub observer: String,
pub instrument: String,
pub instant_secs: i64,
pub instant_nanos: u32,
pub frame: Option<String>,
pub uncertainty: Option<f64>,
pub stalk_id: Option<u64>,
}Expand description
A measurement context — the observer’s stalk (W7).
Captures who observed, with what instrument, at what instant, and the frame of reference. The measurement value itself is separate; this is the epistemic context.
Fields§
§observer: StringThe observer’s DID or IRI.
instrument: StringThe instrument identifier (e.g. “sensor:thermometer-0”).
instant_secs: i64Unix seconds when the measurement was taken.
instant_nanos: u32Nanoseconds within the second.
frame: Option<String>The frame of reference IRI (e.g. “frame:lab-inertial”).
uncertainty: Option<f64>The measurement uncertainty (± in the same units as the value).
stalk_id: Option<u64>The stalk ID this measurement belongs to.
Implementations§
Source§impl MeasurementContext
impl MeasurementContext
Sourcepub fn new(observer: &str, instrument: &str, instant_secs: i64) -> Self
pub fn new(observer: &str, instrument: &str, instant_secs: i64) -> Self
Creates a new MeasurementContext.
Sourcepub fn with_frame(self, frame: &str) -> Self
pub fn with_frame(self, frame: &str) -> Self
Builder — sets frame.
Sourcepub fn with_uncertainty(self, u: f64) -> Self
pub fn with_uncertainty(self, u: f64) -> Self
Builder — sets uncertainty.
Sourcepub fn with_stalk(self, stalk_id: u64) -> Self
pub fn with_stalk(self, stalk_id: u64) -> Self
Builder — sets stalk.
Sourcepub fn from_value(val: &Value) -> Option<Self>
pub fn from_value(val: &Value) -> Option<Self>
Extract from a Value::Record, if possible.
Trait Implementations§
Source§impl Clone for MeasurementContext
impl Clone for MeasurementContext
Source§impl Debug for MeasurementContext
impl Debug for MeasurementContext
Source§impl PartialEq for MeasurementContext
impl PartialEq for MeasurementContext
impl StructuralPartialEq for MeasurementContext
Auto Trait Implementations§
impl Freeze for MeasurementContext
impl RefUnwindSafe for MeasurementContext
impl Send for MeasurementContext
impl Sync for MeasurementContext
impl Unpin for MeasurementContext
impl UnsafeUnpin for MeasurementContext
impl UnwindSafe for MeasurementContext
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