diff --git a/Cargo.lock b/Cargo.lock index e7b22c7..0e1355d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,17 +75,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "atty" version = "0.2.14" @@ -848,7 +837,6 @@ dependencies = [ name = "rkvm-net" version = "0.1.0" dependencies = [ - "async-trait", "bincode", "hmac", "rand", diff --git a/rkvm-net/Cargo.toml b/rkvm-net/Cargo.toml index 363cd97..635153f 100644 --- a/rkvm-net/Cargo.toml +++ b/rkvm-net/Cargo.toml @@ -11,7 +11,6 @@ rkvm-input = { path = "../rkvm-input" } serde = { version = "1.0.117", features = ["derive"] } bincode = "1.3.3" tokio = { version = "1.0.1", features = ["io-util"] } -async-trait = "0.1.68" thiserror = "1.0.40" hmac = "0.12.1" sha2 = "0.10.6" diff --git a/rkvm-net/src/lib.rs b/rkvm-net/src/lib.rs index 79e0059..9425e38 100644 --- a/rkvm-net/src/lib.rs +++ b/rkvm-net/src/lib.rs @@ -1,3 +1,6 @@ +// This is not really public API. +#![allow(async_fn_in_trait)] + pub mod auth; pub mod message; pub mod version; diff --git a/rkvm-net/src/message.rs b/rkvm-net/src/message.rs index 64fc21f..930af14 100644 --- a/rkvm-net/src/message.rs +++ b/rkvm-net/src/message.rs @@ -4,14 +4,12 @@ use serde::Serialize; use std::io::{Error, ErrorKind}; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; -#[async_trait::async_trait] pub trait Message: Sized { async fn decode(stream: &mut R) -> Result; async fn encode(&self, stream: &mut W) -> Result<(), Error>; } -#[async_trait::async_trait] impl Message for T { async fn decode(stream: &mut R) -> Result { let length = stream.read_u16().await?; diff --git a/rkvm-net/src/version.rs b/rkvm-net/src/version.rs index a0da8a5..8cd0143 100644 --- a/rkvm-net/src/version.rs +++ b/rkvm-net/src/version.rs @@ -17,7 +17,6 @@ impl Display for Version { } } -#[async_trait::async_trait] impl Message for Version { async fn decode(stream: &mut R) -> Result { stream.read_u16_le().await.map(Self)