lando v0.2.0 Release Notes

Release Date: 2018-11-28 // over 5 years ago
    • 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 a strmap::StrMap type instead of HashMap<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")
    }