Releases: anza-xyz/wincode
wincode@v0.4.5
What's Changed
- chore: don't deny warnings during compilation by @kskalski in #189
- feat: add take_array replacing all usages of fill_array by @kskalski in #188
- build(deps): bump syn from 2.0.114 to 2.0.116 by @dependabot[bot] in #191
- chore: pin nightly version to avoid flaky build errors by @cpubot in #186
- Add
uninit_<field>_ref()to UninitBuilder by @cpubot in #180 - feat: Implement
SeqLenfor primitive integers by @cpubot in #194 - chore: add name to config and remove cron by @0xalpharush in #195
- test: add cursor test case deserializing nested zero-copy payload by @kskalski in #197
- perf: manual decode for utf-8 char deserialization using take_array by @kskalski in #187
- feat: support hash collections with any hasher state by @kskalski in #198
- build(deps): bump syn from 2.0.116 to 2.0.117 by @dependabot[bot] in #201
- feat: implement schemas for bytes::Bytes by @kskalski in #200
- Add collection benchmarks for BTreeMap, BTreeSet, LinkedList, VecDeque by @tanmay4l in #70
- refactor: replace matches of TypeMeta series with summing helper by @kskalski in #202
- Adding neodyme audit report by @nbelenkov in #207
- Bump wincode-derive to 0.4.3 by @cpubot in #208
- Bump wincode to 0.4.5 by @cpubot in #209
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.4...wincode@v0.4.5
wincode-derive@v0.4.3
What's Changed
- chore: don't deny warnings during compilation by @kskalski in #189
- feat: add take_array replacing all usages of fill_array by @kskalski in #188
- build(deps): bump syn from 2.0.114 to 2.0.116 by @dependabot[bot] in #191
- chore: pin nightly version to avoid flaky build errors by @cpubot in #186
- Add
uninit_<field>_ref()to UninitBuilder by @cpubot in #180 - feat: Implement
SeqLenfor primitive integers by @cpubot in #194 - chore: add name to config and remove cron by @0xalpharush in #195
- test: add cursor test case deserializing nested zero-copy payload by @kskalski in #197
- perf: manual decode for utf-8 char deserialization using take_array by @kskalski in #187
- feat: support hash collections with any hasher state by @kskalski in #198
- build(deps): bump syn from 2.0.116 to 2.0.117 by @dependabot[bot] in #201
- feat: implement schemas for bytes::Bytes by @kskalski in #200
- Add collection benchmarks for BTreeMap, BTreeSet, LinkedList, VecDeque by @tanmay4l in #70
- refactor: replace matches of TypeMeta series with summing helper by @kskalski in #202
- Adding neodyme audit report by @nbelenkov in #207
- Bump wincode-derive to 0.4.3 by @cpubot in #208
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.4...wincode-derive@v0.4.3
wincode@v0.4.4
What's Changed
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode-derive@v0.4.2...wincode@v0.4.4
wincode-derive@v0.4.2
What's Changed
- chore: add derive feature in wincode dev-deps by @kskalski in #175
- build(deps): bump libfuzzer-sys from 0.4.10 to 0.4.12 in /fuzz by @dependabot[bot] in #176
- Add
by_reffunction toReaderandWritertraits by @cpubot in #177 - Bump to wincode-derive 0.4.2 by @cpubot in #178
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.3...wincode-derive@v0.4.2
wincode@v0.4.3
What's Changed
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode-derive@v0.4.1...wincode@v0.4.3
wincode@v0.4.2
What's Changed
- fix: Result impl should use SchemaRead TYPE_META on TagEncoding by @cpubot in #163
- chore(cargo): default-features = false on solana-short-vec by @cpubot in #161
- chore: String impl -
copy_into_sliceby @cpubot in #162 - chore: Remove deprecated
Elemcontainer by @cpubot in #171 - Feat: Added
SchemaReadandSchemaWriteimplementations forBound,Range,RangeInclusivefromstd::opsby @adpthegreat in #106 - feat: Expose UninitBuilder as derive macro; deprecate struct_extensions by @cpubot in #169
- Bump to wincode 0.4.2 by @cpubot in #172
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.1...wincode@v0.4.2
wincode-derive@v0.4.1
What's Changed
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.2...wincode-derive@v0.4.1
wincode@v0.4.1
What's Changed
- Bump proptest-derive from 0.7.0 to 0.8.0 by @dependabot[bot] in #153
- fix: alloc import in config/serde by @cpubot in #160
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.0...wincode@v0.4.1
wincode@v0.4.0
Features
Automatic Generic Constraints in Derive
Deriving SchemaRead and SchemaWrite on compound types with generic type parameters will now automatically generate the appropriate constraints for generic type parameters in SchemaRead and SchemaWrite implementations.
Previously, one would have to constrain generic type parameters at the type definition site. E.g.,
#[derive(SchemaWrite, SchemaRead)]
struct Gen<T: SchemaWrite<Src = T> + for<'de> SchemaRead<'de, Dst = T>> {
inner: T,
}Now, constraints will generated at implementation sites for SchemRead and SchemaWrite, such that:
#[derive(SchemaWrite, SchemaRead)]
struct Gen<T> {
inner: T,
}compiles and works as expected.
References in Compound Types Containing Integers
Prior to the 0.3.0 release, ZeroCopy was implemented unconditionally for integer types on little endian targets. This meant that taking references to integer types or zero-copy structs containing integer types in a SchemaRead derived struct/enum trivially type-checked.
E.g.,
#[repr(C)]
#[derive(SchemaWrite, SchemaRead)]
struct Point {
x: u64
y: u64
}
struct PointRef<'a> {
point: &'a Point
}Since 0.3.0, ZeroCopy depends on the Config used for deserialization. And, more specifically, SchemaRead is only implemented on references &T where T: ZeroCopy<Config>. As such, the above code did not compile. This was a regression relative to 0.2.x.
The derive macro will now generate the appropriate constraints for compound types containing references such that the above code now compiles and will be type-checked at the deserialization site. In particular, if the integer encoding is FixInt and configured endianness matches platform endianness, deserialization will type-check.
#[wincode(skip)] derive attribute
It is now possible to skip fields in serialization and deserialization with the #[wincode(skip)] derive attribute.
#[derive(SchemaRead, SchemaWrite)]
struct Foo {
x: u64,
#[wincode(skip)]
y: u64,
}By default, when #[wincode(skip)] is declared, the derive macro will attempt to initialize the field with Default::default.
A default value can be provided if desired or if the type does not implement Default.
#[derive(SchemaRead, SchemaWrite)]
struct Foo {
x: u64,
#[wincode(skip(default_val = 42)]
y: u64,
}Note that skipping fields with sized types will disqualify the outer type for zero-copy deserialization.
Simplified Reader and Writer bounds in SchemaRead and SchemaWrite
SchemaRead and SchemaWrite trait definitions previously required &mut impl Reader<'de> and &mut impl Writer:
pub unsafe trait SchemaWrite<C: ConfigCore> {
// ...
fn write(writer: &mut impl Writer, src: &Self::Src) -> WriteResult<()>;
}
pub unsafe trait SchemaRead<'de, C: ConfigCore> {
// ...
fn read(reader: &mut impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>) -> ReadResult<()>;
}They now accept just impl Writer and impl Reader<'de>.
pub unsafe trait SchemaWrite<C: ConfigCore> {
// ...
fn write(writer: impl Writer, src: &Self::Src) -> WriteResult<()>;
}
pub unsafe trait SchemaRead<'de, C: ConfigCore> {
// ...
fn read(reader: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>) -> ReadResult<()>;
}A blanket implementation for Reader and Writer is now provided for all &mut Reader and &mut Writer.
Commits
- Adding path to dependency for CI testing by @nbelenkov in #125
- ci: add quick link for release ref by @yihau in #126
- Fix: fixed zero sized struct error by @adpthegreat in #114
- ci: add .github/dependabot.yml by @yihau in #127
- Bump syn from 2.0.106 to 2.0.114 by @dependabot[bot] in #136
- Bump proptest-derive from 0.6.0 to 0.7.0 by @dependabot[bot] in #137
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #128
- Bump proptest from 1.8.0 to 1.9.0 by @dependabot[bot] in #135
- Bump solana-short-vec from 3.0.0 to 3.2.0 by @dependabot[bot] in #133
- Bump proc-macro2 from 1.0.101 to 1.0.106 by @dependabot[bot] in #130
- Bump quote from 1.0.41 to 1.0.44 by @dependabot[bot] in #131
- Bump rand from 0.8.5 to 0.9.2 by @dependabot[bot] in #129
- Include SchemaRead/SchemaWrite bounds when deriving with generics by @cpubot in #124
- Support wincode(skip) in derive for fields by @kskalski in #73
- fix
Duration/SystemTimetype metadata by @publicqi in #141 - add length check for uuid by @publicqi in #142
- Bump thiserror from 2.0.17 to 2.0.18 by @dependabot[bot] in #147
- add extra check in assert_zero_copy by @publicqi in #146
- derive:
SchemaReadref constraints by @cpubot in #150 - fix(docs): make comment relate to SkipMode instead of attributes by @kskalski in #151
- Test/update fuzzer by @0xalpharush in #140
- ci: dispatch fuzzing from maser on push or every 24 hrs by @0xalpharush in #148
- Bump proptest from 1.9.0 to 1.10.0 by @dependabot[bot] in #154
- Feat: Add
SchemaReadandSchemaWriteimplementations ofNonZerotypes - NonZeroU8, NonZeroU16 ..... fromstd::numby @adpthegreat in #109 - fix: rand version bump
randomexport by @cpubot in #156 - feat!: remove &mut from parameters passing Reader and Writer impls by @kskalski in #152
- patch wincode-derive in the workspace level by @yihau in #158
- Bump wincode-derive to 0.4.0 by @cpubot in #157
- Bump wincode to 0.4.0 by @cpubot in #159
New Contributors
- @adpthegreat made their first contribution in #114
- @dependabot[bot] made their first contribution in #136
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.3.1...wincode@v0.4.0
wincode-derive@v0.4.0
What's Changed
- Adding path to dependency for CI testing by @nbelenkov in #125
- ci: add quick link for release ref by @yihau in #126
- Fix: fixed zero sized struct error by @adpthegreat in #114
- ci: add .github/dependabot.yml by @yihau in #127
- Bump syn from 2.0.106 to 2.0.114 by @dependabot[bot] in #136
- Bump proptest-derive from 0.6.0 to 0.7.0 by @dependabot[bot] in #137
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #128
- Bump proptest from 1.8.0 to 1.9.0 by @dependabot[bot] in #135
- Bump solana-short-vec from 3.0.0 to 3.2.0 by @dependabot[bot] in #133
- Bump proc-macro2 from 1.0.101 to 1.0.106 by @dependabot[bot] in #130
- Bump quote from 1.0.41 to 1.0.44 by @dependabot[bot] in #131
- Bump rand from 0.8.5 to 0.9.2 by @dependabot[bot] in #129
- Include SchemaRead/SchemaWrite bounds when deriving with generics by @cpubot in #124
- Support wincode(skip) in derive for fields by @kskalski in #73
- fix
Duration/SystemTimetype metadata by @publicqi in #141 - add length check for uuid by @publicqi in #142
- Bump thiserror from 2.0.17 to 2.0.18 by @dependabot[bot] in #147
- add extra check in assert_zero_copy by @publicqi in #146
- derive:
SchemaReadref constraints by @cpubot in #150 - fix(docs): make comment relate to SkipMode instead of attributes by @kskalski in #151
- Test/update fuzzer by @0xalpharush in #140
- ci: dispatch fuzzing from maser on push or every 24 hrs by @0xalpharush in #148
- Bump proptest from 1.9.0 to 1.10.0 by @dependabot[bot] in #154
- Feat: Add
SchemaReadandSchemaWriteimplementations ofNonZerotypes - NonZeroU8, NonZeroU16 ..... fromstd::numby @adpthegreat in #109 - fix: rand version bump
randomexport by @cpubot in #156 - feat!: remove &mut from parameters passing Reader and Writer impls by @kskalski in #152
- patch wincode-derive in the workspace level by @yihau in #158
- Bump wincode-derive to 0.4.0 by @cpubot in #157
New Contributors
- @adpthegreat made their first contribution in #114
- @dependabot[bot] made their first contribution in #136
Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.3.1...wincode-derive@v0.4.0