pub struct Sample<T> {
pub value: T,
pub provenance: Provenance,
pub freshness: Freshness,
pub envelope: Envelope,
}Expand description
A signal value with its provenance, its freshness and its envelope.
Fields§
§value: TThe value. Never absent: the init value under Init, and the last good
value or the init value under Invalid.
provenance: ProvenanceWhere the value comes from.
freshness: FreshnessHow old the value is.
envelope: EnvelopeThe sender’s timestamp and sequence number.
Implementations§
Source§impl<T> Sample<T>
impl<T> Sample<T>
Sourcepub fn usable(&self) -> bool
pub fn usable(&self) -> bool
true when the provenance is Live and the freshness is not Stale.
Examples found in repository?
examples/read_sample.rs (line 374)
364fn main() {
365 let steps = [
366 "init",
367 "live",
368 "stale",
369 "declared invalid",
370 "detected invalid",
371 "corrupt",
372 ];
373 for (step, sample) in steps.iter().zip(walk()) {
374 println!("{step}: {sample:?} usable={}", sample.usable());
375 }
376}Trait Implementations§
impl<T: Copy> Copy for Sample<T>
impl<T: Eq> Eq for Sample<T>
impl<T: PartialEq> StructuralPartialEq for Sample<T>
Auto Trait Implementations§
impl<T> Freeze for Sample<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sample<T>where
T: RefUnwindSafe,
impl<T> Send for Sample<T>where
T: Send,
impl<T> Sync for Sample<T>where
T: Sync,
impl<T> Unpin for Sample<T>where
T: Unpin,
impl<T> UnsafeUnpin for Sample<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Sample<T>where
T: UnwindSafe,
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