Skip to content

Commit bbbb22a

Browse files
authored
feat: get rid of unnecessary as-any dependency (#9)
1 parent 0364105 commit bbbb22a

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ server = ["tokio"]
1818
tokio = ["dep:tokio"]
1919

2020
[dependencies]
21-
as-any = "0.3"
2221
async-trait = "0.1"
23-
byteorder = "1"
2422
bytes = "1"
2523
percent-encoding = "2"
2624
serde = { version = "1", features = ["derive"], optional = true }

examples/s5-server.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ where
116116
{
117117
let (conn, res) = conn.authenticate().await?;
118118

119-
use as_any::AsAny;
120-
if let Some(res) = res.as_any().downcast_ref::<std::io::Result<bool>>() {
119+
use std::any::Any;
120+
let res = &res as &dyn Any;
121+
if let Some(res) = res.downcast_ref::<std::io::Result<bool>>() {
121122
let res = *res.as_ref().map_err(|err| err.to_string())?;
122123
if !res {
123124
log::info!("authentication failed");

src/server/auth.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::protocol::{AsyncStreamOperation, AuthMethod, UserKey, handshake::password_method};
2-
use as_any::AsAny;
32
use async_trait::async_trait;
43
use std::sync::Arc;
54
use tokio::net::TcpStream;
@@ -36,7 +35,7 @@ use tokio::net::TcpStream;
3635
/// ```
3736
#[async_trait]
3837
pub trait AuthExecutor {
39-
type Output: AsAny;
38+
type Output;
4039
fn auth_method(&self) -> AuthMethod;
4140
async fn execute(&self, stream: &mut TcpStream) -> Self::Output;
4241
}

0 commit comments

Comments
 (0)