diff --git a/Cargo.lock b/Cargo.lock index 62e432ab..7a444286 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,33 +23,21 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" - -[[package]] -name = "bytes" -version = "0.5.4" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "bytes" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72" - -[[package]] -name = "cfg-if" -version = "0.1.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] name = "cfg-if" @@ -59,21 +47,31 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "dtoa" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" +checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" [[package]] name = "fnv" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] [[package]] name = "futures" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" dependencies = [ "futures-channel", "futures-core", @@ -86,9 +84,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", "futures-sink", @@ -96,15 +94,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-executor" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -113,15 +111,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" [[package]] name = "futures-macro" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -131,21 +129,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" +dependencies = [ + "once_cell", +] [[package]] name = "futures-util" -version = "0.3.1" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-channel", "futures-core", @@ -154,6 +155,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -162,20 +164,20 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] [[package]] name = "http" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" +checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" dependencies = [ - "bytes 0.5.4", + "bytes", "fnv", "itoa", ] @@ -186,7 +188,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" dependencies = [ - "bytes 1.0.0", + "bytes", "http", ] @@ -208,7 +210,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12219dc884514cb4a6a03737f4413c0e01c23a1b059b0156004b23f1e19dccbe" dependencies = [ - "bytes 1.0.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -217,7 +219,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.3", + "pin-project 1.0.4", "socket2", "tokio", "tower-service", @@ -238,20 +240,19 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "lambda" version = "0.1.0" dependencies = [ "async-stream", - "bytes 1.0.0", + "bytes", "futures", "http", "hyper", - "lambda-attributes", "serde", "serde_json", "tokio", @@ -260,15 +261,6 @@ dependencies = [ "tracing-futures", ] -[[package]] -name = "lambda-attributes" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "lambda_http" version = "0.2.0-beta.1" @@ -276,7 +268,6 @@ dependencies = [ "base64", "http", "lambda", - "lambda-attributes", "log", "maplit", "serde", @@ -294,17 +285,17 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.81" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" +checksum = "1cca32fa0182e8c0989459524dc356b8f2b5c10f1b9eb521b7d182c03cf8c5ff" [[package]] name = "log" -version = "0.4.8" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -321,9 +312,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.3.0" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "mio" @@ -350,9 +341,9 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ "winapi", ] @@ -367,6 +358,12 @@ dependencies = [ "libc", ] +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + [[package]] name = "percent-encoding" version = "2.1.0" @@ -375,27 +372,27 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.8" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" dependencies = [ - "pin-project-internal 0.4.8", + "pin-project-internal 0.4.27", ] [[package]] name = "pin-project" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a83804639aad6ba65345661744708855f9fbcb71176ea8d28d05aeb11d975e7" +checksum = "95b70b68509f17aa2857863b6fa00bf21fc93674c7a8893de2f469f6aa7ca2f2" dependencies = [ - "pin-project-internal 1.0.3", + "pin-project-internal 1.0.4", ] [[package]] name = "pin-project-internal" -version = "0.4.8" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" dependencies = [ "proc-macro2", "quote", @@ -404,9 +401,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7bcc46b8f73443d15bc1c5fecbb315718491fa9187fa483f0e359323cde8b3a" +checksum = "caa25a6393f22ce819b0f50e0be89287292fda8d425be38ee0ca14c4931d9e71" dependencies = [ "proc-macro2", "quote", @@ -415,32 +412,27 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36743d754ccdf9954c2e352ce2d4b106e024c814f6499c2dadff80da9a442d8" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" -version = "0.1.0-alpha.4" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro-hack" -version = "0.5.11" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.3" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" @@ -453,33 +445,33 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.2" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ "proc-macro2", ] [[package]] name = "ryu" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "serde" -version = "1.0.104" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.104" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", @@ -488,9 +480,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.45" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" +checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" dependencies = [ "itoa", "ryu", @@ -511,9 +503,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.0.9" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" dependencies = [ "lazy_static", ] @@ -524,42 +516,60 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -[[package]] -name = "smallvec" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" - [[package]] name = "socket2" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "winapi", ] [[package]] name = "syn" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] +[[package]] +name = "thread_local" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tinyvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + [[package]] name = "tokio" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd" +checksum = "8efab2086f17abcddb8f756117665c958feee6b2e39974c2f1600592ab3a4195" dependencies = [ "autocfg", - "bytes 1.0.0", + "bytes", "libc", "memchr", "mio", @@ -581,36 +591,38 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.13" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" +checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", + "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.7" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" +checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" dependencies = [ + "proc-macro2", "quote", "syn", ] [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" dependencies = [ "lazy_static", ] @@ -631,25 +643,26 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" dependencies = [ - "pin-project 0.4.8", + "pin-project 0.4.27", "tracing", ] [[package]] name = "tracing-subscriber" -version = "0.2.5" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" dependencies = [ "sharded-slab", + "thread_local", "tracing-core", ] [[package]] name = "try-lock" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "unicode-bidi" @@ -662,25 +675,26 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.12" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" dependencies = [ - "smallvec", + "tinyvec", ] [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "url" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ + "form_urlencoded", "idna", "matches", "percent-encoding", @@ -698,9 +712,9 @@ dependencies = [ [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", diff --git a/Cargo.toml b/Cargo.toml index 7942bf40..4c4ad33d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,5 @@ [workspace] members = [ "lambda", - "lambda-attributes", "lambda-http" ] \ No newline at end of file diff --git a/lambda-attributes/Cargo.toml b/lambda-attributes/Cargo.toml deleted file mode 100644 index 26bc2365..00000000 --- a/lambda-attributes/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "lambda-attributes" -version = "0.1.0" -authors = ["David Barsky "] -edition = "2018" -license = "Apache-2.0" - -[lib] -proc-macro = true - -[dependencies] -proc-macro2 = "1.0" -syn = { version = "1.0.5", features = ["full"] } -quote = "1" diff --git a/lambda-attributes/src/lib.rs b/lambda-attributes/src/lib.rs deleted file mode 100644 index a17fdfad..00000000 --- a/lambda-attributes/src/lib.rs +++ /dev/null @@ -1,98 +0,0 @@ -extern crate proc_macro; - -use proc_macro::TokenStream; -use quote::quote_spanned; -use syn::{spanned::Spanned, AttributeArgs, FnArg, ItemFn, Meta, NestedMeta}; - -/// Return true if attribute macro args declares http flavor in the form `#[lambda(http)]` -fn is_http(args: &AttributeArgs) -> bool { - args.iter().any(|arg| match arg { - NestedMeta::Meta(Meta::Path(path)) => path.is_ident("http"), - _ => false, - }) -} - -#[proc_macro_attribute] -pub fn lambda(attr: TokenStream, item: TokenStream) -> TokenStream { - let input = syn::parse_macro_input!(item as ItemFn); - let args = syn::parse_macro_input!(attr as AttributeArgs); - let ret = &input.sig.output; - let name = &input.sig.ident; - let body = &input.block; - let attrs = &input.attrs; - let asyncness = &input.sig.asyncness; - let inputs = &input.sig.inputs; - - if name != "main" { - let tokens = quote_spanned! { name.span() => - compile_error!("only the main function can be tagged with #[lambda]"); - }; - return TokenStream::from(tokens); - } - - if asyncness.is_none() { - let tokens = quote_spanned! { input.span() => - compile_error!("the async keyword is missing from the function declaration"); - }; - return TokenStream::from(tokens); - } - - let result = match inputs.len() { - 2 => { - let event = match inputs.first().expect("expected event argument") { - FnArg::Typed(arg) => arg, - _ => { - let tokens = quote_spanned! { inputs.span() => - compile_error!("fn main's first argument must be fully formed"); - }; - return TokenStream::from(tokens); - } - }; - let event_name = &event.pat; - let event_type = &event.ty; - let context = match inputs.iter().nth(1).expect("expected context argument") { - FnArg::Typed(arg) => arg, - _ => { - let tokens = quote_spanned! { inputs.span() => - compile_error!("fn main's second argument must be fully formed"); - }; - return TokenStream::from(tokens); - } - }; - let context_name = &context.pat; - let context_type = &context.ty; - - if is_http(&args) { - quote_spanned! { input.span() => - - #(#attrs)* - #asyncness fn main() { - async fn actual(#event_name: #event_type, #context_name: #context_type) #ret #body - - let f = lambda_http::handler(actual); - lambda_http::lambda::run(f).await.unwrap(); - } - } - } else { - quote_spanned! { input.span() => - - #(#attrs)* - #asyncness fn main() { - async fn actual(#event_name: #event_type, #context_name: #context_type) #ret #body - - let f = lambda::handler_fn(actual); - lambda::run(f).await.unwrap(); - } - } - } - } - _ => { - let tokens = quote_spanned! { inputs.span() => - compile_error!("The #[lambda] macro can expects two arguments: a triggered event and lambda context."); - }; - return TokenStream::from(tokens); - } - }; - - result.into() -} diff --git a/lambda-http/Cargo.toml b/lambda-http/Cargo.toml index f0cfa6b7..4abbc02c 100644 --- a/lambda-http/Cargo.toml +++ b/lambda-http/Cargo.toml @@ -19,7 +19,6 @@ maintenance = { status = "actively-developed" } base64 = "0.12" http = "0.2" lambda = { path = "../lambda", version = "0.1" } -lambda-attributes = { path = "../lambda-attributes", version = "0.1" } serde = "^1" serde_derive = "^1" serde_json = "^1" diff --git a/lambda-http/examples/hello-http-without-macros.rs b/lambda-http/examples/hello-http-without-macros.rs deleted file mode 100644 index 0a609651..00000000 --- a/lambda-http/examples/hello-http-without-macros.rs +++ /dev/null @@ -1,23 +0,0 @@ -use lambda_http::{ - handler, - lambda::{self, Context}, - IntoResponse, Request, RequestExt, Response, -}; - -type Error = Box; - -#[tokio::main] -async fn main() -> Result<(), Error> { - lambda::run(handler(func)).await?; - Ok(()) -} - -async fn func(event: Request, _: Context) -> Result { - Ok(match event.query_string_parameters().get("first_name") { - Some(first_name) => format!("Hello, {}!", first_name).into_response(), - _ => Response::builder() - .status(400) - .body("Empty first name".into()) - .expect("failed to render response"), - }) -} diff --git a/lambda-http/examples/hello-http.rs b/lambda-http/examples/hello-http.rs index f8fa1f16..0a609651 100644 --- a/lambda-http/examples/hello-http.rs +++ b/lambda-http/examples/hello-http.rs @@ -1,12 +1,23 @@ use lambda_http::{ - lambda::{lambda, Context}, - IntoResponse, Request, + handler, + lambda::{self, Context}, + IntoResponse, Request, RequestExt, Response, }; type Error = Box; -#[lambda(http)] #[tokio::main] -async fn main(_: Request, _: Context) -> Result { - Ok("👋 world") +async fn main() -> Result<(), Error> { + lambda::run(handler(func)).await?; + Ok(()) +} + +async fn func(event: Request, _: Context) -> Result { + Ok(match event.query_string_parameters().get("first_name") { + Some(first_name) => format!("Hello, {}!", first_name).into_response(), + _ => Response::builder() + .status(400) + .body("Empty first name".into()) + .expect("failed to render response"), + }) } diff --git a/lambda-http/src/lib.rs b/lambda-http/src/lib.rs index f26fa351..80796e10 100644 --- a/lambda-http/src/lib.rs +++ b/lambda-http/src/lib.rs @@ -11,33 +11,10 @@ //! //! ## Hello World //! -//! `lambda_http` handlers adapt to the standard `lambda::Handler` interface using the [`handler`](fn.handler.html) function. -//! -//! The simplest case of an http handler is a function of an `http::Request` to a type that can be lifted into an `http::Response`. -//! You can learn more about these types [here](trait.IntoResponse.html). -//! -//! Adding an `#[lambda(http)]` attribute to a `#[tokio::run]`-decorated `main` function will setup and run the Lambda function. -//! -//! Note: this comes at the expense of any onetime initialization your lambda task might find value in. -//! The full body of your `main` function will be executed on **every** invocation of your lambda task. -//! -//! ```rust,no_run -//! use lambda_http::{lambda::{lambda, Context}, Request, IntoResponse}; -//! -//! type Error = Box; -//! -//! #[lambda(http)] -//! #[tokio::main] -//! async fn main(_: Request, _: Context) -> Result { -//! Ok("👋 world!") -//! } -//! ``` -//! -//! ## Hello World, Without Macros -//! -//! For cases where your lambda might benfit from one time function initializiation might -//! prefer a plain `main` function and invoke `lambda::run` explicitly in combination with the [`handler`](fn.handler.html) function. -//! Depending on the runtime cost of your dependency bootstrapping, this can reduce the overall latency of your functions execution path. +//! The following example is how you would structure your Lambda such that you have a `main` function where you explicitly invoke +//! `lambda::run` in combination with the [`handler`](fn.handler.html) function. This pattern allows you to utilize global initialization +//! of tools such as loggers, to use on warm invokes to the same Lambda function after the first request, helping to reduce the latency of +//! your function's execution path. //! //! ```rust,no_run //! use lambda_http::{handler, lambda}; @@ -51,7 +28,6 @@ //! lambda::run(handler(|request, context| async { Ok("👋 world!") })).await?; //! Ok(()) //! } -//! //! ``` //! //! ## Leveraging trigger provided data @@ -92,7 +68,6 @@ extern crate maplit; pub use http::{self, Response}; use lambda::Handler as LambdaHandler; pub use lambda::{self, Context}; -pub use lambda_attributes::lambda; mod body; pub mod ext; diff --git a/lambda/Cargo.toml b/lambda/Cargo.toml index 02320bb3..b4d24894 100644 --- a/lambda/Cargo.toml +++ b/lambda/Cargo.toml @@ -7,9 +7,8 @@ edition = "2018" license = "Apache-2.0" [features] -default = ["simulated", "derive"] +default = ["simulated"] simulated = [] -derive = ["lambda-attributes"] [dependencies] tokio = { version = "1.0", features = ["macros", "io-util", "sync", "rt-multi-thread"] } @@ -18,7 +17,6 @@ serde = { version = "1", features = ["derive"] } serde_json = "1.0.39" bytes = "1.0" http = "0.2" -lambda-attributes = { path = "../lambda-attributes", version = "0.1.0", optional = true} async-stream = "0.3" futures = "0.3" tracing = "0.1.13" diff --git a/lambda/examples/hello-without-macro.rs b/lambda/examples/hello-without-macro.rs deleted file mode 100644 index d94ee322..00000000 --- a/lambda/examples/hello-without-macro.rs +++ /dev/null @@ -1,17 +0,0 @@ -use lambda::{handler_fn, Context}; -use serde_json::{json, Value}; - -type Error = Box; - -#[tokio::main] -async fn main() -> Result<(), Error> { - let func = handler_fn(func); - lambda::run(func).await?; - Ok(()) -} - -async fn func(event: Value, _: Context) -> Result { - let first_name = event["firstName"].as_str().unwrap_or("world"); - - Ok(json!({ "message": format!("Hello, {}!", first_name) })) -} diff --git a/lambda/examples/hello.rs b/lambda/examples/hello.rs index 99472874..d94ee322 100644 --- a/lambda/examples/hello.rs +++ b/lambda/examples/hello.rs @@ -1,10 +1,17 @@ -use lambda::{lambda, Context}; -use serde_json::Value; +use lambda::{handler_fn, Context}; +use serde_json::{json, Value}; type Error = Box; -#[lambda] #[tokio::main] -async fn main(event: Value, _: Context) -> Result { - Ok(event) +async fn main() -> Result<(), Error> { + let func = handler_fn(func); + lambda::run(func).await?; + Ok(()) +} + +async fn func(event: Value, _: Context) -> Result { + let first_name = event["firstName"].as_str().unwrap_or("world"); + + Ok(json!({ "message": format!("Hello, {}!", first_name) })) } diff --git a/lambda/src/lib.rs b/lambda/src/lib.rs index 1f2c1824..6f420f56 100644 --- a/lambda/src/lib.rs +++ b/lambda/src/lib.rs @@ -3,40 +3,13 @@ //! The official Rust runtime for AWS Lambda. //! -//! There are two mechanisms available for defining a Lambda function: -//! 1. The `#[lambda]` attribute, which generates the boilerplate to -//! to launch and run a Lambda function. +//! The mechanism available for defining a Lambda function is as follows: //! -//! The `#[lambda]` attribute _must_ be placed on an asynchronous main function. -//! However, as asynchronous main functions are not legal valid Rust -//! this means that the main function must also be decorated using a -//! `#[tokio::main]` attribute macro. This is available from -//! the [tokio](https://github.com/tokio-rs/tokio) crate. -//! -//! 2. A type that conforms to the [`Handler`] trait. This type can then be passed -//! to the the `lambda::run` function, which launches and runs the Lambda runtime. -//! -//! An asynchronous function annotated with the `#[lambda]` attribute must -//! accept an argument of type `A` which implements [`serde::Deserialize`], a [`lambda::Context`] and -//! return a `Result`, where `B` implements [`serde::Serializable`]. `E` is -//! any type that implements `Into>`. -//! -//! ```no_run -//! use lambda::{lambda, Context}; -//! use serde_json::Value; -//! -//! type Error = Box; -//! -//! #[lambda] -//! #[tokio::main] -//! async fn main(event: Value, _: Context) -> Result { -//! Ok(event) -//! } -//! ``` +//! Create a type that conforms to the [`Handler`] trait. This type can then be passed +//! to the the `lambda::run` function, which launches and runs the Lambda runtime. pub use crate::types::Context; use client::Client; use futures::stream::{Stream, StreamExt}; -pub use lambda_attributes::lambda; use serde::{Deserialize, Serialize}; use std::{ convert::{TryFrom, TryInto},