use super::DiagnosticPolicy;
use super::MarkdownFencePolicy;
use super::NormalizingJsonDecodePolicy;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NormalizingJsonDecodePolicyBuilder {
policy: NormalizingJsonDecodePolicy,
}
impl NormalizingJsonDecodePolicyBuilder {
#[inline]
#[must_use]
pub const fn new() -> Self {
Self {
policy: NormalizingJsonDecodePolicy::lenient(),
}
}
#[inline]
#[must_use]
pub const fn trim_whitespace(mut self, enabled: bool) -> Self {
self.policy.set_trim_whitespace(enabled);
self
}
#[inline]
#[must_use]
pub const fn strip_utf8_bom(mut self, enabled: bool) -> Self {
self.policy.set_strip_utf8_bom(enabled);
self
}
#[inline]
#[must_use]
pub const fn markdown_fence_policy(mut self, policy: MarkdownFencePolicy) -> Self {
self.policy.set_markdown_fence_policy(policy);
self
}
#[inline]
#[must_use]
pub const fn escape_control_chars_in_strings(mut self, enabled: bool) -> Self {
self.policy.set_escape_control_chars_in_strings(enabled);
self
}
#[inline]
#[must_use]
pub const fn diagnostic_policy(mut self, policy: DiagnosticPolicy) -> Self {
self.policy.set_diagnostic_policy(policy);
self
}
#[inline]
#[must_use]
pub const fn build(self) -> NormalizingJsonDecodePolicy {
self.policy
}
}
impl Default for NormalizingJsonDecodePolicyBuilder {
#[inline]
fn default() -> Self {
Self::new()
}
}