25 releases (10 breaking)

0.11.0 Nov 12, 2019
0.10.0 Jul 15, 2019
0.9.0 Jun 11, 2019
0.6.0 Mar 19, 2019
0.1.5 Jul 28, 2018

#15 in #service-bus

21 downloads per month

MIT license

705KB
16K SLoC

Azure Functions for Rust

The Azure Functions for Rust crate supports creating Azure Functions with Rust.

The following Azure Functions trigger bindings are supported:

The following Azure Functions input bindings are supported:

The following Azure Functions output bindings are supported:

Eventually more bindings will be implemented, including custom binding data.

Example

Start by installing the Azure Functions for Rust SDK:

$ cargo install azure-functions-sdk

Create a new Azure Functions for Rust application:

$ cargo func new-app hello && cd hello

Create a HTTP-triggered function:

$ cargo func new http -n hello

This generates src/functions/hello.rs with the following contents:

use azure_functions::{
    bindings::{HttpRequest, HttpResponse},
    func,
};

#[func]
pub fn hello(req: HttpRequest) -> HttpResponse {
    "Hello from Rust!".into()
}

Azure Functions are implemented by applying a #[func] attribute to a Rust function.

Run the application with cargo func run:

$ cargo func run

The above Azure Function can be invoked with http://localhost:8080/api/hello.

The expected response would be Hello from Rust!.

Dependencies

~21–32MB
~534K SLoC