Rust set-up
Set up a Rust project
Use the following command to initialize a Rust project in an empty directory:
cargo init
Two files will be created, Cargo.toml
and src/main.rs
.
Add dependencies
-
Add required dependencies to the
Cargo.toml
file in your Rust project. You’ll need at leaststargate-grpc
and an async framework, such as tokio:[dependencies] stargate-grpc = "0.3" tokio = { version = "1", features = ["full"]}
-
Build the project with
cargo build
and fetch and compile the dependencies. -
Add the following line to the includes in the source code of your app, such as
main.rs
:use stargate_grpc::*;
This set-up will make all the Stargate gRPC functionality available.
The next sections explain the parts of a script to use the Stargate functionality. A full working script is included below.