5 releases

0.1.3 Sep 13, 2023
0.1.2 Jan 2, 2023
0.1.1 Nov 29, 2022
0.1.0 Nov 29, 2022
0.0.0 Nov 11, 2022

#2 in #mezzenger

29 downloads per month
Used in zzrpc

Apache-2.0

29KB
544 lines

mezzenger-tcp

TCP transport for mezzenger.

https://crates.io/crates/mezzenger-tcp

ko-fi

note

Despite its name this crate supports other transports as well as long as they implement AsyncRead and AsyncWrite traits.

usage

Add dependencies to Cargo.toml:

[dependencies]
# ...
serde = { version = "1", features = ["derive"] }
kodec = { version = "0.1.0", features = ["binary"] } # or json or different one from another crate...
mezzenger = "0.1.3"
mezzenger-tcp = "0.1.1"

See example code here.

see also

mezzenger


lib.rs:

Transport for communication over tokio TCP implementation.

See repository for more info.

Example

let tcp_stream = TcpStream::connect("127.0.0.1:8080").await?;

use kodec::binary::Codec;
let mut transport: Transport<_, Codec, i32, String> =
    Transport::new(tcp_stream, Codec::default());

use mezzenger::Receive;
let integer = transport.receive().await?;

transport.send("Hello World!".to_string()).await?;

Dependencies

~3.5–9.5MB
~91K SLoC