Struct ParseConfig
pub struct ParseConfig { /* private fields */ }
Expand description
Configuration for the NDJSON-parser which controls the behavior in various situations.
By default, the parser will attempt to parse every line, i.e. every segment between \n
characters, even if it is empty. This will result in errors for empty lines.
You can construct a config by first calling ParseConfig::default and then using the builder-style associated functions to configure it. See the example below.
Implementations§
§impl ParseConfig
impl ParseConfig
pub fn with_empty_line_handling(
self,
empty_line_handling: EmptyLineHandling,
) -> ParseConfig
pub fn with_empty_line_handling( self, empty_line_handling: EmptyLineHandling, ) -> ParseConfig
Creates a new config from this config which has a different handling for lines that contain no JSON values. See EmptyLineHandling for more details.
§Returns
A new config with all the same values as this one, except the empty-line-handling.
pub fn set_empty_line_handling(
&mut self,
empty_line_handling: EmptyLineHandling,
) -> &mut ParseConfig
pub fn set_empty_line_handling( &mut self, empty_line_handling: EmptyLineHandling, ) -> &mut ParseConfig
Creates a new config from this config which has a different handling for lines that contain no JSON values. See EmptyLineHandling for more details.
§Returns
A new config with all the same values as this one, except the empty-line-handling.
pub fn with_parse_rest(self, parse_rest: bool) -> ParseConfig
pub fn with_parse_rest(self, parse_rest: bool) -> ParseConfig
Creates a new config from this config which has the given configuration on whether to parse
or ignore the rest, i.e. the part after the last newline character. If parse_rest
is set
to false
, the rest will always be ignored, while true
causes it to only be ignored if it
is empty or considered empty by the handling configured in
ParseConfig::with_empty_line_handling, which by default is only truly empty. Otherwise,
the rest is parsed like an ordinary JSON record. By default, this is set to true
.
§Returns
A new config with all the same values as this one, except the parse-rest-flag.
pub fn set_parse_rest(&mut self, parse_rest: bool) -> &mut ParseConfig
pub fn set_parse_rest(&mut self, parse_rest: bool) -> &mut ParseConfig
Creates a new config from this config which has the given configuration on whether to parse
or ignore the rest, i.e. the part after the last newline character. If parse_rest
is set
to false
, the rest will always be ignored, while true
causes it to only be ignored if it
is empty or considered empty by the handling configured in
ParseConfig::with_empty_line_handling, which by default is only truly empty. Otherwise,
the rest is parsed like an ordinary JSON record. By default, this is set to true
.
§Returns
A new config with all the same values as this one, except the parse-rest-flag.
Trait Implementations§
§impl Clone for ParseConfig
impl Clone for ParseConfig
§fn clone(&self) -> ParseConfig
fn clone(&self) -> ParseConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ParseConfig
impl Debug for ParseConfig
§impl Default for ParseConfig
impl Default for ParseConfig
§fn default() -> ParseConfig
fn default() -> ParseConfig
§impl Hash for ParseConfig
impl Hash for ParseConfig
§impl PartialEq for ParseConfig
impl PartialEq for ParseConfig
impl Copy for ParseConfig
impl Eq for ParseConfig
impl StructuralPartialEq for ParseConfig
Auto Trait Implementations§
impl Freeze for ParseConfig
impl RefUnwindSafe for ParseConfig
impl Send for ParseConfig
impl Sync for ParseConfig
impl Unpin for ParseConfig
impl UnwindSafe for ParseConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more