The YottaDB Rust wrapper requires a minimum YottaDB version of r1.30 and is tested with a minimum Rust version of 1.40.
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 three major APIs that are part of the Rust wrapper:
craw, the FFI bindings generated directly by bindgen. Not recommended for normal use.
simple_api, a wrapper around the
crawAPI which handles resizing buffers and various other recoverable errors.
context_api, which is wrapper around the
simple_apithat stores the current tptoken and error buffer so you don’t have to keep a track of them yourself.
context_api is recommended for normal use, but the others are available if your needs are more specialized.
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