From ac06f6b2048ca03f691e8a6ec08943dd7c795bb2 Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Fri, 25 Oct 2024 12:20:55 -0700 Subject: [PATCH] Fix docs --- manul/src/protocol/message.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manul/src/protocol/message.rs b/manul/src/protocol/message.rs index e1d2802..916925c 100644 --- a/manul/src/protocol/message.rs +++ b/manul/src/protocol/message.rs @@ -25,11 +25,13 @@ use private::{MessagePayload, ProtocolMessageWrapper}; /// A serialized part of the protocol message. /// -/// These would usually be generated separately by the round, but delivered together to [`Round::receive_message`]. +/// These would usually be generated separately by the round, but delivered together to +/// [`Round::receive_message`](`crate::protocol::Round::receive_message`). pub trait ProtocolMessage: ProtocolMessageWrapper { /// The error specific to deserializing this message. /// - /// Used to distinguish which deserialization failed in [`Round::receive_message`] + /// Used to distinguish which deserialization failed in + /// [`Round::receive_message`](`crate::protocol::Round::receive_message`) /// and store the corresponding message in the evidence. type Error: From; @@ -40,7 +42,7 @@ pub trait ProtocolMessage: ProtocolMessageWrapper { Self::new_inner(None) } - /// Creates a new serialized direct message. + /// Creates a new serialized message. fn new(message: T) -> Result { let payload = MessagePayload(P::serialize(message)?); Ok(Self::new_inner(Some(payload))) @@ -64,7 +66,8 @@ pub trait ProtocolMessage: ProtocolMessageWrapper { /// Returns `Ok(())` if the message cannot be deserialized into `T`. /// - /// This is intended to be used in the implementations of [`Protocol::verify_direct_message_is_invalid`]. + /// This is intended to be used in the implementations of + /// [`Protocol::verify_direct_message_is_invalid`] or [`Protocol::verify_echo_broadcast_is_invalid`]. fn verify_is_not Deserialize<'de>>(&self) -> Result<(), MessageValidationError> { if self.deserialize::().is_err() { Ok(()) @@ -77,7 +80,8 @@ pub trait ProtocolMessage: ProtocolMessageWrapper { /// Returns `Ok(())` if the message contains a payload. /// - /// This is intended to be used in the implementations of [`Protocol::verify_direct_message_is_invalid`]. + /// This is intended to be used in the implementations of + /// [`Protocol::verify_direct_message_is_invalid`] or [`Protocol::verify_echo_broadcast_is_invalid`]. fn verify_is_some(&self) -> Result<(), MessageValidationError> { if self.maybe_message().is_some() { Ok(()) @@ -88,7 +92,7 @@ pub trait ProtocolMessage: ProtocolMessageWrapper { } } - /// Deserializes the direct message. + /// Deserializes the message into `T`. fn deserialize Deserialize<'de>>(&self) -> Result { let payload = self .maybe_message()