bytecodec

Crates.iobytecodec
lib.rsbytecodec
version0.4.15
sourcesrc
created_at2018-04-01 18:09:00.424081
updated_at2021-07-22 05:16:08.316956
descriptionA tiny framework for implementing encoders/decoders of byte-oriented protocols
homepagehttps://github.com/sile/bytecodec
repositoryhttps://github.com/sile/bytecodec
max_upload_size
id58526
size212,002
Takeru Ohta (sile)

documentation

README

bytecodec

bytecodec Documentation Actions Status Coverage Status License: MIT

A tiny Rust framework for implementing encoders/decoders of byte-oriented protocols.

Documentation

Features

  • Suited for byte-oriented protocols
  • Incremental encoding/decoding:
    • Encode and Decode traits support incremental encoding and decoding
    • The number of bytes consumed in an execution of encode/decode methods can be completely controlled by the caller
    • This property makes it easy to implement, for example, multi-stream multiplexing, transmittin rate control and asynchronous I/O
  • Composable:
    • By combining multiple encoders (or decoders), it is easy to build a more complex encoder (or decoder)
    • See the examples of EncodeExt and DecodeExt traits
  • Reduced number of memory copies:
    • In design, only two memory copies are required
    • Considering in the decode process, one is the copy from the actual stream (e.g., TCP socket) to the decoding buffer, the other one is the copy to construct the item from the buffer.
  • Supports some serde implemention crates:
    • Currently serde_json and bincode are supported (as optional featuers)
    • See json_codec and bincode_codec modules
  • Easily adapt to synchronous I/O, asynchronous I/O, UDP, etc
  • Trackable errors:
    • By using trackable crate, the location where an error occurred can be easily specified
    • See EncodeExt::map_err and DecodeExt::map_err methods
Commit count: 235

cargo fmt