Struct zenoh::Selector[][src]

pub struct Selector {
    pub path_expr: PathExpr,
    pub predicate: String,
    pub filter: Option<String>,
    pub properties: Properties,
    pub fragment: Option<String>,
}

A zenoh Selector is the conjunction of a path expression identifying a set of paths and some optional parts allowing to refine the set of paths and associated values.

Structure of a selector:

/s1/s2/.../sn?x>1&y<2&...&z=4(p1=v1;p2=v2;...;pn=vn)[a;b;x;y;...;z]
|           | |             | |                   |  |           |
|-- expr ---| |--- filter --| |---- properties ---|  |--fragment-|

where:

  • expr: is a PathExpr.
  • filter: a list of predicates separated by '&' allowing to perform filtering on the values associated with the matching keys. Each predicate has the form “field-operator-value” value where:
    • field is the name of a field in the value (is applicable and is existing. otherwise the predicate is false)
    • operator is one of a comparison operators: < , > , <= , >= , = , !=
    • value is the the value to compare the field’s value with
  • fragment: a list of fields names allowing to return a sub-part of each value. This feature only applies to structured values using a “self-describing” encoding, such as JSON or XML. It allows to select only some fields within the structure. A new structure with only the selected fields will be used in place of the original value.

NOTE: the filters and fragments are not yet supported in current zenoh version.

Fields

path_expr: PathExpr

the path expression part of this Selector (before ? character).

predicate: String

the predicate part of this Selector, as used in zenoh-net. I.e. all characters starting from ?.

filter: Option<String>

the filter part of this Selector, if any (all characters after ? and before ( or [)

properties: Properties

the properties part of this Selector (all characters between ( ) and after ?)

fragment: Option<String>

the fragment part of this Selector, if any (all characters between [ ] and after ?)

Implementations

impl Selector[src]

pub fn with_prefix(&self, prefix: &Path) -> Selector[src]

Returns the concatenation of prefix with this Selector.

pub fn strip_prefix(&self, prefix: &Path) -> Option<Self>[src]

If this Selector starts with prefix returns a copy of this Selector with the prefix removed.
Otherwise, returns None.

pub fn is_relative(&self) -> bool[src]

Returns true is this Selector is relative (i.e. not starting with '/').

pub fn matches(&self, path: &Path) -> bool[src]

Returns true if path matches this Selector’s path expression.

pub fn has_time_range(&self) -> bool[src]

Returns true if the Selector specifies a time-range in its properties (i.e. using "starttime" or "stoptime")

Trait Implementations

impl Clone for Selector[src]

impl Debug for Selector[src]

impl Display for Selector[src]

impl PartialEq<Selector> for Selector[src]

impl StructuralPartialEq for Selector[src]

impl TryFrom<&'_ Query> for Selector[src]

type Error = ZError

The type returned in the event of a conversion error.

impl TryFrom<&'_ str> for Selector[src]

type Error = ZError

The type returned in the event of a conversion error.

impl TryFrom<String> for Selector[src]

type Error = ZError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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