| Crates.io | rsmgp-sys |
| lib.rs | rsmgp-sys |
| version | 1.0.0 |
| created_at | 2021-06-06 17:07:33.463662+00 |
| updated_at | 2021-06-16 18:30:40.970919+00 |
| description | Library to develop query modules for Memgraph in Rust. |
| homepage | https://memgraph.com |
| repository | https://github.com/memgraph/mage |
| max_upload_size | |
| id | 406947 |
| size | 149,800 |
rsmgp-sys stands for Rust Memgraph Procedures "system" library to develop
query modules for Memgraph in Rust.
Adding a new Rust Memgraph query module is simple, just add the following to
your Cargo.toml project file.
[dependencies]
c_str_macro = "1.0.2"
rsmgp-sys = "^0.1.0"
[lib]
name = "query_module_name"
crate-type = ["cdylib"]
In the module/procedure code, it's preferred to use Edge, List, Map,
Memgraph, Path, Property, Value, Vertex structures. Structures
prefixed by Mgp are there to be a bridge between the procedure code and
Memgraph. Mgp prefixed structures should be used to return data to Memgraph
/ client. Underlying pointers prefixed by mgp_ are exposed but shouldn't be
directly manipulated in the procedure call. The whole point of this library is
to hide that complexity as much as possible.
Memgraph Rust Query Modules API uses
CStr (&CStr) becuase
that's the most compatible type between Rust and Memgraph engine. Rust
String can validly
contain a null-byte in the middle of the string (0 is a valid Unicode
codepoint). This means that not all Rust strings can actually be translated to
C strings. While interacting with the rsmgp API, built-in CStr or
c_str library should be used because Memgraph query
modules API only provides C strings.