endian.rs |
|
629 |
int.rs |
|
22488 |
legacy.rs |
|
8711 |
limit.rs |
|
1326 |
mod.rs |
`bincode` uses a Builder-pattern to configure the Serializers and Deserializers in this
crate. This means that if you need to customize the behavior of `bincode`, you should create an
instance of the `DefaultOptions` struct:
```rust
use bincode::Options;
let my_options = bincode::DefaultOptions::new();
```
# Options Struct vs bincode functions
Due to historical reasons, the default options used by the `serialize()` and `deserialize()`
family of functions are different than the default options created by the `DefaultOptions` struct:
| | Byte limit | Endianness | Int Encoding | Trailing Behavior |
|----------|------------|------------|--------------|-------------------|
| struct | Unlimited | Little | Varint | Reject |
| function | Unlimited | Little | Fixint | Allow |
This means that if you want to use the `Serialize` / `Deserialize` structs with the same
settings as the functions, you should adjust the `DefaultOptions` struct like so:
```rust
use bincode::Options;
let my_options = bincode::DefaultOptions::new()
.with_fixint_encoding()
.allow_trailing_bytes();
``` |
13997 |
trailing.rs |
|
1158 |