Struct dts_core::ser::SerializerBuilder
source · [−]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
sourceimpl 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 where
S: AsRef<str>,
pub fn text_join_separator<S>(&mut self, sep: S) -> &mut Self where
S: AsRef<str>,
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
sourceimpl Clone for SerializerBuilder
impl Clone for SerializerBuilder
sourcefn clone(&self) -> SerializerBuilder
fn clone(&self) -> SerializerBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for SerializerBuilder
impl Debug for SerializerBuilder
sourceimpl Default for SerializerBuilder
impl Default for SerializerBuilder
sourcefn default() -> SerializerBuilder
fn default() -> SerializerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for SerializerBuilder
impl Send for SerializerBuilder
impl Sync for SerializerBuilder
impl Unpin for SerializerBuilder
impl UnwindSafe for SerializerBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more