pub struct SerializeOptions {
pub pretty: bool,
pub indent: &'static str,
pub bytes_format: BytesFormat,
}Expand description
Options for JSON serialization.
Fields§
§pretty: boolWhether to pretty-print with indentation (default: false)
indent: &'static strIndentation string for pretty-printing (default: “ “)
bytes_format: BytesFormatHow byte sequences (Vec<u8>, [u8; N], bytes::Bytes, etc.) are serialized.
Implementations§
Source§impl SerializeOptions
impl SerializeOptions
Sourcepub const fn indent(self, indent: &'static str) -> Self
pub const fn indent(self, indent: &'static str) -> Self
Set a custom indentation string (implies pretty-printing).
Sourcepub const fn bytes_format(self, bytes_format: BytesFormat) -> Self
pub const fn bytes_format(self, bytes_format: BytesFormat) -> Self
Configure how byte sequences are serialized.
Sourcepub const fn bytes_as_array(self) -> Self
pub const fn bytes_as_array(self) -> Self
Serialize byte sequences as JSON arrays of numbers.
Sourcepub const fn bytes_as_hex(self) -> Self
pub const fn bytes_as_hex(self) -> Self
Serialize byte sequences as hex strings without truncation.
Sourcepub const fn bytes_as_hex_with_options(self, options: HexBytesOptions) -> Self
pub const fn bytes_as_hex_with_options(self, options: HexBytesOptions) -> Self
Serialize byte sequences as hex strings with custom options.
Trait Implementations§
Source§impl Clone for SerializeOptions
impl Clone for SerializeOptions
Source§fn clone(&self) -> SerializeOptions
fn clone(&self) -> SerializeOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SerializeOptions
impl Debug for SerializeOptions
Auto Trait Implementations§
impl Freeze for SerializeOptions
impl RefUnwindSafe for SerializeOptions
impl Send for SerializeOptions
impl Sync for SerializeOptions
impl Unpin for SerializeOptions
impl UnsafeUnpin for SerializeOptions
impl UnwindSafe for SerializeOptions
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
Mutably borrows from an owned value. Read more