pub struct Json { /* private fields */ }
Implementations§
Source§impl Json
impl Json
pub fn new() -> Json
Sourcepub fn fromFile<T: ToString>(filePath: T) -> Result<Json, String>
pub fn fromFile<T: ToString>(filePath: T) -> Result<Json, String>
Reads the file at filePath
and returns a Json struct corresponding to its content
pub fn fromString<T: ToString>(text: T) -> Result<Json, String>
Sourcepub fn getAllNodes(&self) -> Vec<Node>
pub fn getAllNodes(&self) -> Vec<Node>
Returns a vector containing all nodes in the Json object
Sourcepub fn get<T: ToString>(&self, label: T) -> Option<&NodeContent>
pub fn get<T: ToString>(&self, label: T) -> Option<&NodeContent>
Returns the content of the requested node
pub fn renderContent(object: &NodeContent) -> String
Sourcepub fn writeToFile<T: ToString>(&self, fileName: T) -> bool
pub fn writeToFile<T: ToString>(&self, fileName: T) -> bool
Exports the Json struct into a Json file and writes it into fileName
Sourcepub fn setContent<T: ToString>(
&mut self,
label: T,
content: NodeContent,
) -> bool
pub fn setContent<T: ToString>( &mut self, label: T, content: NodeContent, ) -> bool
Changes the content of a node, returns a bool representing the status of the change
Trait Implementations§
impl StructuralPartialEq for Json
Auto Trait Implementations§
impl Freeze for Json
impl RefUnwindSafe for Json
impl Send for Json
impl Sync for Json
impl Unpin for Json
impl UnwindSafe for Json
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