Skip to content

Commit a338109

Browse files
2.0.0 stable (#742)
Prepare for 2.0.0 stable release --------- Co-authored-by: Zoey Riordan <[email protected]>
1 parent c8a42f7 commit a338109

File tree

9 files changed

+50
-41
lines changed

9 files changed

+50
-41
lines changed

.github/workflows/rust.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"rust": [
2626
"stable",
2727
"beta",
28-
"nightly"
29-
# "1.55.0" TODO: Pick latest stable version when we release 2.0
28+
"nightly",
29+
"1.85.0"
3030
]
3131
}
3232
},
@@ -81,7 +81,7 @@
8181
],
8282
"rust": [
8383
"stable",
84-
# "1.55.0" TODO: Pick latest stable version when we release 2.0
84+
"1.85.0"
8585
],
8686
"features": [
8787
"",

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ members = ["derive", "compatibility"]
33

44
[package]
55
name = "bincode"
6-
version = "2.0.0-rc.3" # remember to update html_root_url and bincode_derive
6+
version = "2.0.0" # remember to update html_root_url and bincode_derive
77
authors = [
88
"Ty Overby <[email protected]>",
99
"Zoey Riordan <[email protected]>",
1010
"Victor Koenders <[email protected]>",
1111
]
1212
exclude = ["logo.svg", "examples/*", ".gitignore", ".github/"]
13+
rust-version = "1.85.0"
1314

1415
publish = true
1516

@@ -31,7 +32,7 @@ alloc = ["serde?/alloc"]
3132
derive = ["bincode_derive"]
3233

3334
[dependencies]
34-
bincode_derive = { path = "derive", version = "2.0.0-rc.3", optional = true }
35+
bincode_derive = { path = "derive", version = "2.0.0", optional = true }
3536
serde = { version = "1.0", default-features = false, optional = true }
3637
unty = "0.0.3"
3738

derive/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "bincode_derive"
3-
version = "2.0.0-rc.3" # remember to update bincode
3+
version = "2.0.0" # remember to update bincode
44
authors = [
55
"Zoey Riordan <[email protected]>",
66
"Victor Koenders <[email protected]>",
77
]
88
edition = "2021"
9+
rust-version = "1.85.0"
910

1011
repository = "https://github.com/bincode-org/bincode"
1112
documentation = "https://docs.rs/bincode_derive"

docs/migration_guide.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bincode 2 now has an optional dependency on `serde`. You can either use `serde`,
44

55
## From `Options` to `Configuration`
66

7-
Bincode 1 had the [Options](https://docs.rs/bincode/1/bincode/config/trait.Options.html) trait. This has been replaced with the [Configuration](https://docs.rs/bincode/2.0.0-rc/bincode/config/struct.Configuration.html) struct.
7+
Bincode 1 had the [Options](https://docs.rs/bincode/1/bincode/config/trait.Options.html) trait. This has been replaced with the [Configuration](https://docs.rs/bincode/2.0.0/bincode/config/struct.Configuration.html) struct.
88

99
If you're using `Options`, you can change it like this:
1010

@@ -46,10 +46,10 @@ If so, make sure to include bincode 2 with the `serde` feature enabled, and use
4646

4747
```toml
4848
[dependencies]
49-
bincode = { version = "2.0.0-rc", features = ["serde"] }
49+
bincode = { version = "2.0.0", features = ["serde"] }
5050

5151
# Optionally you can disable the `derive` feature:
52-
# bincode = { version = "2.0.0-rc", default-features = false, features = ["std", "serde"] }
52+
# bincode = { version = "2.0.0", default-features = false, features = ["std", "serde"] }
5353
```
5454

5555
Then replace the following functions: (`Configuration` is `bincode::config::legacy()` by default)
@@ -70,13 +70,13 @@ Then replace the following functions: (`Configuration` is `bincode::config::lega
7070

7171
```toml,ignore
7272
[dependencies]
73-
bincode = "2.0.0-rc"
73+
bincode = "2.0.0"
7474
7575
# If you need `no_std` with `alloc`:
76-
# bincode = { version = "2.0.0-rc", default-features = false, features = ["derive", "alloc"] }
76+
# bincode = { version = "2.0.0", default-features = false, features = ["derive", "alloc"] }
7777
7878
# If you need `no_std` and no `alloc`:
79-
# bincode = { version = "2.0.0-rc", default-features = false, features = ["derive"] }
79+
# bincode = { version = "2.0.0", default-features = false, features = ["derive"] }
8080
```
8181

8282
Replace or add the following attributes. You are able to use both `serde-derive` and `bincode-derive` side-by-side.
@@ -86,7 +86,7 @@ Replace or add the following attributes. You are able to use both `serde-derive`
8686
| `#[derive(serde::Serialize)]` | `#[derive(bincode::Encode)]` |
8787
| `#[derive(serde::Deserialize)]` | `#[derive(bincode::Decode)]` |
8888

89-
**note:** To implement these traits manually, see the documentation of [Encode](https://docs.rs/bincode/2.0.0-rc/bincode/enc/trait.Encode.html) and [Decode](https://docs.rs/bincode/2.0.0-rc/bincode/de/trait.Decode.html).
89+
**note:** To implement these traits manually, see the documentation of [Encode](https://docs.rs/bincode/2.0.0/bincode/enc/trait.Encode.html) and [Decode](https://docs.rs/bincode/2.0.0/bincode/de/trait.Decode.html).
9090

9191
**note:** For more information on using `bincode-derive` with external libraries, see [below](#bincode-derive-and-libraries).
9292

@@ -107,10 +107,10 @@ Then replace the following functions: (`Configuration` is `bincode::config::lega
107107
Currently not many libraries support the traits `Encode` and `Decode`. There are a couple of options if you want to use `#[derive(bincode::Encode, bincode::Decode)]`:
108108

109109
- Enable the `serde` feature and add a `#[bincode(with_serde)]` above each field that implements `serde::Serialize/Deserialize` but not `Encode/Decode`
110-
- Enable the `serde` feature and wrap your field in [bincode::serde::Compat](https://docs.rs/bincode/2.0.0-rc/bincode/serde/struct.Compat.html) or [bincode::serde::BorrowCompat](https://docs.rs/bincode/2.0.0-rc/bincode/serde/struct.BorrowCompat.html)
110+
- Enable the `serde` feature and wrap your field in [bincode::serde::Compat](https://docs.rs/bincode/2.0.0/bincode/serde/struct.Compat.html) or [bincode::serde::BorrowCompat](https://docs.rs/bincode/2.0.0/bincode/serde/struct.BorrowCompat.html)
111111
- Make a pull request to the library:
112112
- Make sure to be respectful, most of the developers are doing this in their free time.
113-
- Add a dependency `bincode = { version = "2.0.0-rc", default-features = false, optional = true }` to the `Cargo.toml`
114-
- Implement [Encode](https://docs.rs/bincode/2.0.0-rc/bincode/enc/trait.Encode.html)
115-
- Implement [Decode](https://docs.rs/bincode/2.0.0-rc/bincode/de/trait.Decode.html)
113+
- Add a dependency `bincode = { version = "2.0.0", default-features = false, optional = true }` to the `Cargo.toml`
114+
- Implement [Encode](https://docs.rs/bincode/2.0.0/bincode/enc/trait.Encode.html)
115+
- Implement [Decode](https://docs.rs/bincode/2.0.0/bincode/de/trait.Decode.html)
116116
- Make sure both of these implementations have a `#[cfg(feature = "bincode")]` attribute.

docs/spec.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ By default, this serialization format uses little-endian byte order for basic nu
1515

1616
Endianness can be configured with the following methods, allowing for big-endian serialization when required:
1717

18-
- [`with_big_endian`](https://docs.rs/bincode/2.0.0-rc/bincode/config/struct.Configuration.html#method.with_big_endian)
19-
- [`with_little_endian`](https://docs.rs/bincode/2.0.0-rc/bincode/config/struct.Configuration.html#method.with_little_endian)
18+
- [`with_big_endian`](https://docs.rs/bincode/2.0.0/bincode/config/struct.Configuration.html#method.with_big_endian)
19+
- [`with_little_endian`](https://docs.rs/bincode/2.0.0/bincode/config/struct.Configuration.html#method.with_little_endian)
2020

2121
### Byte Order Considerations
2222

@@ -31,7 +31,7 @@ Endianness can be configured with the following methods, allowing for big-endian
3131
- Encoded as a single byte
3232
- `false` is represented by `0`
3333
- `true` is represented by `1`
34-
- During deserialization, values other than 0 and 1 will result in an error [`DecodeError::InvalidBooleanValue`](https://docs.rs/bincode/2.0.0-rc/bincode/error/enum.DecodeError.html#variant.InvalidBooleanValue)
34+
- During deserialization, values other than 0 and 1 will result in an error [`DecodeError::InvalidBooleanValue`](https://docs.rs/bincode/2.0.0/bincode/error/enum.DecodeError.html#variant.InvalidBooleanValue)
3535

3636
### Numeric Types
3737

@@ -62,7 +62,7 @@ Endianness can be configured with the following methods, allowing for big-endian
6262
- Surrogate code points (0xD800 to 0xDFFF) are not valid
6363
- Invalid Unicode characters can be acquired via unsafe code, this is handled as:
6464
- during serialization: data is written as-is
65-
- during deserialization: an error is raised [`DecodeError::InvalidCharEncoding`](https://docs.rs/bincode/2.0.0-rc/bincode/error/enum.DecodeError.html#variant.InvalidCharEncoding)
65+
- during deserialization: an error is raised [`DecodeError::InvalidCharEncoding`](https://docs.rs/bincode/2.0.0/bincode/error/enum.DecodeError.html#variant.InvalidCharEncoding)
6666
- No additional metadata or encoding scheme beyond the raw code point value
6767

6868
All tuples have no additional bytes, and are encoded in their specified order, e.g.
@@ -92,15 +92,15 @@ Encoding an unsigned integer v (of any type excepting u8/i8) works as follows:
9292

9393
`usize` is being encoded/decoded as a `u64` and `isize` is being encoded/decoded as a `i64`.
9494

95-
See the documentation of [VarintEncoding](https://docs.rs/bincode/2.0.0-rc/bincode/config/struct.Configuration.html#method.with_variable_int_encoding) for more information.
95+
See the documentation of [VarintEncoding](https://docs.rs/bincode/2.0.0/bincode/config/struct.Configuration.html#method.with_variable_int_encoding) for more information.
9696

9797
### FixintEncoding
9898

9999
- Fixed size integers are encoded directly
100100
- Enum discriminants are encoded as u32
101101
- Lengths and usize are encoded as u64
102102

103-
See the documentation of [FixintEncoding](https://docs.rs/bincode/2.0.0-rc/bincode/config/struct.Configuration.html#method.with_fixed_int_encoding) for more information.
103+
See the documentation of [FixintEncoding](https://docs.rs/bincode/2.0.0/bincode/config/struct.Configuration.html#method.with_fixed_int_encoding) for more information.
104104

105105
## Enums
106106

@@ -224,7 +224,7 @@ assert_eq!(encoded.as_slice(), &[
224224
- During serialization, the string is encoded as a sequence of the given bytes.
225225
- Rust strings are UTF-8 encoded by default, but this is not enforced by bincode
226226
- No normalization or transformation of text
227-
- If an invalid UTF-8 sequence is encountered during decoding, an [`DecodeError::Utf8`](https://docs.rs/bincode/2.0.0-rc/bincode/error/enum.DecodeError.html#variant.Utf8) error is raised
227+
- If an invalid UTF-8 sequence is encountered during decoding, an [`DecodeError::Utf8`](https://docs.rs/bincode/2.0.0/bincode/error/enum.DecodeError.html#variant.Utf8) error is raised
228228

229229
```rust
230230
let str = "Hello 🌍"; // Mixed ASCII and Unicode

fuzz/Cargo.lock

+13-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ maximum size limit. Malicious inputs will fail upon deserialization.
100100

101101
### What is Bincode's MSRV (minimum supported Rust version)?
102102

103-
Bincode 2.0 is still in development and does not yet have a targeted MSRV. Once 2.0 is fully released the MSRV will be locked. After this point any changes to the MSRV are considered a breaking change for semver purposes.
103+
Bincode 2.0 has an MSRV of 1.85.0. Any changes to the MSRV are considered a breaking change for semver purposes, except when certain features are enabled. Features affecting MSRV are documented in the crate root.
104104

105105
### Why does bincode not respect `#[repr(u8)]`?
106106

src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
//!
1616
//! # Features
1717
//!
18-
//! |Name |Default?|Supported types for Encode/Decode|Enabled methods |Other|
19-
//! |------|--------|-----------------------------------------|-----------------------------------------------------------------|-----|
20-
//! |std | Yes |`HashMap` and `HashSet`|`decode_from_std_read` and `encode_into_std_write`|
21-
//! |alloc | Yes |All common containers in alloc, like `Vec`, `String`, `Box`|`encode_to_vec`|
22-
//! |atomic| Yes |All `Atomic*` integer types, e.g. `AtomicUsize`, and `AtomicBool`||
23-
//! |derive| Yes |||Enables the `BorrowDecode`, `Decode` and `Encode` derive macros|
24-
//! |serde | No |`Compat` and `BorrowCompat`, which will work for all types that implement serde's traits|serde-specific encode/decode functions in the [serde] module|Note: There are several [known issues](serde/index.html#known-issues) when using serde and bincode|
18+
//! |Name |Default?|Affects MSRV?|Supported types for Encode/Decode|Enabled methods |Other|
19+
//! |------|--------|-------------|-----------------------------------------|-----------------------------------------------------------------|-----|
20+
//! |std | Yes | No |`HashMap` and `HashSet`|`decode_from_std_read` and `encode_into_std_write`|
21+
//! |alloc | Yes | No |All common containers in alloc, like `Vec`, `String`, `Box`|`encode_to_vec`|
22+
//! |atomic| Yes | No |All `Atomic*` integer types, e.g. `AtomicUsize`, and `AtomicBool`||
23+
//! |derive| Yes | No |||Enables the `BorrowDecode`, `Decode` and `Encode` derive macros|
24+
//! |serde | No | Yes (MSRV reliant on serde)|`Compat` and `BorrowCompat`, which will work for all types that implement serde's traits|serde-specific encode/decode functions in the [serde] module|Note: There are several [known issues](serde/index.html#known-issues) when using serde and bincode|
2525
//!
2626
//! # Which functions to use
2727
//!
@@ -71,7 +71,7 @@
7171
//! [`net::TcpStream`]: std::net::TcpStream
7272
//!
7373
74-
#![doc(html_root_url = "https://docs.rs/bincode/2.0.0-rc.3")]
74+
#![doc(html_root_url = "https://docs.rs/bincode/2.0.0")]
7575
#![crate_name = "bincode"]
7676
#![crate_type = "rlib"]
7777

tests/std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod utils;
55

66
use bincode::error::DecodeError;
77
use std::{
8-
ffi::{CStr, CString},
8+
ffi::CString,
99
io::{Cursor, Seek, SeekFrom},
1010
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
1111
path::{Path, PathBuf},
@@ -128,7 +128,7 @@ fn test_std_commons() {
128128
let mut buffer = [0u8; 1024];
129129

130130
// &CStr
131-
let cstr = CStr::from_bytes_with_nul(b"Hello world\0").unwrap();
131+
let cstr = c"Hello world";
132132
let len = bincode::encode_into_slice(cstr, &mut buffer, config).unwrap();
133133
let (decoded, len): (CString, usize) =
134134
bincode::decode_from_slice(&buffer[..len], config).unwrap();

0 commit comments

Comments
 (0)