diff --git a/protocols/v2/framing-sv2/src/framing.rs b/protocols/v2/framing-sv2/src/framing.rs index 1bddf16da9..8ac44339fb 100644 --- a/protocols/v2/framing-sv2/src/framing.rs +++ b/protocols/v2/framing-sv2/src/framing.rs @@ -43,7 +43,7 @@ impl From> for Frame { pub struct Sv2Frame { header: Header, payload: Option, - /// Serialized header + payload + // Serialized header + payload serialized: Option, } @@ -227,7 +227,7 @@ impl HandShakeFrame { Self { payload: bytes } } - /// Returns the size of the `HandShakeFrame` payload. + // Returns the size of the `HandShakeFrame` payload. #[inline] fn encoded_length(&self) -> usize { self.payload.len() @@ -255,10 +255,10 @@ pub fn handshake_message_to_frame>(message: T) -> HandShakeFrame } } -/// Basically a boolean bit filter for `extension_type`. -/// Takes an `extension_type` represented as a `u16` and a boolean flag (`channel_msg`). -/// If `channel_msg` is true, it sets the most significant bit of `extension_type` to 1, -/// otherwise, it clears the most significant bit to 0. +// Basically a boolean bit filter for `extension_type`. +// Takes an `extension_type` represented as a `u16` and a boolean flag (`channel_msg`). +// If `channel_msg` is true, it sets the most significant bit of `extension_type` to 1, +// otherwise, it clears the most significant bit to 0. fn update_extension_type(extension_type: u16, channel_msg: bool) -> u16 { if channel_msg { let mask = 0b1000_0000_0000_0000; diff --git a/protocols/v2/framing-sv2/src/header.rs b/protocols/v2/framing-sv2/src/header.rs index 3c3d871cd9..178dc9f13e 100644 --- a/protocols/v2/framing-sv2/src/header.rs +++ b/protocols/v2/framing-sv2/src/header.rs @@ -17,18 +17,18 @@ pub const NOISE_HEADER_SIZE: usize = const_sv2::NOISE_FRAME_HEADER_SIZE; /// Abstraction for a SV2 Frame Header. #[derive(Debug, Serialize, Deserialize, Copy, Clone)] pub struct Header { - /// Unique identifier of the extension describing this protocol message. Most significant bit - /// (i.e.bit 15, 0-indexed, aka channel_msg) indicates a message which is specific to a - /// channel, whereas if the most significant bit is unset, the message is to be interpreted - /// by the immediate receiving device. Note that the channel_msg bit is ignored in the - /// extension lookup, i.e.an extension_type of 0x8ABC is for the same "extension" as - /// 0x0ABC. If the channel_msg bit is set, the first four bytes of the payload field is a - /// U32 representing the channel_id this message is destined for. Note that for the Job - /// Declaration and Template Distribution Protocols the channel_msg bit is always unset. + // Unique identifier of the extension describing this protocol message. Most significant bit + // (i.e.bit 15, 0-indexed, aka channel_msg) indicates a message which is specific to a channel, + // whereas if the most significant bit is unset, the message is to be interpreted by the + // immediate receiving device. Note that the channel_msg bit is ignored in the extension + // lookup, i.e.an extension_type of 0x8ABC is for the same "extension" as 0x0ABC. If the + // channel_msg bit is set, the first four bytes of the payload field is a U32 representing the + // channel_id this message is destined for. Note that for the Job Declaration and Template + // Distribution Protocols the channel_msg bit is always unset. extension_type: u16, // fix: use U16 type - /// Unique identifier of the extension describing this protocol message + // Unique identifier of the extension describing this protocol message msg_type: u8, // fix: use specific type? - /// Length of the protocol message, not including this header + // Length of the protocol message, not including this header msg_length: U24, } @@ -51,7 +51,7 @@ impl Header { }) } - /// Get the payload length + // Get the payload length #[allow(clippy::len_without_is_empty)] #[inline] pub(crate) fn len(&self) -> usize { @@ -59,7 +59,7 @@ impl Header { inner as usize } - /// Construct a `Header` from payload length, type and extension type. + // Construct a `Header` from payload length, type and extension type. #[inline] pub(crate) fn from_len(msg_length: u32, msg_type: u8, extension_type: u16) -> Option
{ Some(Self {