data-stream 0.3.0

A simple serialization library based on streams
Documentation
  • Coverage
  • 100%
    32 out of 32 items documented0 out of 17 items with examples
  • Size
  • Source code size: 19.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.82 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • porky11/data-stream
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • porky11

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