The YottaDB Rust wrapper requires a minimum YottaDB version of r1.30 and is tested with a minimum Rust version of 1.40.
Follow the instructions in the Quick Start section to install YottaDB.
The next step is to install Rust. Follow the instructions provided here to get setup with Rust on your system.
Clone the YDBRust repository and run an example.
git clone https://gitlab.com/YottaDB/Lang/YDBRust/ cd YDBRust cargo run --example say_hello_rust
There are two major APIs that are part of the Rust wrapper:
craw, the FFI bindings generated directly by bindgen. These are not recommended for normal use, but are available in case functionality is needed beyond that provided by the Context API.
The main Context API, which is a safe wrapper around the C API which keeps track of the current tptoken and an error buffer. The reason this metadata is necessary is because this crate binds to the threaded version of YottaDB, which requires a
err_buffer. See transaction processing for more details on
Most operations are encapsulated in methods in the KeyContext struct. Iteration helpers are available to iterate over values in the database in a variety of ways.
Rust has almost no overhead calling into C. There is no reallocation of buffers as with Go.
Rust has a context API, not an easy API. The difference is that buffers are re-used between calls so it’s not constantly allocating and deallocating like the Go Easy API does, nor does it require passing in the tptoken and error buffer like the Go Simple API.
Rust can pass numbers into M FFI, not just