Expand description
Utility methods to encode or decode wire protocol messages in Postcard format with message framing using 4 bytes frame length prefixes.
§Example
Encoding for string “hello” (10 bytes):
Postcard varint prefix
|
Frame Length |
(4 bytes) | "hello" string (5 bytes)
| | |
[----------] | [-h----e----l----l----o-]
[0, 0, 0, 6, 5, 104, 101, 108, 108, 111]
============ ===========================
PREFIX MESSAGEStructs§
- Codec
- Implementation of the tokio codec traits to encode- and decode length-prefixed postcard data as a framed stream.
Enums§
- Codec
Error - Errors which can occur while decoding or encoding streams of postcard bytes.
Functions§
- into_
codec_ sink - Returns a writer for your wire-protocol messages, automatically encoding it as a framed byte-stream.
- into_
codec_ stream - Returns a reader for your wire-protocol messages, automatically decoding byte-streams and handling the framing.