pub struct Config { /* private fields */ }
👎 Deprecated since 1.3.0:

please use the DefaultOptions/Options system instead

Expand description

A configuration builder whose options Bincode will use while serializing and deserializing.

Options

Endianness: The endianness with which multi-byte integers will be read/written. default: little endian Limit: The maximum number of bytes that will be read/written in a bincode serialize/deserialize. default: unlimited

Byte Limit Details

The purpose of byte-limiting is to prevent Denial-Of-Service attacks whereby malicious attackers get bincode deserialization to crash your process by allocating too much memory or keeping a connection open for too long.

When a byte limit is set, bincode will return Err on any deserialization that goes over the limit, or any serialization that goes over the limit.

Implementations

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

Sets the byte limit to limit.

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

Sets the endianness to big-endian

Sets the endianness to the the machine-native endianness

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

If the serialization would take more bytes than allowed by the size limit, an error is returned and no bytes will be written into the Writer

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

If this returns an Error, reader may be in an invalid state.

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

If this returns an Error, reader may be in an invalid state.

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.

If this returns an Error, reader may be in an invalid state.

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.

If this returns an Error, reader may be in an invalid state.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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.