Releases: anza-xyz/wincode
v0.2.2
What's Changed
- feat(io): implement Writer directly for [u8] and [MaybeUninit] by @kskalski in #41
- Ensure HashMaps are preallocated in read by @cpubot in #43
- Implement drop-safe struct_extensions builder by @cpubot in #42
- feat: implement consolidated benchmarking suite by @TanmayDhobale in #40
- v0.2.2 by @cpubot in #44 #45
New Contributors
Full Changelog: v0.2.1...v0.2.2
v0.2.1
v0.2.0
Release Notes
This release introduces compile-time type metadata that enables optimized serialization and deserialization of types with compile-time known sizes, dramatically improving performance while simplifying the API surface. It also adds additional I/O helpers, more built-in type support, and flexible enum encoding options.
Compile-time Type Metadata (TypeMeta)
A major new addition: SchemaRead and SchemaWrite now expose a TypeMeta constant that describes a type's serialized size and zero-copy capability.
Types are classified as one of:
- Dynamic: variable length (e.g.
Vec<T>,Box<[T]>) - Static: fixed size but non-zero-copy
- Zero-copy: fixed size, directly serializable from memory
This metadata allows us to:
- Prefetch and bounds-check entire contiguous read/write chunks for
Staticaggregates, eliding intermediate bounds checks for those chunks. - Optimize composite and container type implementations without manual
Podannotations.
SchemaRead and SchemaWrite derive macros will automatically generate this metadata for your types.
In microbenchmarks, types qualifying for TypeMeta::Static and collections containing TypeMeta::Static types show 6–10× faster serialization and deserialization over v0.1.x.
Reader/Writer Refactor
Reader and Writer are now traits rather than concrete types.
This enables multiple I/O backends (slice, Cursor, Vec, etc.) and allows implementing trusted (bounds-check-elided) variants where subsets of the serialization / deserialization targets have compile-time known sizes.
Breaking Change
SchemaRead and SchemaWrite now take impl Reader / impl Writer instead of concrete types.
Automatic Pod Inference & Deprecation of Elem
The new compile-time metadata makes manual annotation with Pod unnecessary in most cases:
Collections like Vec<T> or Box<[T]> now infer Pod automatically
Elemis deprecated (still supported as a transparent pass-through for backwards compatibility)- This drastically reduces boilerplate while ensuring optimal serialization behavior by default.
Enum Configurability & TypeMeta Inference
Enums will be qualified as TypeMeta::Static if all variants share equal serialized size, unlocking significant performance improvements for unit enums and enums with equal sized variants.
Custom Discriminant Encodings
Enums can now specify how their discriminants are encoded:
#[wincode(tag_encoding = "u8")]
enum Example { A, B }Custom Variant Tags
Enums can now specify custom discriminant expressions for variants:
enum Enum {
#[wincode(tag = 1)]
A { name: String, id: u64 },
#[wincode(tag = 2)]
B(String, Vec<u8>),
#[wincode(tag = 3)]
C,
}Expanded Type Support
Added built-in implementations:
f32f64Result<T, E>
Error Handling
ReadErrorandWriteErrornow support custom error variants.io::ReadErrorandio::WriteErrornow supportstd::io::Errorwhen thestdfeature is enabled.
Commits
- deny
repr(packed)during compile by @publicqi in #10 - add custom error variants to
ReadErrorandWriteErrorby @qkniep in #15 - Add compile-time type metadata to tune implementations by @cpubot in #16
- impl f32 and f64 by @cpubot in #20
- Add package categories and keywords by @cpubot in #21
- Add Cursor and Vec Reader/Writer impls by @cpubot in #17
- Include padding check in zero_copy qualification by @cpubot in #25
- Allow specifying custom enum discriminant encodings by @cpubot in #22
- fix: doc tests + clippy replace_box warn by @sonicfromnewyoke in #28
- Add Result<T, E> implementation by @TanmayDhobale in #29
- Simplify Result<T, E> read() implementation by @TanmayDhobale in #30
- Simplify Option read() implementation by @TanmayDhobale in #32
- Implement more robust TypeMeta inference for enums by @cpubot in #27
- Make trusted reader/writer variants private +
unsafe as_trusted_forby @cpubot in #26 - Automatically infer Pod; deprecate Elem by @cpubot in #19
- v0.2.0 by @cpubot in #35
- Reduce keywords by @cpubot in #36
New Contributors
- @publicqi made their first contribution in #10
- @qkniep made their first contribution in #15
- @sonicfromnewyoke made their first contribution in #28
- @TanmayDhobale made their first contribution in #29
Full Changelog: v0.1.2...v0.2.0
v0.1.2
What's Changed
- Implement specialization for contiguous byte structures by @cpubot in #7
- Add
SchemaReadimpl for&'de [u8]by @cpubot in #8 - Removed a redundant statement in readme by @deepesh-sr in #11
- Overhaul tuple macro to use a drop guard by @cpubot in #9
- Documentation improvements by @cpubot in #12
New Contributors
- @deepesh-sr made their first contribution in #11
Full Changelog: v0.1.1...v0.1.2
wincode v0.1.1
What's Changed
- Make
#[derive(SchemaRead)]less brittle with generic lifetimes by @cpubot in #4 doc_auto_cfgwas merged intodoc_cfgby @cpubot in #5
Full Changelog: https://github.com/anza-xyz/wincode/commits/v0.1.1