`data-stream` is a binary serialization library focused on simplicity.
It provides two core traits:
- `ToStream`
- `FromStream`
Implement these traits for your types to write to `impl Write` and read from `impl Read`.
# Why?
This crate is built for straightforward binary I/O without a large abstraction layer.
Many existing solutions are built around broader data models and generic serialization frameworks.
That can be useful, but it can also add complexity when you only want explicit binary read/write behavior.
With `data-stream`, manual implementations are simple:
you write or read fields in the order you define.
Because everything is stream-based, integration with files, sockets, and in-memory buffers is direct.
# Features
Implemented:
- [x] Booleans (`bool`)
- [x] Numbers (`u8` to `u128`, `i8` to `i128`, `f32`, `f64`, `usize`)
- [x] Fixed-size arrays (`[T; N]`)
- [x] Text types (`char`, `String`, `str` for writing)
- [x] Wrapper types (`Box`, `Option`, `Result`)
- [x] Collections (`Vec`, `VecDeque`, `LinkedList`, `HashMap`, `BTreeMap`, `HashSet`, `BTreeSet`, `BinaryHeap`)
- [x] Derive macros (`data-stream-derive`)
Settings:
- Endianness via `EndianSettings`
- Collection/string size encoding via `SizeSettings`
- Ready-to-use defaults:
- `default_settings::NativeSettings`
- `default_settings::PortableSettings`
# Notes
- `PortableSettings` is recommended for stable cross-platform binary formats.
- `NativeSettings` is useful for local/native performance-oriented formats.
- `str` supports writing (`ToStream`), while owned text reading is done via `String` (`FromStream`).