[−][src]Struct indexer::Index
Fields
indexer: Indexer
Implementations
impl Index
[src]
impl<'a> Index
[src]
pub fn new(indexer: Indexer) -> Self
[src]
Creates a new Index
Example
use indexer::{Indexer, IndexString, IndexOrd}; let string_indexer = Indexer::String(IndexString { ordering: IndexOrd::ASC });
pub fn insert<V>(&mut self, key: &str, value: V) where
V: Serialize + Deserialize<'a>,
[src]
V: Serialize + Deserialize<'a>,
Inserts a new entry or overrides a previous entry in the index
pub fn remove(&mut self, k: &str)
[src]
Removes an entry from the index
pub fn batch(&mut self, f: impl Fn(&mut Batch<'_>) + Sync + Send)
[src]
Batch transaction on the index. you can insert/update/delete multiple entries with one operation by commit the operation with b.commit()
Example
use indexer::{Index, BatchTransaction}; use serde_json::Value; let mut names_index = Index::new(string_indexer); names_index.batch(|b| { b.delete("user.4"); b.insert("user.1", "Kwadwo".to_string()); b.insert("user.2", Value::String("Kwame".to_string())); b.update("user.3", Value::String("Joseph".to_string())); b.commit() });
pub fn get_all_items(&self, f: impl Fn((&String, &Value)) + Sync + Send)
[src]
pub fn par_get_all_items(&self, f: impl Fn((&String, &Value)) + Sync + Send)
[src]
pub fn find_where<V>(&self, field: &str, op: Op, value: V) -> QueryResult where
V: Serialize + Deserialize<'a>,
[src]
V: Serialize + Deserialize<'a>,
Query on an index. by using conditional operators
eq
Equalslt
Less thangt
Greater thanlike
Check for match using Glob style pattern matching
Example
let query = students_index.find_where("state", Op::EQ, "CA"); println!("Find all students in CA: {:?}", query());
pub fn count(&self) -> usize
[src]
👎 Deprecated since 0.2.5:
Please use the size() instead
pub fn size(&self) -> usize
[src]
pub fn get_items(&self) -> Vec<(String, Value)>
[src]
Trait Implementations
impl Clone for Index
[src]
impl<'de> Deserialize<'de> for Index
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Index
[src]
Auto Trait Implementations
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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>,