pub struct CsvStreamFormat { /* private fields */ }Available on crate feature
csv only.Expand description
CSV rows, with an optional header row.
Implementations§
Source§impl CsvStreamFormat
impl CsvStreamFormat
Sourcepub fn new(has_headers: bool, delimiter: u8) -> Self
pub fn new(has_headers: bool, delimiter: u8) -> Self
CSV with the given header behaviour and field delimiter, everything else default.
Sourcepub fn with_flexible(self, flexible: bool) -> Self
pub fn with_flexible(self, flexible: bool) -> Self
Sets whether to use flexible serialize.
Encode only. On the way back in, records are framed and deserialised one at a time, so there is no “first record” to compare a field count against. That was already true of the previous decoder, where a fresh reader was built per row.
Sourcepub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
pub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
Sets the quote style to use.
Sourcepub fn with_quote(self, quote: u8) -> Self
pub fn with_quote(self, quote: u8) -> Self
Sets the quote character to use.
Sourcepub fn with_double_quote(self, double_quote: bool) -> Self
pub fn with_double_quote(self, double_quote: bool) -> Self
Sets whether to double quote.
Sourcepub fn with_escape(self, escape: u8) -> Self
pub fn with_escape(self, escape: u8) -> Self
Sets the escape character to use.
Sourcepub fn with_terminator(self, terminator: Terminator) -> Self
pub fn with_terminator(self, terminator: Terminator) -> Self
Sets the record terminator to use.
Honoured in both directions: the framer is configured from the same value.
Sourcepub fn with_delimiter(self, delimiter: u8) -> Self
pub fn with_delimiter(self, delimiter: u8) -> Self
Set the field delimiter to use.
Sourcepub fn with_has_headers(self, has_headers: bool) -> Self
pub fn with_has_headers(self, has_headers: bool) -> Self
Set whether to write headers.
Trait Implementations§
Source§impl Clone for CsvStreamFormat
impl Clone for CsvStreamFormat
Source§fn clone(&self) -> CsvStreamFormat
fn clone(&self) -> CsvStreamFormat
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CsvStreamFormat
impl Debug for CsvStreamFormat
Source§impl Default for CsvStreamFormat
impl Default for CsvStreamFormat
Source§impl DefaultFormat for CsvStreamFormat
impl DefaultFormat for CsvStreamFormat
Source§fn default_format() -> Self
fn default_format() -> Self
The configuration to use when the caller supplied none.
Source§impl StreamFormat for CsvStreamFormat
impl StreamFormat for CsvStreamFormat
Source§fn format_name(&self) -> &'static str
fn format_name(&self) -> &'static str
A short, stable name, reported as the
format tracing field.Source§fn default_content_type(&self) -> &'static str
fn default_content_type(&self) -> &'static str
The
Content-Type this format emits when encoding.Source§fn accepts_content_type(&self, ct: &ContentType<'_>) -> bool
fn accepts_content_type(&self, ct: &ContentType<'_>) -> bool
Whether an incoming
Content-Type should be accepted as this format. Read moreSource§impl<T> StreamFormatDecode<T> for CsvStreamFormatwhere
T: for<'de> Deserialize<'de>,
impl<T> StreamFormatDecode<T> for CsvStreamFormatwhere
T: for<'de> Deserialize<'de>,
Source§type Frame = ByteRecord
type Frame = ByteRecord
One framed record, before deserialisation. Read more
Source§type Framer = CsvRecordCodec
type Framer = CsvRecordCodec
Splits the body into records. Read more
Source§fn framer(&self, options: &DecodeOptions) -> Self::Framer
fn framer(&self, options: &DecodeOptions) -> Self::Framer
Build a framer for one body.
Source§impl<T> StreamFormatEncode<T> for CsvStreamFormatwhere
T: Serialize,
impl<T> StreamFormatEncode<T> for CsvStreamFormatwhere
T: Serialize,
Auto Trait Implementations§
impl Freeze for CsvStreamFormat
impl RefUnwindSafe for CsvStreamFormat
impl Send for CsvStreamFormat
impl Sync for CsvStreamFormat
impl Unpin for CsvStreamFormat
impl UnsafeUnpin for CsvStreamFormat
impl UnwindSafe for CsvStreamFormat
Blanket Implementations§
impl<T> Allocation for T
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