diff --git a/commons/zenoh-buffers/src/slice.rs b/commons/zenoh-buffers/src/slice.rs index 1f3771c2eb..6453c47bab 100644 --- a/commons/zenoh-buffers/src/slice.rs +++ b/commons/zenoh-buffers/src/slice.rs @@ -123,7 +123,7 @@ impl<'s> BacktrackableWriter for &'s mut [u8] { } // Reader -impl<'a> HasReader for &'a [u8] { +impl HasReader for &[u8] { type Reader = Self; fn reader(self) -> Self::Reader { @@ -196,7 +196,7 @@ impl<'a> BacktrackableReader for &'a [u8] { } } -impl<'a> SiphonableReader for &'a [u8] { +impl SiphonableReader for &[u8] { fn siphon(&mut self, writer: &mut W) -> Result where W: Writer, diff --git a/commons/zenoh-buffers/src/vec.rs b/commons/zenoh-buffers/src/vec.rs index fc81fa6687..35056e7351 100644 --- a/commons/zenoh-buffers/src/vec.rs +++ b/commons/zenoh-buffers/src/vec.rs @@ -62,7 +62,7 @@ impl SplitBuffer for Vec { } // Writer -impl<'a> HasWriter for &'a mut Vec { +impl HasWriter for &mut Vec { type Writer = Self; fn writer(self) -> Self::Writer { diff --git a/commons/zenoh-buffers/src/zbuf.rs b/commons/zenoh-buffers/src/zbuf.rs index 76c06e2765..1dff2486a5 100644 --- a/commons/zenoh-buffers/src/zbuf.rs +++ b/commons/zenoh-buffers/src/zbuf.rs @@ -195,7 +195,7 @@ impl<'a> HasReader for &'a ZBuf { } } -impl<'a> Reader for ZBufReader<'a> { +impl Reader for ZBufReader<'_> { fn read(&mut self, mut into: &mut [u8]) -> Result { let mut read = 0; while let Some(slice) = self.inner.slices.get(self.cursor.slice) { @@ -299,7 +299,7 @@ impl<'a> Reader for ZBufReader<'a> { } } -impl<'a> BacktrackableReader for ZBufReader<'a> { +impl BacktrackableReader for ZBufReader<'_> { type Mark = ZBufPos; fn mark(&mut self) -> Self::Mark { @@ -312,7 +312,7 @@ impl<'a> BacktrackableReader for ZBufReader<'a> { } } -impl<'a> SiphonableReader for ZBufReader<'a> { +impl SiphonableReader for ZBufReader<'_> { fn siphon(&mut self, writer: &mut W) -> Result where W: Writer, @@ -345,7 +345,7 @@ impl<'a> SiphonableReader for ZBufReader<'a> { } #[cfg(feature = "std")] -impl<'a> io::Read for ZBufReader<'a> { +impl io::Read for ZBufReader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { match ::read(self, buf) { Ok(n) => Ok(n.get()), @@ -354,7 +354,7 @@ impl<'a> io::Read for ZBufReader<'a> { } } -impl<'a> AdvanceableReader for ZBufReader<'a> { +impl AdvanceableReader for ZBufReader<'_> { fn skip(&mut self, offset: usize) -> Result<(), DidntRead> { let mut remaining_offset = offset; while remaining_offset > 0 { @@ -399,7 +399,7 @@ impl<'a> AdvanceableReader for ZBufReader<'a> { } #[cfg(feature = "std")] -impl<'a> io::Seek for ZBufReader<'a> { +impl io::Seek for ZBufReader<'_> { fn seek(&mut self, pos: io::SeekFrom) -> io::Result { let current_pos = self .inner @@ -570,7 +570,7 @@ impl BacktrackableWriter for ZBufWriter<'_> { } #[cfg(feature = "std")] -impl<'a> io::Write for ZBufWriter<'a> { +impl io::Write for ZBufWriter<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { if buf.is_empty() { return Ok(0); diff --git a/commons/zenoh-collections/src/single_or_vec.rs b/commons/zenoh-collections/src/single_or_vec.rs index 7b2391197d..203623491e 100644 --- a/commons/zenoh-collections/src/single_or_vec.rs +++ b/commons/zenoh-collections/src/single_or_vec.rs @@ -192,7 +192,7 @@ pub struct Drain<'a, T> { inner: DrainInner<'a, T>, } -impl<'a, T> Iterator for Drain<'a, T> { +impl Iterator for Drain<'_, T> { type Item = T; fn next(&mut self) -> Option { @@ -209,7 +209,7 @@ impl<'a, T> Iterator for Drain<'a, T> { } } } -impl<'a, T> Drop for Drain<'a, T> { +impl Drop for Drain<'_, T> { fn drop(&mut self) { if let DrainInner::Single(_) = self.inner { self.next(); diff --git a/commons/zenoh-keyexpr/src/key_expr/borrowed.rs b/commons/zenoh-keyexpr/src/key_expr/borrowed.rs index e2afa9712f..4966776e0d 100644 --- a/commons/zenoh-keyexpr/src/key_expr/borrowed.rs +++ b/commons/zenoh-keyexpr/src/key_expr/borrowed.rs @@ -545,7 +545,7 @@ impl<'a> Iterator for Chunks<'a> { Some(unsafe { keyexpr::from_str_unchecked(next) }) } } -impl<'a> DoubleEndedIterator for Chunks<'a> { +impl DoubleEndedIterator for Chunks<'_> { fn next_back(&mut self) -> Option { if self.inner.is_empty() { return None; diff --git a/commons/zenoh-keyexpr/src/key_expr/format/support.rs b/commons/zenoh-keyexpr/src/key_expr/format/support.rs index 65b534dc24..870f6622d1 100644 --- a/commons/zenoh-keyexpr/src/key_expr/format/support.rs +++ b/commons/zenoh-keyexpr/src/key_expr/format/support.rs @@ -50,7 +50,7 @@ impl<'a> TryFrom<&'a str> for Spec<'a> { } } } -impl<'a> Spec<'a> { +impl Spec<'_> { pub fn id(&self) -> &str { &self.spec[..self.id_end as usize] } diff --git a/commons/zenoh-keyexpr/src/key_expr/utils.rs b/commons/zenoh-keyexpr/src/key_expr/utils.rs index 63f4b4c088..9767ee4459 100644 --- a/commons/zenoh-keyexpr/src/key_expr/utils.rs +++ b/commons/zenoh-keyexpr/src/key_expr/utils.rs @@ -16,7 +16,7 @@ pub struct Splitter<'a, S: ?Sized, D: ?Sized> { s: Option<&'a S>, d: &'a D, } -impl<'a, S: ?Sized, D: ?Sized> Clone for Splitter<'a, S, D> { +impl Clone for Splitter<'_, S, D> { fn clone(&self) -> Self { Self { s: self.s, @@ -84,7 +84,7 @@ impl<'a, S: Split + ?Sized, D: ?Sized> Iterator for Splitter<'a, S, D> { } } -impl<'a, S: Split + ?Sized, D: ?Sized> DoubleEndedIterator for Splitter<'a, S, D> { +impl + ?Sized, D: ?Sized> DoubleEndedIterator for Splitter<'_, S, D> { fn next_back(&mut self) -> Option { match self.s { Some(s) => { diff --git a/commons/zenoh-keyexpr/src/keyexpr_tree/traits/default_impls.rs b/commons/zenoh-keyexpr/src/keyexpr_tree/traits/default_impls.rs index 6a043ccda0..4205675103 100644 --- a/commons/zenoh-keyexpr/src/keyexpr_tree/traits/default_impls.rs +++ b/commons/zenoh-keyexpr/src/keyexpr_tree/traits/default_impls.rs @@ -18,12 +18,12 @@ use token_cell::prelude::{TokenCell, TokenCellTrait, TokenTrait}; use super::*; -impl<'a, T: HasChunk> HasChunk for &'a T { +impl HasChunk for &T { fn chunk(&self) -> &keyexpr { T::chunk(self) } } -impl<'a, T: HasChunk> HasChunk for &'a mut T { +impl HasChunk for &mut T { fn chunk(&self) -> &keyexpr { T::chunk(self) } diff --git a/commons/zenoh-protocol/src/core/cowstr.rs b/commons/zenoh-protocol/src/core/cowstr.rs index b31c1c4a5d..81aa40306c 100644 --- a/commons/zenoh-protocol/src/core/cowstr.rs +++ b/commons/zenoh-protocol/src/core/cowstr.rs @@ -43,7 +43,7 @@ impl<'a> From<&'a str> for CowStr<'a> { CowStr::borrowed(value) } } -impl<'a> From for CowStr<'a> { +impl From for CowStr<'_> { fn from(s: String) -> Self { if s.is_empty() { CowStr::borrowed("") @@ -70,7 +70,7 @@ impl core::ops::Deref for CowStr<'_> { } } } -impl<'a> Clone for CowStr<'a> { +impl Clone for CowStr<'_> { fn clone(&self) -> Self { self.as_str().to_owned().into() } diff --git a/commons/zenoh-protocol/src/transport/close.rs b/commons/zenoh-protocol/src/transport/close.rs index e4029f09d6..cfdb60b211 100644 --- a/commons/zenoh-protocol/src/transport/close.rs +++ b/commons/zenoh-protocol/src/transport/close.rs @@ -12,6 +12,36 @@ // ZettaScale Zenoh Team, // +pub mod flag { + pub const S: u8 = 1 << 5; // 0x20 Session close if S==1 close the whole session, close only the link otherwise + // pub const X: u8 = 1 << 6; // 0x40 Reserved + pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow +} + +// Reason for the Close message +pub mod reason { + pub const GENERIC: u8 = 0x00; + pub const UNSUPPORTED: u8 = 0x01; + pub const INVALID: u8 = 0x02; + pub const MAX_SESSIONS: u8 = 0x03; + pub const MAX_LINKS: u8 = 0x04; + pub const EXPIRED: u8 = 0x05; + pub const UNRESPONSIVE: u8 = 0x06; +} + +pub fn reason_to_str(reason: u8) -> &'static str { + match reason { + reason::GENERIC => "GENERIC", + reason::UNSUPPORTED => "UNSUPPORTED", + reason::INVALID => "INVALID", + reason::MAX_SESSIONS => "MAX_SESSIONS", + reason::MAX_LINKS => "MAX_LINKS", + reason::EXPIRED => "EXPIRED", + reason::UNRESPONSIVE => "UNRESPONSIVE", + _ => "UNKNOWN", + } +} + /// # Close message /// /// The [`Close`] message is sent in any of the following two cases: @@ -50,37 +80,6 @@ /// the boundary of the serialized messages. The length is encoded as little-endian. /// In any case, the length of a message must not exceed 65535 bytes. /// - -pub mod flag { - pub const S: u8 = 1 << 5; // 0x20 Session close if S==1 close the whole session, close only the link otherwise - // pub const X: u8 = 1 << 6; // 0x40 Reserved - pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow -} - -// Reason for the Close message -pub mod reason { - pub const GENERIC: u8 = 0x00; - pub const UNSUPPORTED: u8 = 0x01; - pub const INVALID: u8 = 0x02; - pub const MAX_SESSIONS: u8 = 0x03; - pub const MAX_LINKS: u8 = 0x04; - pub const EXPIRED: u8 = 0x05; - pub const UNRESPONSIVE: u8 = 0x06; -} - -pub fn reason_to_str(reason: u8) -> &'static str { - match reason { - reason::GENERIC => "GENERIC", - reason::UNSUPPORTED => "UNSUPPORTED", - reason::INVALID => "INVALID", - reason::MAX_SESSIONS => "MAX_SESSIONS", - reason::MAX_LINKS => "MAX_LINKS", - reason::EXPIRED => "EXPIRED", - reason::UNRESPONSIVE => "UNRESPONSIVE", - _ => "UNKNOWN", - } -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct Close { pub reason: u8, diff --git a/commons/zenoh-protocol/src/transport/fragment.rs b/commons/zenoh-protocol/src/transport/fragment.rs index eccc7b80c0..c82aefbd8a 100644 --- a/commons/zenoh-protocol/src/transport/fragment.rs +++ b/commons/zenoh-protocol/src/transport/fragment.rs @@ -16,6 +16,12 @@ use zenoh_buffers::ZSlice; use crate::core::Reliability; pub use crate::transport::TransportSn; +pub mod flag { + pub const R: u8 = 1 << 5; // 0x20 Reliable if R==1 then the frame is reliable + pub const M: u8 = 1 << 6; // 0x40 More if M==1 then another fragment will follow + pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow +} + /// # Fragment message /// /// The [`Fragment`] message is used to transmit on the wire large [`crate::network::NetworkMessage`] @@ -62,12 +68,6 @@ pub use crate::transport::TransportSn; /// the boundary of the serialized messages. The length is encoded as little-endian. /// In any case, the length of a message must not exceed 65535 bytes. /// -pub mod flag { - pub const R: u8 = 1 << 5; // 0x20 Reliable if R==1 then the frame is reliable - pub const M: u8 = 1 << 6; // 0x40 More if M==1 then another fragment will follow - pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct Fragment { pub reliability: Reliability, diff --git a/commons/zenoh-protocol/src/transport/frame.rs b/commons/zenoh-protocol/src/transport/frame.rs index 10e55cc99e..4b93984151 100644 --- a/commons/zenoh-protocol/src/transport/frame.rs +++ b/commons/zenoh-protocol/src/transport/frame.rs @@ -15,6 +15,12 @@ use alloc::vec::Vec; use crate::{core::Reliability, network::NetworkMessage, transport::TransportSn}; +pub mod flag { + pub const R: u8 = 1 << 5; // 0x20 Reliable if R==1 then the frame is reliable + // pub const X: u8 = 1 << 6; // 0x40 Reserved + pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow +} + /// # Frame message /// /// The [`Frame`] message is used to transmit one ore more complete serialized @@ -61,12 +67,6 @@ use crate::{core::Reliability, network::NetworkMessage, transport::TransportSn}; /// the boundary of the serialized messages. The length is encoded as little-endian. /// In any case, the length of a message must not exceed 65535 bytes. /// -pub mod flag { - pub const R: u8 = 1 << 5; // 0x20 Reliable if R==1 then the frame is reliable - // pub const X: u8 = 1 << 6; // 0x40 Reserved - pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct Frame { pub reliability: Reliability, diff --git a/commons/zenoh-protocol/src/transport/init.rs b/commons/zenoh-protocol/src/transport/init.rs index e9660ea7ec..b514e6b9b0 100644 --- a/commons/zenoh-protocol/src/transport/init.rs +++ b/commons/zenoh-protocol/src/transport/init.rs @@ -11,6 +11,89 @@ // Contributors: // ZettaScale Zenoh Team, // + +//! # Init message +//! +//! The INIT message is sent on a specific Locator to initiate a transport with the zenoh node +//! associated with that Locator. The initiator MUST send an INIT message with the A flag set to 0. +//! If the corresponding zenohd node deems appropriate to accept the INIT message, the corresponding +//! peer MUST reply with an INIT message with the A flag set to 1. Alternatively, it MAY reply with +//! a [`super::Close`] message. For convenience, we call [`InitSyn`] and [`InitAck`] an INIT message +//! when the A flag is set to 0 and 1, respectively. +//! +//! The [`InitSyn`]/[`InitAck`] message flow is the following: +//! +//! ```text +//! A B +//! | INIT SYN | +//! |------------------>| +//! | | +//! | INIT ACK | +//! |<------------------| +//! | | +//! ``` +//! +//! The INIT message structure is defined as follows: +//! +//! ```text +//! Flags: +//! - A: Ack If A==0 then the message is an InitSyn else it is an InitAck +//! - S: Size params If S==1 then size parameters are exchanged +//! - Z: Extensions If Z==1 then zenoh extensions will follow. +//! +//! 7 6 5 4 3 2 1 0 +//! +-+-+-+-+-+-+-+-+ +//! |Z|S|A| INIT | +//! +-+-+-+---------+ +//! | version | +//! +---------------+ +//! |zid_len|x|x|wai| (#)(*) +//! +-------+-+-+---+ +//! ~ [u8] ~ -- ZenohID of the sender of the INIT message +//! +---------------+ +//! |x|x|x|x|rid|fsn| \ -- SN/ID resolution (+) +//! +---------------+ | if Flag(S)==1 +//! | u16 | | -- Batch Size ($) +//! | | / +//! +---------------+ +//! ~ ~ -- if Flag(A)==1 -- Cookie +//! +---------------+ +//! ~ [InitExts] ~ -- if Flag(Z)==1 +//! +---------------+ +//! +//! If A==1 and S==0 then size parameters are (ie. S flag) are accepted. +//! +//! (*) WhatAmI. It indicates the role of the zenoh node sending the INIT message. +//! The valid WhatAmI values are: +//! - 0b00: Router +//! - 0b01: Peer +//! - 0b10: Client +//! - 0b11: Reserved +//! +//! (#) ZID length. It indicates how many bytes are used for the ZenohID bytes. +//! A ZenohID is minimum 1 byte and maximum 16 bytes. Therefore, the actual length is computed as: +//! real_zid_len := 1 + zid_len +//! +//! (+) Sequence Number/ID resolution. It indicates the resolution and consequently the wire overhead +//! of various SN and ID in Zenoh. +//! - fsn: frame/fragment sequence number resolution. Used in Frame/Fragment messages. +//! - rid: request ID resolution. Used in Request/Response messages. +//! The valid SN/ID resolution values are: +//! - 0b00: 8 bits +//! - 0b01: 16 bits +//! - 0b10: 32 bits +//! - 0b11: 64 bits +//! +//! ($) Batch Size. It indicates the maximum size of a batch the sender of the INIT message is willing +//! to accept when reading from the network. Default on unicast: 65535. +//! +//! NOTE: 16 bits (2 bytes) may be prepended to the serialized message indicating the total length +//! in bytes of the message, resulting in the maximum length of a message being 65535 bytes. +//! This is necessary in those stream-oriented transports (e.g., TCP) that do not preserve +//! the boundary of the serialized messages. The length is encoded as little-endian. +//! In any case, the length of a message must not exceed 65535 bytes. +//! ``` + use zenoh_buffers::ZSlice; use crate::{ @@ -18,95 +101,21 @@ use crate::{ transport::BatchSize, }; -/// # Init message -/// -/// The INIT message is sent on a specific Locator to initiate a transport with the zenoh node -/// associated with that Locator. The initiator MUST send an INIT message with the A flag set to 0. -/// If the corresponding zenohd node deems appropriate to accept the INIT message, the corresponding -/// peer MUST reply with an INIT message with the A flag set to 1. Alternatively, it MAY reply with -/// a [`super::Close`] message. For convenience, we call [`InitSyn`] and [`InitAck`] an INIT message -/// when the A flag is set to 0 and 1, respectively. -/// -/// The [`InitSyn`]/[`InitAck`] message flow is the following: -/// -/// ```text -/// A B -/// | INIT SYN | -/// |------------------>| -/// | | -/// | INIT ACK | -/// |<------------------| -/// | | -/// ``` -/// -/// The INIT message structure is defined as follows: +pub mod flag { + pub const A: u8 = 1 << 5; // 0x20 Ack if A==0 then the message is an InitSyn else it is an InitAck + pub const S: u8 = 1 << 6; // 0x40 Size params if S==1 then size parameters are exchanged + pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow +} + +/// # InitSyn message /// /// ```text -/// Flags: -/// - A: Ack If A==0 then the message is an InitSyn else it is an InitAck -/// - S: Size params If S==1 then size parameters are exchanged -/// - Z: Extensions If Z==1 then zenoh extensions will follow. -/// /// 7 6 5 4 3 2 1 0 /// +-+-+-+-+-+-+-+-+ -/// |Z|S|A| INIT | -/// +-+-+-+---------+ -/// | version | /// +---------------+ -/// |zid_len|x|x|wai| (#)(*) -/// +-------+-+-+---+ -/// ~ [u8] ~ -- ZenohID of the sender of the INIT message -/// +---------------+ -/// |x|x|x|x|rid|fsn| \ -- SN/ID resolution (+) -/// +---------------+ | if Flag(S)==1 -/// | u16 | | -- Batch Size ($) -/// | | / -/// +---------------+ -/// ~ ~ -- if Flag(A)==1 -- Cookie -/// +---------------+ -/// ~ [InitExts] ~ -- if Flag(Z)==1 -/// +---------------+ -/// -/// If A==1 and S==0 then size parameters are (ie. S flag) are accepted. /// -/// (*) WhatAmI. It indicates the role of the zenoh node sending the INIT message. -/// The valid WhatAmI values are: -/// - 0b00: Router -/// - 0b01: Peer -/// - 0b10: Client -/// - 0b11: Reserved -/// -/// (#) ZID length. It indicates how many bytes are used for the ZenohID bytes. -/// A ZenohID is minimum 1 byte and maximum 16 bytes. Therefore, the actual length is computed as: -/// real_zid_len := 1 + zid_len -/// -/// (+) Sequence Number/ID resolution. It indicates the resolution and consequently the wire overhead -/// of various SN and ID in Zenoh. -/// - fsn: frame/fragment sequence number resolution. Used in Frame/Fragment messages. -/// - rid: request ID resolution. Used in Request/Response messages. -/// The valid SN/ID resolution values are: -/// - 0b00: 8 bits -/// - 0b01: 16 bits -/// - 0b10: 32 bits -/// - 0b11: 64 bits -/// -/// ($) Batch Size. It indicates the maximum size of a batch the sender of the INIT message is willing -/// to accept when reading from the network. Default on unicast: 65535. -/// -/// NOTE: 16 bits (2 bytes) may be prepended to the serialized message indicating the total length -/// in bytes of the message, resulting in the maximum length of a message being 65535 bytes. -/// This is necessary in those stream-oriented transports (e.g., TCP) that do not preserve -/// the boundary of the serialized messages. The length is encoded as little-endian. -/// In any case, the length of a message must not exceed 65535 bytes. +/// ZExtUnit /// ``` -/// - -pub mod flag { - pub const A: u8 = 1 << 5; // 0x20 Ack if A==0 then the message is an InitSyn else it is an InitAck - pub const S: u8 = 1 << 6; // 0x40 Size params if S==1 then size parameters are exchanged - pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct InitSyn { pub version: u8, @@ -199,6 +208,16 @@ impl InitSyn { } } +/// # InitAck message +/// +/// ```text +/// 7 6 5 4 3 2 1 0 +/// +-+-+-+-+-+-+-+-+ +/// ~ nonce ~ +/// +---------------+ +/// +/// ZExtZ64 +/// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct InitAck { pub version: u8, diff --git a/commons/zenoh-protocol/src/transport/keepalive.rs b/commons/zenoh-protocol/src/transport/keepalive.rs index cc9ccfad99..33903e3958 100644 --- a/commons/zenoh-protocol/src/transport/keepalive.rs +++ b/commons/zenoh-protocol/src/transport/keepalive.rs @@ -12,6 +12,12 @@ // ZettaScale Zenoh Team, // +pub mod flag { + // pub const X: u8 = 1 << 5; // 0x20 Reserved + // pub const X: u8 = 1 << 6; // 0x40 Reserved + pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow +} + /// # KeepAlive message /// /// The [`KeepAlive`] message SHOULD be sent periodically to avoid the expiration of the @@ -75,12 +81,6 @@ /// the boundary of the serialized messages. The length is encoded as little-endian. /// In any case, the length of a message must not exceed 65535 bytes. /// -pub mod flag { - // pub const X: u8 = 1 << 5; // 0x20 Reserved - // pub const X: u8 = 1 << 6; // 0x40 Reserved - pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct KeepAlive; diff --git a/commons/zenoh-protocol/src/transport/open.rs b/commons/zenoh-protocol/src/transport/open.rs index 8042eeb634..4729c7bd7e 100644 --- a/commons/zenoh-protocol/src/transport/open.rs +++ b/commons/zenoh-protocol/src/transport/open.rs @@ -11,69 +11,77 @@ // Contributors: // ZettaScale Zenoh Team, // + +//! # Open message +//! +//! After having successfully complete the [`super::InitSyn`]-[`super::InitAck`] message exchange, +//! the OPEN message is sent on a link to finalize the initialization of the link and +//! associated transport with a zenoh node. +//! For convenience, we call [`OpenSyn`] and [`OpenAck`] an OPEN message with the A flag +//! is set to 0 and 1, respectively. +//! +//! The [`OpenSyn`]/[`OpenAck`] message flow is the following: +//! +//! ```text +//! A B +//! | OPEN SYN | +//! |------------------>| +//! | | +//! | OPEN ACK | +//! |<------------------| +//! | | +//! ``` +//! +//! ```text +//! Flags: +//! - A: Ack If A==0 then the message is an OpenSyn else it is an OpenAck +//! - T: Lease period if T==1 then the lease period is in seconds else in milliseconds +//! - Z: Extensions If Z==1 then zenoh extensions will follow. +//! +//! 7 6 5 4 3 2 1 0 +//! +-+-+-+-+-+-+-+-+ +//! |Z|T|A| OPEN | +//! +-+-+-+---------+ +//! % lease % -- Lease period of the sender of the OPEN message +//! +---------------+ +//! % initial_sn % -- Initial SN proposed by the sender of the OPEN(*) +//! +---------------+ +//! ~ ~ if Flag(A)==0 (**) -- Cookie +//! +---------------+ +//! ~ [OpenExts] ~ if Flag(Z)==1 +//! +---------------+ +//! +//! (*) The initial sequence number MUST be compatible with the sequence number resolution agreed in the +//! [`super::InitSyn`]-[`super::InitAck`] message exchange +//! (**) The cookie MUST be the same received in the [`super::InitAck`]from the corresponding zenoh node +//! ``` +//! +//! NOTE: 16 bits (2 bytes) may be prepended to the serialized message indicating the total length +//! in bytes of the message, resulting in the maximum length of a message being 65535 bytes. +//! This is necessary in those stream-oriented transports (e.g., TCP) that do not preserve +//! the boundary of the serialized messages. The length is encoded as little-endian. +//! In any case, the length of a message must not exceed 65535 bytes. + use core::time::Duration; use zenoh_buffers::ZSlice; use crate::transport::TransportSn; -/// # Open message -/// -/// After having successfully complete the [`super::InitSyn`]-[`super::InitAck`] message exchange, -/// the OPEN message is sent on a link to finalize the initialization of the link and -/// associated transport with a zenoh node. -/// For convenience, we call [`OpenSyn`] and [`OpenAck`] an OPEN message with the A flag -/// is set to 0 and 1, respectively. -/// -/// The [`OpenSyn`]/[`OpenAck`] message flow is the following: -/// -/// ```text -/// A B -/// | OPEN SYN | -/// |------------------>| -/// | | -/// | OPEN ACK | -/// |<------------------| -/// | | -/// ``` -/// -/// ```text -/// Flags: -/// - A: Ack If A==0 then the message is an OpenSyn else it is an OpenAck -/// - T: Lease period if T==1 then the lease period is in seconds else in milliseconds -/// - Z: Extensions If Z==1 then zenoh extensions will follow. -/// -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// |Z|T|A| OPEN | -/// +-+-+-+---------+ -/// % lease % -- Lease period of the sender of the OPEN message -/// +---------------+ -/// % initial_sn % -- Initial SN proposed by the sender of the OPEN(*) -/// +---------------+ -/// ~ ~ if Flag(A)==0 (**) -- Cookie -/// +---------------+ -/// ~ [OpenExts] ~ if Flag(Z)==1 -/// +---------------+ -/// -/// (*) The initial sequence number MUST be compatible with the sequence number resolution agreed in the -/// [`super::InitSyn`]-[`super::InitAck`] message exchange -/// (**) The cookie MUST be the same received in the [`super::InitAck`]from the corresponding zenoh node -/// ``` -/// -/// NOTE: 16 bits (2 bytes) may be prepended to the serialized message indicating the total length -/// in bytes of the message, resulting in the maximum length of a message being 65535 bytes. -/// This is necessary in those stream-oriented transports (e.g., TCP) that do not preserve -/// the boundary of the serialized messages. The length is encoded as little-endian. -/// In any case, the length of a message must not exceed 65535 bytes. -/// - pub mod flag { pub const A: u8 = 1 << 5; // 0x20 Ack if A==0 then the message is an InitSyn else it is an InitAck pub const T: u8 = 1 << 6; // 0x40 Lease period if T==1 then the lease period is in seconds else in milliseconds pub const Z: u8 = 1 << 7; // 0x80 Extensions if Z==1 then an extension will follow } +/// # OpenSyn message +/// +/// ```text +/// 7 6 5 4 3 2 1 0 +/// +-+-+-+-+-+-+-+-+ +/// ~ challenge ~ +/// +---------------+ +/// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct OpenSyn { pub lease: Duration, @@ -171,6 +179,14 @@ impl OpenSyn { } } +/// # OpenAck message +/// +/// ```text +/// 7 6 5 4 3 2 1 0 +/// +-+-+-+-+-+-+-+-+ +/// ~ ack ~ +/// +---------------+ +/// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct OpenAck { pub lease: Duration, diff --git a/commons/zenoh-shm/src/api/provider/shm_provider.rs b/commons/zenoh-shm/src/api/provider/shm_provider.rs index 70081d0b93..5a3af8eb9e 100644 --- a/commons/zenoh-shm/src/api/provider/shm_provider.rs +++ b/commons/zenoh-shm/src/api/provider/shm_provider.rs @@ -127,7 +127,7 @@ where } #[zenoh_macros::unstable_doc] -impl<'a, IDSource, Backend> Resolvable for AllocLayoutSizedBuilder<'a, IDSource, Backend> +impl Resolvable for AllocLayoutSizedBuilder<'_, IDSource, Backend> where IDSource: ProtocolIDSource, Backend: ShmProviderBackend, @@ -544,8 +544,7 @@ where } } -impl<'a, IDSource, Backend, Policy> Resolvable - for ProviderAllocBuilder<'a, IDSource, Backend, Policy> +impl Resolvable for ProviderAllocBuilder<'_, IDSource, Backend, Policy> where IDSource: ProtocolIDSource, Backend: ShmProviderBackend, @@ -554,7 +553,7 @@ where } // Sync alloc policy -impl<'a, IDSource, Backend, Policy> Wait for ProviderAllocBuilder<'a, IDSource, Backend, Policy> +impl Wait for ProviderAllocBuilder<'_, IDSource, Backend, Policy> where IDSource: ProtocolIDSource, Backend: ShmProviderBackend, @@ -627,7 +626,7 @@ where } } -impl<'a, IDSource, Backend, Policy> Resolvable for LayoutAllocBuilder<'a, IDSource, Backend, Policy> +impl Resolvable for LayoutAllocBuilder<'_, IDSource, Backend, Policy> where IDSource: ProtocolIDSource, Backend: ShmProviderBackend, @@ -636,7 +635,7 @@ where } // Sync alloc policy -impl<'a, IDSource, Backend, Policy> Wait for LayoutAllocBuilder<'a, IDSource, Backend, Policy> +impl Wait for LayoutAllocBuilder<'_, IDSource, Backend, Policy> where IDSource: ProtocolIDSource, Backend: ShmProviderBackend, diff --git a/commons/zenoh-shm/tests/posix_array.rs b/commons/zenoh-shm/tests/posix_array.rs index 83fdad88fb..2837f44f79 100644 --- a/commons/zenoh-shm/tests/posix_array.rs +++ b/commons/zenoh-shm/tests/posix_array.rs @@ -126,7 +126,6 @@ fn arr_u32_index_memory_test() { } /// ELEM COUNT CHECKS /// - fn test_invalid_elem_index() where ElemIndex: Unsigned + PrimInt + 'static + AsPrimitive + Debug, diff --git a/commons/zenoh-util/src/time_range.rs b/commons/zenoh-util/src/time_range.rs index f282985c3a..075bdfd1d0 100644 --- a/commons/zenoh-util/src/time_range.rs +++ b/commons/zenoh-util/src/time_range.rs @@ -375,7 +375,7 @@ impl Add for TimeExpr { } } -impl<'a> Add for &'a TimeExpr { +impl Add for &TimeExpr { type Output = TimeExpr; fn add(self, duration: f64) -> TimeExpr { match self { diff --git a/io/zenoh-transport/src/manager.rs b/io/zenoh-transport/src/manager.rs index d0cf2a093b..a1c45a6d71 100644 --- a/io/zenoh-transport/src/manager.rs +++ b/io/zenoh-transport/src/manager.rs @@ -101,7 +101,6 @@ fn duration_from_i64us(us: i64) -> Duration { /// .build(Arc::new(MySH::default())) /// .unwrap(); /// ``` - pub struct TransportManagerConfig { pub version: u8, pub zid: ZenohIdProto, diff --git a/io/zenoh-transport/src/unicast/establishment/ext/auth/pubkey.rs b/io/zenoh-transport/src/unicast/establishment/ext/auth/pubkey.rs index 5638a9ee33..4893da570d 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/auth/pubkey.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/auth/pubkey.rs @@ -337,17 +337,6 @@ where } } -/*************************************/ -/* OpenAck */ -/*************************************/ -/// ```text -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// +---------------+ -/// -/// ZExtUnit -/// ``` - pub(crate) struct AuthPubKeyFsm<'a> { inner: &'a RwLock, prng: &'a Mutex, diff --git a/io/zenoh-transport/src/unicast/establishment/ext/auth/usrpwd.rs b/io/zenoh-transport/src/unicast/establishment/ext/auth/usrpwd.rs index 46d3f349b4..0f7087851b 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/auth/usrpwd.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/auth/usrpwd.rs @@ -214,29 +214,6 @@ impl<'a> AuthUsrPwdFsm<'a> { } } -/*************************************/ -/* InitSyn */ -/*************************************/ -/// ```text -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// +---------------+ -/// -/// ZExtUnit -/// ``` - -/*************************************/ -/* InitAck */ -/*************************************/ -/// ```text -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// ~ nonce ~ -/// +---------------+ -/// -/// ZExtZ64 -/// ``` - /*************************************/ /* OpenSyn */ /*************************************/ diff --git a/io/zenoh-transport/src/unicast/establishment/ext/compression.rs b/io/zenoh-transport/src/unicast/establishment/ext/compression.rs index 1d4e995af6..64231e1ecc 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/compression.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/compression.rs @@ -29,7 +29,7 @@ pub(crate) struct CompressionFsm<'a> { _a: PhantomData<&'a ()>, } -impl<'a> CompressionFsm<'a> { +impl CompressionFsm<'_> { pub(crate) const fn new() -> Self { Self { _a: PhantomData } } diff --git a/io/zenoh-transport/src/unicast/establishment/ext/lowlatency.rs b/io/zenoh-transport/src/unicast/establishment/ext/lowlatency.rs index ff1efc90b9..51a10204fe 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/lowlatency.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/lowlatency.rs @@ -29,7 +29,7 @@ pub(crate) struct LowLatencyFsm<'a> { _a: PhantomData<&'a ()>, } -impl<'a> LowLatencyFsm<'a> { +impl LowLatencyFsm<'_> { pub(crate) const fn new() -> Self { Self { _a: PhantomData } } diff --git a/io/zenoh-transport/src/unicast/establishment/ext/qos.rs b/io/zenoh-transport/src/unicast/establishment/ext/qos.rs index 9a98fce581..6c522c8e38 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/qos.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/qos.rs @@ -35,7 +35,7 @@ pub(crate) struct QoSFsm<'a> { _a: PhantomData<&'a ()>, } -impl<'a> QoSFsm<'a> { +impl QoSFsm<'_> { pub(crate) const fn new() -> Self { Self { _a: PhantomData } } diff --git a/io/zenoh-transport/src/unicast/establishment/ext/shm.rs b/io/zenoh-transport/src/unicast/establishment/ext/shm.rs index 025aaaef44..35eff8a809 100644 --- a/io/zenoh-transport/src/unicast/establishment/ext/shm.rs +++ b/io/zenoh-transport/src/unicast/establishment/ext/shm.rs @@ -194,26 +194,6 @@ where } } -/*************************************/ -/* OpenSyn */ -/*************************************/ -/// ```text -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// ~ challenge ~ -/// +---------------+ -/// ``` - -/*************************************/ -/* OpenAck */ -/*************************************/ -/// ```text -/// 7 6 5 4 3 2 1 0 -/// +-+-+-+-+-+-+-+-+ -/// ~ ack ~ -/// +---------------+ -/// ``` - // Extension Fsm pub(crate) struct ShmFsm<'a> { inner: &'a AuthUnicast, diff --git a/plugins/zenoh-plugin-rest/src/config.rs b/plugins/zenoh-plugin-rest/src/config.rs index d215b8a5a7..35d0d34de4 100644 --- a/plugins/zenoh-plugin-rest/src/config.rs +++ b/plugins/zenoh-plugin-rest/src/config.rs @@ -63,7 +63,7 @@ fn default_max_block_thread_num() -> usize { struct HttpPortVisitor; -impl<'de> Visitor<'de> for HttpPortVisitor { +impl Visitor<'_> for HttpPortVisitor { type Value = String; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/zenoh-ext/src/querying_subscriber.rs b/zenoh-ext/src/querying_subscriber.rs index c4674d643a..fa9981e2b5 100644 --- a/zenoh-ext/src/querying_subscriber.rs +++ b/zenoh-ext/src/querying_subscriber.rs @@ -226,6 +226,7 @@ impl<'a, 'b, KeySpace, Handler, const BACKGROUND: bool> self } + #[allow(clippy::type_complexity)] fn into_fetching_subscriber_builder( self, ) -> ZResult< @@ -427,13 +428,12 @@ pub struct FetchingSubscriberBuilder< impl< 'a, - 'b, KeySpace, Handler, Fetch: FnOnce(Box) -> ZResult<()>, TryIntoSample, const BACKGROUND: bool, - > FetchingSubscriberBuilder<'a, 'b, KeySpace, Handler, Fetch, TryIntoSample, BACKGROUND> + > FetchingSubscriberBuilder<'a, '_, KeySpace, Handler, Fetch, TryIntoSample, BACKGROUND> where TryIntoSample: ExtractSample, { diff --git a/zenoh/src/api/builders/info.rs b/zenoh/src/api/builders/info.rs index e8396eab08..29861e96f4 100644 --- a/zenoh/src/api/builders/info.rs +++ b/zenoh/src/api/builders/info.rs @@ -43,17 +43,17 @@ impl<'a> ZenohIdBuilder<'a> { } } -impl<'a> Resolvable for ZenohIdBuilder<'a> { +impl Resolvable for ZenohIdBuilder<'_> { type To = ZenohId; } -impl<'a> Wait for ZenohIdBuilder<'a> { +impl Wait for ZenohIdBuilder<'_> { fn wait(self) -> Self::To { self.runtime.zid() } } -impl<'a> IntoFuture for ZenohIdBuilder<'a> { +impl IntoFuture for ZenohIdBuilder<'_> { type Output = ::To; type IntoFuture = Ready<::To>; @@ -87,11 +87,11 @@ impl<'a> RoutersZenohIdBuilder<'a> { } } -impl<'a> Resolvable for RoutersZenohIdBuilder<'a> { +impl Resolvable for RoutersZenohIdBuilder<'_> { type To = Box + Send + Sync>; } -impl<'a> Wait for RoutersZenohIdBuilder<'a> { +impl Wait for RoutersZenohIdBuilder<'_> { fn wait(self) -> Self::To { Box::new( zenoh_runtime::ZRuntime::Application @@ -107,7 +107,7 @@ impl<'a> Wait for RoutersZenohIdBuilder<'a> { } } -impl<'a> IntoFuture for RoutersZenohIdBuilder<'a> { +impl IntoFuture for RoutersZenohIdBuilder<'_> { type Output = ::To; type IntoFuture = Ready<::To>; @@ -141,11 +141,11 @@ impl<'a> PeersZenohIdBuilder<'a> { } } -impl<'a> Resolvable for PeersZenohIdBuilder<'a> { +impl Resolvable for PeersZenohIdBuilder<'_> { type To = Box + Send + Sync>; } -impl<'a> Wait for PeersZenohIdBuilder<'a> { +impl Wait for PeersZenohIdBuilder<'_> { fn wait(self) -> ::To { Box::new( zenoh_runtime::ZRuntime::Application @@ -161,7 +161,7 @@ impl<'a> Wait for PeersZenohIdBuilder<'a> { } } -impl<'a> IntoFuture for PeersZenohIdBuilder<'a> { +impl IntoFuture for PeersZenohIdBuilder<'_> { type Output = ::To; type IntoFuture = Ready<::To>; diff --git a/zenoh/src/api/builders/publisher.rs b/zenoh/src/api/builders/publisher.rs index ac6565cd27..17d0aef165 100644 --- a/zenoh/src/api/builders/publisher.rs +++ b/zenoh/src/api/builders/publisher.rs @@ -294,7 +294,7 @@ pub struct PublisherBuilder<'a, 'b> { pub(crate) destination: Locality, } -impl<'a, 'b> Clone for PublisherBuilder<'a, 'b> { +impl Clone for PublisherBuilder<'_, '_> { fn clone(&self) -> Self { Self { session: self.session, @@ -340,7 +340,7 @@ impl QoSBuilderTrait for PublisherBuilder<'_, '_> { } } -impl<'a, 'b> PublisherBuilder<'a, 'b> { +impl PublisherBuilder<'_, '_> { /// Changes the [`crate::sample::Locality`] applied when routing the data. /// /// This restricts the matching subscribers that will receive the published data to the ones @@ -367,11 +367,11 @@ impl<'a, 'b> PublisherBuilder<'a, 'b> { } } -impl<'a, 'b> Resolvable for PublisherBuilder<'a, 'b> { +impl<'b> Resolvable for PublisherBuilder<'_, 'b> { type To = ZResult>; } -impl<'a, 'b> Wait for PublisherBuilder<'a, 'b> { +impl Wait for PublisherBuilder<'_, '_> { fn wait(self) -> ::To { let mut key_expr = self.key_expr?; if !key_expr.is_fully_optimized(&self.session.0) { @@ -426,7 +426,7 @@ impl<'a, 'b> Wait for PublisherBuilder<'a, 'b> { } } -impl<'a, 'b> IntoFuture for PublisherBuilder<'a, 'b> { +impl IntoFuture for PublisherBuilder<'_, '_> { type Output = ::To; type IntoFuture = Ready<::To>; diff --git a/zenoh/src/api/builders/query.rs b/zenoh/src/api/builders/query.rs index 362aa8a25c..a5c9994308 100644 --- a/zenoh/src/api/builders/query.rs +++ b/zenoh/src/api/builders/query.rs @@ -230,7 +230,7 @@ impl<'a, 'b> SessionGetBuilder<'a, 'b, DefaultHandler> { } } } -impl<'a, 'b, Handler> SessionGetBuilder<'a, 'b, Handler> { +impl SessionGetBuilder<'_, '_, Handler> { #[inline] pub fn payload(mut self, payload: IntoZBytes) -> Self where diff --git a/zenoh/src/api/builders/reply.rs b/zenoh/src/api/builders/reply.rs index c69c882ae1..3abb6c6b62 100644 --- a/zenoh/src/api/builders/reply.rs +++ b/zenoh/src/api/builders/reply.rs @@ -224,7 +224,7 @@ pub struct ReplyErrBuilder<'a> { } impl<'a> ReplyErrBuilder<'a> { - pub(crate) fn new(query: &'a Query, payload: IntoZBytes) -> ReplyErrBuilder<'_> + pub(crate) fn new(query: &'a Query, payload: IntoZBytes) -> ReplyErrBuilder<'a> where IntoZBytes: Into, { @@ -246,7 +246,7 @@ impl EncodingBuilderTrait for ReplyErrBuilder<'_> { } } -impl<'a> Resolvable for ReplyErrBuilder<'a> { +impl Resolvable for ReplyErrBuilder<'_> { type To = ZResult<()>; } @@ -278,7 +278,7 @@ impl Wait for ReplyErrBuilder<'_> { } } -impl<'a> IntoFuture for ReplyErrBuilder<'a> { +impl IntoFuture for ReplyErrBuilder<'_> { type Output = ::To; type IntoFuture = Ready<::To>; diff --git a/zenoh/src/api/config.rs b/zenoh/src/api/config.rs index 673bc5d422..88338b4ee4 100644 --- a/zenoh/src/api/config.rs +++ b/zenoh/src/api/config.rs @@ -211,7 +211,7 @@ pub struct LookupGuard<'a, T> { subref: *const dyn Any, } -impl<'a, T> Deref for LookupGuard<'a, T> { +impl Deref for LookupGuard<'_, T> { type Target = dyn Any; fn deref(&self) -> &Self::Target { @@ -220,7 +220,7 @@ impl<'a, T> Deref for LookupGuard<'a, T> { } } -impl<'a, T> AsRef for LookupGuard<'a, T> { +impl AsRef for LookupGuard<'_, T> { fn as_ref(&self) -> &dyn Any { self.deref() } diff --git a/zenoh/src/api/handlers/fifo.rs b/zenoh/src/api/handlers/fifo.rs index 3029baca17..28c19e7a4e 100644 --- a/zenoh/src/api/handlers/fifo.rs +++ b/zenoh/src/api/handlers/fifo.rs @@ -197,7 +197,7 @@ impl IntoIterator for FifoChannelHandler { /// An iterator over the msgs received from a channel. pub struct Iter<'a, T>(flume::Iter<'a, T>); -impl<'a, T> Iterator for Iter<'a, T> { +impl Iterator for Iter<'_, T> { type Item = T; fn next(&mut self) -> Option { @@ -208,7 +208,7 @@ impl<'a, T> Iterator for Iter<'a, T> { /// An non-blocking iterator over the msgs received from a channel. pub struct TryIter<'a, T>(flume::TryIter<'a, T>); -impl<'a, T> Iterator for TryIter<'a, T> { +impl Iterator for TryIter<'_, T> { type Item = T; fn next(&mut self) -> Option { @@ -220,7 +220,7 @@ impl<'a, T> Iterator for TryIter<'a, T> { #[derive(Debug)] pub struct Drain<'a, T>(flume::Drain<'a, T>); -impl<'a, T> Iterator for Drain<'a, T> { +impl Iterator for Drain<'_, T> { type Item = T; fn next(&mut self) -> Option { @@ -228,7 +228,7 @@ impl<'a, T> Iterator for Drain<'a, T> { } } -impl<'a, T> ExactSizeIterator for Drain<'a, T> { +impl ExactSizeIterator for Drain<'_, T> { fn len(&self) -> usize { self.0.len() } @@ -266,7 +266,7 @@ impl FifoChannelHandler { #[must_use = "futures/streams/sinks do nothing unless you `.await` or poll them"] pub struct RecvFut<'a, T>(flume::r#async::RecvFut<'a, T>); -impl<'a, T> Future for RecvFut<'a, T> { +impl Future for RecvFut<'_, T> { type Output = ZResult; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -274,7 +274,7 @@ impl<'a, T> Future for RecvFut<'a, T> { } } -impl<'a, T> futures::future::FusedFuture for RecvFut<'a, T> { +impl futures::future::FusedFuture for RecvFut<'_, T> { fn is_terminated(&self) -> bool { futures::future::FusedFuture::is_terminated(&self.0) } @@ -300,7 +300,7 @@ impl FifoChannelHandler { #[derive(Clone)] pub struct RecvStream<'a, T>(flume::r#async::RecvStream<'a, T>); -impl<'a, T> RecvStream<'a, T> { +impl RecvStream<'_, T> { /// See [`FifoChannelHandler::is_disconnected`]. pub fn is_disconnected(&self) -> bool { self.0.is_disconnected() @@ -332,7 +332,7 @@ impl<'a, T> RecvStream<'a, T> { } } -impl<'a, T> futures::stream::Stream for RecvStream<'a, T> { +impl futures::stream::Stream for RecvStream<'_, T> { type Item = T; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { @@ -340,7 +340,7 @@ impl<'a, T> futures::stream::Stream for RecvStream<'a, T> { } } -impl<'a, T> futures::stream::FusedStream for RecvStream<'a, T> { +impl futures::stream::FusedStream for RecvStream<'_, T> { fn is_terminated(&self) -> bool { futures::stream::FusedStream::is_terminated(&self.0) } diff --git a/zenoh/src/api/key_expr.rs b/zenoh/src/api/key_expr.rs index 2a3c775bfc..e32b90b936 100644 --- a/zenoh/src/api/key_expr.rs +++ b/zenoh/src/api/key_expr.rs @@ -305,7 +305,7 @@ impl<'a> From<&'a keyexpr> for KeyExpr<'a> { Self(KeyExprInner::Borrowed(ke)) } } -impl<'a> From for KeyExpr<'a> { +impl From for KeyExpr<'_> { fn from(v: OwnedKeyExpr) -> Self { Self(KeyExprInner::Owned(v)) } @@ -349,7 +349,7 @@ impl<'a> From<&'a KeyExpr<'a>> for KeyExpr<'a> { } } } -impl<'a> From> for String { +impl From> for String { fn from(ke: KeyExpr) -> Self { match ke.0 { KeyExprInner::Borrowed(key_expr) | KeyExprInner::BorrowedWire { key_expr, .. } => { @@ -360,7 +360,7 @@ impl<'a> From> for String { } } -impl<'a> TryFrom for KeyExpr<'a> { +impl TryFrom for KeyExpr<'_> { type Error = zenoh_result::Error; fn try_from(value: String) -> Result { Ok(Self(KeyExprInner::Owned(value.try_into()?))) diff --git a/zenoh/src/api/publisher.rs b/zenoh/src/api/publisher.rs index 2b996504db..03191b2d8a 100644 --- a/zenoh/src/api/publisher.rs +++ b/zenoh/src/api/publisher.rs @@ -359,7 +359,7 @@ impl Drop for Publisher<'_> { } } -impl<'a> Sink for Publisher<'a> { +impl Sink for Publisher<'_> { type Error = Error; #[inline] diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index 7974dbad3e..6684edb193 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -230,7 +230,6 @@ pub mod sample { /// The`zenoh_ext` crate provides serialization and deserialization of basic types and structures for `ZBytes` /// [`z_serialize`](../../zenoh_ext/fn.z_serialize.html) / /// [`z_deserialize`](../../zenoh_ext/fn.z_deserialize.html). - pub mod bytes { pub use crate::api::{ bytes::{OptionZBytes, ZBytes, ZBytesReader, ZBytesSliceIterator, ZBytesWriter}, diff --git a/zenoh/tests/liveliness.rs b/zenoh/tests/liveliness.rs index b78292c148..a7de858c8e 100644 --- a/zenoh/tests/liveliness.rs +++ b/zenoh/tests/liveliness.rs @@ -421,7 +421,6 @@ async fn test_liveliness_after_close() { /// ------------------------------------------------------- /// DOUBLE CLIENT /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_before() { @@ -1026,7 +1025,6 @@ async fn test_liveliness_subscriber_double_client_history_after() { /// ------------------------------------------------------- /// DOUBLE PEER /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_before() { @@ -1613,7 +1611,6 @@ async fn test_liveliness_subscriber_double_peer_history_after() { /// ------------------------------------------------------- /// DOUBLE ROUTER /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_before() { @@ -2248,7 +2245,6 @@ async fn test_liveliness_subscriber_double_router_history_after() { /// ------------------------------------------------------- /// DOUBLE CLIENT VIA PEER /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_before() { @@ -2970,7 +2966,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_after() { /// ------------------------------------------------------- /// SUBGET CLIENT /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_before() { @@ -3361,7 +3356,6 @@ async fn test_liveliness_subget_client_history_middle() { /// ------------------------------------------------------- /// SUBGET PEER /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_before() { @@ -3752,7 +3746,6 @@ async fn test_liveliness_subget_peer_history_middle() { /// ------------------------------------------------------- /// SUBGET ROUTER /// ------------------------------------------------------- - #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_before() {