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 limit | Endianness | Int Encoding | Trailing Behavior |
---|---|---|---|
Unlimited | Little | Varint | Reject |
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DefaultOptions
impl Send for DefaultOptions
impl Sync for DefaultOptions
impl Unpin for DefaultOptions
impl UnwindSafe for DefaultOptions
Blanket Implementations
Mutably borrows from an owned value. Read more
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
fn deserialize_seed<'a, T: DeserializeSeed<'a>>(
self,
seed: T,
bytes: &'a [u8]
) -> Result<T::Value>
[src]
fn deserialize_seed<'a, T: DeserializeSeed<'a>>(
self,
seed: T,
bytes: &'a [u8]
) -> Result<T::Value>
[src]Deserializes a slice of bytes with state seed
using this configuration.
Deserializes an object directly from a Read
er using this configuration Read more
fn deserialize_from_seed<'a, R: Read, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R
) -> Result<T::Value>
[src]
fn deserialize_from_seed<'a, R: Read, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R
) -> Result<T::Value>
[src]Deserializes an object directly from a Read
er with state seed
using this configuration Read more
fn deserialize_from_custom<'a, R: BincodeRead<'a>, T: DeserializeOwned>(
self,
reader: R
) -> Result<T>
[src]
fn deserialize_from_custom<'a, R: BincodeRead<'a>, T: DeserializeOwned>(
self,
reader: R
) -> Result<T>
[src]Deserializes an object from a custom BincodeRead
er using the default configuration.
It is highly recommended to use deserialize_from
unless you need to implement
BincodeRead
for performance reasons. Read more
fn deserialize_from_custom_seed<'a, R: BincodeRead<'a>, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R
) -> Result<T::Value>
[src]
fn deserialize_from_custom_seed<'a, R: BincodeRead<'a>, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R
) -> Result<T::Value>
[src]Deserializes an object from a custom BincodeRead
er 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