moving (un)marshal to crate tuic
This commit is contained in:
parent
20384701a0
commit
e3760f4a01
@ -4,9 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-trait = { version = "0.1.62", default-features = false }
|
||||
bytes = { version = "1.3.0", default-features = false, features = ["std"] }
|
||||
futures-util = { version = "0.3.25", default-features = false, features = ["io", "std"] }
|
||||
quinn = { version = "0.9.3", default-features = false, features = ["futures-io"] }
|
||||
thiserror = { version = "1.0.38", default-features = false }
|
||||
tuic = { path = "../tuic", default-features = false, features = ["model"] }
|
||||
tuic = { path = "../tuic", default-features = false, features = ["marshal", "model"] }
|
||||
|
@ -1,8 +1,4 @@
|
||||
use self::{
|
||||
marshal::Marshal,
|
||||
side::Side,
|
||||
unmarshal::{Unmarshal, UnmarshalError},
|
||||
};
|
||||
use self::side::Side;
|
||||
use bytes::Bytes;
|
||||
use futures_util::{io::Cursor, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
use quinn::{
|
||||
@ -20,12 +16,9 @@ use tuic::{
|
||||
AssembleError, Connect as ConnectModel, Connection as ConnectionModel,
|
||||
Packet as PacketModel,
|
||||
},
|
||||
protocol::{Address, Header},
|
||||
Address, Header, Marshal, Unmarshal, UnmarshalError,
|
||||
};
|
||||
|
||||
mod marshal;
|
||||
mod unmarshal;
|
||||
|
||||
pub mod side {
|
||||
pub struct Client;
|
||||
pub struct Server;
|
||||
|
@ -4,11 +4,14 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
marshal = ["async-trait", "futures-io"]
|
||||
model = ["parking_lot", "thiserror"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = { version = "0.1.62", default-features = false, optional = true }
|
||||
futures-io = { version = "0.3.25", default-features = false, features = ["std"], optional = true }
|
||||
parking_lot = { version = "0.12.1", default-features = false, optional = true }
|
||||
thiserror = { version = "1.0.38", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tuic = { path = ".", features = ["model"] }
|
||||
tuic = { path = ".", features = ["marshal", "model"] }
|
||||
|
@ -1,6 +1,22 @@
|
||||
//! The TUIC protocol
|
||||
|
||||
pub mod protocol;
|
||||
mod protocol;
|
||||
|
||||
#[cfg(feature = "marshal")]
|
||||
mod marshal;
|
||||
|
||||
#[cfg(feature = "marshal")]
|
||||
mod unmarshal;
|
||||
|
||||
pub use self::protocol::{
|
||||
Address, Authenticate, Command, Connect, Dissociate, Header, Heartbeat, Packet, VERSION,
|
||||
};
|
||||
|
||||
#[cfg(feature = "marshal")]
|
||||
pub use self::{
|
||||
marshal::Marshal,
|
||||
unmarshal::{Unmarshal, UnmarshalError},
|
||||
};
|
||||
|
||||
#[cfg(feature = "model")]
|
||||
pub mod model;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::protocol::Header;
|
||||
use async_trait::async_trait;
|
||||
use futures_util::AsyncWrite;
|
||||
use futures_io::AsyncWrite;
|
||||
use std::io::Error as IoError;
|
||||
use tuic::protocol::Header;
|
||||
|
||||
#[async_trait]
|
||||
pub(super) trait Marshal {
|
||||
pub trait Marshal {
|
||||
async fn marshal(&self, s: &mut impl AsyncWrite) -> Result<(), IoError>;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::protocol::Header;
|
||||
use async_trait::async_trait;
|
||||
use futures_util::AsyncRead;
|
||||
use futures_io::AsyncRead;
|
||||
use thiserror::Error;
|
||||
use tuic::protocol::Header;
|
||||
|
||||
#[async_trait]
|
||||
pub(super) trait Unmarshal
|
||||
pub trait Unmarshal
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user