pub enum CommentPolicy {
TreatAsError,
Remove,
Preserve,
}Expand description
Policy for handling comments in JSON input.
Standard JSON does not support comments, but many JSON-like formats (such as JSONC used by VS Code) do allow them. This enum controls how comments are handled during formatting.
Variants§
TreatAsError
Return an error if comments are encountered in the input. This is the default, enforcing strict JSON compliance.
Remove
Silently remove any comments from the output.
Preserve
Keep comments in the output, preserving their relative positions.
Trait Implementations§
Source§impl Clone for CommentPolicy
impl Clone for CommentPolicy
Source§fn clone(&self) -> CommentPolicy
fn clone(&self) -> CommentPolicy
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 CommentPolicy
impl Debug for CommentPolicy
Source§impl PartialEq for CommentPolicy
impl PartialEq for CommentPolicy
impl Copy for CommentPolicy
impl Eq for CommentPolicy
impl StructuralPartialEq for CommentPolicy
Auto Trait Implementations§
impl Freeze for CommentPolicy
impl RefUnwindSafe for CommentPolicy
impl Send for CommentPolicy
impl Sync for CommentPolicy
impl Unpin for CommentPolicy
impl UnwindSafe for CommentPolicy
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