Skip to content

Commit

Permalink
Small changes to documentation of functions/moddules
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmgleite committed Jul 18, 2024
1 parent 8e37c74 commit 8aa1411
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cmd/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{error::Result, server::message::IntoMessage};

use super::CommandId;

#[derive(Debug, Serialize)]
#[derive(Debug)]
pub struct Ping;

impl Ping {
Expand Down
6 changes: 3 additions & 3 deletions src/server/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! When serialized, a [`Message`] looks like the following:
//!
//! [4 bytes - ID][4 bytes - length of payload][payload (dynamic size)]
//! [2 bytes - cmd_id][4 bytes - request_id len][request_id][4 bytes - length of payload][payload]
use std::mem::size_of;

use bytes::{BufMut, Bytes, BytesMut};
Expand All @@ -24,7 +24,7 @@ pub const MAX_MESSAGE_SIZE: u32 = 1024 * 1024;
/// that this server uses.
#[derive(Debug)]
pub struct Message {
/// Message id -> used as a way of identifying the format of the payload for deserialization
/// Used as a way of identifying the format of the payload for deserialization
pub cmd_id: CommandId,
/// A unique request identifier - used for request tracing and debugging
/// Note that this has to be encoded as utf8 otherwise parsing the message will fail
Expand All @@ -35,7 +35,7 @@ pub struct Message {

/// A trait that has to be implemented for any structs/enums that can be transformed into a [`Message`]
pub trait IntoMessage {
/// Same as [`Message::id`]
/// Same as [`Message::cmd_id`]
fn cmd_id(&self) -> CommandId;
/// Same as [`Message::payload`]
fn payload(&self) -> Option<Bytes> {
Expand Down

0 comments on commit 8aa1411

Please sign in to comment.