Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-06-23
toolchain: nightly-2025-01-03
components: rustfmt, miri, rust-src
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: rustfmt (check)
run: cargo +nightly-2025-06-23 fmt --all -- --check
run: cargo +nightly-2025-01-03 fmt --all -- --check
- name: miri (check)
run: cargo +nightly-2025-06-23 miri test --all-features --lib --bins --no-fail-fast --workspace --exclude wincode-fuzz
run: cargo +nightly-2025-01-03 miri test --all-features --lib --bins --no-fail-fast --workspace --exclude wincode-fuzz

lint-test:
name: clippy & tests (MSRV)
Expand All @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.89.0
toolchain: 1.85.0
components: clippy
- uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ authors = ["Anza Maintainers <maintainers@anza.xyz>"]
repository = "https://github.com/anza-xyz/wincode"
homepage = "https://anza.xyz/"
license = "Apache-2.0"
edition = "2024"
rust-version = "1.89.0"
edition = "2021"
rust-version = "1.85.0"

[workspace.dependencies]
quote = "1.0.45"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.89.0"
channel = "1.85.0"
4 changes: 2 additions & 2 deletions wincode-derive/src/assert_zero_copy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::common::{SchemaArgs, StructRepr, get_crate_name},
darling::{Error, Result, ast::Data},
crate::common::{get_crate_name, SchemaArgs, StructRepr},
darling::{ast::Data, Error, Result},
proc_macro2::TokenStream,
quote::quote,
std::borrow::Cow,
Expand Down
11 changes: 6 additions & 5 deletions wincode-derive/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
use {
darling::{
FromDeriveInput, FromField, FromMeta, FromVariant, Result,
ast::{Data, Fields, NestedMeta, Style},
FromDeriveInput, FromField, FromMeta, FromVariant, Result,
},
proc_macro2::{Span, TokenStream},
quote::{ToTokens as _, quote},
quote::{quote, ToTokens as _},
std::{
borrow::Cow,
collections::VecDeque,
fmt::{self, Display},
},
syn::{
DeriveInput, Expr, ExprLit, GenericArgument, Generics, Ident, Lifetime, Lit, LitInt,
Member, Path, Type, TypeImplTrait, TypeParamBound, TypeReference, TypeTraitObject,
Visibility, parse_quote,
parse_quote,
spanned::Spanned,
visit::{self, Visit},
visit_mut::{self, VisitMut},
DeriveInput, Expr, ExprLit, GenericArgument, Generics, Ident, Lifetime, Lit, LitInt,
Member, Path, Type, TypeImplTrait, TypeParamBound, TypeReference, TypeTraitObject,
Visibility,
},
};

