the-fourth-server 0.3.0

A lightweight tcp server/client pair for network programming
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use async_trait::async_trait;
use tokio::io;
use tokio_util::bytes::{Bytes, BytesMut};
use tokio_util::codec::{Decoder, Encoder};
use crate::structures::transport::Transport;

#[async_trait]
///The additional trait that gaves ability to setup codec per connection.
pub trait TfCodec: Encoder<Bytes, Error = io::Error>
+ Decoder<Item = BytesMut, Error = io::Error>
+ Send
+ Sync
+ Clone
+ 'static
{
    async fn initial_setup(&mut self, transport: &mut Transport) -> bool;
}