pub struct Querier<'a> { /* private fields */ }Expand description
A querier that allows sending queries to a Queryable.
The querier is a preconfigured object that can be used to send multiple
queries to a given key expression. It is declared using
Session::declare_querier.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let querier = session.declare_querier("key/expression").await.unwrap();
let replies = querier.get().await.unwrap();Implementations§
Source§impl<'a> Querier<'a>
impl<'a> Querier<'a>
Sourcepub fn id(&self) -> EntityGlobalId
Available on crate feature unstable only.
pub fn id(&self) -> EntityGlobalId
unstable only.Returns the EntityGlobalId of this Querier.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let querier = session.declare_querier("key/expression")
.await
.unwrap();
let querier_id = querier.id();Sourcepub fn congestion_control(&self) -> CongestionControl
pub fn congestion_control(&self) -> CongestionControl
Get the congestion_control applied when routing the data.
Sourcepub fn accept_replies(&self) -> ReplyKeyExpr
Available on crate feature unstable only.
pub fn accept_replies(&self) -> ReplyKeyExpr
unstable only.See details in the ReplyKeyExpr documentation.
Sourcepub fn get(&self) -> QuerierGetBuilder<'_, '_, DefaultHandler>
pub fn get(&self) -> QuerierGetBuilder<'_, '_, DefaultHandler>
Send a query. Returns a builder to customize the query. The builder
resolves to a handler generating a series of
Reply values for each response received.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let querier = session.declare_querier("key/expression").await.unwrap();
let replies = querier.get();Sourcepub fn matching_status(&self) -> impl Resolve<ZResult<MatchingStatus>> + '_
pub fn matching_status(&self) -> impl Resolve<ZResult<MatchingStatus>> + '_
Return the MatchingStatus of the querier.
MatchingStatus::matching will return true if there are Queryables
matching the Querier’s key expression and target, and false otherwise.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let querier = session.declare_querier("key/expression").await.unwrap();
let matching_queriers: bool = querier
.matching_status()
.await
.unwrap()
.matching();Sourcepub fn matching_listener(&self) -> MatchingListenerBuilder<'_, DefaultHandler>
pub fn matching_listener(&self) -> MatchingListenerBuilder<'_, DefaultHandler>
Return a MatchingListener for this Querier.
The MatchingListener will send a notification each time the MatchingStatus of
the Querier changes.
§Examples
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let querier = session.declare_querier("key/expression").await.unwrap();
let matching_listener = querier.matching_listener().await.unwrap();
while let Ok(matching_status) = matching_listener.recv_async().await {
if matching_status.matching() {
println!("Querier has matching queryables.");
} else {
println!("Querier has NO MORE matching queryables.");
}
}Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Querier<'a>
impl<'a> !RefUnwindSafe for Querier<'a>
impl<'a> Send for Querier<'a>
impl<'a> Sync for Querier<'a>
impl<'a> Unpin for Querier<'a>
impl<'a> !UnwindSafe for Querier<'a>
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