Apache OpenWhisk Runtime Rust supports Apache OpenWhisk functions written in Rust

Clone this repo:
  1. 3fdec10 Add missing licenses. (#24) by rodric rabbah · 5 months ago master rust1.34@1.0.0
  2. bdbdee5 fix yet another file with incorrect execute mode (#23) by David Grove · 5 months ago
  3. 3047f7b misc pre-release cleanups (#22) by David Grove · 5 months ago
  4. b43cf42 update publish.sh for core subdir (missed in PR#20) (#21) by David Grove · 5 months ago
  5. e9f97f9 release prep (#20) by David Grove · 5 months ago

Apache OpenWhisk Runtime for Rust

License Build Status

Give it a try today

To use as a Docker action:

wsk action update myAction my_action.rs --docker openwhisk/action-rust-v1.34

The file my_action.rs looks like:

extern crate serde_json;

use serde_derive::{Deserialize, Serialize};
use serde_json::{Error, Value};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Input {
    #[serde(default = "stranger")]
    name: String,

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Output {
    body: String,

fn stranger() -> String {

pub fn main(args: Value) -> Result<Value, Error> {
    let input: Input = serde_json::from_value(args)?;
    let output = Output {
        body: format!("Hello, {}", input.name),

The action is mainly composed by a main function that accepts a JSON serdes Value as input and returns a Result including a JSON serde Value.

Managing dependencies

If your action needs external dependencies, you need to provide a zip file including your source and your cargo file with all your dependencies. The folder structure is the following:

|- Cargo.toml
|- src
    |- lib.rs

Here is an example of a Cargo.toml file

name = "actions"
version = "0.1.0"
authors = ["John Doe <john@doe.domain>"]
edition = "2018"

serde_json = "1.0"
serde = "1.0"
serde_derive = "1.0"

Once you have all your code zipped in a file with the showed folder structure you can generate your action with the following command:

wsk action create yourAction /full_path_to/yourCode.zip --docker openwhisk/action-rust-v1.34