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.
Examples
Start by creating a new binary package:
Edit Cargo.toml
to include the following dependencies:
= "0.2.6"
= "0.4.2"
Azure Functions are implemented by applying a #[func]
attribute to a Rust function.
For example, let's create src/greet.rs
that implements a HTTP triggered function:
# extern crate azure_functions;
# extern crate log;
use func;
use ;
Replace the contents of src/main.rs
with the following to export the function to
the Azure Functions Host:
extern crate log;
extern crate azure_functions;
Initialize the application with the init
command, where $AzureWebJobsScriptRoot
is
the desired Azure Functions script root directory:
Run the Azure Functions Host:
The above Azure Function can be invoked with http://localhost:5000/api/greet?name=John
.
The expected response would be Hello from Rust, John!
.