pub struct SampleView {Show 13 fields
pub key: String,
pub payload: ZBytes,
pub encoding: String,
pub kind: SampleKind,
pub timestamp: Option<Timestamp>,
pub stamped_by: Option<StampProvenance>,
pub attachment: Option<ZBytes>,
pub priority: Priority,
pub congestion_control: CongestionControl,
pub reliability: Reliability,
pub express: bool,
pub source: Option<SampleSource>,
pub received: Instant,
}Expand description
One observed sample, cheap to clone (the payload is zenoh’s refcounted buffer, not a copy — report §14’s zero-copy discipline).
Fields§
§key: StringFull wire key, as received (this session is un-namespaced).
payload: ZBytes§encoding: StringThe sample’s declared encoding, verbatim.
kind: SampleKind§timestamp: Option<Timestamp>HLC timestamp, when the sample carried one.
Absent is common — nothing on the path had timestamping enabled — and
absence must never be defaulted to an arrival time. This is not
necessarily the publisher’s clock: see SampleView::stamped_by for
whose it is. SampleView::received is ours, and the two are never
mixed (a consumer plotting a time axis states which one it plotted).
stamped_by: Option<StampProvenance>Who stamped SampleView::timestamp — None exactly when it is.
The stamper’s identity rode on every sample all along and was thrown away, which is how “the publisher’s HLC” survived as a description of a number that is often a router’s (issue #213).
attachment: Option<ZBytes>The sample’s attachment, when it carried one — zenoh’s refcounted
buffer, like the payload, so retaining it is a refcount bump and the
per-sample allocation floor stands (docs/zero-copy.md §4).
None means the sample carried none: an attachment is a wire fact,
not a decode, and what arrived is a fact to show (#117).
priority: PriorityThe wire’s actual QoS axes (#120) — always present: zenoh stamps
every sample with them, defaults included. A registry declares a
profile; these are what actually rode, and the two can disagree —
which is exactly what a frontend renders. All Copy.
Deliberately absent: SHM-vs-raw buffer provenance. zenoh 1.9’s
public API does not expose it on a received sample, and chasing it
through zenoh::internal is the dependency this crate refuses
(nuze’s decoder is the cautionary tale).
congestion_control: CongestionControl§reliability: Reliability§express: bool§source: Option<SampleSource>The publishing entity, when SourceInfo rode the sample. None is
“the publisher’s session does not attach it” — common, and not a
defect.
received: InstantArrival, on this observer’s monotonic clock — always available, never wall-clock, and never a claim about when the sample was produced.
Stamped per sample rather than per batch so a consumer that coalesces (zengui ticks at 250 ms) can still space a 5 Hz key’s samples truthfully instead of collapsing a tick’s worth onto one instant.
Implementations§
Source§impl SampleView
impl SampleView
Sourcepub fn of(sample: &Sample) -> SampleView
pub fn of(sample: &Sample) -> SampleView
Build a view from a received sample.
The one place this conversion lives. It was written out by hand twice — here and on the seed/GET-reply path — and the second copy is exactly the kind of site that silently misses a new field: adding stamp provenance to only one of them would have left seeded samples unattributed for no stated reason (issue #213).
Sourcepub fn qos_matches(&self, profile: QosProfile) -> bool
pub fn qos_matches(&self, profile: QosProfile) -> bool
Whether the wire’s actual axes match a declared profile (RFC 04 §3) — the declared-vs-observed comparison nobody else in the field can render, because nobody else holds a registry that declares QoS.
Trait Implementations§
Source§impl Clone for SampleView
impl Clone for SampleView
Source§fn clone(&self) -> SampleView
fn clone(&self) -> SampleView
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SampleView
impl !UnwindSafe for SampleView
impl Freeze for SampleView
impl Send for SampleView
impl Sync for SampleView
impl Unpin for SampleView
impl UnsafeUnpin for SampleView
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more