4 releases
Uses old Rust 2015
0.1.3 | Jun 30, 2018 |
---|---|
0.1.2 | Jun 30, 2018 |
0.1.1 | Jun 30, 2018 |
0.1.0 | Jun 30, 2018 |
#78 in #serverless
12KB
160 lines
kubeless-rs
A Rust Library for Writing Kubeless Functions.
Example
#[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
:
A Library for Writing Kubeless Functions
#[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));
}
Dependencies
~29MB
~526K SLoC