25 releases (14 breaking)

0.16.0-rc.3 Nov 25, 2024
0.16.0-rc.1 Aug 20, 2024
0.14.0 Mar 6, 2024
0.13.0 Oct 13, 2023
0.1.0-alpha.2 Oct 29, 2019

#103 in Network programming

Download history 1530/week @ 2024-08-21 971/week @ 2024-08-28 742/week @ 2024-09-04 600/week @ 2024-09-11 1197/week @ 2024-09-18 1061/week @ 2024-09-25 359/week @ 2024-10-02 505/week @ 2024-10-09 531/week @ 2024-10-16 382/week @ 2024-10-23 597/week @ 2024-10-30 868/week @ 2024-11-06 860/week @ 2024-11-13 743/week @ 2024-11-20 623/week @ 2024-11-27 830/week @ 2024-12-04

3,142 downloads per month
Used in drasi-source-sdk

Apache-2.0

475KB
10K SLoC

Dapr SDK for Rust (Alpha)

Crates.io Build Status discord License: Apache 2.0 FOSSA Status

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

Alpha

This SDK is currently in Alpha. Work is underway to bring forward a stable release and will likely involve breaking changes.

  • Documentation is incomplete.
  • Not all building blocks are currently implemented.
  • There may be bugs.
  • The SDK does not have complete test coverage.

The maintainers commit to resolving any issues that arise and bringing this SDK to a stable release. With this in mind, the SDK will follow the norms and conventions of a stable SDK so far as is possible.

This SDK will be accounted for as a part of the release process. Support for the latest runtime release is targeted but not guaranteed.

The main tenet of development will be stability and functionality that improves resiliency.

Prerequisites

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

These crates no longer require protoc unless to recompile the protobuf files.

How to use

Add the following to your Cargo.toml file:

[dependencies]
dapr = "0.16.0-rc.3"

Here's a basic example to create a client:

use dapr;

#[tokio::main]
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

Developing (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.14.0

You will also need to install protoc.

Protos can then be compiled using:

cargo run proto-gen

Contact Us

Reach out with any questions you may have and we'll be sure to answer them as soon as possible!

Discord Banner

Dependencies

~8–15MB
~180K SLoC