From 1b471ca9f3742020539d71f917abafea8da8b918 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sat, 21 Mar 2020 14:08:28 +0000 Subject: [PATCH 1/8] Removed openssl installation The openssl installation was breaking `now dev` on any environment that isn't using `yum` as package manager. It seems sensible to remove it and instead projects that require it can add it (along with package management logic) into `build.sh`. --- README.md | 2 -- package/README.md | 2 -- src/install-rust.ts | 14 -------------- 3 files changed, 18 deletions(-) diff --git a/README.md b/README.md index 30a1a76..c2598e2 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,6 @@ This Builder supports installing dependencies defined in the `Cargo.toml` file. Furthermore, more system dependencies can be installed at build time with the presence of a shell `build.sh` file in the same directory as the entrypoint file. -By default, `openssl` is installed by the Builder due to its common usage with Rust projects. - #### Example This could be our `api/user.rs` file: diff --git a/package/README.md b/package/README.md index c6c5422..726e6d0 100644 --- a/package/README.md +++ b/package/README.md @@ -113,8 +113,6 @@ This Builder supports installing dependencies defined in the `Cargo.toml` file. Furthermore, more system dependencies can be installed at build time with the presence of a shell `build.sh` file in the same directory as the entry point file. -By default, `openssl` is installed by the Builder due to its common usage with Rust projects. - ## FAQ ### Are cargo workspaces supported? diff --git a/src/install-rust.ts b/src/install-rust.ts index 28e4e05..8adf768 100644 --- a/src/install-rust.ts +++ b/src/install-rust.ts @@ -13,20 +13,6 @@ async function downloadRustToolchain(version: string = "stable") { } } -async function installOpenSSL() { - console.log("installing openssl-devel..."); - try { - await execa("yum", ["install", "-y", "openssl-devel"], { - stdio: "inherit" - }); - } catch (err) { - console.error("failed to `yum install -y openssl-devel`"); - throw err; - } -} - export const installRustAndFriends = async (version?: string) => { await downloadRustToolchain(version); - await installOpenSSL(); }; - From 0b4af02d08b3a5dc4467fad90b9b97d53d80c2d3 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sat, 21 Mar 2020 14:15:32 +0000 Subject: [PATCH 2/8] Require main function in entrypoints The replacement logic was breaking `now dev` as it was adding imports and the main function each time `now dev` was run. To mitigate this, the entrypoints now require the main function. --- README.md | 11 +++++++---- src/index.ts | 12 +----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c2598e2..4cd39d2 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,6 @@ That's the simplest way to use this runtime! The entrypoint, in this case every file that matches `api/**/*.rs`, is used to create a Serverless Function for you. Note that the `Cargo.toml` file must exist on the same level as the `.rs` files. -The requirements for this entrypoint is to expose a `handler` function and not to have a `main` function. - ### Dependencies This Builder supports installing dependencies defined in the `Cargo.toml` file. @@ -48,8 +46,8 @@ Furthermore, more system dependencies can be installed at build time with the pr This could be our `api/user.rs` file: ```rust -use http::{StatusCode}; -use now_lambda::{error::NowError, IntoResponse, Request, Response}; +use now_lambda::{lambda, error::NowError, IntoResponse, Request, Response}; +use std::error::Error; fn handler(_: Request) -> Result { let response = Response::builder() @@ -60,6 +58,11 @@ fn handler(_: Request) -> Result { Ok(response) } + +// Start the runtime with the handler +fn main() -> Result<(), Box> { + Ok(lambda!(handler)) +} ``` Our `api/Cargo.toml` could look like this: diff --git a/src/index.ts b/src/index.ts index 7fc7070..ec7c0ba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -171,24 +171,14 @@ async function cargoLocateProject(config: CargoConfig) { } async function buildSingleFile( - { workPath, entrypoint, config }: BuildOptions, + { entrypoint, config }: BuildOptions, downloadedFiles: DownloadedFiles, extraFiles: DownloadedFiles, rustEnv: Record ) { console.log("building single file"); - const launcherPath = path.join(__dirname, "..", "launcher.rs"); - let launcherData = await fs.readFile(launcherPath, "utf8"); - const entrypointPath = downloadedFiles[entrypoint].fsPath; const entrypointDirname = path.dirname(entrypointPath); - launcherData = launcherData.replace( - "// PLACEHOLDER", - await fs.readFile(path.join(workPath, entrypoint), "utf8") - ); - // replace the entrypoint with one that includes the the imports + lambda.start - await fs.remove(entrypointPath); - await fs.writeFile(entrypointPath, launcherData); // Find a Cargo.toml file or TODO: create one const cargoTomlFile = await cargoLocateProject({ From 34ad38b2e63a200f5f5afe1f4bb6afa3a1ca1ba9 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sat, 21 Mar 2020 21:33:29 +0000 Subject: [PATCH 3/8] Debugging matches official builders Other builders are using @now/build-utils `debug` function to log debug messages. It is hidden behind NOW_BUILD_DEBUG environment variable, so I have also matched that behaviour for cargo verbosity. Without enabling, cargo is now less verbose, however still shows compilation errors. --- src/index.ts | 34 +++++++++++++++++----------------- src/install-rust.ts | 3 ++- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/index.ts b/src/index.ts index ec7c0ba..773f3cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import toml from "@iarna/toml"; import { glob, createLambda, + debug, download, FileRef, FileFsRef, @@ -37,7 +38,8 @@ const codegenFlags = [ "target-feature=-aes,-avx,+fxsr,-popcnt,+sse,+sse2,-sse3,-sse4.1,-sse4.2,-ssse3,-xsave,-xsaveopt" ]; -export const version = process.env.RUNTIME_NAME ? 3 : 1; +export const version = 3; +const builderDebug = process.env.NOW_BUILDER_DEBUG ? true : false; async function inferCargoBinaries(config: CargoConfig) { try { @@ -69,12 +71,11 @@ async function buildWholeProject( rustEnv: Record ) { const entrypointDirname = path.dirname(downloadedFiles[entrypoint].fsPath); - const { debug } = config; - console.log("running `cargo build`..."); + debug("Running `cargo build`..."); try { await execa( "cargo", - ["build", "--verbose"].concat(debug ? [] : ["--release"]), + ["build", "--verbose"].concat(config.debug ? [] : ["--release"]), { env: rustEnv, cwd: entrypointDirname, @@ -89,7 +90,7 @@ async function buildWholeProject( const targetPath = path.join( entrypointDirname, "target", - debug ? "debug" : "release" + config.debug ? "debug" : "release" ); const binaries = await inferCargoBinaries({ env: rustEnv, @@ -123,7 +124,7 @@ async function gatherExtraFiles( ) { if (!globMatcher) return {}; - console.log("gathering extra files for the fs..."); + debug("Gathering extra files for the fs..."); const entryDir = path.dirname(entrypoint); @@ -144,7 +145,7 @@ async function runUserScripts(entrypoint: string) { const buildScriptExists = await fs.pathExists(buildScriptPath); if (buildScriptExists) { - console.log("running `build.sh`..."); + debug("Running `build.sh`..."); await runShellScript(buildScriptPath); } } @@ -171,12 +172,12 @@ async function cargoLocateProject(config: CargoConfig) { } async function buildSingleFile( - { entrypoint, config }: BuildOptions, + { entrypoint }: BuildOptions, downloadedFiles: DownloadedFiles, extraFiles: DownloadedFiles, rustEnv: Record ) { - console.log("building single file"); + debug("Building single file"); const entrypointPath = downloadedFiles[entrypoint].fsPath; const entrypointDirname = path.dirname(entrypointPath); @@ -214,20 +215,19 @@ async function buildSingleFile( } ] }); - console.log("toml to write:", tomlToWrite); + debug("Writing following toml to file:", tomlToWrite); // Overwrite the Cargo.toml file with one that includes the `now_lambda` // dependency and our binary. `dependencies` is a map so we don't run the // risk of having 2 `now_lambda`s in there. await fs.writeFile(cargoTomlFile, tomlToWrite); - const { debug } = config; - console.log("running `cargo build`..."); + debug("Running `cargo build`..."); try { await execa( "cargo", - ["build", "--bin", binName, "--verbose"].concat( - debug ? [] : ["--release"] + ["build", "--bin", binName].concat( + builderDebug ? ["--verbose"] : ["--quiet", "--release"] ), { env: rustEnv, @@ -243,7 +243,7 @@ async function buildSingleFile( const bin = path.join( path.dirname(cargoTomlFile), "target", - debug ? "debug" : "release", + builderDebug ? "debug" : "release", binName ); @@ -269,7 +269,7 @@ export async function build(opts: BuildOptions) { await installRustAndFriends(); const { files, entrypoint, workPath, config, meta = {} } = opts; - console.log("downloading files"); + debug("Downloading files"); const downloadedFiles = await download(files, workPath, meta); const entryPath = downloadedFiles[entrypoint].fsPath; @@ -296,7 +296,7 @@ export async function prepareCache({ entrypoint, workPath }: PrepareCacheOptions) { - console.log("preparing cache..."); + debug("Preparing cache..."); let targetFolderDir: string; diff --git a/src/install-rust.ts b/src/install-rust.ts index 8adf768..25ac12d 100644 --- a/src/install-rust.ts +++ b/src/install-rust.ts @@ -1,7 +1,8 @@ import execa from "execa"; +import { debug } from "@now/build-utils"; async function downloadRustToolchain(version: string = "stable") { - console.log("downloading the rust toolchain"); + debug("Downloading the rust toolchain"); try { await execa.shell( From 2199aa7ff32be1c80cc045b3d91568d0abd672e9 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sun, 22 Mar 2020 15:25:40 +0000 Subject: [PATCH 4/8] Now only support version 3 of runtimes --- src/index.ts | 121 +-------------------------------------------------- 1 file changed, 2 insertions(+), 119 deletions(-) diff --git a/src/index.ts b/src/index.ts index 773f3cb..74e2dbc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,20 +7,14 @@ import { createLambda, debug, download, - FileRef, FileFsRef, runShellScript, BuildOptions, PrepareCacheOptions, - DownloadedFiles, - Lambda + DownloadedFiles } from "@now/build-utils"; // eslint-disable-line import/no-extraneous-dependencies import { installRustAndFriends } from './install-rust'; -interface PackageManifest { - targets: { kind: string; name: string }[]; -} - interface CargoConfig { env: Record; cwd: string; @@ -41,83 +35,10 @@ const codegenFlags = [ export const version = 3; const builderDebug = process.env.NOW_BUILDER_DEBUG ? true : false; -async function inferCargoBinaries(config: CargoConfig) { - try { - const { stdout: manifestStr } = await execa( - "cargo", - ["read-manifest"], - config - ); - - const { targets } = JSON.parse(manifestStr) as PackageManifest; - - return targets - .filter(({ kind }) => kind.includes("bin")) - .map(({ name }) => name); - } catch (err) { - console.error("failed to run `cargo read-manifest`"); - throw err; - } -} - async function parseTOMLStream(stream: NodeJS.ReadableStream) { return toml.parse.stream(stream); } -async function buildWholeProject( - { entrypoint, config }: BuildOptions, - downloadedFiles: DownloadedFiles, - extraFiles: DownloadedFiles, - rustEnv: Record -) { - const entrypointDirname = path.dirname(downloadedFiles[entrypoint].fsPath); - debug("Running `cargo build`..."); - try { - await execa( - "cargo", - ["build", "--verbose"].concat(config.debug ? [] : ["--release"]), - { - env: rustEnv, - cwd: entrypointDirname, - stdio: "inherit" - } - ); - } catch (err) { - console.error("failed to `cargo build`"); - throw err; - } - - const targetPath = path.join( - entrypointDirname, - "target", - config.debug ? "debug" : "release" - ); - const binaries = await inferCargoBinaries({ - env: rustEnv, - cwd: entrypointDirname - }); - - const lambdas: Record = {}; - const lambdaPath = path.dirname(entrypoint); - await Promise.all( - binaries.map(async binary => { - const fsPath = path.join(targetPath, binary); - const lambda = await createLambda({ - files: { - ...extraFiles, - bootstrap: new FileFsRef({ mode: 0o755, fsPath }) - }, - handler: "bootstrap", - runtime: "provided" - }); - - lambdas[path.join(lambdaPath, binary)] = lambda; - }) - ); - - return lambdas; -} - async function gatherExtraFiles( globMatcher: string | string[] | undefined, entrypoint: string @@ -256,13 +177,7 @@ async function buildSingleFile( runtime: "provided" }); - if (version === 3) { - return { output: lambda }; - } - - return { - [entrypoint]: lambda - }; + return { output: lambda }; } export async function build(opts: BuildOptions) { @@ -285,9 +200,6 @@ export async function build(opts: BuildOptions) { await runUserScripts(entryPath); const extraFiles = await gatherExtraFiles(config.includeFiles, entryPath); - if (path.extname(entrypoint) === ".toml" && version !== 3) { - return buildWholeProject(opts, downloadedFiles, extraFiles, rustEnv); - } return buildSingleFile(opts, downloadedFiles, extraFiles, rustEnv); } @@ -359,33 +271,4 @@ export async function prepareCache({ return cacheFiles; } -function findCargoToml( - files: BuildOptions["files"], - entrypoint: BuildOptions["entrypoint"] -) { - let currentPath = path.dirname(entrypoint); - let cargoTomlPath; - - // eslint-disable-next-line no-constant-condition - while (true) { - cargoTomlPath = path.join(currentPath, "Cargo.toml"); - if (files[cargoTomlPath]) break; - const newPath = path.dirname(currentPath); - if (currentPath === newPath) break; - currentPath = newPath; - } - - return cargoTomlPath; -} - -export const getDefaultCache = ({ files, entrypoint }: BuildOptions) => { - const cargoTomlPath = findCargoToml(files, entrypoint); - if (!cargoTomlPath) return undefined; - const defaultCacheRef = new FileRef({ - digest: - "sha:204e0c840c43473bbd130d7bc704fe5588b4eab43cda9bc940f10b2a0ae14b16" - }); - return { '.': defaultCacheRef }; -}; - export { shouldServe } from "@now/build-utils"; From 5e9cf9b5aa5f7fb0df4b216f48bc44f972d31d94 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sun, 22 Mar 2020 15:36:34 +0000 Subject: [PATCH 5/8] Added support for path segments rustc does not support `[]` in crate names, hence cargo was failing to build path segments. Replacing brackets with underscores for naming fixes the issue. --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 74e2dbc..369a3b0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -122,7 +122,10 @@ async function buildSingleFile( const binName = path .basename(entrypointPath) - .replace(path.extname(entrypointPath), ""); + .replace(path.extname(entrypointPath), "") + .replace("[", "_") + .replace("]", "_"); + const { package: pkg, dependencies } = cargoToml; // default to latest now_lambda dependencies.now_lambda = "*"; From dd917c4ca0012fafc394f028bba561877b9897ae Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Mon, 23 Mar 2020 20:56:19 +0000 Subject: [PATCH 6/8] Check if rust exists before trying to install This shaves off time as the installer no longer needs to download rustup and try to install. Instead it checks before downloading. --- src/install-rust.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/install-rust.ts b/src/install-rust.ts index 25ac12d..ede9c9e 100644 --- a/src/install-rust.ts +++ b/src/install-rust.ts @@ -15,5 +15,10 @@ async function downloadRustToolchain(version: string = "stable") { } export const installRustAndFriends = async (version?: string) => { - await downloadRustToolchain(version); + try { + await execa.shell(`rustup -V`, { stdio: "ignore" }); + debug("Rust already exists"); + } catch (err) { + await downloadRustToolchain(version); + } }; From 4d1e89b307b314d1bb82d151ff3bbf41d4a75431 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Sun, 29 Mar 2020 00:34:07 +0000 Subject: [PATCH 7/8] Cargo.toml handling is more flexible In order to allow usage of helper libraries across all folders Cargo allows specifying them via [lib]. This was removed on each build, previously which no longer happens. These changes however mean that Cargo is not as strictly controlled (now_lambda is not set to latest always, however the [[bin]] is overwritten). Cargo.toml is now also backed up and restored for builds, so that it does not get updated for the users source control management. --- README.md | 21 ++++++++++++++++++++- src/index.ts | 40 +++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4cd39d2..f801513 100644 --- a/README.md +++ b/README.md @@ -41,15 +41,22 @@ This Builder supports installing dependencies defined in the `Cargo.toml` file. Furthermore, more system dependencies can be installed at build time with the presence of a shell `build.sh` file in the same directory as the entrypoint file. +#### Unlisted Utility Functions + +Utility functions could be created as described in [Prevent Endpoint Listing](https://zeit.co/docs/v2/serverless-functions/introduction#prevent-endpoint-listing). +To make use of them make sure to include them in the `Cargo.toml` under `[lib]`. + #### Example This could be our `api/user.rs` file: ```rust +use util::print_foo; use now_lambda::{lambda, error::NowError, IntoResponse, Request, Response}; use std::error::Error; fn handler(_: Request) -> Result { + print_foo(); let response = Response::builder() .status(StatusCode::OK) .header("Content-Type", "text/plain") @@ -65,6 +72,14 @@ fn main() -> Result<(), Box> { } ``` +Our helper utilities `api/_util.rs` file: + +```rust +pub fn print_foo() { + println!("foo"); +} +``` + Our `api/Cargo.toml` could look like this: ```toml @@ -76,7 +91,11 @@ edition = "2018" [dependencies] http = "0.1" -now_lambda = "0.1" +now_lambda = "*" + +[lib] +name = "util" +path = "_util.rs" ``` Finally we need a `now.json` file to specify the runtime for `api/user.rs`: diff --git a/src/index.ts b/src/index.ts index 369a3b0..185fdcc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,11 +20,6 @@ interface CargoConfig { cwd: string; } -interface CargoToml extends toml.JsonMap { - package: toml.JsonMap; - dependencies: toml.JsonMap; -} - const codegenFlags = [ "-C", "target-cpu=ivybridge", @@ -93,7 +88,7 @@ async function cargoLocateProject(config: CargoConfig) { } async function buildSingleFile( - { entrypoint }: BuildOptions, + { entrypoint, meta = {} }: BuildOptions, downloadedFiles: DownloadedFiles, extraFiles: DownloadedFiles, rustEnv: Record @@ -110,11 +105,11 @@ async function buildSingleFile( // TODO: we're assuming there's a Cargo.toml file. We need to create one // otherwise - let cargoToml: CargoToml; + let cargoToml: toml.JsonMap; try { cargoToml = (await parseTOMLStream( fs.createReadStream(cargoTomlFile) - )) as CargoToml; + )) as toml.JsonMap; } catch (err) { console.error("Failed to parse TOML from entrypoint:", entrypoint); throw err; @@ -126,12 +121,8 @@ async function buildSingleFile( .replace("[", "_") .replace("]", "_"); - const { package: pkg, dependencies } = cargoToml; - // default to latest now_lambda - dependencies.now_lambda = "*"; const tomlToWrite = toml.stringify({ - package: pkg, - dependencies, + ...cargoToml, bin: [ { name: binName, @@ -139,11 +130,17 @@ async function buildSingleFile( } ] }); - debug("Writing following toml to file:", tomlToWrite); - // Overwrite the Cargo.toml file with one that includes the `now_lambda` - // dependency and our binary. `dependencies` is a map so we don't run the - // risk of having 2 `now_lambda`s in there. + if (meta.isDev) { + debug("Backing up Cargo.toml file"); + await fs.move( + cargoTomlFile, + `${cargoTomlFile}.backup`, + { overwrite: true } + ); + } + + debug("Writing following toml to file:", tomlToWrite); await fs.writeFile(cargoTomlFile, tomlToWrite); debug("Running `cargo build`..."); @@ -164,6 +161,15 @@ async function buildSingleFile( throw err; } + if (meta.isDev) { + debug("Restoring backed up Cargo.toml file"); + await fs.move( + `${cargoTomlFile}.backup`, + cargoTomlFile, + { overwrite: true } + ); + } + const bin = path.join( path.dirname(cargoTomlFile), "target", From ac25855ac39197d98f6911691166106629906134 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Thu, 2 Apr 2020 22:54:16 +0100 Subject: [PATCH 8/8] Updated tests for changes --- test/fixtures/01-include-files/Cargo.toml | 2 +- .../01-include-files/{src => }/main.rs | 0 test/fixtures/01-include-files/now.json | 4 +- .../api/Cargo.lock | 0 test/fixtures/02-with-utility/api/Cargo.toml | 13 + test/fixtures/02-with-utility/api/_util.rs | 3 + .../api/user.rs | 10 +- .../now.json | 4 +- test/fixtures/03-with-function/api/Cargo.toml | 2 +- test/fixtures/03-with-function/api/user.rs | 7 +- test/fixtures/03-with-function/now.json | 2 +- .../fixtures/04-with-parameter/api/Cargo.lock | 1090 +++++++++++++++++ .../api/Cargo.toml | 2 +- test/fixtures/04-with-parameter/api/[user].rs | 17 + test/fixtures/04-with-parameter/now.json | 16 + test/test.js | 8 +- 16 files changed, 1167 insertions(+), 13 deletions(-) rename test/fixtures/01-include-files/{src => }/main.rs (100%) rename test/fixtures/{02-with-rust-entrypoint => 02-with-utility}/api/Cargo.lock (100%) create mode 100644 test/fixtures/02-with-utility/api/Cargo.toml create mode 100644 test/fixtures/02-with-utility/api/_util.rs rename test/fixtures/{02-with-rust-entrypoint => 02-with-utility}/api/user.rs (53%) rename test/fixtures/{02-with-rust-entrypoint => 02-with-utility}/now.json (87%) create mode 100644 test/fixtures/04-with-parameter/api/Cargo.lock rename test/fixtures/{02-with-rust-entrypoint => 04-with-parameter}/api/Cargo.toml (87%) create mode 100644 test/fixtures/04-with-parameter/api/[user].rs create mode 100644 test/fixtures/04-with-parameter/now.json diff --git a/test/fixtures/01-include-files/Cargo.toml b/test/fixtures/01-include-files/Cargo.toml index 4d55de8..29f2d8a 100644 --- a/test/fixtures/01-include-files/Cargo.toml +++ b/test/fixtures/01-include-files/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] http = "0.1" -now_lambda = "0.1" +now_lambda = "*" diff --git a/test/fixtures/01-include-files/src/main.rs b/test/fixtures/01-include-files/main.rs similarity index 100% rename from test/fixtures/01-include-files/src/main.rs rename to test/fixtures/01-include-files/main.rs diff --git a/test/fixtures/01-include-files/now.json b/test/fixtures/01-include-files/now.json index 3f341fa..815c4ce 100644 --- a/test/fixtures/01-include-files/now.json +++ b/test/fixtures/01-include-files/now.json @@ -2,7 +2,7 @@ "version": 2, "builds": [ { - "src": "Cargo.toml", + "src": "main.rs", "use": "now-rust", "config": { "includeFiles": ["static/**/*.txt", "static/**/*.svg"] @@ -11,7 +11,7 @@ ], "probes": [ { - "path": "/", + "path": "/main.rs", "status": 200, "mustContain": "Include me in the lambda fs!" } diff --git a/test/fixtures/02-with-rust-entrypoint/api/Cargo.lock b/test/fixtures/02-with-utility/api/Cargo.lock similarity index 100% rename from test/fixtures/02-with-rust-entrypoint/api/Cargo.lock rename to test/fixtures/02-with-utility/api/Cargo.lock diff --git a/test/fixtures/02-with-utility/api/Cargo.toml b/test/fixtures/02-with-utility/api/Cargo.toml new file mode 100644 index 0000000..8f518aa --- /dev/null +++ b/test/fixtures/02-with-utility/api/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "index" +version = "1.0.0" +authors = ["Mike Engel "] +edition = "2018" + +[dependencies] +http = "0.1" +now_lambda = "*" + +[lib] +name = "util" +path = "_util.rs" diff --git a/test/fixtures/02-with-utility/api/_util.rs b/test/fixtures/02-with-utility/api/_util.rs new file mode 100644 index 0000000..ea150dd --- /dev/null +++ b/test/fixtures/02-with-utility/api/_util.rs @@ -0,0 +1,3 @@ +pub fn return_foo() -> String { + String::from("foo") +} diff --git a/test/fixtures/02-with-rust-entrypoint/api/user.rs b/test/fixtures/02-with-utility/api/user.rs similarity index 53% rename from test/fixtures/02-with-rust-entrypoint/api/user.rs rename to test/fixtures/02-with-utility/api/user.rs index 74ddc0f..c3520b5 100644 --- a/test/fixtures/02-with-rust-entrypoint/api/user.rs +++ b/test/fixtures/02-with-utility/api/user.rs @@ -1,12 +1,18 @@ +use util::return_foo; use http::{StatusCode}; -use now_lambda::{error::NowError, IntoResponse, Request, Response}; +use now_lambda::{error::NowError, lambda, IntoResponse, Request, Response}; +use std::error::Error; fn handler(_: Request) -> Result { let response = Response::builder() .status(StatusCode::OK) .header("Content-Type", "text/plain") - .body("user endpoint") + .body(return_foo()) .expect("Internal Server Error"); Ok(response) } + +fn main() -> Result<(), Box> { + Ok(lambda!(handler)) +} diff --git a/test/fixtures/02-with-rust-entrypoint/now.json b/test/fixtures/02-with-utility/now.json similarity index 87% rename from test/fixtures/02-with-rust-entrypoint/now.json rename to test/fixtures/02-with-utility/now.json index 8dcc1e7..7515ba8 100644 --- a/test/fixtures/02-with-rust-entrypoint/now.json +++ b/test/fixtures/02-with-utility/now.json @@ -16,7 +16,7 @@ { "path": "/api/user", "status": 200, - "mustContain": "user endpoint" + "mustContain": "foo" } ] -} \ No newline at end of file +} diff --git a/test/fixtures/03-with-function/api/Cargo.toml b/test/fixtures/03-with-function/api/Cargo.toml index 4d55de8..29f2d8a 100644 --- a/test/fixtures/03-with-function/api/Cargo.toml +++ b/test/fixtures/03-with-function/api/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] http = "0.1" -now_lambda = "0.1" +now_lambda = "*" diff --git a/test/fixtures/03-with-function/api/user.rs b/test/fixtures/03-with-function/api/user.rs index 74ddc0f..cbdeb76 100644 --- a/test/fixtures/03-with-function/api/user.rs +++ b/test/fixtures/03-with-function/api/user.rs @@ -1,5 +1,6 @@ use http::{StatusCode}; -use now_lambda::{error::NowError, IntoResponse, Request, Response}; +use std::error::Error; +use now_lambda::{error::NowError, lambda, IntoResponse, Request, Response}; fn handler(_: Request) -> Result { let response = Response::builder() @@ -10,3 +11,7 @@ fn handler(_: Request) -> Result { Ok(response) } + +fn main() -> Result<(), Box> { + Ok(lambda!(handler)) +} diff --git a/test/fixtures/03-with-function/now.json b/test/fixtures/03-with-function/now.json index 964556e..03b2cb0 100644 --- a/test/fixtures/03-with-function/now.json +++ b/test/fixtures/03-with-function/now.json @@ -27,4 +27,4 @@ "mustContain": "user endpoint" } ] -} \ No newline at end of file +} diff --git a/test/fixtures/04-with-parameter/api/Cargo.lock b/test/fixtures/04-with-parameter/api/Cargo.lock new file mode 100644 index 0000000..660bfd8 --- /dev/null +++ b/test/fixtures/04-with-parameter/api/Cargo.lock @@ -0,0 +1,1090 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "arrayvec" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-queue" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "h2" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "http" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hyper" +version = "0.12.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "index" +version = "1.0.0" +dependencies = [ + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "now_lambda 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lambda_runtime" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lambda_runtime_client" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_errors 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lambda_runtime_core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_client 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_errors 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lambda_runtime_errors" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_errors_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lambda_runtime_errors_derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.50" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lock_api" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "now_lambda" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num_cpus" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "owning_ref" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_jitter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.51" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-demangle" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "smallvec" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "string" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-sync" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-trace-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "try-lock" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "want" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" +"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +"checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d" +"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" +"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum h2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "910a5e7be6283a9c91b3982fa5188368c8719cce2a3cf3b86048673bf9d9c36b" +"checksum http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fe67e3678f2827030e89cc4b9e7ecd16d52f132c0b940ab5005f88e821500f6a" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" +"checksum hyper 0.12.25 (registry+https://github.com/rust-lang/crates.io-index)" = "7d5b6658b016965ae301fa995306db965c93677880ea70765a84235a96eae896" +"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lambda_runtime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb6f5263f79e29c69b349c6cd906381674871a03625a04fbcb686af363a7cd03" +"checksum lambda_runtime_client 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aeecd7fe8331642af52f39f62f762605e1dd5a62e7f288b2bb939b7cc7fb7544" +"checksum lambda_runtime_core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "754758eccf7a245db273db7255cdc461e28332cf78591fec738f335e940eaa2c" +"checksum lambda_runtime_errors 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edc65224e35e9f86514394e8c4db27f3f0fce02a40b0f2d7d54b0f1528c0a606" +"checksum lambda_runtime_errors_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6eebda5e30caceb2702acf511b4744a2c624599a87477452ffd2d369936f35c0" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +"checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" +"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum now_lambda 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f8eb2b51ee8c79860d73e275350782d52e4d9d76547e078821e70ab0cf9b30c7" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" +"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" +"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" +"checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" +"checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "65641e515a437b308ab131a82ce3042ff9795bef5d6c5a9be4eb24195c417fd9" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" +"checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" +"checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" +"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" +"checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" +"checksum tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fda385df506bf7546e70872767f71e81640f1f251bdf2fd8eb81a0eaec5fe022" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ec5759cf26cf9659555f36c431b515e3d05f66831741c85b4b5d5dfb9cf1323c" +"checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350c9edade9830dc185ae48ba45667a445ab59f6167ef6d0254ec9d2430d9dd3" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/test/fixtures/02-with-rust-entrypoint/api/Cargo.toml b/test/fixtures/04-with-parameter/api/Cargo.toml similarity index 87% rename from test/fixtures/02-with-rust-entrypoint/api/Cargo.toml rename to test/fixtures/04-with-parameter/api/Cargo.toml index 4d55de8..29f2d8a 100644 --- a/test/fixtures/02-with-rust-entrypoint/api/Cargo.toml +++ b/test/fixtures/04-with-parameter/api/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] http = "0.1" -now_lambda = "0.1" +now_lambda = "*" diff --git a/test/fixtures/04-with-parameter/api/[user].rs b/test/fixtures/04-with-parameter/api/[user].rs new file mode 100644 index 0000000..e5b9467 --- /dev/null +++ b/test/fixtures/04-with-parameter/api/[user].rs @@ -0,0 +1,17 @@ +use http::{StatusCode}; +use now_lambda::{error::NowError, lambda, IntoResponse, Request, Response}; +use std::error::Error; + +fn handler(request: Request) -> Result { + let response = Response::builder() + .status(StatusCode::OK) + .header("Content-Type", "text/plain") + .body(String::from(request.uri().query().unwrap())) + .expect("Internal Server Error"); + + Ok(response) +} + +fn main() -> Result<(), Box> { + Ok(lambda!(handler)) +} diff --git a/test/fixtures/04-with-parameter/now.json b/test/fixtures/04-with-parameter/now.json new file mode 100644 index 0000000..ea620bc --- /dev/null +++ b/test/fixtures/04-with-parameter/now.json @@ -0,0 +1,16 @@ +{ + "version": 2, + "builds": [ + { + "src": "api/[user].rs", + "use": "now-rust" + } + ], + "probes": [ + { + "path": "/api/[user].rs?user=foo", + "status": 200, + "mustContain": "user=foo" + } + ] +} diff --git a/test/test.js b/test/test.js index 44e0253..38c9a36 100644 --- a/test/test.js +++ b/test/test.js @@ -85,11 +85,15 @@ describe('now-rust', () => { await testFixture('01-include-files', builder); }); - it('Deploy 02-with-rust-entrypoint', async () => { - await testFixture('02-with-rust-entrypoint', builder); + it('Deploy 02-with-utility', async () => { + await testFixture('02-with-utility', builder); }); it('Deploy 03-with-function', async () => { await testFixture('03-with-function', builder); }); + + it('Deploy 04-with-parameter', async () => { + await testFixture('04-with-parameter', builder); + }); });