Struct bincode::config::DefaultOptions[][src]

pub struct DefaultOptions(_);
Expand description

The default options for bincode serialization/deserialization.

Defaults

By default bincode will use little-endian encoding for multi-byte integers, and will not limit the number of serialized/deserialized bytes.

Configuring DefaultOptions

DefaultOptions implements the Options trait, which means it exposes functions to change the behavior of bincode.

For example, if you wanted to limit the bincode deserializer to 1 kilobyte of user input:

use bincode::Options;
let my_options = bincode::DefaultOptions::new().with_limit(1024);

DefaultOptions struct vs. functions

The default configuration used by this struct is not the same as that used by the bincode helper functions in the root of this crate. See the config module for more details

Implementations

Get a default configuration object.

Default Configuration:
Byte limitEndiannessInt EncodingTrailing Behavior
UnlimitedLittleVarintReject

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Sets the byte limit to be unlimited. This is the default. Read more

Sets the byte limit to limit.

Sets the endianness to little-endian This is the default. Read more

Sets the endianness to big-endian

Sets the endianness to the the machine-native endianness

Sets the length encoding to varint

Sets the length encoding to be fixed

Sets the deserializer to reject trailing bytes

Sets the deserializer to allow trailing bytes

Serializes a serializable object into a Vec of bytes using this configuration

Returns the size that an object would be if serialized using Bincode with this configuration

Serializes an object directly into a Writer using this configuration Read more

Deserializes a slice of bytes into an instance of T using this configuration

Deserializes a slice of bytes with state seed using this configuration.

Deserializes an object directly from a Reader using this configuration Read more

Deserializes an object directly from a Reader with state seed using this configuration Read more

Deserializes an object from a custom BincodeReader using the default configuration. It is highly recommended to use deserialize_from unless you need to implement BincodeRead for performance reasons. Read more

Deserializes an object from a custom BincodeReader with state seed using the default configuration. It is highly recommended to use deserialize_from unless you need to implement BincodeRead for performance reasons. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.