pub struct NdjsonConfig {
pub trailing_newline: bool,
pub pretty: bool,
pub content_type: Option<Vec<u8>>,
}Expand description
Configuration for NDJSON responses.
Fields§
§trailing_newline: boolWhether to include a trailing newline after the last item.
pretty: boolWhether to pretty-print each JSON line (not recommended for production).
content_type: Option<Vec<u8>>Custom content type (defaults to application/x-ndjson).
Implementations§
Source§impl NdjsonConfig
impl NdjsonConfig
Sourcepub fn trailing_newline(self, enabled: bool) -> Self
pub fn trailing_newline(self, enabled: bool) -> Self
Set whether to include a trailing newline.
Sourcepub fn pretty(self, enabled: bool) -> Self
pub fn pretty(self, enabled: bool) -> Self
Enable pretty-printing of JSON (not recommended for production).
Sourcepub fn content_type(self, content_type: impl Into<Vec<u8>>) -> Self
pub fn content_type(self, content_type: impl Into<Vec<u8>>) -> Self
Set a custom content type.
Sourcepub fn get_content_type(&self) -> &[u8] ⓘ
pub fn get_content_type(&self) -> &[u8] ⓘ
Get the content type to use.
Trait Implementations§
Source§impl Clone for NdjsonConfig
impl Clone for NdjsonConfig
Source§fn clone(&self) -> NdjsonConfig
fn clone(&self) -> NdjsonConfig
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 NdjsonConfig
impl Debug for NdjsonConfig
Auto Trait Implementations§
impl Freeze for NdjsonConfig
impl RefUnwindSafe for NdjsonConfig
impl Send for NdjsonConfig
impl Sync for NdjsonConfig
impl Unpin for NdjsonConfig
impl UnwindSafe for NdjsonConfig
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).