Struct zenoh::sample::Sample

source ·
#[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

source

pub fn new<IntoKeyExpr, IntoValue>( key_expr: IntoKeyExpr, value: IntoValue ) -> Self
where IntoKeyExpr: Into<KeyExpr<'static>>, IntoValue: Into<Value>,

Creates a new Sample.

source

pub fn try_from<TryIntoKeyExpr, IntoValue>( key_expr: TryIntoKeyExpr, value: IntoValue ) -> Result<Self, Error>
where TryIntoKeyExpr: TryInto<KeyExpr<'static>>, <TryIntoKeyExpr as TryInto<KeyExpr<'static>>>::Error: Into<Error>, IntoValue: Into<Value>,

Creates a new Sample.

source

pub fn get_timestamp(&self) -> Option<&Timestamp>

Gets the timestamp of this Sample.

source

pub fn with_timestamp(self, timestamp: Timestamp) -> Self

Sets the timestamp of this Sample.

source

pub fn with_source_info(self, source_info: SourceInfo) -> Self

Available on crate feature 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.
source

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)

source

pub fn attachment(&self) -> Option<&Attachment>

Available on crate feature unstable only.
source

pub fn attachment_mut(&mut self) -> &mut Option<Attachment>

Available on crate feature unstable only.
source

pub fn with_attachment(self, attachment: Attachment) -> Self

Available on crate feature unstable only.

Trait Implementations§

source§

impl Clone for Sample

source§

fn clone(&self) -> Sample

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Sample

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DerefMut for Sample

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Display for Sample

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Sample> for Value

source§

fn from(s: Sample) -> Self

Converts to this type from the input type.
source§

impl TryFrom<Reply> for Sample

§

type Error = Value

The type returned in the event of a conversion error.
source§

fn try_from(value: Reply) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Deref for Sample

§

type Target = Value

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsNode<T> for T

source§

fn as_node(&self) -> &T

source§

impl<T> AsNodeMut<T> for T

source§

fn as_node_mut(&mut self) -> &mut T

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more