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
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
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 changeLabel<T: ToString>(&mut self, label: T, newLabel: T) -> bool
pub fn changeLabel<T: ToString>(&mut self, label: T, newLabel: T) -> bool
Changes the label of a node, returns a bool representing the status of the change
sourcepub fn changeContent<T: ToString>(
&mut self,
label: T,
content: NodeContent
) -> bool
pub fn changeContent<T: ToString>( &mut self, label: T, content: NodeContent ) -> bool
Changes the content of a node, returns a bool representing the status of the change
sourcepub fn removeNode<T: ToString>(&mut self, label: T) -> bool
pub fn removeNode<T: ToString>(&mut self, label: T) -> bool
Removes a node basing on its label
Trait Implementations§
source§impl PartialEq for Json
impl PartialEq for Json
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