Skip to content

Commit

Permalink
fix(socketio): manual impl for Debug to work with Adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
Totodore committed Jan 16, 2025
1 parent a58c242 commit bf11bce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 9 additions & 1 deletion crates/socketioxide/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt;
use std::sync::{Arc, Mutex, OnceLock, RwLock};

use bytes::Bytes;
Expand Down Expand Up @@ -212,7 +213,6 @@ impl<A: Adapter> Client<A> {
}
}

#[derive(Debug)]
pub struct SocketData<A: Adapter> {
pub parser_state: ParserState,
/// Channel used to notify the socket that it has been connected to a namespace for v5
Expand All @@ -230,6 +230,14 @@ impl<A: Adapter> Default for SocketData<A> {
}
}
}
impl<A: Adapter> fmt::Debug for SocketData<A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SocketData")
.field("parser_state", &self.parser_state)
.field("connect_recv_tx", &self.connect_recv_tx)
.finish()
}
}

impl<A: Adapter> EngineIoHandler for Client<A> {
type Data = SocketData<A>;
Expand Down
1 change: 0 additions & 1 deletion crates/socketioxide/src/extract/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl<A: Adapter> fmt::Debug for SocketRef<A> {
///
/// It is generic over the [`Adapter`] type. If you plan to use it with another adapter than the default,
/// make sure to have a handler that is [generic over the adapter type](crate#adapters).
#[derive(Debug)]
pub struct AckSender<A: Adapter = LocalAdapter> {
socket: Arc<Socket<A>>,
ack_id: Option<i64>,
Expand Down

0 comments on commit bf11bce

Please sign in to comment.