Simple async codec for rkyv. Reuses streaming buffer for maximum speed!
This crate provides a makeshift adaptor for streaming &Archived<Object>
s from an AsyncRead
using a reusable external buffer, as well as a futures::Sink
implementation to serialize Object
s to an AsyncWrite
.
It uses multiformat's unsigned_varint for variable-length length encoding.
This crate has two examples: chatclient & chatserver. Run both of them at the same time to see a proof-of-concept Archive tcp stream in action.
To run:
cargo run --example chat_client
cargo run --eaxmple chat_server
Simple usage example: ```rust
struct Test {
int: u8,
string: String,
option: Option
// Writing let writer = Vec::new(); let mut codec = RkyvWriter::new(writer); codec.send(value.clone()).await.unwrap();
// Reading
let mut reader = &codec.inner()[..];
let mut buffer = AlignedVec::new(); // Aligned streaming buffer for re-use
let data: &Archived
asserteq!(value, valuereceived); ```