pub struct EncoderOptions {
explicit_nulls: bool,
struct_mode: StructMode,
encoder_factory: Option<Arc<dyn EncoderFactory>>,
date_format: Option<String>,
datetime_format: Option<String>,
timestamp_format: Option<String>,
timestamp_tz_format: Option<String>,
time_format: Option<String>,
}
Expand description
Configuration options for the JSON encoder.
Fields§
§explicit_nulls: bool
Whether to include nulls in the output or elide them.
struct_mode: StructMode
Whether to encode structs as JSON objects or JSON arrays of their values.
encoder_factory: Option<Arc<dyn EncoderFactory>>
An optional hook for customizing encoding behavior.
date_format: Option<String>
Optional date format for date arrays
datetime_format: Option<String>
Optional datetime format for datetime arrays
timestamp_format: Option<String>
Optional timestamp format for timestamp arrays
timestamp_tz_format: Option<String>
Optional timestamp format for timestamp with timezone arrays
time_format: Option<String>
Optional time format for time arrays
Implementations§
Source§impl EncoderOptions
impl EncoderOptions
Sourcepub fn with_explicit_nulls(self, explicit_nulls: bool) -> Self
pub fn with_explicit_nulls(self, explicit_nulls: bool) -> Self
Set whether to include nulls in the output or elide them.
Sourcepub fn with_struct_mode(self, struct_mode: StructMode) -> Self
pub fn with_struct_mode(self, struct_mode: StructMode) -> Self
Set whether to encode structs as JSON objects or JSON arrays of their values.
Sourcepub fn with_encoder_factory(
self,
encoder_factory: Arc<dyn EncoderFactory>,
) -> Self
pub fn with_encoder_factory( self, encoder_factory: Arc<dyn EncoderFactory>, ) -> Self
Set an optional hook for customizing encoding behavior.
Sourcepub fn explicit_nulls(&self) -> bool
pub fn explicit_nulls(&self) -> bool
Get whether to include nulls in the output or elide them.
Sourcepub fn struct_mode(&self) -> StructMode
pub fn struct_mode(&self) -> StructMode
Get whether to encode structs as JSON objects or JSON arrays of their values.
Sourcepub fn encoder_factory(&self) -> Option<&Arc<dyn EncoderFactory>>
pub fn encoder_factory(&self) -> Option<&Arc<dyn EncoderFactory>>
Get the optional hook for customizing encoding behavior.
Sourcepub fn with_date_format(self, format: String) -> Self
pub fn with_date_format(self, format: String) -> Self
Set the JSON file’s date format
Sourcepub fn date_format(&self) -> Option<&str>
pub fn date_format(&self) -> Option<&str>
Get the JSON file’s date format if set, defaults to RFC3339
Sourcepub fn with_datetime_format(self, format: String) -> Self
pub fn with_datetime_format(self, format: String) -> Self
Set the JSON file’s datetime format
Sourcepub fn datetime_format(&self) -> Option<&str>
pub fn datetime_format(&self) -> Option<&str>
Get the JSON file’s datetime format if set, defaults to RFC3339
Sourcepub fn with_time_format(self, format: String) -> Self
pub fn with_time_format(self, format: String) -> Self
Set the JSON file’s time format
Sourcepub fn time_format(&self) -> Option<&str>
pub fn time_format(&self) -> Option<&str>
Get the JSON file’s datetime time if set, defaults to RFC3339
Sourcepub fn with_timestamp_format(self, format: String) -> Self
pub fn with_timestamp_format(self, format: String) -> Self
Set the JSON file’s timestamp format
Sourcepub fn timestamp_format(&self) -> Option<&str>
pub fn timestamp_format(&self) -> Option<&str>
Get the JSON file’s timestamp format if set, defaults to RFC3339
Sourcepub fn with_timestamp_tz_format(self, tz_format: String) -> Self
pub fn with_timestamp_tz_format(self, tz_format: String) -> Self
Set the JSON file’s timestamp tz format
Sourcepub fn timestamp_tz_format(&self) -> Option<&str>
pub fn timestamp_tz_format(&self) -> Option<&str>
Get the JSON file’s timestamp tz format if set, defaults to RFC3339
Trait Implementations§
Source§impl Clone for EncoderOptions
impl Clone for EncoderOptions
Source§fn clone(&self) -> EncoderOptions
fn clone(&self) -> EncoderOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more