Struct EncoderOptions
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§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>Implementations§
§impl EncoderOptions
impl EncoderOptions
pub fn with_explicit_nulls(self, explicit_nulls: bool) -> EncoderOptions
pub fn with_explicit_nulls(self, explicit_nulls: bool) -> EncoderOptions
Set whether to include nulls in the output or elide them.
pub fn with_struct_mode(self, struct_mode: StructMode) -> EncoderOptions
pub fn with_struct_mode(self, struct_mode: StructMode) -> EncoderOptions
Set whether to encode structs as JSON objects or JSON arrays of their values.
pub fn with_encoder_factory(
self,
encoder_factory: Arc<dyn EncoderFactory>,
) -> EncoderOptions
pub fn with_encoder_factory( self, encoder_factory: Arc<dyn EncoderFactory>, ) -> EncoderOptions
Set an optional hook for customizing encoding behavior.
pub fn explicit_nulls(&self) -> bool
pub fn explicit_nulls(&self) -> bool
Get whether to include nulls in the output or elide them.
pub 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.
pub 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.
pub fn with_date_format(self, format: String) -> EncoderOptions
pub fn with_date_format(self, format: String) -> EncoderOptions
Set the JSON file’s date format
pub 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
pub fn with_datetime_format(self, format: String) -> EncoderOptions
pub fn with_datetime_format(self, format: String) -> EncoderOptions
Set the JSON file’s datetime format
pub 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
pub fn with_time_format(self, format: String) -> EncoderOptions
pub fn with_time_format(self, format: String) -> EncoderOptions
Set the JSON file’s time format
pub 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
pub fn with_timestamp_format(self, format: String) -> EncoderOptions
pub fn with_timestamp_format(self, format: String) -> EncoderOptions
Set the JSON file’s timestamp format
pub 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
pub fn with_timestamp_tz_format(self, tz_format: String) -> EncoderOptions
pub fn with_timestamp_tz_format(self, tz_format: String) -> EncoderOptions
Set the JSON file’s timestamp tz format
pub 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§
§impl Clone for EncoderOptions
impl Clone for EncoderOptions
§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§impl Debug for EncoderOptions
impl Debug for EncoderOptions
§impl Default for EncoderOptions
impl Default for EncoderOptions
§fn default() -> EncoderOptions
fn default() -> EncoderOptions
Auto Trait Implementations§
impl Freeze for EncoderOptions
impl !RefUnwindSafe for EncoderOptions
impl Send for EncoderOptions
impl Sync for EncoderOptions
impl Unpin for EncoderOptions
impl !UnwindSafe for EncoderOptions
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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