[−][src]Struct keratin::Collection
Represents a collection of documents.
It is the main API for data managment for Keratin.
Implementations
impl Collection
[src]
pub fn get(&mut self, k: &str) -> Option<&Entry>
[src]
Returns an entry of the database given the respective key, or None
if the key
corresponds to no known entries
pub fn insert(&mut self, key: &str, entry: &str) -> Result<(), Errors>
[src]
pub fn delete(&mut self, query: &str) -> Result<(), Errors>
[src]
Delete a entry in the database given the key.
This deletes from both the cache and non-volatile storage.
Note
In the future this will use a query string to find what multiple elements to delete
Return
Returns an Error EntryNotFound
if the key does not match any entry
pub fn modify(&mut self, key: &str, new_entry: &str) -> Result<(), Errors>
[src]
pub fn new(self, truncate: bool) -> Result<Collection, Errors>
[src]
A function to create a new Keratin db from scratch for a fast setup.
The config file keratin.toml is created with the default options. If it already exists, the config file.
Arguments
Truncate: if it is TRUE, this function wipes every document in db/data/
along with
truncating the mapped keys file.
Panics
This fuction uses the enviroment variable CARGO_MANIFEST_DIR
, so this will only work
when running your project using cargo
, else it will panic.
If you're using planning in using Keratin in production use configure()
instead
pub fn configure(path: Option<&str>) -> Collection
[src]
A function to initialize the collection using the path of a configuration file
Arguments
path
- An Option with a Path. If this is None, Keratin will use the default config file path (eg.db/keratin.toml
)
Attention
USE ONLY ABSOLUTE PATHS!!!
Use of the None
Option is unstable
Errors
This returns an error if the config file is not found OR if the folder doesn't have the right permitions
pub fn cache_entries(&mut self)
[src]
Trait Implementations
impl Clone for Collection
[src]
pub fn clone(&self) -> Collection
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Collection
[src]
Auto Trait Implementations
impl RefUnwindSafe for Collection
[src]
impl Send for Collection
[src]
impl Sync for Collection
[src]
impl Unpin for Collection
[src]
impl UnwindSafe for Collection
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,