#[non_exhaustive]pub struct Sample {
pub key_expr: KeyExpr<'static>,
pub value: Value,
pub kind: SampleKind,
pub timestamp: Option<Timestamp>,
pub qos: QoS,
pub source_info: SourceInfo,
pub attachment: Option<Attachment>,
}
Expand description
A zenoh sample.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.key_expr: KeyExpr<'static>
The key expression on which this Sample was published.
value: Value
The value of this Sample.
kind: SampleKind
The kind of this Sample.
timestamp: Option<Timestamp>
The Timestamp
of this Sample.
qos: QoS
Quality of service settings this sample was sent with.
source_info: SourceInfo
Available on crate feature
unstable
only.
🔬
This API has been marked as unstable: it works as advertised, but we may change it in a future release.
To use it, you must enable zenoh's
unstable
feature flag.
Infos on the source of this Sample.
attachment: Option<Attachment>
Available on crate feature
unstable
only.
🔬
This API has been marked as unstable: it works as advertised, but we may change it in a future release.
To use it, you must enable zenoh's
unstable
feature flag.
A map of key-value pairs, where each key and value are byte-slices.
Implementations§
source§impl Sample
impl Sample
sourcepub fn new<IntoKeyExpr, IntoValue>(
key_expr: IntoKeyExpr,
value: IntoValue
) -> Self
pub fn new<IntoKeyExpr, IntoValue>( key_expr: IntoKeyExpr, value: IntoValue ) -> Self
Creates a new Sample.
sourcepub fn try_from<TryIntoKeyExpr, IntoValue>(
key_expr: TryIntoKeyExpr,
value: IntoValue
) -> Result<Self, Error>
pub fn try_from<TryIntoKeyExpr, IntoValue>( key_expr: TryIntoKeyExpr, value: IntoValue ) -> Result<Self, Error>
Creates a new Sample.
sourcepub fn get_timestamp(&self) -> Option<&Timestamp>
pub fn get_timestamp(&self) -> Option<&Timestamp>
Gets the timestamp of this Sample.
sourcepub fn with_timestamp(self, timestamp: Timestamp) -> Self
pub fn with_timestamp(self, timestamp: Timestamp) -> Self
Sets the timestamp of this Sample.
sourcepub fn with_source_info(self, source_info: SourceInfo) -> Self
Available on crate feature unstable
only.
pub fn with_source_info(self, source_info: SourceInfo) -> Self
unstable
only.Sets the source info of this Sample.
This API has been marked as unstable: it works as advertised, but it may be changed in a future release.
sourcepub fn ensure_timestamp(&mut self) -> &Timestamp
pub fn ensure_timestamp(&mut self) -> &Timestamp
Ensure that an associated Timestamp is present in this Sample. If not, a new one is created with the current system time and 0x00 as id. Get the timestamp of this sample (either existing one or newly created)
pub fn attachment(&self) -> Option<&Attachment>
Available on crate feature
unstable
only.pub fn attachment_mut(&mut self) -> &mut Option<Attachment>
Available on crate feature
unstable
only.pub fn with_attachment(self, attachment: Attachment) -> Self
Available on crate feature
unstable
only.Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sample
impl !RefUnwindSafe for Sample
impl Send for Sample
impl Sync for Sample
impl Unpin for Sample
impl !UnwindSafe for Sample
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