Skip to content

Commit

Permalink
fix(clippy): clippy doc lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Totodore committed Oct 5, 2024
1 parent 71d679f commit 8580914
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crates/parser-common/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ mod tests {
assert_eq!(
to_str_bin(
Data2 {
data: vec![BIN; 5].into(),
data: vec![BIN; 5],
test: "null".to_string()
},
Some("event")
Expand Down Expand Up @@ -261,7 +261,7 @@ mod tests {
vec![BIN; 5].into()
),
Data2 {
data: vec![BIN; 5].into(),
data: vec![BIN; 5],
test: "null".to_string()
}
);
Expand Down
22 changes: 11 additions & 11 deletions crates/socketioxide-core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
//! The parsing system in socketioxide is split in three phases for serialization and deserialization:
//!
//! ## Deserialization
//! * The SocketIO server receives a packet and calls [`Parse::decode_str`] or [`Parse::decode_bin`]
//! * The SocketIO server receives a packet and calls [`Parse::decode_str`] or [`Parse::decode_bin`]
//! to decode the incoming packet. If a [`ParseError::NeedsMoreBinaryData`] is returned, the server keeps the packet

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! and waits for new incoming data.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! * Once the packet is complete, the server dispatches the packet to the appropriate namespace
//! * Once the packet is complete, the server dispatches the packet to the appropriate namespace
//! and calls [`Parse::read_event`] to route the data to the appropriate event handler.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! * If the user-provided handler has a `Data` extractor with a provided `T` type, the server
//! * If the user-provided handler has a `Data` extractor with a provided `T` type, the server
//! calls [`Parse::decode_value`] to deserialize the data. This function will handle the event

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! name as the first argument of the array, as well as variadic arguments.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//!
//! ## Serialization
//! * The user calls emit from the socket or namespace with custom `Serializable` data. The server calls
//! * The user calls emit from the socket or namespace with custom `Serializable` data. The server calls
//! [`Parse::encode_value`] to convert this to a raw [`Value`] to be included in the packet. The function

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! will take care of handling the event name as the first argument of the array, along with variadic arguments.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
//! * The server then calls [`Parse::encode`] to convert the payload provided by the user,
//! * The server then calls [`Parse::encode`] to convert the payload provided by the user,
//! along with other metadata (namespace, ack ID, etc.), into a fully serialized packet ready to be sent.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

use std::{
Expand Down Expand Up @@ -72,9 +72,9 @@ pub trait Parse: Default + Copy {

/// Convert any serializable data to a generic [`Value`] to be later included as a payload in the packet.
///
/// * Any data serialized will be wrapped in an array to match the socket.io format (`[data]`).
/// * If the data is a tuple-like type the tuple will be expanded in the array (`[...data]`).
/// * If provided the event name will be serialized as the first element of the array
/// * Any data serialized will be wrapped in an array to match the socket.io format (`[data]`).
/// * If the data is a tuple-like type the tuple will be expanded in the array (`[...data]`).
/// * If provided the event name will be serialized as the first element of the array
/// (`[event, ...data]`) or (`[event, data]`).

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
fn encode_value<T: ?Sized + Serialize>(
self,
Expand All @@ -85,11 +85,11 @@ pub trait Parse: Default + Copy {
/// Convert any generic [`Value`] to a deserializable type.
/// It should always be an array (according to the serde model).
///
/// * If `with_event` is true, we expect an event str as the first element and we will skip
/// * If `with_event` is true, we expect an event str as the first element and we will skip
/// it when deserializing data.

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
/// * If `T` is a tuple-like type, all the remaining elements of the array will be
/// * If `T` is a tuple-like type, all the remaining elements of the array will be
/// deserialized (`[...data]`).

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation

Check warning

Code scanning / clippy

doc list item without indentation Warning

doc list item without indentation
/// * If `T` is not a tuple-like type, the first element of the array will be deserialized (`[data]`).
/// * If `T` is not a tuple-like type, the first element of the array will be deserialized (`[data]`).
fn decode_value<'de, T: Deserialize<'de>>(
self,
value: &'de mut Value,
Expand Down

0 comments on commit 8580914

Please sign in to comment.