pub struct Builder(/* private fields */);Expand description
Options builder.
Implementations§
Source§impl Builder
impl Builder
Sourcepub const fn integer(self, integer: Integer) -> Self
pub const fn integer(self, integer: Integer) -> Self
Indicates if an integer serialization should be variable.
§Examples
use musli::options::{self, Integer, Options};
const OPTIONS: Options = options::new().integer(Integer::Fixed).build();Sourcepub const fn float(self, float: Float) -> Self
pub const fn float(self, float: Float) -> Self
Indicates the configuration of float serialization.
§Examples
use musli::options::{self, Float, Options};
const OPTIONS: Options = options::new().float(Float::Fixed).build();Sourcepub const fn byte_order(self, byte_order: ByteOrder) -> Self
pub const fn byte_order(self, byte_order: ByteOrder) -> Self
Specify which byte order to use.
§Examples
use musli::options::{self, ByteOrder, Options};
const OPTIONS: Options = options::new().byte_order(ByteOrder::Little).build();Sourcepub const fn native_byte_order(self) -> Self
pub const fn native_byte_order(self) -> Self
Specify that the ByteOrder::NATIVE byte order should be used.
§Examples
use musli::options::{self, Width, Options};
const OPTIONS: Options = options::new().native_byte_order().build();Sourcepub const fn pointer(self, width: Width) -> Self
pub const fn pointer(self, width: Width) -> Self
Sets the way in which pointer-like usize and isize types are
encoded.
§Examples
use musli::options::{self, Width, Options};
const OPTIONS: Options = options::new().pointer(Width::U32).build();Sourcepub const fn map_keys_as_numbers(self) -> Self
pub const fn map_keys_as_numbers(self) -> Self
Configured a format to use numbers as map keys.
This options is used for an encoding such as JSON to allow for storing numbers as string keys, since this would otherwise not be possible and cause an error.
§Examples
use musli::options::{self, Options};
const OPTIONS: Options = options::new().map_keys_as_numbers().build();Sourcepub const fn fixed(self) -> Self
pub const fn fixed(self) -> Self
Configure the options to use fixed serialization.
This causes numerical types to use the default fixed-length
serialization which is typically more efficient than variable-length
through variable() but is less compact.
This is the same as calling integer(Integer::Fixed),
float(Float::Fixed), and pointer(Width::NATIVE).
§Examples
use musli::options::{self, Options};
const OPTIONS: Options = options::new().fixed().build();Sourcepub const fn variable(self) -> Self
pub const fn variable(self) -> Self
Configure the options to use variable serialization.
This causes numerical types to use the default variable-length
serialization which is typically less efficient than fixed-length
through fixed() but is more compact.
This is the same as calling integer(Integer::Variable),
float(Float::Variable), and pointer(Width::Variable).
§Examples
use musli::options::{self, Options};
const OPTIONS: Options = options::new().variable().build();