pub struct Selector<'a> { /* private fields */ }Expand description
A selector is the combination of a Key Expression, which defines the
set of keys that are relevant to an operation, and a set of Parameters,
with a few intended uses:
- specifying arguments to a queryable, allowing the passing of Remote Procedure Call parameters,
- filtering by value,
- filtering by metadata, such as the timestamp of a value,
- specifying arguments to zenoh when using the REST API.
When in string form, selectors look a lot like a URI, with similar semantics:
- the
key_exprbefore the first?must be a valid key expression. - the
parametersafter the first?should be encoded like the query section of a URL:- parameters are separated by
;, - the parameter name and value are separated by the first
=, - in the absence of
=, the parameter value is considered to be the empty string, - both name and value should use percent-encoding to escape characters,
- defining a value for the same parameter name twice is considered undefined behavior, with the encouraged behavior being to reject operations when a duplicate parameter is detected.
- parameters are separated by
Zenoh intends to standardize the usage of a set of parameter names. To avoid conflicting with RPC parameters, the Zenoh team has settled on reserving the set of parameter names that start with non-alphanumeric characters.
The full specification for selectors is available here, It includes standardized parameters.
Queryable implementers are encouraged to prefer these standardized parameter names when implementing their associated features, and to prefix their own parameter names to avoid having conflicting parameter names with other queryables.
Here are the currently standardized parameters for Zenoh (check the specification page for the exhaustive list):
[unstable]_time: used to express interest in only values dated within a certain time range; values for this parameter must be readable by the Zenoh Time DSL for the value to be considered valid.[unstable]_anyke: used in queries to express interest in replies coming from any key expression. By default, only replies whose key expression matches the query’s key expression are accepted._anykedisables the query-reply key expression matching check.
Implementations§
Source§impl<'a> Selector<'a>
impl<'a> Selector<'a>
Sourcepub fn parameters(&self) -> &Parameters<'a>
pub fn parameters(&self) -> &Parameters<'a>
Get the Parameters of this selector.
Sourcepub fn split(self) -> (KeyExpr<'a>, Parameters<'a>)
pub fn split(self) -> (KeyExpr<'a>, Parameters<'a>)
Deconstruct the selector into (KeyExpr, Parameters)
Sourcepub fn owned<K, P>(key_expr: K, parameters: P) -> Self
pub fn owned<K, P>(key_expr: K, parameters: P) -> Self
Builds a new selector which owns keyexpr and parameters
Sourcepub fn borrowed(
key_expr: &'a KeyExpr<'a>,
parameters: &'a Parameters<'a>,
) -> Self
pub fn borrowed( key_expr: &'a KeyExpr<'a>, parameters: &'a Parameters<'a>, ) -> Self
Build a new selector holding references to keyexpr and parameters Useful for printing pairs of keyexpr and parameters in URL-like format
Sourcepub fn into_owned(self) -> Selector<'static>
pub fn into_owned(self) -> Selector<'static>
Convert this selector into an owned one.
Trait Implementations§
Source§impl<'a> From<&'a OwnedKeyExpr> for Selector<'a>
impl<'a> From<&'a OwnedKeyExpr> for Selector<'a>
Source§fn from(key_selector: &'a OwnedKeyExpr) -> Self
fn from(key_selector: &'a OwnedKeyExpr) -> Self
Source§impl From<OwnedKeyExpr> for Selector<'static>
impl From<OwnedKeyExpr> for Selector<'static>
Source§fn from(key_selector: OwnedKeyExpr) -> Self
fn from(key_selector: OwnedKeyExpr) -> Self
impl<'a> Eq for Selector<'a>
impl<'a> StructuralPartialEq for Selector<'a>
Auto Trait Implementations§
impl<'a> Freeze for Selector<'a>
impl<'a> RefUnwindSafe for Selector<'a>
impl<'a> Send for Selector<'a>
impl<'a> Sync for Selector<'a>
impl<'a> Unpin for Selector<'a>
impl<'a> UnwindSafe for Selector<'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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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