pub struct SessionGetBuilder<'a, 'b, Handler> { /* private fields */ }Expand description
A builder for configuring a get
operation from a Session.
The builder resolves to a handler generating a series of
Reply for each response received.
§Examples
use zenoh::{query::{ConsolidationMode, QueryTarget}};
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let replies = session
.get("key/expression?value>1")
.target(QueryTarget::All)
.consolidation(ConsolidationMode::None)
.await
.unwrap();
while let Ok(reply) = replies.recv_async().await {
println!("Received {:?}", reply.result())
}Implementations§
Source§impl<Handler> SessionGetBuilder<'_, '_, Handler>
impl<Handler> SessionGetBuilder<'_, '_, Handler>
pub fn source_info(self, source_info: SourceInfo) -> Self
unstable only.pub fn attachment<T: Into<OptionZBytes>>(self, attachment: T) -> Self
Source§impl SessionGetBuilder<'_, '_, DefaultHandler>
impl SessionGetBuilder<'_, '_, DefaultHandler>
pub fn congestion_control(self, congestion_control: CongestionControl) -> Self
pub fn priority(self, priority: Priority) -> Self
pub fn express(self, is_express: bool) -> Self
Source§impl<Handler> SessionGetBuilder<'_, '_, Handler>
impl<Handler> SessionGetBuilder<'_, '_, Handler>
Source§impl<'a, 'b> SessionGetBuilder<'a, 'b, DefaultHandler>
impl<'a, 'b> SessionGetBuilder<'a, 'b, DefaultHandler>
Sourcepub fn callback<F>(
self,
callback: F,
) -> SessionGetBuilder<'a, 'b, Callback<Reply>>
pub fn callback<F>( self, callback: F, ) -> SessionGetBuilder<'a, 'b, Callback<Reply>>
Receive the replies for this query with a callback.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let queryable = session
.get("key/expression")
.callback(|reply| {println!("Received {:?}", reply.result());})
.await
.unwrap();Sourcepub fn callback_mut<F>(
self,
callback: F,
) -> SessionGetBuilder<'a, 'b, Callback<Reply>>
pub fn callback_mut<F>( self, callback: F, ) -> SessionGetBuilder<'a, 'b, Callback<Reply>>
Receive the replies for this query with a mutable callback.
Using this guarantees that your callback will never be called concurrently.
If your callback is also accepted by the callback method, we suggest you use it instead of callback_mut.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let mut n = 0;
let queryable = session
.get("key/expression")
.callback_mut(move |reply| {n += 1;})
.await
.unwrap();Sourcepub fn with<Handler>(
self,
handler: Handler,
) -> SessionGetBuilder<'a, 'b, Handler>where
Handler: IntoHandler<Reply>,
pub fn with<Handler>(
self,
handler: Handler,
) -> SessionGetBuilder<'a, 'b, Handler>where
Handler: IntoHandler<Reply>,
Receive the replies for this query with a Handler.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let replies = session
.get("key/expression")
.with(flume::bounded(32))
.await
.unwrap();
while let Ok(reply) = replies.recv_async().await {
println!("Received {:?}", reply.result());
}Source§impl<Handler> SessionGetBuilder<'_, '_, Handler>
impl<Handler> SessionGetBuilder<'_, '_, Handler>
pub fn payload<IntoZBytes>(self, payload: IntoZBytes) -> Self
Sourcepub fn target(self, target: QueryTarget) -> Self
pub fn target(self, target: QueryTarget) -> Self
Change the target(s) of the query.
This method allows to specify whether the request should just return the data available in the network which matches the key expression (QueryTarget::BestMatching, default) or if it should arrive to all queryables matching the key expression (QueryTarget::All, QueryTarget::AllComplete).
Sourcepub fn consolidation<QC: Into<QueryConsolidation>>(
self,
consolidation: QC,
) -> Self
pub fn consolidation<QC: Into<QueryConsolidation>>( self, consolidation: QC, ) -> Self
Change the consolidation mode of the query.
The multiple replies to a query may arrive from the network. The
ConsolidationMode enum defines
the strategies of filtering and reordering these replies.
The wrapper struct QueryConsolidation
allows to set an ConsolidationMode::AUTO
mode, which lets the implementation choose the best strategy.
Sourcepub fn allowed_destination(self, destination: Locality) -> Self
Available on crate feature unstable only.
pub fn allowed_destination(self, destination: Locality) -> Self
unstable only.Restrict the matching queryables that will receive the query
Sourcepub fn accept_replies(self, accept: ReplyKeyExpr) -> Self
Available on crate feature unstable only.
pub fn accept_replies(self, accept: ReplyKeyExpr) -> Self
unstable only.See details in ReplyKeyExpr documentation.
Trait Implementations§
Source§impl<'a, 'b, Handler: Debug> Debug for SessionGetBuilder<'a, 'b, Handler>
impl<'a, 'b, Handler: Debug> Debug for SessionGetBuilder<'a, 'b, Handler>
Source§impl<Handler> IntoFuture for SessionGetBuilder<'_, '_, Handler>
impl<Handler> IntoFuture for SessionGetBuilder<'_, '_, Handler>
Source§type Output = <SessionGetBuilder<'_, '_, Handler> as Resolvable>::To
type Output = <SessionGetBuilder<'_, '_, Handler> as Resolvable>::To
Source§type IntoFuture = Ready<<SessionGetBuilder<'_, '_, Handler> as Resolvable>::To>
type IntoFuture = Ready<<SessionGetBuilder<'_, '_, Handler> as Resolvable>::To>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Source§impl<Handler> Resolvable for SessionGetBuilder<'_, '_, Handler>
impl<Handler> Resolvable for SessionGetBuilder<'_, '_, Handler>
Source§impl<Handler> Wait for SessionGetBuilder<'_, '_, Handler>
impl<Handler> Wait for SessionGetBuilder<'_, '_, Handler>
Source§fn wait(self) -> <Self as Resolvable>::To
fn wait(self) -> <Self as Resolvable>::To
Auto Trait Implementations§
impl<'a, 'b, Handler> Freeze for SessionGetBuilder<'a, 'b, Handler>where
Handler: Freeze,
impl<'a, 'b, Handler> !RefUnwindSafe for SessionGetBuilder<'a, 'b, Handler>
impl<'a, 'b, Handler> Send for SessionGetBuilder<'a, 'b, Handler>where
Handler: Send,
impl<'a, 'b, Handler> Sync for SessionGetBuilder<'a, 'b, Handler>where
Handler: Sync,
impl<'a, 'b, Handler> Unpin for SessionGetBuilder<'a, 'b, Handler>where
Handler: Unpin,
impl<'a, 'b, Handler> !UnwindSafe for SessionGetBuilder<'a, 'b, Handler>
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
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