Skip to content

Commit c7365b3

Browse files
committed
chore: fmt
1 parent c57c8f1 commit c7365b3

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

msg-socket/src/hooks/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//!
1717
//! ```no_run
1818
//! use msg_socket::hooks::{ConnectionHook, Error, HookResult};
19-
//! use tokio::io::{AsyncRead, AsyncWrite, AsyncReadExt, AsyncWriteExt};
19+
//! use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
2020
//!
2121
//! struct MyAuth;
2222
//!
@@ -143,7 +143,9 @@ where
143143
Box::pin(async move {
144144
ConnectionHook::on_connection(&*self, io).await.map_err(|e| match e {
145145
Error::Io(io_err) => Error::Io(io_err),
146-
Error::Hook(hook_err) => Error::Hook(Box::new(hook_err) as Box<dyn StdError + Send + Sync>),
146+
Error::Hook(hook_err) => {
147+
Error::Hook(Box::new(hook_err) as Box<dyn StdError + Send + Sync>)
148+
}
147149
})
148150
})
149151
}

msg-socket/src/hooks/token.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
//! # Example
99
//!
1010
//! ```no_run
11-
//! use msg_socket::{RepSocket, ReqSocket};
12-
//! use msg_socket::hooks::token::{ServerHook, ClientHook};
13-
//! use msg_transport::tcp::Tcp;
1411
//! use bytes::Bytes;
12+
//! use msg_socket::{
13+
//! RepSocket, ReqSocket,
14+
//! hooks::token::{ClientHook, ServerHook},
15+
//! };
16+
//! use msg_transport::tcp::Tcp;
1517
//!
1618
//! // Server side - validates incoming tokens
17-
//! let rep = RepSocket::new(Tcp::default())
18-
//! .with_connection_hook(ServerHook::new(|token| {
19-
//! // Custom validation logic
20-
//! token == b"secret"
21-
//! }));
19+
//! let rep = RepSocket::new(Tcp::default()).with_connection_hook(ServerHook::new(|token| {
20+
//! // Custom validation logic
21+
//! token == b"secret"
22+
//! }));
2223
//!
2324
//! // Client side - sends token on connect
24-
//! let req = ReqSocket::new(Tcp::default())
25-
//! .with_connection_hook(ClientHook::new(Bytes::from("secret")));
25+
//! let req =
26+
//! ReqSocket::new(Tcp::default()).with_connection_hook(ClientHook::new(Bytes::from("secret")));
2627
//! ```
2728
2829
use std::io;
@@ -147,8 +148,8 @@ where
147148
/// # Example
148149
///
149150
/// ```no_run
150-
/// use msg_socket::hooks::token::ClientHook;
151151
/// use bytes::Bytes;
152+
/// use msg_socket::hooks::token::ClientHook;
152153
///
153154
/// let hook = ClientHook::new(Bytes::from("my_secret_token"));
154155
/// ```

msg-socket/src/pub/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::{
55
};
66

77
use futures::{Future, StreamExt, stream::FuturesUnordered};
8+
use msg_common::span::{EnterSpan as _, SpanExt as _, WithSpan};
89
use tokio::{sync::broadcast, task::JoinSet};
910
use tokio_util::codec::Framed;
10-
use msg_common::span::{EnterSpan as _, SpanExt as _, WithSpan};
1111
use tracing::{debug, error, info, warn};
1212

1313
use super::{

msg-socket/src/req/conn_manager.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ pub(crate) enum ConnectionError<T: std::error::Error> {
2727

2828
impl<T: std::error::Error + From<std::io::Error>> ConnectionError<T> {
2929
/// Create a ConnectionError from an erased hook error, converting Io errors to Transport.
30-
pub(crate) fn from_erased_hook(err: hooks::Error<Box<dyn std::error::Error + Send + Sync>>) -> Self {
30+
pub(crate) fn from_erased_hook(
31+
err: hooks::Error<Box<dyn std::error::Error + Send + Sync>>,
32+
) -> Self {
3133
match err {
3234
hooks::Error::Io(io_err) => Self::Transport(T::from(io_err)),
3335
hooks::Error::Hook(e) => Self::Hook(e),

msg-socket/src/sub/driver.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ use std::{
66
};
77

88
use futures::{Future, StreamExt};
9+
use msg_common::span::{EnterSpan as _, SpanExt as _, WithSpan};
910
use rustc_hash::FxHashMap;
10-
use tokio::{sync::mpsc::{self, error::TrySendError}, task::JoinSet};
11+
use tokio::{
12+
sync::mpsc::{self, error::TrySendError},
13+
task::JoinSet,
14+
};
1115
use tokio_util::codec::Framed;
12-
use msg_common::span::{EnterSpan as _, SpanExt as _, WithSpan};
1316
use tracing::{debug, error, info, warn};
1417

1518
use super::{

0 commit comments

Comments
 (0)