#[non_exhaustive]pub struct Sample { /* private fields */ }Expand description
The Sample structure is the data unit received
by Subscriber or Querier
or Session::get.
It contains the payload and all metadata associated with the data.
Implementations§
Source§impl Sample
impl Sample
Sourcepub fn key_expr(&self) -> &KeyExpr<'static>
pub fn key_expr(&self) -> &KeyExpr<'static>
Gets the key expression on which this Sample was published.
Sourcepub fn payload_mut(&mut self) -> &mut ZBytes
pub fn payload_mut(&mut self) -> &mut ZBytes
Gets the payload of this Sample.
Sourcepub fn kind(&self) -> SampleKind
pub fn kind(&self) -> SampleKind
Gets the kind of this Sample.
Sourcepub fn congestion_control(&self) -> CongestionControl
pub fn congestion_control(&self) -> CongestionControl
Gets the congestion control of this Sample.
Sourcepub fn reliability(&self) -> Reliability
Available on crate feature unstable only.
pub fn reliability(&self) -> Reliability
unstable only.Gets the reliability 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 express(&self) -> bool
pub fn express(&self) -> bool
Gets the express flag value. If true, the message is not batched during transmission, in order to reduce latency.
Sourcepub fn source_info(&self) -> Option<&SourceInfo>
Available on crate feature unstable only.
pub fn source_info(&self) -> Option<&SourceInfo>
unstable only.Gets info on the source 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 attachment(&self) -> Option<&ZBytes>
pub fn attachment(&self) -> Option<&ZBytes>
Gets the sample attachment: a map of key-value pairs, where each key and each value is a byte-slice.
Sourcepub fn attachment_mut(&mut self) -> Option<&mut ZBytes>
pub fn attachment_mut(&mut self) -> Option<&mut ZBytes>
Gets the sample attachment: a map of key-value pairs, where each key and each value is a byte-slice.
Trait Implementations§
Source§impl From<Sample> for SampleBuilder<SampleBuilderAny>
impl From<Sample> for SampleBuilder<SampleBuilderAny>
Source§impl From<Sample> for SampleFields
impl From<Sample> for SampleFields
Source§impl<T> From<SampleBuilder<T>> for Sample
impl<T> From<SampleBuilder<T>> for Sample
Source§fn from(sample_builder: SampleBuilder<T>) -> Self
fn from(sample_builder: SampleBuilder<T>) -> Self
Converts to this type from the input type.
Source§impl Sink<Sample> for Publisher<'_>
impl Sink<Sample> for Publisher<'_>
Source§type Error = Box<dyn Error + Sync + Send>
type Error = Box<dyn Error + Sync + Send>
The type of value produced by the sink when an error occurs.
Source§fn poll_ready(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: Sample) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Sample) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl TryFrom<Sample> for SampleBuilder<SampleBuilderDelete>
impl TryFrom<Sample> for SampleBuilder<SampleBuilderDelete>
Auto Trait Implementations§
impl Freeze for Sample
impl !RefUnwindSafe for Sample
impl Send for Sample
impl Sync for Sample
impl Unpin for Sample
impl UnsafeUnpin for Sample
impl !UnwindSafe for Sample
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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