Expand Down
2 changes: 1 addition & 1 deletion wincode-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Refer to the [`wincode`](https://docs.rs/wincode) crate for examples.
use {
proc_macro::TokenStream,
syn::{DeriveInput, parse_macro_input},
syn::{parse_macro_input, DeriveInput},
};

mod assert_zero_copy;
Expand Down
10 changes: 5 additions & 5 deletions wincode-derive/src/schema_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ use {
crate::{
assert_zero_copy::assert_zero_copy,
common::{
Field, FieldsExt, SchemaArgs, StructRepr, TraitImpl, TypeExt, Variant, VariantsExt,
default_tag_encoding, extract_repr, get_crate_name, get_src_dst,
get_src_dst_fully_qualified, suppress_unused_fields,
get_src_dst_fully_qualified, suppress_unused_fields, Field, FieldsExt, SchemaArgs,
StructRepr, TraitImpl, TypeExt, Variant, VariantsExt,
},
uninit_builder::impl_uninit_builder,
},
darling::{
Error, FromDeriveInput, Result,
ast::{Data, Fields, Style},
Error, FromDeriveInput, Result,
},
proc_macro2::TokenStream,
quote::{quote, quote_spanned},
syn::{
DeriveInput, GenericParam, Generics, PredicateType, Token, Type, WhereClause,
WherePredicate, parse_quote, punctuated::Punctuated,
parse_quote, punctuated::Punctuated, DeriveInput, GenericParam, Generics, PredicateType,
Token, Type, WhereClause, WherePredicate,
},
};

Expand Down
10 changes: 5 additions & 5 deletions wincode-derive/src/schema_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ use {
crate::{
assert_zero_copy::assert_zero_copy,
common::{
Field, FieldsExt, SchemaArgs, StructRepr, TraitImpl, Variant, VariantsExt,
default_tag_encoding, extract_repr, get_crate_name, get_src_dst,
suppress_unused_fields,
suppress_unused_fields, Field, FieldsExt, SchemaArgs, StructRepr, TraitImpl, Variant,
VariantsExt,
},
},
darling::{
Error, FromDeriveInput, Result,
ast::{Data, Fields, Style},
Error, FromDeriveInput, Result,
},
proc_macro2::TokenStream,
quote::quote,
syn::{
DeriveInput, GenericParam, Generics, PredicateType, Token, Type, WherePredicate,
parse_quote, punctuated::Punctuated,
parse_quote, punctuated::Punctuated, DeriveInput, GenericParam, Generics, PredicateType,
Token, Type, WherePredicate,
},
};

Expand Down
6 changes: 3 additions & 3 deletions wincode-derive/src/uninit_builder.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use {
crate::common::{SchemaArgs, TypeExt, get_crate_name, get_src_dst_fully_qualified},
darling::{Error, FromDeriveInput, Result, ast::Data},
crate::common::{get_crate_name, get_src_dst_fully_qualified, SchemaArgs, TypeExt},
darling::{ast::Data, Error, FromDeriveInput, Result},
proc_macro2::{Span, TokenStream},
quote::{format_ident, quote},
syn::{DeriveInput, GenericParam, LitInt, Path, Type, parse_quote},
syn::{parse_quote, DeriveInput, GenericParam, LitInt, Path, Type},
};

pub(crate) fn impl_uninit_builder(args: &SchemaArgs, crate_name: &Path) -> Result<TokenStream> {
Expand Down
6 changes: 3 additions & 3 deletions wincode/benches/benchmarks.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use {
criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main},
criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput},
rand::{Rng as _, SeedableRng},
serde::{Deserialize, Serialize},
std::{
collections::{BTreeMap, BTreeSet, HashMap, LinkedList, VecDeque},
hint::black_box,
},
wincode::{
SchemaRead, SchemaWrite, config::DefaultConfig, deserialize, serialize, serialize_into,
serialized_size,
config::DefaultConfig, deserialize, serialize, serialize_into, serialized_size, SchemaRead,
SchemaWrite,
},
};

Expand Down
71 changes: 36 additions & 35 deletions wincode/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ pub struct Configuration<
}

impl<
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
> Clone
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
> Clone
for Configuration<
ZERO_COPY_ALIGN_CHECK,
PREALLOCATION_SIZE_LIMIT,
Expand All @@ -64,13 +64,13 @@ impl<
}

impl<
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
> Copy
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
> Copy
for Configuration<
ZERO_COPY_ALIGN_CHECK,
PREALLOCATION_SIZE_LIMIT,
Expand Down Expand Up @@ -122,13 +122,13 @@ impl Configuration {
pub type DefaultConfig = Configuration;

impl<
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
>
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding,
ByteOrder,
IntEncoding,
TagEncoding,
>
Configuration<
ZERO_COPY_ALIGN_CHECK,
PREALLOCATION_SIZE_LIMIT,
Expand Down Expand Up @@ -391,13 +391,13 @@ pub trait ConfigCore: 'static + Sized {
}

impl<
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding: 'static,
B,
I,
TagEncoding: 'static,
> ConfigCore
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding: 'static,
B,
I,
TagEncoding: 'static,
> ConfigCore
for Configuration<
ZERO_COPY_ALIGN_CHECK,
PREALLOCATION_SIZE_LIMIT,
Expand Down Expand Up @@ -432,13 +432,14 @@ pub trait Config: ConfigCore {
}

impl<
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding: 'static,
B,
I,
T,
> Config for Configuration<ZERO_COPY_ALIGN_CHECK, PREALLOCATION_SIZE_LIMIT, LengthEncoding, B, I, T>
const ZERO_COPY_ALIGN_CHECK: bool,
const PREALLOCATION_SIZE_LIMIT: usize,
LengthEncoding: 'static,
B,
I,
T,
> Config
for Configuration<ZERO_COPY_ALIGN_CHECK, PREALLOCATION_SIZE_LIMIT, LengthEncoding, B, I, T>
where
LengthEncoding: SeqLen<Self>,
T: TagEncoding<Self>,
Expand Down
2 changes: 1 addition & 1 deletion wincode/src/config/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use alloc::vec::Vec;
use {
crate::{
ReadResult, SchemaRead, SchemaReadOwned, SchemaWrite, WriteResult,
config::{Config, ConfigCore},
io::{Reader, Writer},
ReadResult, SchemaRead, SchemaReadOwned, SchemaWrite, WriteResult,
},
core::mem::MaybeUninit,
};
Expand Down
2 changes: 1 addition & 1 deletion wincode/src/io/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! [`Reader`] and [`Writer`] implementations.
use {
core::{
mem::{self, MaybeUninit, transmute},
mem::{self, transmute, MaybeUninit},
ptr,
slice::{from_raw_parts, from_raw_parts_mut},
},
Expand Down
4 changes: 2 additions & 2 deletions wincode/src/io/std_read.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::io::{ReadResult, Reader, read_size_limit},
core::mem::{MaybeUninit, transmute},
crate::io::{read_size_limit, ReadResult, Reader},
core::mem::{transmute, MaybeUninit},
std::io::{self, BufReader, Read},
};

