pub struct LenientJsonNormalizer { /* private fields */ }Expand description
Normalizes one raw JSON text input before JSON parsing.
The object holds normalization options and applies all supported preprocessing
rules in the same order for every normalize call.
Implementations§
Source§impl LenientJsonNormalizer
impl LenientJsonNormalizer
Sourcepub const fn new(options: JsonDecodeOptions) -> Self
pub const fn new(options: JsonDecodeOptions) -> Self
Creates a normalizer with the provided lenient decoding options.
The options are copied into the object so each normalize call uses a
consistent policy without external mutation.
Sourcepub const fn options(&self) -> &JsonDecodeOptions
pub const fn options(&self) -> &JsonDecodeOptions
Returns the configuration used by this normalizer.
Sourcepub fn normalize<'a>(
&self,
input: &'a str,
) -> Result<Cow<'a, str>, JsonDecodeError>
pub fn normalize<'a>( &self, input: &'a str, ) -> Result<Cow<'a, str>, JsonDecodeError>
Normalizes one raw JSON text input and returns a parsed-ready text slice.
The pipeline is intentionally narrow: it trims whitespace, strips an optional BOM, optionally removes a Markdown code fence, escapes control characters in strings, and finally validates non-emptiness again.
Trait Implementations§
Source§impl Clone for LenientJsonNormalizer
impl Clone for LenientJsonNormalizer
Source§fn clone(&self) -> LenientJsonNormalizer
fn clone(&self) -> LenientJsonNormalizer
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 LenientJsonNormalizer
impl Debug for LenientJsonNormalizer
Source§impl Default for LenientJsonNormalizer
impl Default for LenientJsonNormalizer
impl Copy for LenientJsonNormalizer
Auto Trait Implementations§
impl Freeze for LenientJsonNormalizer
impl RefUnwindSafe for LenientJsonNormalizer
impl Send for LenientJsonNormalizer
impl Sync for LenientJsonNormalizer
impl Unpin for LenientJsonNormalizer
impl UnsafeUnpin for LenientJsonNormalizer
impl UnwindSafe for LenientJsonNormalizer
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