pub struct EncodeOptions {
pub delimiter: Delimiter,
pub indent: Indent,
pub key_folding: KeyFoldingMode,
pub flatten_depth: usize,
}Expand description
Options for encoding JSON values to TOON format.
Fields§
§delimiter: Delimiter§indent: Indent§key_folding: KeyFoldingMode§flatten_depth: usizeImplementations§
Source§impl EncodeOptions
impl EncodeOptions
Sourcepub fn new() -> EncodeOptions
pub fn new() -> EncodeOptions
Create new encoding options with defaults.
Sourcepub fn with_delimiter(self, delimiter: Delimiter) -> EncodeOptions
pub fn with_delimiter(self, delimiter: Delimiter) -> EncodeOptions
Set the delimiter for array elements.
Sourcepub fn with_indent(self, style: Indent) -> EncodeOptions
pub fn with_indent(self, style: Indent) -> EncodeOptions
Set the indentation string for nested structures.
Sourcepub fn with_spaces(self, count: usize) -> EncodeOptions
pub fn with_spaces(self, count: usize) -> EncodeOptions
Set indentation to a specific number of spaces.
Sourcepub fn with_key_folding(self, mode: KeyFoldingMode) -> EncodeOptions
pub fn with_key_folding(self, mode: KeyFoldingMode) -> EncodeOptions
Enable key folding (v1.5 feature).
When set to Safe, single-key object chains will be folded into
dotted-path notation if all safety requirements are met.
Default: Off
Sourcepub fn with_flatten_depth(self, depth: usize) -> EncodeOptions
pub fn with_flatten_depth(self, depth: usize) -> EncodeOptions
Set maximum depth for key folding.
Controls how many segments will be folded. A value of 2 folds
only two-segment chains: {a: {b: val}} → a.b: val.
Default: usize::MAX (fold entire eligible chains)
Trait Implementations§
Source§impl Clone for EncodeOptions
impl Clone for EncodeOptions
Source§fn clone(&self) -> EncodeOptions
fn clone(&self) -> EncodeOptions
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 EncodeOptions
impl Debug for EncodeOptions
Source§impl Default for EncodeOptions
impl Default for EncodeOptions
Source§fn default() -> EncodeOptions
fn default() -> EncodeOptions
Returns the “default value” for a type. Read more
Source§impl PartialEq for EncodeOptions
impl PartialEq for EncodeOptions
impl Eq for EncodeOptions
impl StructuralPartialEq for EncodeOptions
Auto Trait Implementations§
impl Freeze for EncodeOptions
impl RefUnwindSafe for EncodeOptions
impl Send for EncodeOptions
impl Sync for EncodeOptions
impl Unpin for EncodeOptions
impl UnwindSafe for EncodeOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more