[][src]Struct dino::Tree

pub struct Tree { /* fields omitted */ }

The struct that allows you to create sub trees in the main tree in the database Sub trees do not auto insert in the main tree of the database You can do that by doing

Example

// Create the database instance
let mut db = Database::new("./hello.dino");
 
// Load and create the database if does not exist
db.load();

// Create a new sub Tree in the main Tree of the db
let mut data_tree = Tree::new();

// Insert the [data_tree] under the main tree
db.insert_tree("id", data_tree);

Where the key always need to be a String

Implementations

impl Tree[src]

pub fn new() -> Tree[src]

Create a new sub tree

pub fn from(value: &str) -> Tree[src]

Create a new Tree from String value

pub fn insert(&mut self, key: &str, value: &str)[src]

Insert data with String value type in the sub tree

pub fn insert_number(&mut self, key: &str, value: usize)[src]

Insert data with usize value type in the sub tree

pub fn len(&mut self) -> usize[src]

Return the length of items that are in the sub tree

pub fn remove(&mut self, key: &str)[src]

Remove a key in the sub tree in the database with its value

pub fn find(&self, key: &str) -> Result<Value, String>[src]

Find a value in the sub tree in the database

pub fn contains_key(&mut self, key: &str) -> bool[src]

Check if the key exists in the sub tree of the main database

pub fn insert_tree(&mut self, key: &str, value: Tree)[src]

Insert a key with a subtree in the subtree!

Trait Implementations

impl Debug for Tree[src]

impl Display for Tree[src]

impl Display for Tree So we can print the tree to the display

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl Send for Tree

impl Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.