pub struct JsoncDocument { /* private fields */ }Implementations§
Source§impl JsoncDocument
impl JsoncDocument
Sourcepub fn parse(text: &str) -> Result<Self, ParseError>
pub fn parse(text: &str) -> Result<Self, ParseError>
Parse JSONC text into a document
Sourcepub fn empty() -> Result<Self, ParseError>
pub fn empty() -> Result<Self, ParseError>
Create a new empty document
Sourcepub fn get<T: for<'de> Deserialize<'de>>(&mut self, key: &str) -> Option<T>
pub fn get<T: for<'de> Deserialize<'de>>(&mut self, key: &str) -> Option<T>
Get a value by key and deserialize it to the specified type
Sourcepub fn get_cst_node(&self, key: &str) -> Option<CstNode>
pub fn get_cst_node(&self, key: &str) -> Option<CstNode>
Get a raw serde_json::Value for a key without deserializing to a specific type
Sourcepub fn get_cst_value(&self, key: &str) -> Option<Value>
pub fn get_cst_value(&self, key: &str) -> Option<Value>
Get a raw serde_json::Value for a key without deserializing to a specific type
Sourcepub fn set<T: Serialize>(&mut self, key: &str, value: T) -> Result<(), Error>
pub fn set<T: Serialize>(&mut self, key: &str, value: T) -> Result<(), Error>
Set a value for a key
Sourcepub fn diff(&self, other: &JsoncDocument) -> DocumentDiff
pub fn diff(&self, other: &JsoncDocument) -> DocumentDiff
Compute the difference between this document and another
Sourcepub fn apply_changes(&mut self, other: &JsoncDocument) -> DocumentDiff
pub fn apply_changes(&mut self, other: &JsoncDocument) -> DocumentDiff
Apply changes from another document to this one
Sourcepub fn to_pretty_string(&self) -> String
pub fn to_pretty_string(&self) -> String
Format the document with pretty printing
Trait Implementations§
Source§impl Clone for JsoncDocument
impl Clone for JsoncDocument
Source§fn clone(&self) -> JsoncDocument
fn clone(&self) -> JsoncDocument
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 moreAuto Trait Implementations§
impl Freeze for JsoncDocument
impl !RefUnwindSafe for JsoncDocument
impl !Send for JsoncDocument
impl !Sync for JsoncDocument
impl Unpin for JsoncDocument
impl !UnwindSafe for JsoncDocument
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