Skip to content

Commit

Permalink
tags
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Mar 5, 2024
1 parent db7cd7e commit 4fbeaea
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions api_missing_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ See https://github.com/ZettaScaleLabs/zenoh-tests/tree/tagging/api_matrix for de

tags{api.logger.init(N/A)}
This is necessary only for bindings, in Rust itself it's `envlogger::init()`

tags{api.reply.encoding.set(TODO)}
2 changes: 1 addition & 1 deletion commons/zenoh-protocol/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub enum SubMode {

/// The kind of consolidation.
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
// tags{rust.consolidation_mode, api.options.consolidation_mode}
// tags{rust.consolidation_mode, api.options.consolidation_mode.manual}
pub enum ConsolidationMode {
/// No consolidation applied: multiple samples may be received for the same key-timestamp.
None,
Expand Down
14 changes: 9 additions & 5 deletions zenoh/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ pub use zenoh_protocol::core::ConsolidationMode;
pub enum Mode<T> {
// tags{api.options.consolidation_mode.auto}
Auto,
// tags{}
Manual(T),
}

/// The replies consolidation strategy to apply on replies to a [`get`](Session::get).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
// tags{rust.query_consolidation, api.query_consolidation}
// tags{rust.query_consolidation, api.options.query_consolidation}
pub struct QueryConsolidation {
pub(crate) mode: Mode<ConsolidationMode>,
}

impl QueryConsolidation {
/// Automatic query consolidation strategy selection.
// tags{rust.query_consolidation.auto, api.query_consolidation.auto}
pub const AUTO: Self = Self { mode: Mode::Auto };

pub(crate) const fn from_mode(mode: ConsolidationMode) -> Self {
Expand Down Expand Up @@ -87,7 +87,10 @@ impl Default for QueryConsolidation {
// tags{rust.reply, api.reply}
pub struct Reply {
/// The result of this Reply.
// tags{rust.reply.sample, api.reply.sample}
// tags{rust.reply.sample}
// tags{api.reply.get_sample}
// tags{api.reply.get_error}
// tags{api.reply.is_ok}
pub sample: Result<Sample, Value>,
/// The id of the zenoh instance that answered this Reply.
// tags{rust.reply.replier_id, api.reply.replier_id}
Expand Down Expand Up @@ -367,19 +370,20 @@ impl<'a, 'b, Handler> GetBuilder<'a, 'b, Handler> {

pub(crate) const _REPLY_KEY_EXPR_ANY_SEL_PARAM: &str = "_anyke";
#[zenoh_macros::unstable]
// tags{rust.reply_key_expr_any_sel_param, api.reply_key_expr_any_sel_param}
// tags{}
pub const REPLY_KEY_EXPR_ANY_SEL_PARAM: &str = _REPLY_KEY_EXPR_ANY_SEL_PARAM;

#[zenoh_macros::unstable]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
// tags{rust.reply_key_expr, api.reply_key_expr}
// tags{rust.reply_key_expr, api.options.reply_key_expr}
pub enum ReplyKeyExpr {
Any,
MatchingQuery,
}

#[zenoh_macros::unstable]
impl Default for ReplyKeyExpr {
// tags{rust.reply_key_expr.default, api.options.reply_key_expr.default}
fn default() -> Self {
ReplyKeyExpr::MatchingQuery
}
Expand Down
3 changes: 2 additions & 1 deletion zenoh/src/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl Query {
/// replying on a disjoint key expression will result in an error when resolving the reply.
#[inline(always)]
// tags{rust.query.reply, api.query.reply}
// tags{api.query.reply.encoding.set} // through the `Sample` struct
pub fn reply(&self, result: Result<Sample, Value>) -> ReplyBuilder<'_> {
ReplyBuilder {
query: self,
Expand Down Expand Up @@ -173,7 +174,7 @@ pub struct ReplyBuilder<'a> {
impl<'a> ReplyBuilder<'a> {
#[allow(clippy::result_large_err)]
#[zenoh_macros::unstable]
// tags{rust.reply_builder.with_attachment, api.reply.attachment.set}
// tags{rust.reply_builder.with_attachment, api.query.reply.attachment.set}
pub fn with_attachment(mut self, attachment: Attachment) -> Result<Self, (Self, Attachment)> {
match &mut self.result {
Ok(sample) => {
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub type SourceSn = u64;

/// The locality of samples to be received by subscribers or targeted by publishers.
#[zenoh_macros::unstable]
// tags{api.options.locality.default}
#[derive(Clone, Copy, Debug, Default, Serialize, PartialEq, Eq)]
// tags{rust.locality, api.options.locality}
pub enum Locality {
Expand Down
10 changes: 6 additions & 4 deletions zenoh/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,22 +459,23 @@ impl<'a, 'b, Mode, Handler> SubscriberBuilder<'a, 'b, Mode, Handler> {
/// Change the subscription reliability.
#[inline]
// tags{rust.subscriber_builder.reliability, api.subscriber.reliability.set}
// tags{api.pull_subscriber.reliability.set}
pub fn reliability(mut self, reliability: Reliability) -> Self {
self.reliability = reliability;
self
}

/// Change the subscription reliability to `Reliable`.
#[inline]
// tags{rust.subscriber_builder.reliable, api.subscriber.reliability.set.reliable}
// tags{rust.subscriber_builder.reliable}
pub fn reliable(mut self) -> Self {
self.reliability = Reliability::Reliable;
self
}

/// Change the subscription reliability to `BestEffort`.
#[inline]
// tags{rust.subscriber_builder.best_effort, api.subscriber.reliability.set.best_effort}
// tags{rust.subscriber_builder.best_effort}
pub fn best_effort(mut self) -> Self {
self.reliability = Reliability::BestEffort;
self
Expand All @@ -485,14 +486,15 @@ impl<'a, 'b, Mode, Handler> SubscriberBuilder<'a, 'b, Mode, Handler> {
#[zenoh_macros::unstable]
#[inline]
// tags{rust.subscriber_builder.allowed_origin, api.subscriber.allowed_origin.set}
// tags{api.pull_subscriber.allowed_origin.set}
pub fn allowed_origin(mut self, origin: Locality) -> Self {
self.origin = origin;
self
}

/// Change the subscription mode to Pull.
#[inline]
// tags{rust.subscriber_builder.pull_mode, api.subscriber.pull_mode.set}
// tags{rust.subscriber_builder.pull_mode}
pub fn pull_mode(self) -> SubscriberBuilder<'a, 'b, PullMode, Handler> {
let SubscriberBuilder {
session,
Expand All @@ -514,7 +516,7 @@ impl<'a, 'b, Mode, Handler> SubscriberBuilder<'a, 'b, Mode, Handler> {

/// Change the subscription mode to Push.
#[inline]
// tags{rust.subscriber_builder.push_mode, api.subscriber.push_mode.set}
// tags{rust.subscriber_builder.push_mode}
pub fn push_mode(self) -> SubscriberBuilder<'a, 'b, PushMode, Handler> {
let SubscriberBuilder {
session,
Expand Down

0 comments on commit 4fbeaea

Please sign in to comment.