loro-protocol (Rust)
Rust implementation of the Loro syncing protocol encoder/decoder. Mirrors the TypeScript package in packages/loro-protocol and follows the wire format described in protocol.md and the end-to-end encrypted flow in protocol-e2ee.md.
Features
- Encode/decode Join, DocUpdate, FragmentHeader/Fragment, UpdateError, and Leave messages
- 256 KiB message size guard to match the wire spec
- Bytes utilities (
BytesWriter,BytesReader) for varint/varbytes/varstring %ELOcontainer parsing; Rust-side encryption helpers are WIP and may evolve
Usage
Add the crate to your workspace (published crate name matches the package):
Encode and decode messages:
use ;
let msg = JoinRequest ;
let bytes = encode?;
let roundtrip = decode?;
assert_eq!;
Streaming-friendly decode:
use try_decode;
let buf = /* bytes from the wire */;
if let Some = try_decode else
Tests
Spec References
protocol.mdfor the wire format and message semanticsprotocol-e2ee.mdfor %ELO encryption details