6 releases

0.3.2 Dec 5, 2024
0.3.1 Dec 5, 2024
0.3.0 Sep 10, 2024
0.2.1 Aug 22, 2024
0.1.0-alpha.0 Jul 16, 2024

#284 in Asynchronous

Download history 18/week @ 2024-08-26 8/week @ 2024-09-02 158/week @ 2024-09-09 27/week @ 2024-09-16 5/week @ 2024-09-23 17/week @ 2024-09-30 12/week @ 2024-10-07 4/week @ 2024-10-14 74/week @ 2024-10-21 31/week @ 2024-10-28 59/week @ 2024-11-04 92/week @ 2024-11-11 136/week @ 2024-11-18 110/week @ 2024-11-25 341/week @ 2024-12-02 100/week @ 2024-12-09

688 downloads per month

MIT license

155KB
2.5K SLoC

Documentation crates.io Examples Discord Twitter

Restate Rust SDK

Restate is a system for easily building resilient applications using distributed durable async/await. This repository contains the Restate SDK for writing services using Rust.

Community

Using the SDK

Add Restate and Tokio as dependencies:

[dependencies]
restate-sdk = "0.1"
tokio = { version = "1", features = ["full"] }

Then you're ready to develop your Restate service using Rust:

use restate_sdk::prelude::*;

#[restate_sdk::service]
trait Greeter {
    async fn greet(name: String) -> HandlerResult<String>;
}

struct GreeterImpl;

impl Greeter for GreeterImpl {
    async fn greet(&self, _: Context<'_>, name: String) -> HandlerResult<String> {
        Ok(format!("Greetings {name}"))
    }
}

#[tokio::main]
async fn main() {
    // To enable logging/tracing
    // tracing_subscriber::fmt::init();
    HttpServer::new(
        Endpoint::builder()
            .with_service(GreeterImpl.serve())
            .build(),
    )
    .listen_and_serve("0.0.0.0:9080".parse().unwrap())
    .await;
}

Logging

The SDK uses tokio's tracing crate to generate logs. Just configure it as usual through tracing_subscriber to get your logs.

Versions

The Rust SDK is currently in active development, and might break across releases.

The compatibility with Restate is described in the following table:

Restate Server\sdk-rust 0.0/0.1/0.2 0.3
1.0 βœ… ❌
1.1 βœ… βœ…

Contributing

We’re excited if you join the Restate community and start contributing! Whether it is feature requests, bug reports, ideas & feedback or PRs, we appreciate any and all contributions. We know that your time is precious and, therefore, deeply value any effort to contribute!

Building the SDK locally

Prerequisites:

To build and test the SDK:

just verify

Releasing

You need the Rust toolchain. To verify:

just verify

To release we use cargo-release:

cargo release <VERSION> --exclude test-services --workspace

Dependencies

~14–25MB
~470K SLoC