Skip to content

Commit

Permalink
tags
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Feb 26, 2024
1 parent f40e78c commit c56b6d2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions commons/zenoh-protocol/src/scouting/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,16 @@ use core::fmt;
/// ```
///
pub mod flag {
// tags{}
pub const L: u8 = 1 << 5; // 0x20 Locators if L==1 then the list of locators is present, else the src address is the locator
// tags{}
// pub const X: u8 = 1 << 6; // 0x40 Reserved
// tags{}
pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow
}

#[derive(Debug, Clone, PartialEq, Eq)]
/// tags{rust.hello, api.hello}
pub struct Hello {
pub version: u8,
pub whatami: WhatAmI,
Expand All @@ -118,6 +122,7 @@ impl fmt::Display for Hello {

impl Hello {
#[cfg(feature = "test")]
// tags{}
pub fn rand() -> Self {
use rand::Rng;

Expand Down
6 changes: 6 additions & 0 deletions commons/zenoh-protocol/src/scouting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,30 @@
// ZettaScale Zenoh Team, <[email protected]>
//
pub mod hello;
// ignore_tagging
pub mod scout;

pub use hello::Hello;
pub use scout::Scout;

pub mod id {
// Scouting Messages
// tags{}
pub const SCOUT: u8 = 0x01;
// tags{}
pub const HELLO: u8 = 0x02;
}

// Zenoh messages at scouting level
#[derive(Debug, Clone, PartialEq, Eq)]
// tags{}
pub enum ScoutingBody {
Scout(Scout),
Hello(Hello),
}

#[derive(Debug, Clone, PartialEq, Eq)]
// tags{}
pub struct ScoutingMessage {
pub body: ScoutingBody,
#[cfg(feature = "stats")]
Expand All @@ -39,6 +44,7 @@ pub struct ScoutingMessage {

impl ScoutingMessage {
#[cfg(feature = "test")]
// tags{}
pub fn rand() -> Self {
use rand::Rng;

Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl<'a> Publisher<'a> {
/// # })
/// ```
#[zenoh_macros::unstable]
// tag{}
// tags{}
pub trait PublisherDeclarations {
/// # Examples
/// ```no_run
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/scouting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl ScoutInner {
/// scout.stop();
/// # })
/// ```
// tag{}
// tags{}
pub fn stop(self) {
// This drops the inner `stop_sender` and hence stops the scouting receiver
std::mem::drop(self);
Expand Down
2 changes: 2 additions & 0 deletions zenoh/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ fn selector_accessors() {
assert_eq!(selector.to_string(), without_any + "&other");
}
}
// tags{}
pub trait Parameter: Sized {
type Name: AsRef<str> + Sized;
type Value: AsRef<str> + Sized;
Expand Down Expand Up @@ -337,6 +338,7 @@ type ExtractedValue<'a, VS: Parameters<'a>> = <<VS::Decoder as Iterator>::Item a
/// A trait to help decode zenoh selector parameters.
///
/// Most methods will return an Error if duplicates of a same parameter are found, to avoid HTTP Parameter Pollution like vulnerabilities.
// tags{}
pub trait Parameters<'a> {
type Decoder: Iterator + 'a;
/// Returns this selector's parameters as an iterator.
Expand Down

0 comments on commit c56b6d2

Please sign in to comment.