Rust bindings for UnQlite library.
As its official site says, UnQlite is
An Embeddable NoSQL Database Engine.
Please see UnQLite C/C++ API Reference for full API documents.
This crate provides several features for UnQlite compile-time options:
UNQLITE_ENABLE_THREADS
enabled.JX9_DISABLE_BUILTIN_FUNC
enabled.JX9_ENABLE_MATH_FUNC
enabled.JX9_DISABLE_DISK_IO
enabled.UNQLITE_ENABLE_JX9_HASH_IO
enabled.To provide the same default behavior as original C does, non of the features
is enabled by default. When you want some features, such as enable-threads,
just config in Cargo.toml
:
toml
[dependencies.unqlite-sys]
version = "0.3.0"
features = [ "enable-threads" ]
For multiple features just add them in toml features
array.
Note that even "enable-threads" is featured in your crate, it's not meant that your code is threadsafe.
When UnQLite has been compiled with threading support then the threading mode can be altered at run-time using the unqlitelibconfig() interface together with one of these verbs:
UNQLITELIBCONFIGTHREADLEVEL_SINGLE
UNQLITELIBCONFIGTHREADLEVEL_MULTI
Platforms others than Windows and UNIX systems must install their own mutex subsystem via unqlitelibconfig() with a configuration verb set to UNQLITELIBCONFIGUSERMUTEX. Otherwise the library is not threadsafe.
Note that you must link UnQLite with the POSIX threads library under UNIX systems (i.e: -lpthread).
To use in multithread cases, that is threadsafe, you may use like this:
```rust extern crate unqlite_sys as ffi; use ffi::constants as ffic;
fn main() { unsafe { ffi::unqlitelibconfig(ffic::UNQLITELIBCONFIGTHREADLEVELMULTI); ffi::unqlitelibinit(); asserteq!(ffi::unqlitelibis_threadsafe(), 1);
// do stuff ...
}
} ```