Struct json_db::JsonDB

source ·
pub struct JsonDB { /* private fields */ }
Expand description

Database struct (does not use ::new instead uses ::init)

Examples

let db = JsonDB::init("your db name")?;

Note:

Does not handle errors in version “0.1.0” just passes on to user

Implementations§

Init function (takes the place of ::new)

Examples
let db = JsonDB::init("your db name")?;

Creates a new collection either in your database or in another collection

Examples
db.create_collection("your collection path")?;

Writes (or rewrites) data to document in collection

Examples
db.write("your collection path", "your document", "struct that derives serde::serialize")?;

Reads data from document in collection

let data: impl serde::Deserialize = db.read("your collection path", "your document")?;

Deletes document in collection

Examples
db.delete("your collection path", "your document")?;

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.