Skip to content

Releases: anza-xyz/wincode

wincode@v0.4.5

26 Feb 00:03
095d550

Choose a tag to compare

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 SeqLen for 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

25 Feb 23:51
c09c6e1

Choose a tag to compare

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 SeqLen for 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

12 Feb 01:34
0daa955

Choose a tag to compare

wincode-derive@v0.4.2

12 Feb 01:31
68a3b68

Choose a tag to compare

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_ref function to Reader and Writer traits 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

11 Feb 02:01
b2eafee

Choose a tag to compare

wincode@v0.4.2

11 Feb 01:38
d5e7e68

Choose a tag to compare

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_slice by @cpubot in #162
  • chore: Remove deprecated Elem container by @cpubot in #171
  • Feat: Added SchemaRead and SchemaWrite implementations for Bound, Range, RangeInclusive from std::ops by @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

11 Feb 01:47
2cb42bf

Choose a tag to compare

wincode@v0.4.1

08 Feb 01:11
dc31969

Choose a tag to compare

What's Changed

Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.4.0...wincode@v0.4.1

wincode@v0.4.0

07 Feb 02:57
9e21aed

Choose a tag to compare

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

New Contributors

Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.3.1...wincode@v0.4.0

wincode-derive@v0.4.0

07 Feb 02:19
5dada29

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/anza-xyz/wincode/compare/wincode@v0.3.1...wincode-derive@v0.4.0