You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/migration_guide.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Bincode 2 now has an optional dependency on `serde`. You can either use `serde`,
4
4
5
5
## From `Options` to `Configuration`
6
6
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.
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/bincode/config/struct.Configuration.html) struct.
8
8
9
9
If you're using `Options`, you can change it like this:
10
10
@@ -46,10 +46,10 @@ If so, make sure to include bincode 2 with the `serde` feature enabled, and use
46
46
47
47
```toml
48
48
[dependencies]
49
-
bincode = { version = "2.0.0", features = ["serde"] }
49
+
bincode = { version = "2.0", features = ["serde"] }
50
50
51
51
# Optionally you can disable the `derive` feature:
52
-
# bincode = { version = "2.0.0", default-features = false, features = ["std", "serde"] }
52
+
# bincode = { version = "2.0", default-features = false, features = ["std", "serde"] }
53
53
```
54
54
55
55
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
70
70
71
71
```toml,ignore
72
72
[dependencies]
73
-
bincode = "2.0.0"
73
+
bincode = "2.0"
74
74
75
75
# If you need `no_std` with `alloc`:
76
-
# bincode = { version = "2.0.0", default-features = false, features = ["derive", "alloc"] }
76
+
# bincode = { version = "2.0", default-features = false, features = ["derive", "alloc"] }
77
77
78
78
# If you need `no_std` and no `alloc`:
79
-
# bincode = { version = "2.0.0", default-features = false, features = ["derive"] }
79
+
# bincode = { version = "2.0", default-features = false, features = ["derive"] }
80
80
```
81
81
82
82
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`
**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).
89
+
**note:** To implement these traits manually, see the documentation of [Encode](https://docs.rs/bincode/2/bincode/enc/trait.Encode.html) and [Decode](https://docs.rs/bincode/2/bincode/de/trait.Decode.html).
90
90
91
91
**note:** For more information on using `bincode-derive` with external libraries, see [below](#bincode-derive-and-libraries).
92
92
@@ -107,10 +107,10 @@ Then replace the following functions: (`Configuration` is `bincode::config::lega
107
107
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)]`:
108
108
109
109
- 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/bincode/serde/struct.Compat.html) or [bincode::serde::BorrowCompat](https://docs.rs/bincode/2.0.0/bincode/serde/struct.BorrowCompat.html)
110
+
- Enable the `serde` feature and wrap your field in [bincode::serde::Compat](https://docs.rs/bincode/2/bincode/serde/struct.Compat.html) or [bincode::serde::BorrowCompat](https://docs.rs/bincode/2/bincode/serde/struct.BorrowCompat.html)
111
111
- Make a pull request to the library:
112
112
- 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", default-features = false, optional = true }` to the `Cargo.toml`
@@ -31,7 +31,7 @@ Endianness can be configured with the following methods, allowing for big-endian
31
31
- Encoded as a single byte
32
32
-`false` is represented by `0`
33
33
-`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/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/bincode/error/enum.DecodeError.html#variant.InvalidBooleanValue)
35
35
36
36
### Numeric Types
37
37
@@ -62,7 +62,7 @@ Endianness can be configured with the following methods, allowing for big-endian
62
62
- Surrogate code points (0xD800 to 0xDFFF) are not valid
63
63
- Invalid Unicode characters can be acquired via unsafe code, this is handled as:
64
64
- during serialization: data is written as-is
65
-
- during deserialization: an error is raised [`DecodeError::InvalidCharEncoding`](https://docs.rs/bincode/2.0.0/bincode/error/enum.DecodeError.html#variant.InvalidCharEncoding)
65
+
- during deserialization: an error is raised [`DecodeError::InvalidCharEncoding`](https://docs.rs/bincode/2/bincode/error/enum.DecodeError.html#variant.InvalidCharEncoding)
66
66
- No additional metadata or encoding scheme beyond the raw code point value
67
67
68
68
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:
92
92
93
93
`usize` is being encoded/decoded as a `u64` and `isize` is being encoded/decoded as a `i64`.
94
94
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.
95
+
See the documentation of [VarintEncoding](https://docs.rs/bincode/2/bincode/config/struct.Configuration.html#method.with_variable_int_encoding) for more information.
96
96
97
97
### FixintEncoding
98
98
99
99
- Fixed size integers are encoded directly
100
100
- Enum discriminants are encoded as u32
101
101
- Lengths and usize are encoded as u64
102
102
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.
103
+
See the documentation of [FixintEncoding](https://docs.rs/bincode/2/bincode/config/struct.Configuration.html#method.with_fixed_int_encoding) for more information.
- During serialization, the string is encoded as a sequence of the given bytes.
225
225
- Rust strings are UTF-8 encoded by default, but this is not enforced by bincode
226
226
- 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/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/bincode/error/enum.DecodeError.html#variant.Utf8) error is raised
0 commit comments