4个版本

使用旧的Rust 2015

0.1.3 2018年6月30日
0.1.2 2018年6月30日
0.1.1 2018年6月30日
0.1.0 2018年6月30日

#79 in #serverless

MIT/Apache

12KB
160

kubeless-rs

Crates.io Crates.io

用于编写Kubeless函数的Rust库。

示例

#[macro_use]
extern crate kubeless;

fn say_hello(event: kubeless::Event, ctx: kubeless::Context) -> String {
    match event.data {
        Some(name) => format!("Hello, {}", String::from_utf8_lossy(&name)),
        None => String::from("Hello"),
    }
}

fn say_goodbye(event: kubeless::Event, ctx: kubeless::Context) -> String {
    match event.data {
        Some(name) => format!("Goodbye, {}", String::from_utf8_lossy(&name)),
        None => String::from("Goodbye"),
    }
}

fn main() {
    kubeless::start(select_function!(say_hello, say_goodbye));
}

lib.rs:

用于编写Kubeless函数的库

#[macro_use]
extern crate kubeless;

fn say_hello(event: kubeless::Event, ctx: kubeless::Context) -> String {
    String::from("Hello")
}

fn say_goodbye(event: kubeless::Event, ctx: kubeless::Context) -> String {
    String::from("Goodbye")
}

fn main() {
    // Expose say_hello and say_goodbye to Kubeless
    kubeless::start(select_function!(say_hello, say_goodbye));
}

依赖项

~28MB
~526K SLoC