pub struct DefaultOptions(/* private fields */);
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§
Source§impl DefaultOptions
impl DefaultOptions
Sourcepub fn new() -> DefaultOptions
pub fn new() -> DefaultOptions
Get a default configuration object.
§Default Configuration:
Byte limit | Endianness | Int Encoding | Trailing Behavior |
---|---|---|---|
Unlimited | Little | Varint | Reject |
Trait Implementations§
Source§impl Clone for DefaultOptions
impl Clone for DefaultOptions
Source§fn clone(&self) -> DefaultOptions
fn clone(&self) -> DefaultOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for DefaultOptions
impl Default for DefaultOptions
impl Copy for DefaultOptions
Auto Trait Implementations§
impl Freeze for DefaultOptions
impl RefUnwindSafe for DefaultOptions
impl Send for DefaultOptions
impl Sync for DefaultOptions
impl Unpin for DefaultOptions
impl UnwindSafe for DefaultOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Options for Twhere
T: InternalOptions,
impl<T> Options for Twhere
T: InternalOptions,
Source§fn with_no_limit(self) -> WithOtherLimit<Self, Infinite>
fn with_no_limit(self) -> WithOtherLimit<Self, Infinite>
Source§fn with_limit(self, limit: u64) -> WithOtherLimit<Self, Bounded>
fn with_limit(self, limit: u64) -> WithOtherLimit<Self, Bounded>
limit
.Source§fn with_little_endian(self) -> WithOtherEndian<Self, LittleEndian>
fn with_little_endian(self) -> WithOtherEndian<Self, LittleEndian>
Source§fn with_big_endian(self) -> WithOtherEndian<Self, BigEndian>
fn with_big_endian(self) -> WithOtherEndian<Self, BigEndian>
Source§fn with_native_endian(self) -> WithOtherEndian<Self, NativeEndian>
fn with_native_endian(self) -> WithOtherEndian<Self, NativeEndian>
Source§fn with_varint_encoding(self) -> WithOtherIntEncoding<Self, VarintEncoding>
fn with_varint_encoding(self) -> WithOtherIntEncoding<Self, VarintEncoding>
Source§fn with_fixint_encoding(self) -> WithOtherIntEncoding<Self, FixintEncoding>
fn with_fixint_encoding(self) -> WithOtherIntEncoding<Self, FixintEncoding>
Source§fn reject_trailing_bytes(self) -> WithOtherTrailing<Self, RejectTrailing>
fn reject_trailing_bytes(self) -> WithOtherTrailing<Self, RejectTrailing>
Source§fn allow_trailing_bytes(self) -> WithOtherTrailing<Self, AllowTrailing>
fn allow_trailing_bytes(self) -> WithOtherTrailing<Self, AllowTrailing>
Source§fn serialize<S: ?Sized + Serialize>(self, t: &S) -> Result<Vec<u8>>
fn serialize<S: ?Sized + Serialize>(self, t: &S) -> Result<Vec<u8>>
Vec
of bytes using this configurationSource§fn serialized_size<T: ?Sized + Serialize>(self, t: &T) -> Result<u64>
fn serialized_size<T: ?Sized + Serialize>(self, t: &T) -> Result<u64>
Source§fn serialize_into<W: Write, T: ?Sized + Serialize>(
self,
w: W,
t: &T,
) -> Result<()>
fn serialize_into<W: Write, T: ?Sized + Serialize>( self, w: W, t: &T, ) -> Result<()>
Writer
using this configuration Read moreSource§fn deserialize<'a, T: Deserialize<'a>>(self, bytes: &'a [u8]) -> Result<T>
fn deserialize<'a, T: Deserialize<'a>>(self, bytes: &'a [u8]) -> Result<T>
T
using this configurationSource§fn deserialize_seed<'a, T: DeserializeSeed<'a>>(
self,
seed: T,
bytes: &'a [u8],
) -> Result<T::Value>
fn deserialize_seed<'a, T: DeserializeSeed<'a>>( self, seed: T, bytes: &'a [u8], ) -> Result<T::Value>
seed
using this configuration.Source§fn deserialize_from<R: Read, T: DeserializeOwned>(self, reader: R) -> Result<T>
fn deserialize_from<R: Read, T: DeserializeOwned>(self, reader: R) -> Result<T>
Read
er using this configuration Read moreSource§fn deserialize_from_seed<'a, R: Read, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R,
) -> Result<T::Value>
fn deserialize_from_seed<'a, R: Read, T: DeserializeSeed<'a>>( self, seed: T, reader: R, ) -> Result<T::Value>
Source§fn deserialize_from_custom<'a, R: BincodeRead<'a>, T: DeserializeOwned>(
self,
reader: R,
) -> Result<T>
fn deserialize_from_custom<'a, R: BincodeRead<'a>, T: DeserializeOwned>( self, reader: R, ) -> Result<T>
BincodeRead
er using the default configuration.
It is highly recommended to use deserialize_from
unless you need to implement
BincodeRead
for performance reasons. Read moreSource§fn deserialize_from_custom_seed<'a, R: BincodeRead<'a>, T: DeserializeSeed<'a>>(
self,
seed: T,
reader: R,
) -> Result<T::Value>
fn deserialize_from_custom_seed<'a, R: BincodeRead<'a>, T: DeserializeSeed<'a>>( self, seed: T, reader: R, ) -> Result<T::Value>
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 moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes