17 releases (11 breaking)

0.13.0 Oct 13, 2023
0.12.0 Jun 12, 2023
0.11.0 Feb 22, 2023
0.10.0 Oct 19, 2022
0.1.0-alpha.2 Oct 29, 2019

#334 in Development tools

Download history 379/week @ 2023-11-07 421/week @ 2023-11-14 391/week @ 2023-11-21 449/week @ 2023-11-28 343/week @ 2023-12-05 299/week @ 2023-12-12 250/week @ 2023-12-19 138/week @ 2023-12-26 330/week @ 2024-01-02 332/week @ 2024-01-09 611/week @ 2024-01-16 547/week @ 2024-01-23 686/week @ 2024-01-30 652/week @ 2024-02-06 560/week @ 2024-02-13 703/week @ 2024-02-20

2,722 downloads per month

Custom license

38KB
438 lines

Dapr SDK for Rust

Crates.io Build Status License: Apache 2.0 FOSSA Status

⚠ Work in Progress ⚠

Dapr is a portable, event-driven, serverless runtime for building distributed applications across cloud and edge.

Prerequisites

Ensure you have Rust version 1.40 or higher installed. If not, install Rust here.

How to use

Add the following to your Cargo.toml file:

[dependencies]
dapr = "0.13.0"

Here's a basic example to create a client:

use dapr;

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Get the Dapr port and create a connection
    let port: u16 = std::env::var("DAPR_GRPC_PORT")?.parse()?;
    let addr = format!("https://127.0.0.1:{}", port);

    // Create the client
    let mut client = dapr::Client::<dapr::client::TonicClient>::connect(addr).await?;

Explore more examples

Browse through more examples to understand the SDK better: View examples

Building

To build the SDK run:

cargo build

Note: The protobuf client generation is built into cargo build process so updating the proto files under dapr/ is enough to update the protobuf client.

Updating .proto files from upstream Dapr

To fetch the latest .proto files from Dapr execute the script update-protos.sh:

./update-protos.sh

By default, the script fetches the latest proto updates from the master branch of the Dapr repository. If you need to choose a specific release or version, use the -v flag:

./update-protos.sh -v v1.12.0

Dependencies

~8MB
~144K SLoC