pub struct CollectionOptions {
pub large: bool,
pub compressed: bool,
pub records: i64,
pub cached_records: i32,
}
Represents a set of options of an EJDB collection.
Used when new collections are created. It is not possible to change options of a created
collection.
This is a builder object, so you can chain method calls to set various options. Finally,
you can create a collection with these options with get_or_create()
method.
let options = CollectionOptions::default()
.large(true)
.compressed(true)
.records(1_024_000)
.cached_records(1024);
Make the collection "large", i.e. able to hold more than 2GB of data. Default is false.
Compress records in the collection with DEFLATE. Default is false.
Expected number of records in the collection. Default is 128 000.
Maximum number of records cached in memory. Default is 0.
Invokes db.collection_with_options(name, options)
with this object as an argument.
This is a convenience method which allows setting options and creating a collection
in one go. Remember that if collection with the specified name already exists,
it will be returned and options will be ignored.
name
argument can be of any type which is convertible to a vector of bytes, like
string or byte slice.
let db = Database::open("/path/to/db").unwrap();
let coll = CollectionOptions::default()
.large(true).compressed(true)
.records(1_024_000).cached_records(1024)
.get_or_create(&db, "new_collection").unwrap();
Returns the "default value" for a type. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. 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
)
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
Compare self to key
and return true
if they are equal.