pub struct SerializerBuilder { /* private fields */ }Expand description
A SerializerBuilder can be used to build a Serializer with certain
SerializeOptions.
§Example
use dts_core::{ser::SerializerBuilder, Encoding};
let writer = std::io::stdout();
let mut serializer = SerializerBuilder::new()
.newline(true)
.build(writer);Implementations§
Source§impl SerializerBuilder
impl SerializerBuilder
Sourcepub fn compact(&mut self, yes: bool) -> &mut Self
pub fn compact(&mut self, yes: bool) -> &mut Self
Emit output data in a compact format. This will disable pretty printing for encodings that support it.
Sourcepub fn newline(&mut self, yes: bool) -> &mut Self
pub fn newline(&mut self, yes: bool) -> &mut Self
Append a trailing newline to the serialized data.
Sourcepub fn keys_as_csv_headers(&mut self, yes: bool) -> &mut Self
pub fn keys_as_csv_headers(&mut self, yes: bool) -> &mut Self
When the input is an array of objects and the output encoding is CSV, the field names of the first object will be used as CSV headers. Field values of all following objects will be matched to the right CSV column based on their key. Missing fields produce empty columns while excess fields are ignored.
Sourcepub fn csv_delimiter(&mut self, delim: u8) -> &mut Self
pub fn csv_delimiter(&mut self, delim: u8) -> &mut Self
Sets a custom CSV delimiter.
Sourcepub fn text_join_separator<S>(&mut self, sep: S) -> &mut Self
pub fn text_join_separator<S>(&mut self, sep: S) -> &mut Self
Sets a custom separator to join text output with.
Sourcepub fn build<W>(&self, writer: W) -> Serializer<W>where
W: Write,
pub fn build<W>(&self, writer: W) -> Serializer<W>where
W: Write,
Builds the Serializer for the given writer.
Trait Implementations§
Source§impl Clone for SerializerBuilder
impl Clone for SerializerBuilder
Source§fn clone(&self) -> SerializerBuilder
fn clone(&self) -> SerializerBuilder
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 SerializerBuilder
impl Debug for SerializerBuilder
Source§impl Default for SerializerBuilder
impl Default for SerializerBuilder
Source§fn default() -> SerializerBuilder
fn default() -> SerializerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SerializerBuilder
impl RefUnwindSafe for SerializerBuilder
impl Send for SerializerBuilder
impl Sync for SerializerBuilder
impl Unpin for SerializerBuilder
impl UnwindSafe for SerializerBuilder
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<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