- fix version referenced in docs
- ease dependency declartions by re-exporting
http
crate
before
... in your Cargo.toml
file
[dependencies]
lando = "0.1"
http = "0.1" # need to depend on http crate explicitly
... in your src/lib.rs
#[macro_use]
extern crate lando;
// need to extern http crate explicitly
extern crate http;
use http::{Method, StatusCode};
after
... in your Cargo.toml
[dependencies]
lando = "0.2" # no longer need to add a dependency on http explicitly
... in your src/lib.rs
#[macro_use]
extern crate lando;
// consume http re-export from lando crate
use lando::http::{Method, StatusCode};
- remove the need to explicitly declare cpython as a dependency, both as a depenency and macro_use
before
... in your Cargo.toml
file
[dependencies]
lando = "0.1"
cpython = "0.1" # need to depend on cpython crate explicitly for its macros
... in your src/lib.rs
file
#[macro_use]
extern crate lando;
// needed because lando's macros used cpython macros,
// an impl detail
#[macro_use]
extern crate cpython;
after
... in your Cargo.toml
file
[dependencies]
lando = "0.2" # no longer need to declar cpython as an explicit dependency
... in your src/lib.rs
file
#[macro_use]
extern crate lando; // impl details are hidden
- reduced exposed surface area of internal interfaces
lando::GatewayRequest
still is still public (for benchmarking) but its fields are not
- reduced cost of transformations between lambda proxy types and rust native
http
crate types
Replaced many owned String
types with Cow
. Now deserializing and serializing request headers and http method directly to http::HeaderMap
and http::Method
respectively
RequestExt
methods now return astrmap::StrMap
type instead ofHashMap<String, String>
- introducing
IntoResponse
trait
Handlers can now return anything that implements lando::IntoResponse
. As a result lando::Result
type now takes a type parameter as a placeholder those types. Implementations for lando::Response
and types that implement Into<Body>
are provided
- introducing
#[lando]
proc macro.
You can now attribute a bare function with #[lando]
to have it exported
use lando::{Request, LambdaContext, Result};
#[lando]
fn handler<'a>(_: Request, _: LambdaContext) -> Result<&'a str> {
Ok("hello lando")
}
- bug fix - support for reading host from "host" (lowercase) in addition to "Host"
- feature - add support for "application/x-www-form-urlencoded" and "application/json"
parsed request bodies with
lando::RequestExt#payload()
#[macro_use] extern crate cpython;
#[macro_use] extern crate lando;
#[macro_use] extern crate serde_deserialize;
use lando::{Response, RequestEx};
#[derive(Deserialize, Debug)]
struct Params {
x: usize,
y: usize
}
gateway!(
|req, _| => Ok(
Response::new(
req.payload::<Params>().unwrap_or_else(|_| None).map(
|params| format!(
"the answer is {}", params.x + params.y
)
).unwrap_or_else(
|| "try again".to_string()
)
)
)
);
- initial release