3 unstable releases

0.2.1 Aug 26, 2024
0.2.0 Oct 10, 2022
0.1.0 Sep 30, 2021

#1265 in Encoding

Download history 15/week @ 2024-07-22 12/week @ 2024-07-29 9/week @ 2024-08-05 9/week @ 2024-08-12 10/week @ 2024-08-19 202/week @ 2024-08-26 16/week @ 2024-09-02 15/week @ 2024-09-09 42/week @ 2024-09-16 45/week @ 2024-09-23 15/week @ 2024-09-30 11/week @ 2024-10-07 15/week @ 2024-10-14 13/week @ 2024-10-21 7/week @ 2024-10-28 28/week @ 2024-11-04

64 downloads per month
Used in 10 crates (6 directly)

MIT/Apache

16KB
318 lines

This library is meant to be the easiest and most straightforward way for writing data directy to streams (impl Write) and reading data directly from streams (impl Read).

It contains the traits ToStream and FromStream, which need to be implemented for a type to be written to or read from a stream.

Why?

There is no good binary serialization library. The most common way seems to be bincode, which is based on serde. serde is bloat, especially when just writing binary data. It has a data model and stores the name of everything.

As long as you can derive your traits, you won't notice most of the complexity, but when you have to implement some trait manually in serde, it can get overcomplicated.

In this library you only have to write or read the elements to the stream in order, when you want to implement some trait manually. And since streams are used by default, it should be pretty straightforward for interactions with the file system or networking.

Features and progress

Which data types are already implemented or planned to be implemented?

  • Booleans (bool)
  • Numbers (u8 to u128, i8 to i128, f32 and f64, usize)
  • Fixed size arrays ([T; N], generic over type and size)
  • Characters (char)
  • Strings (String)
  • Simple wrapper types (Box, Option, Result)
  • Collections (Vec, VecDeque, LinkedList, HashMap, BTreeMap, HashSet, BTreeSet, BinaryHeap)

Which types probably won't be implemented?

  • non-static types (also &[T], &str)
  • tuples (since there's no generic way to implement them)

Other planned features:

  • derive traits

No runtime deps