Expand Down
2 changes: 1 addition & 1 deletion wincode/src/io/std_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<W: Write + ?Sized> Writer for BufWriter<W> {
mod tests {
use {
super::*,
crate::serde::{Serialize, serialize},
crate::serde::{serialize, Serialize},
};

const MAGIC: u64 = 0xdeadbeef_cafebabe;
Expand Down
8 changes: 4 additions & 4 deletions wincode/src/len.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Support for heterogenous sequence length encoding.
use {
crate::{
SchemaRead, SchemaWrite, TypeMeta,
config::{ConfigCore, PREALLOCATION_SIZE_LIMIT_DISABLED},
error::{
PreallocationError, ReadResult, WriteResult, pointer_sized_decode_error,
preallocation_size_limit, write_length_encoding_overflow,
pointer_sized_decode_error, preallocation_size_limit, write_length_encoding_overflow,
PreallocationError, ReadResult, WriteResult,
},
int_encoding::{ByteOrder, Endian},
io::{Reader, Writer},
SchemaRead, SchemaWrite, TypeMeta,
},
core::{any::type_name, marker::PhantomData},
};
Expand Down Expand Up @@ -386,8 +386,8 @@ pub mod short_vec {
use {
super::*,
crate::{
error::{write_length_encoding_overflow, ReadError},
SchemaReadContext,
error::{ReadError, write_length_encoding_overflow},
},
core::mem::MaybeUninit,
};
Expand Down
6 changes: 3 additions & 3 deletions wincode/src/schema/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
use alloc::sync::Arc as AllocArc;
use {
crate::{TypeMeta, config::ConfigCore, error::ReadResult, io::Reader, schema::SchemaRead},
crate::{config::ConfigCore, error::ReadResult, io::Reader, schema::SchemaRead, TypeMeta},
core::{
mem::{self, MaybeUninit},
ptr,
Expand All @@ -73,8 +73,8 @@ use {
io::Writer,
len::SeqLen,
schema::{
SchemaReadContext, SchemaWrite, size_of_elem_iter, size_of_elem_slice, write_elem_iter,
write_elem_slice_prealloc_check,
size_of_elem_iter, size_of_elem_slice, write_elem_iter,
write_elem_slice_prealloc_check, SchemaReadContext, SchemaWrite,
},
},
alloc::{boxed::Box as AllocBox, collections, rc::Rc as AllocRc, vec},
Expand Down
2 changes: 1 addition & 1 deletion wincode/src/schema/external/bv.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use {
crate::{
ReadResult, SchemaRead, SchemaWrite, TypeMeta, WriteResult,
config::Config,
error::invalid_tag_encoding,
io::{Reader, Writer},
len::SeqLen,
ReadResult, SchemaRead, SchemaWrite, TypeMeta, WriteResult,
},
bv::{BitVec, Bits, BlockType},
core::mem::MaybeUninit,
Expand Down
2 changes: 1 addition & 1 deletion wincode/src/schema/external/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use {
crate::{
ReadResult, SchemaRead, SchemaWrite, WriteResult,
config::Config,
io::{Reader, Writer},
ReadResult, SchemaRead, SchemaWrite, WriteResult,
},
alloc::boxed::Box,
bytes::{Bytes, BytesMut},
Expand Down
2 changes: 1 addition & 1 deletion wincode/src/schema/external/ecow.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use {
crate::{
ReadResult, SchemaRead, SchemaWrite, WriteResult,
config::Config,
error::invalid_utf8_encoding,
io::{BorrowKind, Reader, Writer},
len::SeqLen,
ReadResult, SchemaRead, SchemaWrite, WriteResult,
},
alloc::vec::Vec,
core::{mem::MaybeUninit, str},
Expand Down
Loading
Loading