pub struct Index<'coll, 'db: 'coll> { /* fields omitted */ }
A builder for an operation on an index of a certain field of an EJDB collection.
In EJDB every collection can have an index on the fields of its records. Indices can be
of one of three types:
- string (possibly case insensitive);
- number;
- array.
Indices can be set, dropped, optimized or rebuilt. Indices are stored in a separate file
from their collections and can speed up certain access patterns in queries. Naturally,
indices are specified for some field in collection records, so this structure is used to
configure indices for one specific field.
Index manipulation is done with this structure which provides a builder-like interface
to create, change properties or drop an index on one field. Since an index can't exist
separately from a collection, this structure is linked via a lifetime to its corresponding
collection object. An instance of this structure is obtained with Collection::index()
method.
let db = Database::open("/path/to/db").unwrap();
let coll = db.collection("some_collection").unwrap();
coll.index("name").string(true).set().unwrap();
coll.index("coords").number().array().set().unwrap();
Specifies that this index must be built over string values of this field.
case_sensitive
argument determines whether this index must take string case into account,
true
for case sensitive matching, false
for the opposite.
Specifies that this index must be built over numeric values of this field.
Specifies that this index must be built over array values of this field.
Creates one or more indices of specified types on this field.
Panics if no types were specified before calling this method.
Drops all indices on this field.
Drops indices of the previously specified types on this field.
Panics if no type has been set prior to calling this method.
Rebuilds indices of the previously specified types on this field from scratch.
Panics if no type has been set prior to calling this method.
Optimizes indices of the previously specified types on this field.
Panics if no type has been set prior to calling this method.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<T, U> TryInto for T where U: TryFrom<T>, | |
type Err = <U as TryFrom<T>>::Err