Libraries and tools to build and use the libcsp C library in your Rust project
.cargo | ||
examples | ||
lib | ||
libcsp-cargo-build | ||
libcsp-rust | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE-APACHE | ||
NOTICE | ||
README.md |
libcsp-rust
This project aims to provide libraries and tools to use
libcsp
in your Rust project.
It provides 2 crates for this:
- [
libcsp-cargo-build
] provides an API to build thelibcsp
usingcargo
with thecc
crate. - [
libcsp-rust
] provides the Rust bindings tolibcsp
and a safe and ergonomic Rust interface.
In addition, it provides a workspace to allow updating the libcsp
and the corresponding bindings
more easily inside the lib
directory. Some of the examples libcsp
provides were ported to Rust
and are showcases in the examples
directory.
Getting started
We assume that cargo should also take care of building the library.
- Add the
libcsp-cargo-build
as a build dependency inside yourCargo.toml
. - Add the
libcsp-rust
as a regular dependency inside yourCargo.toml
. - Create a custom
build.rs
script which takes care of buildinglibcsp
using the API provided bylibcsp-cargo-build
. You have to provide the source code forlibcsp
inside some directory and pass that director to a builder API. - You can now write regular Rust code and use the API provided by
libcsp-rust
to uselibcsp
in a safe and Rusty way.
It is recommended to have a look at the example build script which should give you a general
idea of how a build script might look like to integrate libcsp
.