diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index d02f05007..000000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,75 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of -experience, -education, socio-economic status, nationality, personal appearance, race, -religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or -advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic -address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a -professional setting - - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at yoshuawuyts@gmail.com, or through -IRC. All complaints will be reviewed and investigated and will result in a -response that is deemed necessary and appropriate to the circumstances. The -project team is obligated to maintain confidentiality with regard to the -reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the Contributor Covenant, version 1.4, -available at -https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index e3ad56ae0..000000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,63 +0,0 @@ -# Contributing -Contributions include code, documentation, answering user questions, running the -project's infrastructure, and advocating for all types of users. - -The project welcomes all contributions from anyone willing to work in good faith -with other contributors and the community. No contribution is too small and all -contributions are valued. - -This guide explains the process for contributing to the project's GitHub -Repository. - -- [Code of Conduct](#code-of-conduct) -- [Bad Actors](#bad-actors) -- [Developer Certificate of Origin](#developer-certificate-of-origin) - -## Code of Conduct -The project has a [Code of Conduct](./CODE_OF_CONDUCT.md) that *all* -contributors are expected to follow. This code describes the *minimum* behavior -expectations for all contributors. - -As a contributor, how you choose to act and interact towards your -fellow contributors, as well as to the community, will reflect back not only -on yourself but on the project as a whole. The Code of Conduct is designed and -intended, above all else, to help establish a culture within the project that -allows anyone and everyone who wants to contribute to feel safe doing so. - -Should any individual act in any way that is considered in violation of the -[Code of Conduct](./CODE_OF_CONDUCT.md), corrective actions will be taken. It is -possible, however, for any individual to *act* in such a manner that is not in -violation of the strict letter of the Code of Conduct guidelines while still -going completely against the spirit of what that Code is intended to accomplish. - -Open, diverse, and inclusive communities live and die on the basis of trust. -Contributors can disagree with one another so long as they trust that those -disagreements are in good faith and everyone is working towards a common -goal. - -## Bad Actors -All contributors to tacitly agree to abide by both the letter and -spirit of the [Code of Conduct](./CODE_OF_CONDUCT.md). Failure, or -unwillingness, to do so will result in contributions being respectfully -declined. - -A *bad actor* is someone who repeatedly violates the *spirit* of the Code of -Conduct through consistent failure to self-regulate the way in which they -interact with other contributors in the project. In doing so, bad actors -alienate other contributors, discourage collaboration, and generally reflect -poorly on the project as a whole. - -Being a bad actor may be intentional or unintentional. Typically, unintentional -bad behavior can be easily corrected by being quick to apologize and correct -course *even if you are not entirely convinced you need to*. Giving other -contributors the benefit of the doubt and having a sincere willingness to admit -that you *might* be wrong is critical for any successful open collaboration. - -Don't be a bad actor. - -## Developer Certificate of Origin -All contributors must read and agree to the [Developer Certificate of -Origin (DCO)](../CERTIFICATE). - -The DCO allows us to accept contributions from people to the project, similarly -to how a license allows us to distribute our code. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index fabd2c8c2..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Bug Report -about: Create a report to help us improve ---- - -## Bug Report - -#### Current Behavior - - - -#### Code/Gist - - - -#### Expected behavior/code - - - -#### Environment - -- Rust toolchain version(s): -- OS: [e.g. OSX 10.13.4, Windows 10] - -#### Possible Solution - - -#### Additional context/Screenshots - \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index a391c04b0..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for this project ---- - -## Feature Request - -## Detailed Description - - -## Context - - - -## Possible Implementation - diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 895e2abba..000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Question -about: Ask any question about the Tide framework ---- - - -## Question - - - -## Additional context - - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 521c25269..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## Description - - -## Motivation and Context - - - -## How Has This Been Tested? - - - - -## Types of changes - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to change) - -## Checklist: - - -- [ ] My change requires a change to the documentation. -- [ ] I have updated the documentation accordingly. -- [ ] I have read the [CONTRIBUTING](https://github.com/rustasync/tide/blob/master/.github/CONTRIBUTING.md) document. -- [ ] I have added tests to cover my changes. -- [ ] All new and existing tests passed. diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index b8550d0fb..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -daysUntilStale: 90 -daysUntilClose: 7 -exemptLabels: - - pinned - - security -exemptProjects: false -exemptMilestones: false -staleLabel: wontfix -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -unmarkComment: false -closeComment: false -limitPerRun: 30 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..99b78ddac --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,86 @@ +name: CI + +on: + pull_request: + push: + branches: + - staging + - trying + +env: + RUSTFLAGS: -Dwarnings + +jobs: + build_and_test: + name: Build and test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: [nightly] + + steps: + - uses: actions/checkout@master + + - name: Install ${{ matrix.rust }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --bins --examples + + - name: check unstable + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --benches --bins --examples --tests + + - name: tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all + + check_fmt_and_docs: + name: Checking fmt and docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - id: component + uses: actions-rs/components-nightly@v1 + with: + component: rustfmt + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ steps.component.outputs.toolchain }} + override: true + + - name: setup + run: | + rustup component add rustfmt + rustc --version + + - name: fmt + run: cargo fmt --all -- --check + + - name: Docs + run: cargo doc + + clippy_check: + name: Clippy check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Install rust + run: rustup update beta && rustup default beta + - name: Install clippy + run: rustup component add clippy + - name: clippy + run: cargo clippy --all diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3e4d10906..000000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: rust -rust: - - nightly-2019-05-09 - -before_script: | - rustup component add rustfmt clippy -script: | - cargo fmt --all -- --check && - cargo clippy --all -- -D clippy::all && - cargo build --no-default-features --verbose && - cargo build --all --verbose && - cargo test --all --verbose -cache: cargo diff --git a/CERTIFICATE b/CERTIFICATE deleted file mode 100644 index 8201f9921..000000000 --- a/CERTIFICATE +++ /dev/null @@ -1,37 +0,0 @@ -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -1 Letterman Drive -Suite D4700 -San Francisco, CA, 94129 - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6470cd4..eca4cf96e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,460 +1,93 @@ -## 2019-05-03, Version 0.2.0 -### Commits -- [[`d887e16`](https://github.com/rustasync/tide/commit/d887e162d88289b43a6dba4ac8a98040af35d02d)] (cargo-release) version 0.2.0 (Wonwoo Choi) -- [[`6d8577b`](https://github.com/rustasync/tide/commit/6d8577b5411c4a5ad636debc056e9af69d3a107b)] Fix wrong changelog (Wonwoo Choi) -- [[`69b5762`](https://github.com/rustasync/tide/commit/69b576208f6191029476e7cbec90b19b057f4081)] Merge pull request #193 from Nemo157/futures-alpha.15 (Wonwoo Choi) -- [[`a676391`](https://github.com/rustasync/tide/commit/a6763919525ed6b9d7ee5a5a3ef1dda5b47b495c)] Update for futures v0.3.0-alpha.15 (Wim Looman) -- [[`6b6a7a1`](https://github.com/rustasync/tide/commit/6b6a7a18a196e94aa532dd5059df2e116950bf03)] fix: readme typos (Prasanna V. Loganathar) -- [[`676b497`](https://github.com/rustasync/tide/commit/676b497f8cafcc2709a5fcc91ec430265af34d2d)] Fix minor bugs found during review (#188) (Murali) -- [[`a4464e8`](https://github.com/rustasync/tide/commit/a4464e8806dbfb817104fa15da7a107128fe53f0)] Merge pull request #170 from mmrath/cookie-improvement (Aaron Turon) -- [[`d76a6d2`](https://github.com/rustasync/tide/commit/d76a6d23556caa0368b958d16e534942c4c6a2c9)] Merge pull request #180 from secretfader/serde_urlencoded (Aaron Turon) -- [[`4263895`](https://github.com/rustasync/tide/commit/4263895dcc8729883b9d8d0cd5c87da192963905)] Merge pull request #175 from secretfader/feat/querystring (Aaron Turon) -- [[`85065cf`](https://github.com/rustasync/tide/commit/85065cf36e8b84bd7a95ca4a49b960f87f8b7fc7)] Add query string extension trait (Nicholas Young) -- [[`998fa45`](https://github.com/rustasync/tide/commit/998fa45af2a8b7dd8c1ac3ccc70c785003fd015d)] Merge pull request #183 from secretfader/serde-2018 (Justin Seabrook-Rocha) -- [[`6438a3d`](https://github.com/rustasync/tide/commit/6438a3db79b4bdda4c75a9595e9f1ff7764c0050)] docs: add supported rust versions (#185) (Prasanna V. Loganathar) -- [[`cf3eee2`](https://github.com/rustasync/tide/commit/cf3eee2252f5e3cdc3a0d91a0f89a1a9d9a5149d)] pragma updates (#182) (Prasanna V. Loganathar) -- [[`4476c69`](https://github.com/rustasync/tide/commit/4476c6976217b9eda116b8e15b4697c71a250eb4)] Merge pull request #178 from rustasync/fix-github-templates (Nicholas) -- [[`87ff6ff`](https://github.com/rustasync/tide/commit/87ff6ff77132686aecdcbee1a47be2395a7bf187)] Update question.md (Theodore Zilist) -- [[`8f1daf7`](https://github.com/rustasync/tide/commit/8f1daf772c44798dc63aae61a7561cfffe61d341)] Use Rust 2018 imports for Serde (Nicholas Young) -- [[`0dedfc0`](https://github.com/rustasync/tide/commit/0dedfc0ec98162e9cffe8244028f5899bf5d5002)] Migrate to serde_urlencoded, and away from serde_qs (Nicholas Young) -- [[`d78001f`](https://github.com/rustasync/tide/commit/d78001f3d776c9a16375597572f2c84b1eff18d5)] Merge pull request #181 from sangheestyle/fix_example_readme (Nicholas) -- [[`0ac0168`](https://github.com/rustasync/tide/commit/0ac01681a13ec46f9dc3c9873a1073c2429aeba8)] fix: error on example code (Sanghee Kim) -- [[`6dab8f7`](https://github.com/rustasync/tide/commit/6dab8f777048e37735a48b9aebbf8441c0254dc4)] Update question.md (Theodore Zilist) -- [[`1a185c5`](https://github.com/rustasync/tide/commit/1a185c57ce60d034b12edf31a65eabc3a72b2cfe)] Fix documentation (Murali Mohan Rath) -- [[`8e3fd26`](https://github.com/rustasync/tide/commit/8e3fd26236bf4b436334ab4400e5c5893aa69235)] Merge branch 'master' of https://github.com/rustasync/tide into cookie-improvement (Murali Mohan Rath) -- [[`e06ae37`](https://github.com/rustasync/tide/commit/e06ae375aa31e8fe2dad3689c72bd33e84775d4e)] Update changelog (Yoshua Wuyts) -- [[`31df6c2`](https://github.com/rustasync/tide/commit/31df6c2cec56157ec675d42ebb7cf41c9fc5476b)] Add test cases (Murali Mohan Rath) -- [[`03cf8f1`](https://github.com/rustasync/tide/commit/03cf8f16d6182f05e27b9d9e90771b4ccd963ff9)] Add documentation (Murali Mohan Rath) -- [[`ca059c0`](https://github.com/rustasync/tide/commit/ca059c0f238b93117d04f30befdfc80453bac074)] Merge branch 'master' of https://github.com/rustasync/tide into cookie-improvement (Murali Mohan Rath) -- [[`f8f6203`](https://github.com/rustasync/tide/commit/f8f6203e83bac4ca923de21a0899af4dce069b8e)] improve error handling (Murali Mohan Rath) -- [[`935151a`](https://github.com/rustasync/tide/commit/935151a56ace7356f6123df92f93f827a0b71785)] Cookie revamp (Murali Mohan Rath) -- [[`2e44305`](https://github.com/rustasync/tide/commit/2e443055ab4f8da80b1a22e315ed47a53b504712)] cookie revamp (Murali Mohan Rath) - -### Stats -```diff - .github/ISSUE_TEMPLATE/question.md | 4 +- - .travis.yml | 2 +- - CHANGELOG.md | 107 +++++++++++++++++------ - Cargo.toml | 17 ++-- - README.md | 19 ++++- - examples/body_types.rs | 6 +- - examples/catch_all.rs | 2 +- - examples/cookie_extractor.rs | 15 ---- - examples/cookies.rs | 26 ++++++ - examples/graphql.rs | 2 +- - examples/messages.rs | 6 +- - examples/multipart-form/main.rs | 6 +- - src/app.rs | 8 +- - src/cookies.rs | 92 +++++++++++++++----- - src/endpoint.rs | 6 +- - src/error.rs | 4 +- - src/forms.rs | 7 +- - src/lib.rs | 10 +-- - src/middleware/cookies.rs | 170 +++++++++++++++++++++++++++++++++++++ - src/middleware/default_headers.rs | 4 +- - src/middleware/logger.rs | 4 +- - src/middleware/mod.rs | 13 +-- - src/querystring.rs | 80 +++++++++++++++++ - src/router.rs | 9 +- - tests/wildcard.rs | 2 +- - 25 files changed, 498 insertions(+), 123 deletions(-) -``` - - -## 2019-04-18, Version 0.1.1 -### Commits -- [[`8c247b8`](https://github.com/rustasync/tide/commit/8c247b884fe6795c9489a76d7ee9f265a2d6539c)] (cargo-release) version 0.1.1 (Yoshua Wuyts) -- [[`7e57a55`](https://github.com/rustasync/tide/commit/7e57a55e8ff1229594a439141e9bb6c204f74703)] fix: sync up with nightly futures_api (#176) (Prasanna V. Loganathar) -- [[`69c0c60`](https://github.com/rustasync/tide/commit/69c0c60bacef29dd0e0071c799ace3a2f0977aaa)] fix: cargo fmt check in the last commit (Prasanna V. Loganathar) -- [[`0281fa6`](https://github.com/rustasync/tide/commit/0281fa671cafa9761f08282c5df823bb13c3082d)] fix: 2018 edition lints (Prasanna V. Loganathar) -- [[`b09fcda`](https://github.com/rustasync/tide/commit/b09fcdaee34e338e178a8ce51d0bd52b621e5570)] compiler pragmas (Prasanna V. Loganathar) -- [[`9e0a19a`](https://github.com/rustasync/tide/commit/9e0a19ad2ed6168737a44d9f82c00453f9ef8260)] Documents acceptable endpoint fns (#177) (Allen) -- [[`3d22441`](https://github.com/rustasync/tide/commit/3d224417398d81e83edac230d8d0ad2c16849d23)] redo readme (#172) (Yoshua Wuyts) -- [[`be9832d`](https://github.com/rustasync/tide/commit/be9832d3a677944acd904821652eb027853eb7c0)] Update changelog (Yoshua Wuyts) - -### Stats -```diff - .travis.yml | 2 +- - CHANGELOG.md | 31 ++++++++++++++++ - Cargo.toml | 24 ++++++------- - README.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- - src/endpoint.rs | 20 ++++++++++- - src/error.rs | 2 +- - src/lib.rs | 7 +++- - 7 files changed, 173 insertions(+), 22 deletions(-) -``` - - -## 2019-04-15, Version 0.1.0 -### Commits -- [[`8c6ecd6`](https://github.com/rustasync/tide/commit/8c6ecd695845b7460ee9098c29ac9c0292886a45)] (cargo-release) version 0.1.0 (Yoshua Wuyts) -- [[`2791a61`](https://github.com/rustasync/tide/commit/2791a61b334da2cc309a2e8206c69b4c2e6e8346)] re-export http crate (#166) (Thomas Lee) -- [[`dc36c89`](https://github.com/rustasync/tide/commit/dc36c898ff145a4175aee074bea0e291a1d47ffb)] fix: Capture wildcard path correctly, resolve #167. (#171) (Nicholas) -- [[`c70d2bc`](https://github.com/rustasync/tide/commit/c70d2bcd5ee4c0a09a87055ba7973e4c59d09156)] example: remove asterisk from route params. Resolves #167. (#168) (Nicholas) -- [[`dc28fd5`](https://github.com/rustasync/tide/commit/dc28fd5601d8b8d071de999e080f2c347c3fd61d)] Follow up to #156 (Aaron Turon) -- [[`7a9519a`](https://github.com/rustasync/tide/commit/7a9519a308f1dcc2572a8887040cdeae4590bfb6)] Merge pull request #161 from rustasync/inline-docs (Aaron Turon) -- [[`e51c0c8`](https://github.com/rustasync/tide/commit/e51c0c863be21760e90b8c3b640e7892df28a207)] inline docs (Yoshua Wuyts) -- [[`f8d00ad`](https://github.com/rustasync/tide/commit/f8d00adfb2c72733fb47a5b11e311af455074a3b)] Merge pull request #156 from aturon/revamp (Aaron Turon) -- [[`adba649`](https://github.com/rustasync/tide/commit/adba649a79a992e1eb1d5db4abfdf3ca805d76b1)] Revamp Tide, dropping Extractors and simplifying the framework (Aaron Turon) -- [[`d14e8f8`](https://github.com/rustasync/tide/commit/d14e8f82f0df3dec25f55a8f26749a4aca384837)] Update references to old repository (#157) (Pradip Caulagi) -- [[`7e87e4e`](https://github.com/rustasync/tide/commit/7e87e4e0699a3fff4453c8a25d3f8f5fa186fdbb)] Update to nightly-2019-02-27 and make it default (#146) (Wonwoo Choi) -- [[`70ed8aa`](https://github.com/rustasync/tide/commit/70ed8aa44a9eba129d879304630c406caab2fee5)] Merge pull request #142 from gruberb/use_external_http_service_mock (Wonwoo Choi) -- [[`56e5076`](https://github.com/rustasync/tide/commit/56e5076c469fc525bf8fec241aece8f2eb14045e)] Update the CI badge to point to rustasync/tide (#145) (David Cornu) -- [[`9bef037`](https://github.com/rustasync/tide/commit/9bef0370dc0554a2f1d49952d893d4d3dfe9da83)] Update blog post URLs after wg-net repo move (#144) (Tim Neumann) -- [[`644f47e`](https://github.com/rustasync/tide/commit/644f47e8ddc614de9786954f1e0e68965516f70a)] Add routes to each test (Bastian Gruber) -- [[`8170c5f`](https://github.com/rustasync/tide/commit/8170c5f27ad52b8b096fe9d541f9a9ca200ef5a4)] Add external crate http_service_mock, delete local TestBackend (Bastian Gruber) -- [[`bb7ad2b`](https://github.com/rustasync/tide/commit/bb7ad2bdcf7a451e7c9211fc13098baa96042a0a)] Update changelog (Yoshua Wuyts) - -### Stats -```diff - .github/PULL_REQUEST_TEMPLATE.md | 2 +- - .travis.yml | 5 +- - CHANGELOG.md | 31 ++ - Cargo.toml | 10 +- - README.md | 12 +- - examples/body_types.rs | 53 ++- - examples/catch_all.rs | 14 +- - examples/cli_parsing.rs | 48 --- - examples/computed_values.rs | 38 --- - examples/configuration.rs | 34 -- - examples/cookie_extractor.rs | 11 +- - examples/default_handler.rs | 13 - - examples/default_headers.rs | 4 +- - examples/graphql.rs | 32 +- - examples/hello.rs | 5 +- - examples/messages.rs | 53 ++- - examples/multipart-form/main.rs | 17 +- - examples/named_path.rs | 29 -- - examples/simple_nested_router.rs | 38 --- - src/app.rs | 464 ++++++++++++++++--------- - src/body.rs | 351 ------------------- - src/configuration/default_config.rs | 79 ----- - src/configuration/mod.rs | 156 --------- - src/context.rs | 141 ++++++++ - src/cookies.rs | 51 ++- - src/endpoint.rs | 167 ++------- - src/error.rs | 102 ++++++ - src/extract.rs | 20 -- - src/forms.rs | 55 +++ - src/head.rs | 225 ------------ - src/lib.rs | 41 ++- - src/middleware/default_headers.rs | 32 +- - src/middleware/logger.rs | 39 ++- - src/middleware/mod.rs | 63 ++-- - src/request.rs | 65 ---- - src/response.rs | 25 +- - src/route.rs | 101 ++++++ - src/router.rs | 657 +++--------------------------------- - src/serve.rs | 4 - - tests/wildcard.rs | 70 +--- - 40 files changed, 1036 insertions(+), 2321 deletions(-) -``` - - -## 2019-02-26, Version 0.0.5 -### Commits -- [[`990c80f78e`](https://github.com/rust-net-web/tide/commit/990c80f78e5622a751a5d2d4948cd005616e84f8)] (cargo-release) version 0.0.5 (Yoshua Wuyts) -- [[`61f2aa5bf7`](https://github.com/rust-net-web/tide/commit/61f2aa5bf71f8eff34b1f9dcbb97e83a86f33b92)] Extract serve.rs into a separate crate (#140) (Wonwoo Choi) -- [[`b4d0806a15`](https://github.com/rust-net-web/tide/commit/b4d0806a15e50ccbfcffeaf5bb6f767019269670)] Merge pull request #139 from aturon/http-service (Aaron Turon) -- [[`092fc7f4e4`](https://github.com/rust-net-web/tide/commit/092fc7f4e4764b3a4c0101046f0ceced95f09194)] update rust version (Aaron Turon) -- [[`703d41b79a`](https://github.com/rust-net-web/tide/commit/703d41b79a3089640731cae2de54b4dec0c0c93a)] rustfmt (Aaron Turon) -- [[`fe0c39cc60`](https://github.com/rust-net-web/tide/commit/fe0c39cc60b0ff54bc577a3d8d21b4821c13841a)] Update to use new Body::into_vec method (Aaron Turon) -- [[`369095140d`](https://github.com/rust-net-web/tide/commit/369095140d0acdad0656e0d79a3a64c9aae87436)] update tests (Aaron Turon) -- [[`9fee015612`](https://github.com/rust-net-web/tide/commit/9fee015612fc89c78fb5555a837ad03af2c32ef1)] Refactor to use HttpService internally (Aaron Turon) -- [[`1fb71bf421`](https://github.com/rust-net-web/tide/commit/1fb71bf421ef27b6acf8c23d5d0a267a9b385d62)] Move to http_service::Body (Aaron Turon) -- [[`c727750a69`](https://github.com/rust-net-web/tide/commit/c727750a694b0a2f217eb391a5d8d9f07b722802)] docs: updated docs to have correct default port (#137) (Matt Gathu) -- [[`b02220a06a`](https://github.com/rust-net-web/tide/commit/b02220a06aac5bf42455bcc6c9bdc36368fe9a9f)] Update changelog (Yoshua Wuyts) - -### Stats -```diff - .travis.yml | 3 +- - CHANGELOG.md | 18 +++++++- - Cargo.toml | 25 ++++++---- - src/app.rs | 58 ++++++++---------------- - src/body.rs | 133 +++++-------------------------------------------------- - src/lib.rs | 4 +- - src/request.rs | 3 +- - src/response.rs | 3 +- - src/router.rs | 27 ++++------- - src/serve.rs | 4 ++- - tests/wildcard.rs | 96 ++++++++++++++++++++++++++++++++++++++++- - 11 files changed, 189 insertions(+), 185 deletions(-) -``` - - -## 2019-02-04, Version 0.0.4 -### Commits -- [[`2128abc1d0`](https://github.com/rust-net-web/tide/commit/2128abc1d01b95eabdfadc8ce2d587ba2bb1d62e)] (cargo-release) version 0.0.4 (Yoshua Wuyts) -- [[`cbd7525557`](https://github.com/rust-net-web/tide/commit/cbd7525557ee7ddb65a6ed5103618df5263cd5a6)] pin nightly version on CI (#136) (Yoshua Wuyts) -- [[`3455f96cf9`](https://github.com/rust-net-web/tide/commit/3455f96cf9eca83baad31d9a2a7170f9f1a6fde3)] Merge pull request #135 from rust-net-web/fix-env-pub (Aaron Turon) -- [[`9402aef6d5`](https://github.com/rust-net-web/tide/commit/9402aef6d58e3207100c6d4d177ba1de2fa2eaa1)] make the Environment struct public (Yoshua Wuyts) -- [[`012b49dc15`](https://github.com/rust-net-web/tide/commit/012b49dc1576821fcb637802e552dae5409041b5)] Update changelog (Yoshua Wuyts) - -### Stats -```diff - .travis.yml | 1 + - CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ - Cargo.toml | 2 +- - src/configuration/mod.rs | 2 +- - 4 files changed, 35 insertions(+), 2 deletions(-) -``` - - -## 2019-01-31, Version 0.0.3 -### Commits -- [[`658aa8222a`](https://github.com/rust-net-web/tide/commit/658aa8222a6467e289ee992eeed7b7cfb27ebf5b)] (cargo-release) version 0.0.3 (Yoshua Wuyts) -- [[`4aeb4b831d`](https://github.com/rust-net-web/tide/commit/4aeb4b831d883819a20d61ed48e3f4bce3f7f731)] Fixes GH-130 (#133) (Yoshua Wuyts) -- [[`5f7e387bb0`](https://github.com/rust-net-web/tide/commit/5f7e387bb09f4fae4318db7b030dd6b3ccfc613c)] Merge pull request #132 from bIgBV/cli-example (Bhargav) -- [[`af8db24cdd`](https://github.com/rust-net-web/tide/commit/af8db24cdd491f14ef067efa615120c46e58d144)] change 'Content-Type' for IntoResponse::into_response(Vec) (#124) (DCjanus) -- [[`fd575921f8`](https://github.com/rust-net-web/tide/commit/fd575921f80d607087f2c46228f80db38f2e6818)] Basic cookie extractor (#114) (Murali) -- [[`6554105144`](https://github.com/rust-net-web/tide/commit/6554105144ae989648ba3827ba799203db30f0c1)] Add example to show CLI parsing integration with tide app (Bhargav Voleti) -- [[`bf1e3d8103`](https://github.com/rust-net-web/tide/commit/bf1e3d8103d66994b8510317f0544e83359035b2)] Merge pull request #131 from rust-net-web/tmp-fix-dep (Wonwoo Choi) -- [[`bf7cb2e145`](https://github.com/rust-net-web/tide/commit/bf7cb2e145f90967962d52ee4bfe33608c971fef)] temporarily override fix-cookie source (Yoshua Wuyts) -- [[`4517d11c32`](https://github.com/rust-net-web/tide/commit/4517d11c32123ef47745a0a32a6ba9c7f2f22806)] Fix links from contributing to code of conduct (#128) (HeroicKatora) -- [[`efd51ac407`](https://github.com/rust-net-web/tide/commit/efd51ac4073a30daff53afd3f807dc8ec23b8f2e)] Clean up doctests and messages example via Default trait (#125) (whentze) -- [[`9b3fe0c9dd`](https://github.com/rust-net-web/tide/commit/9b3fe0c9ddcbeca08b9815f51164b22f263e854b)] Update changelog (Yoshua Wuyts) - -### Stats -```diff - .github/CONTRIBUTING.md | 6 +- - .gitignore | 1 +- - CHANGELOG.md | 226 ++++++++++++++++++++++++++++++++++++++++++++- - Cargo.toml | 6 +- - examples/cli_parsing.rs | 48 +++++++++- - examples/cookie_extractor.rs | 18 ++++- - examples/messages.rs | 10 +-- - src/app.rs | 12 +-- - src/cookies.rs | 55 +++++++++++- - src/endpoint.rs | 12 +-- - src/lib.rs | 2 +- - src/response.rs | 20 +++- - 12 files changed, 381 insertions(+), 35 deletions(-) -``` - - -## 2019-01-18, Version 0.0.1 -### Commits -- [[`ae2faa1eef`](https://github.com/rust-net-web/tide/commit/ae2faa1eefba07e551e5766e458555a3a3109062)] (cargo-release) version 0.0.1 (Yoshua Wuyts) -- [[`f0599031e3`](https://github.com/rust-net-web/tide/commit/f0599031e332b2ccfd6dcd391fbcaa56a6cde246)] Merge pull request #122 from tirr-c/intoresponse-no-static (Aaron Turon) -- [[`fe734d7df3`](https://github.com/rust-net-web/tide/commit/fe734d7df3f3b025e7142f74516c448b3f4c476f)] Relieve lifetime bound of IntoResponse (Wonwoo Choi) -- [[`ef4406766a`](https://github.com/rust-net-web/tide/commit/ef4406766a11716f5ab56b7bf953a003b4d826b1)] use path-table crate (#121) (Yoshua Wuyts) -- [[`71393645c0`](https://github.com/rust-net-web/tide/commit/71393645c07075df8cedb0bf1703a7acddca0594)] Per-endpoint configuration (#109) (Wonwoo Choi) -- [[`5f4cc3d6cb`](https://github.com/rust-net-web/tide/commit/5f4cc3d6cbbc3666c70106090cf235a97119d503)] Update futures-preview to 0.3.0-alpha.12 (#119) (Wonwoo Choi) -- [[`5be7493412`](https://github.com/rust-net-web/tide/commit/5be74934125a5b3e79bca7aa9ffd4f240ca04050)] Merge pull request #118 from tirr-c/response-status (Aaron Turon) -- [[`8be6d4c445`](https://github.com/rust-net-web/tide/commit/8be6d4c4454f2bc0853e205bcd8aaa78e7f6b34c)] Run rustfmt (Wonwoo Choi) -- [[`ddd47656fc`](https://github.com/rust-net-web/tide/commit/ddd47656fcca91b292108bfdfb9ad2bb049d8a0a)] Add status code modifier for IntoResponse (Wonwoo Choi) -- [[`14a13e5347`](https://github.com/rust-net-web/tide/commit/14a13e5347fa40c124b156ce9d0afaba93550c10)] Make it allocate less when running middleware chain (#110) (Wonwoo Choi) -- [[`c8e43e52ee`](https://github.com/rust-net-web/tide/commit/c8e43e52ee45c8739bd6674a61723e411cc6535c)] Update futures-preview and pin-utils (#113) (Wonwoo Choi) -- [[`23905de5f5`](https://github.com/rust-net-web/tide/commit/23905de5f501406809ade4332b073faff615ee8a)] Fix repository location in Cargo.toml (#111) (Artem Vorotnikov) -- [[`f3a9357dd1`](https://github.com/rust-net-web/tide/commit/f3a9357dd17d3888c2a907b1c8b3240db9f040fa)] Merge pull request #97 from pbvie/doc-examples (Aaron Turon) -- [[`1ed6a44cda`](https://github.com/rust-net-web/tide/commit/1ed6a44cda0815446f674596cdc724ad5ca17c46)] Add IntoResponse for Vec and Bytes (Petra Bierleutgeb) -- [[`721f9540d7`](https://github.com/rust-net-web/tide/commit/721f9540d797f0ebd373d126a7af08ed04920a7f)] Merge pull request #93 from tirr-c/catch-all (Aaron Turon) -- [[`4410f4c725`](https://github.com/rust-net-web/tide/commit/4410f4c72513b65fb2bf4e35e21a58df9acf4da7)] Run rustfmt (Wonwoo Choi) -- [[`e18e0b5066`](https://github.com/rust-net-web/tide/commit/e18e0b5066b6b93d37e8080b077446117af52293)] Rename: WildcardCountModifier -> WildcardKind (Wonwoo Choi) -- [[`0da52f993e`](https://github.com/rust-net-web/tide/commit/0da52f993e3988bd76bddf83463760fd7596c8d3)] Add docs about wildcard modifiers (Tirr) -- [[`61e96edf3b`](https://github.com/rust-net-web/tide/commit/61e96edf3bfb5fee4298165481cd53d84b696af9)] Add a tiny catch-all endpoint example (Tirr) -- [[`2e399c1974`](https://github.com/rust-net-web/tide/commit/2e399c19741e7df076e951c0c75173cd979e85b7)] path_table: Add support for wildcard count modifier (Tirr) -- [[`df9876b6c4`](https://github.com/rust-net-web/tide/commit/df9876b6c493d54c8840e01b26de2229303e261a)] Merge pull request #91 from tirr-c/multipart-features (Aaron Turon) -- [[`d87cc0c7a2`](https://github.com/rust-net-web/tide/commit/d87cc0c7a2db763ff74cabd8d985a79b1dec84db)] Update description for AppData (Petra Bierleutgeb) -- [[`6e4d1ac3d6`](https://github.com/rust-net-web/tide/commit/6e4d1ac3d6cd7d2609d4c8a04598459ec1c7ec7e)] Add examples to API docs (Petra Bierleutgeb) -- [[`e1f5c324c4`](https://github.com/rust-net-web/tide/commit/e1f5c324c43148997f590b3f811bc24795007f82)] Merge pull request #88 from hseeberger/rename-path-component-segment (Theodore Zilist) -- [[`7b39638444`](https://github.com/rust-net-web/tide/commit/7b396384446ff1fb06c7ed87b6d69c215de017b4)] Rename path component to path segment (Heiko Seeberger) -- [[`ab1eea97ee`](https://github.com/rust-net-web/tide/commit/ab1eea97ee30442af3af65d35f56ca89f2f55625)] Merge pull request #94 from tzilist/github-templates (Aaron Turon) -- [[`08405f9b98`](https://github.com/rust-net-web/tide/commit/08405f9b983e20a425c0f261d2e76bdbde3b7b31)] add question template (Theodore Zilist) -- [[`3958ed8b1b`](https://github.com/rust-net-web/tide/commit/3958ed8b1b3a2b33d42f9ad65d1f77d1af36f2f5)] add github templates (Theodore Zilist) -- [[`a973f2758a`](https://github.com/rust-net-web/tide/commit/a973f2758a3a49fac2a4f5d712f2da32d914e3f0)] Merge pull request #92 from DeltaManiac/master (Theodore Zilist) -- [[`c704f41983`](https://github.com/rust-net-web/tide/commit/c704f41983767a1008f7059370d3c12f827f3c25)] Merge pull request #64 from tzilist/feat-default-handler (Wonwoo Choi) -- [[`2e5da53e36`](https://github.com/rust-net-web/tide/commit/2e5da53e3623b6c9f2b12bb7844ba6e75a63469f)] refactor (Theodore Zilist) -- [[`41160d83f4`](https://github.com/rust-net-web/tide/commit/41160d83f47fbe731d585b5f014bfa11c95d0bc7)] remove superflous Arc (Theodore Zilist) -- [[`f209db3386`](https://github.com/rust-net-web/tide/commit/f209db3386518a180a5f5883b9e05b0930a05614)] fix tests (Theodore Zilist) -- [[`9be6fb6bdc`](https://github.com/rust-net-web/tide/commit/9be6fb6bdc3c514ba7ff880b684fc2a1a560bae9)] change example port (Theodore Zilist) -- [[`f6cf7252e0`](https://github.com/rust-net-web/tide/commit/f6cf7252e0fb35e31388060056990eb0de2ed2b6)] chore: refactor to app and clone handler down to router (Theodore Zilist) -- [[`59897f858e`](https://github.com/rust-net-web/tide/commit/59897f858e75b8aa685c2c79e3d3923f41d75e02)] make params optional (Theodore Zilist) -- [[`7abd4e00fe`](https://github.com/rust-net-web/tide/commit/7abd4e00fea1bfa450e377f4cfe89ae193196e64)] refactor: remove unnessary trait (Theodore Zilist) -- [[`5e2b193c1d`](https://github.com/rust-net-web/tide/commit/5e2b193c1ddd7b3e9ce0c167d0da88338731b898)] set small doc on function at app level (Theodore Zilist) -- [[`325eae94b8`](https://github.com/rust-net-web/tide/commit/325eae94b8d82f83d48acbbe5a61bfb6f6bd73ac)] initial implementation of default handler completed (Theodore Zilist) -- [[`36c849877b`](https://github.com/rust-net-web/tide/commit/36c849877b80841e9a0e3456bd851e2e4c20fe85)] Added blog entry to Readme.md (DeltaManiac) -- [[`80e35bdcf0`](https://github.com/rust-net-web/tide/commit/80e35bdcf081103dd2434d292f1e991f1e3c5852)] Merge remote-tracking branch 'upstream/master' (DeltaManiac) -- [[`19d0a2df24`](https://github.com/rust-net-web/tide/commit/19d0a2df240fbe152688a68928889864f3619397)] Enable only needed features for multipart (Tirr) -- [[`c6a03eee1e`](https://github.com/rust-net-web/tide/commit/c6a03eee1e75ad080829837620b7dbb434f78598)] Merge pull request #90 from leaxoy/master (Wonwoo Choi) -- [[`5ec29a5e78`](https://github.com/rust-net-web/tide/commit/5ec29a5e78134557be675067437cb6ec32fec3c9)] fix futures build error (lixiaohui) -- [[`f7e084d3f2`](https://github.com/rust-net-web/tide/commit/f7e084d3f2a29618face710c4598d0d0f797fd12)] Merge pull request #81 from ibaryshnikov/body-types-usage-simplified (Aaron Turon) -- [[`210db7a453`](https://github.com/rust-net-web/tide/commit/210db7a453c6e245fca2fd71e8764fcb9ccf32de)] implemented DerefMut for body and query types (ibaryshnikov) -- [[`3e750752cd`](https://github.com/rust-net-web/tide/commit/3e750752cd1f903a43953a3e2c9a9559d3eeb794)] Merge pull request #76 from hseeberger/18_document_routing_syntax (Aaron Turon) -- [[`f0e82a95e5`](https://github.com/rust-net-web/tide/commit/f0e82a95e55543eba918bfdda54780ab11f761aa)] Merge pull request #80 from simonasker/extend-cookie-example (Aaron Turon) -- [[`fbcc358b3a`](https://github.com/rust-net-web/tide/commit/fbcc358b3adc1c1246b2c1cc99e23a772c51ed3e)] Merge pull request #79 from ibaryshnikov/unify-listening-ports-in-examples (Aaron Turon) -- [[`41f374b679`](https://github.com/rust-net-web/tide/commit/41f374b6798327f59c4a4d0c0c247e6c41f21ca6)] Extend cookie example (Simon Andersson) -- [[`854dbd53c7`](https://github.com/rust-net-web/tide/commit/854dbd53c773acf9d3cdeff51365fa1257c94999)] removed unused import (ibaryshnikov) -- [[`9ae1f13b8d`](https://github.com/rust-net-web/tide/commit/9ae1f13b8dbdd00945619c3695545052420b854a)] implemented Deref for body types and some Path types, updated examples (ibaryshnikov) -- [[`1d97b2c312`](https://github.com/rust-net-web/tide/commit/1d97b2c3125fbc39eb13b611639e8c9341372305)] use the same port in examples, also print the address (ibaryshnikov) -- [[`853f6204c5`](https://github.com/rust-net-web/tide/commit/853f6204c5ce6b103dddc46d332b3e4426baef5a)] Merge pull request #74 from hoodie/feature/example/computed-values (Aaron Turon) -- [[`9863cd9f82`](https://github.com/rust-net-web/tide/commit/9863cd9f826d38bc3b7ea359b8e382aa782fed2c)] Fixes and improvement (Heiko Seeberger) -- [[`cacdeffd8b`](https://github.com/rust-net-web/tide/commit/cacdeffd8b09980603cafcdba0eafb2527abee2c)] Documemnt routing syntax (Heiko Seeberger) -- [[`7c21c01bfa`](https://github.com/rust-net-web/tide/commit/7c21c01bfa6bcca9ce90ecfc107596178c7f350f)] Expose Computed Values Api (Hendrik Sollich) -- [[`0c8a132086`](https://github.com/rust-net-web/tide/commit/0c8a1320867bef6f7ede3eee1f169cc5634be960)] Merge pull request #68 from hseeberger/typo_default_headers (Aaron Turon) -- [[`181f582f1d`](https://github.com/rust-net-web/tide/commit/181f582f1dc4f39feb119467763276947b6bbf82)] Merge pull request #70 from ibaryshnikov/default-content-type-set-to-utf-8 (Aaron Turon) -- [[`c5c830d99e`](https://github.com/rust-net-web/tide/commit/c5c830d99eb814294da5fbd548d8e4f56c049f30)] Merge pull request #71 from caulagi/fix-travis-badge-2 (Aaron Turon) -- [[`3a1623d5dd`](https://github.com/rust-net-web/tide/commit/3a1623d5dd8854d2191e6a7fb8ba6b868ed52e56)] Merge pull request #72 from hoodie/feature/travis-nightly (Aaron Turon) -- [[`2c31ba5fbd`](https://github.com/rust-net-web/tide/commit/2c31ba5fbd1419d6b0b719566d8ab8d970cf01b0)] Pin a specific nightly version for travis builds (Hendrik Sollich) -- [[`8baee03649`](https://github.com/rust-net-web/tide/commit/8baee03649bc8122f15f88a3953a3f4631730171)] Fix the travis badge again (Pradip Caulagi) -- [[`ffc77f16ec`](https://github.com/rust-net-web/tide/commit/ffc77f16ec39ec90afd1ebbeec8b9974c50e399f)] set default content type for strings to utf-8 (ibaryshnikov) -- [[`cb22f4546e`](https://github.com/rust-net-web/tide/commit/cb22f4546eef2b4ed6f01b9da03f2f7b89f9cdd4)] Fix typo in default_headers example (Heiko Seeberger) -- [[`bdde7d3d69`](https://github.com/rust-net-web/tide/commit/bdde7d3d69bf0b25c5ed4edaf05defb72302aa94)] Merge remote-tracking branch 'upstream/master' (DeltaManiac) -- [[`c9999f2cd4`](https://github.com/rust-net-web/tide/commit/c9999f2cd4d67ab5b855180d574cd39314d34482)] Merge pull request #66 from caulagi/fix-travis-badge (Theodore Zilist) -- [[`9a1040f64e`](https://github.com/rust-net-web/tide/commit/9a1040f64ee1df2f17ed5875a8f4e02d780308e7)] Fix travis badge to show build status (Pradip Caulagi) -- [[`07e436ab01`](https://github.com/rust-net-web/tide/commit/07e436ab01b9a3f3a856bcc6729e5c9073a3f837)] Merge pull request #52 from bIgBV/logging-middleware (Aaron Turon) -- [[`84d1a09361`](https://github.com/rust-net-web/tide/commit/84d1a0936172a405bda6f51d9574a79ceb90151b)] Rebase master and update RootLogger to use new middleware structure (Bhargav Voleti) -- [[`7431da8787`](https://github.com/rust-net-web/tide/commit/7431da87878b43641df3e65bf5f6cf4c4117c358)] rustfmt changes (Bhargav Voleti) -- [[`89ad3148a2`](https://github.com/rust-net-web/tide/commit/89ad3148a2fc5556a2c50b7b352a2393f55af7b2)] Use data stored in Head (Bhargav Voleti) -- [[`9ac66bbf3d`](https://github.com/rust-net-web/tide/commit/9ac66bbf3d09595a2e4192e8eff6872ac88b88a2)] Rename Logger to RootLogger (Bhargav Voleti) -- [[`69ca6cd1a9`](https://github.com/rust-net-web/tide/commit/69ca6cd1a9c0f3e8dcce008e2b2287d92ebd1784)] Add basic logger to log request information. (Bhargav Voleti) -- [[`9ee7426fda`](https://github.com/rust-net-web/tide/commit/9ee7426fda8c337d2ead99c9f92612a23f31d243)] Merge pull request #59 from tirr-c/extract-url-table (Aaron Turon) -- [[`4b9b5d53ce`](https://github.com/rust-net-web/tide/commit/4b9b5d53ce2f53ce213e10974ef4bdbde594aecd)] Update .travis.yml to run tests of all crates (Wonwoo Choi) -- [[`20fec26616`](https://github.com/rust-net-web/tide/commit/20fec2661631a57e031e693cc3929b3c6b5975c8)] Fix clippy for path_table (Wonwoo Choi) -- [[`834717ef4c`](https://github.com/rust-net-web/tide/commit/834717ef4c28792b8086e3de8ca4b44222b7b3d2)] Run rustfmt (Wonwoo Choi) -- [[`93dcb5e69a`](https://github.com/rust-net-web/tide/commit/93dcb5e69a5a867cc8c242a138cd8bd32fbc8842)] Extract `url_table` into `path_table` crate (Wonwoo Choi) -- [[`ae6591aefb`](https://github.com/rust-net-web/tide/commit/ae6591aefbd74015ed336cccbaff77b8320a35b8)] Merge pull request #58 from tirr-c/around-middleware (Aaron Turon) -- [[`1b4b4474a8`](https://github.com/rust-net-web/tide/commit/1b4b4474a8990063356ca26b20733e453f7998ad)] Remove ResponseContext (Tirr) -- [[`5a16e88d9c`](https://github.com/rust-net-web/tide/commit/5a16e88d9c434a32a2f81a7e6185f703604410b9)] Get rid of ReqResMiddleware (Tirr) -- [[`e7651f8770`](https://github.com/rust-net-web/tide/commit/e7651f8770a15e6cb938f7e9836ed4c32253eede)] Add Middleware impl for closures (Tirr) -- [[`c123fe900d`](https://github.com/rust-net-web/tide/commit/c123fe900dc5b63a86bdcb0db870a01e11ccedf7)] Relieve trait bound for Middleware (Tirr) -- [[`01e4f7a58c`](https://github.com/rust-net-web/tide/commit/01e4f7a58c029ea34cfe513af362b6279b64dbf0)] Fix tests (Tirr) -- [[`94d95a4558`](https://github.com/rust-net-web/tide/commit/94d95a45584a58c9b2aab99e18b63ec185902186)] Make DefaultHeaders middleware use wrap-around middleware (Tirr) -- [[`06c01a0ba0`](https://github.com/rust-net-web/tide/commit/06c01a0ba0c2c360b1faee1d017deff75f677b12)] Experiment: Wrap-around middleware (Tirr) -- [[`8cc895f0ec`](https://github.com/rust-net-web/tide/commit/8cc895f0ecce882b9579f5626982900110387552)] Merge pull request #46 from tirr-c/subrouter (Wonwoo Choi) -- [[`092cc1e64e`](https://github.com/rust-net-web/tide/commit/092cc1e64ea248c4957df6017aa6b345b8d8f87c)] Take a slightly different approach for middleware (Wonwoo Choi) -- [[`4af918de5b`](https://github.com/rust-net-web/tide/commit/4af918de5bef30d9402d356ef504de4f1c054150)] Fix tests (Wonwoo Choi) -- [[`fe0b77cf69`](https://github.com/rust-net-web/tide/commit/fe0b77cf6986ef9de736709a4d393d17486c2dde)] Merge remote-tracking branch 'upstream/master' into subrouter (Wonwoo Choi) -- [[`6e3530c7aa`](https://github.com/rust-net-web/tide/commit/6e3530c7aa4971bb6fca3a340c8b2dddc4fe7956)] Set method of the Request for testing (Wonwoo Choi) -- [[`17f494063a`](https://github.com/rust-net-web/tide/commit/17f494063a147ac22598f01acd4eb8a40cf6d11f)] Merge pull request #57 from tirr-c/middleware-lifetime (Wonwoo Choi) -- [[`c046ce6f70`](https://github.com/rust-net-web/tide/commit/c046ce6f70e1a3036497d85b91cdca22b4cf0fb0)] Change return type of `request` to Result<(), Response> (Wonwoo Choi) -- [[`ae2416a1bb`](https://github.com/rust-net-web/tide/commit/ae2416a1bb2347552ba73fc58e6286a60d56699a)] Specify output lifetime for App::at (Aaron Turon) -- [[`eba71f062e`](https://github.com/rust-net-web/tide/commit/eba71f062e9f1e57281a1f12779cd199b2417f41)] Merge pull request #55 from leaxoy/master (Aaron Turon) -- [[`35dd9eb908`](https://github.com/rust-net-web/tide/commit/35dd9eb9083d4161fff0644d8e6b232228b74517)] Merge pull request #47 from liufuyang/multipart-form-file-upload (Aaron Turon) -- [[`2215e2d723`](https://github.com/rust-net-web/tide/commit/2215e2d7232484d05ac02d69435a7af6a61a8dc4)] Relieve middleware FutureObj lifetime bounds (Wonwoo Choi) -- [[`cb11f3a80b`](https://github.com/rust-net-web/tide/commit/cb11f3a80b0952e8128a849289f29a206fbd1097)] Allow handel file upload via multipart form (Fuyang Liu) -- [[`764d83f43b`](https://github.com/rust-net-web/tide/commit/764d83f43b965d04a71169488f6b90fe8fe7a4f6)] Merge pull request #44 from jnicklas/form-extractors (Wonwoo Choi) -- [[`e45f6a592c`](https://github.com/rust-net-web/tide/commit/e45f6a592c66697c70f96fc58beac9b08f72bcc9)] add rest method to Resource (lixiaohui) -- [[`3c83d7ba62`](https://github.com/rust-net-web/tide/commit/3c83d7ba62eb8b22c75e034209f385aa14e99437)] Use impl trait for builder type (Wonwoo Choi) -- [[`8fe1daa530`](https://github.com/rust-net-web/tide/commit/8fe1daa530c6146b408a7102760493a4001a3e8f)] Downcase content types (Jonas Nicklas) -- [[`a2b4599f8d`](https://github.com/rust-net-web/tide/commit/a2b4599f8d3e97218cd174209c28859ccebe68cc)] Make `Resource` public (Tirr) -- [[`263cb249f8`](https://github.com/rust-net-web/tide/commit/263cb249f8b7655eb21c359ef785a643d39af234)] Document `Router` (Tirr) -- [[`fed6edc466`](https://github.com/rust-net-web/tide/commit/fed6edc466a0d363238369dbf23f12561795ad15)] Add Router tests (Tirr) -- [[`f2bc72a450`](https://github.com/rust-net-web/tide/commit/f2bc72a4505ebb863e80c03e79f31c7e7f2f7aa3)] Change middleware application method (Tirr) -- [[`06a358f95d`](https://github.com/rust-net-web/tide/commit/06a358f95dde8432bfaca55aeefa73adfd461aac)] Rename Resource to ResourceData, and make it private (Tirr) -- [[`a125f8fcea`](https://github.com/rust-net-web/tide/commit/a125f8fceaab517d8ba633f18df6a37b6a91e55c)] Add resource existence check to .nest (Wonwoo Choi) -- [[`4bb3d3f198`](https://github.com/rust-net-web/tide/commit/4bb3d3f19861d567ad319372d4ce93a7c04a7970)] Add simple nested router example (Wonwoo Choi) -- [[`dfe72abe23`](https://github.com/rust-net-web/tide/commit/dfe72abe238ad7afd642c4b546596393bd1bdade)] Add subrouter and per-endpoint middleware support (Wonwoo Choi) -- [[`a724ef3561`](https://github.com/rust-net-web/tide/commit/a724ef35610ef4074c6141e2afdd13335a56e896)] Merge pull request #42 from tzilist/feat-default-headers (Wonwoo Choi) -- [[`145911b8b2`](https://github.com/rust-net-web/tide/commit/145911b8b29ab084a903fa241c7d022d2a79b096)] update map_err now maps into http::error::Error (Theodore Zilist) -- [[`73dfd4dc26`](https://github.com/rust-net-web/tide/commit/73dfd4dc260eafcde5252eab736470302bf1a11c)] Add form data extraction from body via serde_qs (Jonas Nicklas) -- [[`1dac61cc6d`](https://github.com/rust-net-web/tide/commit/1dac61cc6d303f8508836f90d1c791756161d612)] Merge pull request #30 from csmoe/extract_query (Aaron Turon) -- [[`0894aa1aa6`](https://github.com/rust-net-web/tide/commit/0894aa1aa6a639bc879e29a4e1376dcc5300c82c)] #23 Handle HEAD requests (#31) (Harikrishnan Menon) -- [[`30c52918c2`](https://github.com/rust-net-web/tide/commit/30c52918c2b4244a1d9190253818c1db67e36dbe)] Merge remote-tracking branch 'upstream/master' (DeltaManiac) -- [[`e25e1d2ded`](https://github.com/rust-net-web/tide/commit/e25e1d2ded3a4df1bfe2f2af5c1ffe33951729fe)] rustfmt (DeltaManiac) -- [[`a61617d90e`](https://github.com/rust-net-web/tide/commit/a61617d90e381636b33ce39a5c8dd52c2b7bfced)] Readability Enhancements (DeltaManiac) -- [[`656b5cd347`](https://github.com/rust-net-web/tide/commit/656b5cd34772ab7b34a11e27483a13b860a6d2b1)] remove clippy lint opt-out (Theodore Zilist) -- [[`6a77bd8202`](https://github.com/rust-net-web/tide/commit/6a77bd82022603e0beb89120d859a7b13ce1529d)] remove commented out code (Theodore Zilist) -- [[`dd878b4b83`](https://github.com/rust-net-web/tide/commit/dd878b4b83e20114a6464f6cd4d73524184e82dd)] change or_with statement (Theodore Zilist) -- [[`98985fd857`](https://github.com/rust-net-web/tide/commit/98985fd85739afb13d6478b4d2cb946e4c1d41bd)] make changes based on comments (Theodore Zilist) -- [[`567a627033`](https://github.com/rust-net-web/tide/commit/567a627033dcf32f2c8e72610d074d779523d3e0)] add another header in the example (Theodore Zilist) -- [[`7fb05b9276`](https://github.com/rust-net-web/tide/commit/7fb05b9276804a567170f9dff68b1ac4faeaefae)] fix lint issues (Theodore Zilist) -- [[`858b1debfa`](https://github.com/rust-net-web/tide/commit/858b1debfa1ab8d938786574fae9444af991f41b)] feat: deafault headers middleware working (Theodore Zilist) -- [[`38bb80bfd9`](https://github.com/rust-net-web/tide/commit/38bb80bfd97888d4b8c06dae3f1cabe4d740752f)] extract query from url (csmoe) -- [[`a3c6549ada`](https://github.com/rust-net-web/tide/commit/a3c6549ada591174d65ad02097870a0d74d9518d)] changed unwrap to try (DeltaManiac) -- [[`2995b4405d`](https://github.com/rust-net-web/tide/commit/2995b4405dc9b54ea28063fa04425cdc27c4b4ba)] Merge pull request #33 from tzilist/master (Aaron Turon) -- [[`48e05987ee`](https://github.com/rust-net-web/tide/commit/48e05987ee4fcccf31fb7ecf74b6125763d391cb)] Merge remote-tracking branch 'upstream/master' (DeltaManiac) -- [[`4925028091`](https://github.com/rust-net-web/tide/commit/49250280914ced146503179a41369669f8241dc5)] fix formatting (Theodore Zilist) -- [[`f5995b0499`](https://github.com/rust-net-web/tide/commit/f5995b04999b23f17186c80c058f420c38259b55)] merge upstream changes (Theodore Zilist) -- [[`04321df8a4`](https://github.com/rust-net-web/tide/commit/04321df8a4c19a9ab99763803744cd71250ddbf2)] Merge pull request #40 from tirr-c/fix-travis (Aaron Turon) -- [[`6e4ba702bd`](https://github.com/rust-net-web/tide/commit/6e4ba702bd0db72a3d20e21c2748ec5fcec4f799)] Refactor (DeltaManiac) -- [[`029db9794b`](https://github.com/rust-net-web/tide/commit/029db9794b9551d4f5e7b410dacc17f292f43f39)] Fix clippy `type_complexity` (Wonwoo Choi) -- [[`b596a3cdad`](https://github.com/rust-net-web/tide/commit/b596a3cdad98d448734bcf0f49e37327b455dc44)] Fix clippy `wrong_self_convention` (Wonwoo Choi) -- [[`ee51444564`](https://github.com/rust-net-web/tide/commit/ee514445645c56207c953bd153dcb349b035a186)] Set rustfmt edition = "2018" (Wonwoo Choi) -- [[`477875c013`](https://github.com/rust-net-web/tide/commit/477875c013f9c7dbac6f390856f6f7745ce43864)] Fix some clippy lints (Wonwoo Choi) -- [[`651c4f36ba`](https://github.com/rust-net-web/tide/commit/651c4f36ba61d6bb9a3d08da85ce6f2d2b8a2d59)] Run rustfmt (Wonwoo Choi) -- [[`a8191a0efa`](https://github.com/rust-net-web/tide/commit/a8191a0efacad8b099d8003dee0f8bf9a1fd02b5)] Fix broken CI (Wonwoo Choi) -- [[`f498f598cc`](https://github.com/rust-net-web/tide/commit/f498f598ccecf433569415efa7c7da6c7c41d8d4)] Merge pull request #39 from tirr-c/example-graphql (Aaron Turon) -- [[`66885572f8`](https://github.com/rust-net-web/tide/commit/66885572f8a8f54caa2598cbf0048ff0daebb470)] Add some comments for GraphQL example (Wonwoo Choi) -- [[`6c2b9efc52`](https://github.com/rust-net-web/tide/commit/6c2b9efc520a71c683f0c6981592f02b6ef91108)] Merge pull request #38 from tirr-c/refactor-endpoint-impl (Aaron Turon) -- [[`bfc4707419`](https://github.com/rust-net-web/tide/commit/bfc4707419f87917a939d8be8bd4573b1fcc5579)] Add simple GraphQL example (Wonwoo Choi) -- [[`aa69f86619`](https://github.com/rust-net-web/tide/commit/aa69f8661999f8bafd3b9bb08e645c2e1cdb7dda)] Simplify `end_point_impl_raw!` rules (Wonwoo Choi) -- [[`1b0d6b67df`](https://github.com/rust-net-web/tide/commit/1b0d6b67df791f98a51596ef10ee5daf4a2117e8)] Refactor `end_point_impl!` (Wonwoo Choi) -- [[`caf0119534`](https://github.com/rust-net-web/tide/commit/caf011953404ef40b90225a06fd1ccf9bb34717b)] fix formatting to 4 tabs (Theodore Zilist) -- [[`40cbc2981d`](https://github.com/rust-net-web/tide/commit/40cbc2981d3b7252a012f93a59971fecacea89fc)] chore: remove formatting (Theodore Zilist) -- [[`520ca853d7`](https://github.com/rust-net-web/tide/commit/520ca853d7914ae2580f75999e1598401ed7ad85)] refactor: add types to body parsing as well as add a lossy interpreter (Theodore Zilist) -- [[`294c3113bb`](https://github.com/rust-net-web/tide/commit/294c3113bbb55b75cc6c0e746a57cd756b8871cd)] Merge pull request #35 from cramertj/strip-whitespace (Aaron Turon) -- [[`fdcb1774ce`](https://github.com/rust-net-web/tide/commit/fdcb1774ce17db6d9d6bd18f379c498e0d05b32d)] Merge pull request #36 from rust-net-web/revert-34-executor-agnostic (Aaron Turon) -- [[`0ad90b97e6`](https://github.com/rust-net-web/tide/commit/0ad90b97e6a4c40ad6cb932482ab1f34041a0602)] Revert "Allow running Tide on non-Tokio executors" (Aaron Turon) -- [[`2cbbce4288`](https://github.com/rust-net-web/tide/commit/2cbbce4288df11dae91ca3ea76dacd9e5d5814ea)] Merge pull request #34 from cramertj/executor-agnostic (Aaron Turon) -- [[`ae6e6fa220`](https://github.com/rust-net-web/tide/commit/ae6e6fa2204ada5fd3e85dff6d06ee777f96b59f)] Strip whitespace (Taylor Cramer) -- [[`214f789856`](https://github.com/rust-net-web/tide/commit/214f789856185df7c9b091aa075b157ffbee4e00)] Allow running Tide on non-Tokio executors (Taylor Cramer) -- [[`07b0dfb05e`](https://github.com/rust-net-web/tide/commit/07b0dfb05eb4bf3cb446ed7ea89176d840653db5)] Rustfmt (DeltaManiac) -- [[`aeba74d4f5`](https://github.com/rust-net-web/tide/commit/aeba74d4f5dfe8b6d53e7d68d511553710354441)] Fallback to HTTP GET implementation if HEAD implementaion is not present (DeltaManiac) -- [[`b311fccd43`](https://github.com/rust-net-web/tide/commit/b311fccd432fa40ed67af7030aa63f603d46ff91)] chore: run rustfmt on code (Theodore Zilist) -- [[`383b581286`](https://github.com/rust-net-web/tide/commit/383b581286aa7daf087f63df98be1439d1dea3c0)] update examples (Theodore Zilist) -- [[`f2edc44fcd`](https://github.com/rust-net-web/tide/commit/f2edc44fcd3f44d33fc96b1b4e1f3fec1bcbf47c)] feat: add examples of how to extract a string or vec (Theodore Zilist) -- [[`d16c8d56fe`](https://github.com/rust-net-web/tide/commit/d16c8d56fe9f75e003347c04653ed9e5e452499a)] feat: parsing body reqeusts to String and Vec seems to be working (Theodore Zilist) -- [[`e3564d8d82`](https://github.com/rust-net-web/tide/commit/e3564d8d829f69e1df8445f4126ceb58cc37ccc6)] Merge pull request #32 from Stinners/master (Aaron Turon) -- [[`b82e58fc17`](https://github.com/rust-net-web/tide/commit/b82e58fc172d01db169aacef4a209ca1deb6609f)] Fix spelling (Chris Stinson) -- [[`bbdd369f0e`](https://github.com/rust-net-web/tide/commit/bbdd369f0e6e8eb73d9f749efdb0e28eca674588)] Named path example (Chris Stinson) -- [[`916d7778ab`](https://github.com/rust-net-web/tide/commit/916d7778ab78b476bfe6c3edea700c228a53b3cd)] Add named path extractor (Chris Stinson) -- [[`013be3c6b8`](https://github.com/rust-net-web/tide/commit/013be3c6b8facf5b2d7efbbaf1727f0a375b509a)] handle HTTP HEAD (DeltaManiac) -- [[`967d41f6d4`](https://github.com/rust-net-web/tide/commit/967d41f6d4d0acbbcaae09a2fc7f25e38cd4823e)] Merge pull request #28 from dtolnay/slice (Aaron Turon) -- [[`b5059acfea`](https://github.com/rust-net-web/tide/commit/b5059acfea283ecf5e85648523b986061306ce37)] Merge pull request #29 from fbstj/patch-1 (Aaron Turon) -- [[`37f00da77c`](https://github.com/rust-net-web/tide/commit/37f00da77cc1320e186d8fe07d182e65567c74ee)] Update README.md (Joe ST) -- [[`6417e9e3cb`](https://github.com/rust-net-web/tide/commit/6417e9e3cb507b2a6e3dc35a8e499ceea740ea50)] Use serde_json::from_slice to deserialize from &[u8] (David Tolnay) -- [[`287acfcf35`](https://github.com/rust-net-web/tide/commit/287acfcf35334442df9402903f193c3658abce95)] accidental upload (Aaron Turon) -- [[`815c3314d6`](https://github.com/rust-net-web/tide/commit/815c3314d6480d4e4fa610d292cd5f1709210c74)] Initial implementation (Aaron Turon) -- [[`4085eed8aa`](https://github.com/rust-net-web/tide/commit/4085eed8aa9f43f6fa4e79186fb3c352117a04eb)] v0.0.0 (Yoshua Wuyts) -- [[`b67ec1b09e`](https://github.com/rust-net-web/tide/commit/b67ec1b09ec072898a2a4eb40b41477cc0e97510)] s/rise/tide (Yoshua Wuyts) -- [[`9da9a1ed0a`](https://github.com/rust-net-web/tide/commit/9da9a1ed0ad00c762168c909a9400b25197e78ca)] . (Yoshua Wuyts) - -### Stats -```diff - .github/CODE_OF_CONDUCT.md | 75 ++++- - .github/CONTRIBUTING.md | 63 +++- - .github/ISSUE_TEMPLATE/bug_report.md | 32 ++- - .github/ISSUE_TEMPLATE/feature_request.md | 16 +- - .github/ISSUE_TEMPLATE/question.md | 13 +- - .github/PULL_REQUEST_TEMPLATE.md | 28 +- - .github/stale.yml | 17 +- - .gitignore | 7 +- - .travis.yml | 12 +- - CERTIFICATE | 37 ++- - Cargo.toml | 40 ++- - LICENSE-APACHE | 190 +++++++++- - LICENSE-MIT | 21 +- - README.md | 18 +- - examples/body_types.rs | 56 +++- - examples/catch_all.rs | 14 +- - examples/computed_values.rs | 38 ++- - examples/configuration.rs | 34 ++- - examples/default_handler.rs | 13 +- - examples/default_headers.rs | 17 +- - examples/graphql.rs | 67 +++- - examples/hello.rs | 8 +- - examples/messages.rs | 85 ++++- - examples/multipart-form/main.rs | 73 ++++- - examples/multipart-form/test.txt | 1 +- - examples/named_path.rs | 29 +- - examples/simple_nested_router.rs | 38 ++- - rustfmt.toml | 2 +- - src/app.rs | 271 +++++++++++++- - src/body.rs | 456 ++++++++++++++++++++++- - src/configuration/default_config.rs | 79 ++++- - src/configuration/mod.rs | 156 ++++++++- - src/endpoint.rs | 181 +++++++++- - src/extract.rs | 20 +- - src/head.rs | 225 +++++++++++- - src/lib.rs | 35 ++- - src/middleware/default_headers.rs | 50 ++- - src/middleware/logger.rs | 44 ++- - src/middleware/mod.rs | 65 +++- - src/request.rs | 64 +++- - src/response.rs | 124 ++++++- - src/router.rs | 636 +++++++++++++++++++++++++++++++- - 42 files changed, 3450 insertions(+) -``` +# Changelog +All notable changes to async-std will be documented in this file. +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://book.async.rs/overview/stability-guarantees.html). + +## [Unreleased] + +### Added + +- Added `logger::RequestLogger` based on `log` (replaces `logger:RootLogger`) + +### Changed + +- Resolved an `#[allow(unused_mut)]` workaround. +- Renamed `ExtractForms` to `ContextExt`. + +### Removed + +- Removed `logger::RootLogger` (replaced by `logger:RequestLogger`) +- Removed internal use of the `box_async` macro + +## [0.3.0] - 2019-10-31 + +This is the first release in almost 6 months; introducing a snapshot of where we +were right before splitting up the crate. This release is mostly similar to +`0.2.0`, but sets us up to start rewinding prior work on top. + +### Added + +- Added "unstable" feature flag. +- Added example for serving static files. +- Added keywords and categories to Cargo.toml. +- Implemented `Default` for `App`. +- Added `App::with_state` constructor method. +- Added `Context::state` (replacing `Context::app_data`) + +### Changed + +- Fixed multipart uploads. +- Fixed some doc tests. +- Rename `cookies::CookiesExt` to `cookies::ContextExt`. +- Rename `querystring::ExtractQuery` to `querystring::ContextExt`. +- Switched CI provider from Travis to GitHub actions. +- Updated README. +- Updated all dependencies. +- Replaced `AppData` with `State`. + +### Removed + +- Removed the RFCs subdirectory. +- Removed an extra incoming license requirement. +- Removed outdated version logs. +- Removed `rustfmt.toml`. +- Removed `Context::app_data` (replaced with `Context::state`). + +## [0.2.0] - 2019-05-03 + +Log not kept. + +## [0.1.1] - 2019-04-18 + +Log not kept. + +## [0.1.0] - 2019-04-15 + +Log not kept. + +## [0.0.5] - 2019-02-26 + +Log not kept. + +## [0.0.4] - 2019-02-04 + +Log not kept. + +## [0.0.3] - 2019-01-31 + +Log not kept. + +## [0.0.1] - 2019-01-18 + +Log not kept. + +[Unreleased]: https://github.com/async-rs/async-std/compare/v0.3.0...HEAD +[0.3.0]: https://github.com/async-rs/async-std/compare/v0.2.0...v0.3.0 +[0.2.0]: https://github.com/async-rs/async-std/compare/v0.1.0...v0.2.0 +[0.1.0]: https://github.com/async-rs/async-std/compare/v0.0.5...v0.1.0 +[0.0.5]: https://github.com/async-rs/async-std/compare/v0.0.4...v0.0.5 +[0.0.4]: https://github.com/async-rs/async-std/compare/v0.0.3...v0.0.4 +[0.0.3]: https://github.com/async-rs/async-std/compare/v0.0.1...v0.0.3 +[0.0.1]: https://github.com/async-rs/async-std/compare/v0.0.1 diff --git a/Cargo.toml b/Cargo.toml index d90daaea7..11e2b7088 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,11 @@ [package] +name = "tide" +version = "0.3.0" +description = "Serve the web – HTTP server framework" authors = [ "Aaron Turon ", "Yoshua Wuyts ", ] -description = "WIP modular web framework" documentation = "https://docs.rs/tide" keywords = ["tide", "http", "web", "framework", "async"] categories = [ @@ -13,31 +15,27 @@ categories = [ ] edition = "2018" license = "MIT OR Apache-2.0" -name = "tide" readme = "README.md" -repository = "https://github.com/rustasync/tide" -version = "0.2.0" +repository = "https://github.com/http-rs/tide" [dependencies] -cookie = { version = "0.12", features = ["percent-encode"] } -futures-preview = "0.3.0-alpha.16" +cookie = { version = "0.12.0", features = ["percent-encode"] } +futures-preview = "0.3.0-alpha.19" fnv = "1.0.6" -http = "0.1" -http-service = "0.2.0" +http = "0.1.19" +http-service = "0.3.1" pin-utils = "0.1.0-alpha.4" -route-recognizer = "0.1.12" -serde = "1.0.91" -serde_derive = "1.0.91" -serde_json = "1.0.39" -slog = "2.4.1" -slog-async = "2.3.0" -slog-term = "2.4.0" +route-recognizer = "0.1.13" +serde = "1.0.102" +serde_derive = "1.0.102" +serde_json = "1.0.41" typemap = "0.3.3" -serde_urlencoded = "0.5.5" +serde_urlencoded = "0.6.1" +log = "0.4.8" [dependencies.http-service-hyper] optional = true -version = "0.2.0" +version = "0.3.1" [dependencies.multipart] default-features = false @@ -47,21 +45,17 @@ version = "0.16.1" [features] default = ["hyper"] hyper = ["http-service-hyper"] +unstable = [] [dev-dependencies] basic-cookies = "0.1.3" bytes = "0.4.12" futures-fs = "0.0.5" -futures-util-preview = { version = "0.3.0-alpha.16", features = ["compat"] } -http-service-mock = "0.2.0" -juniper = "0.11.1" -mime = "0.3.13" -mime_guess = "2.0.0-alpha.6" -percent-encoding = "1.0.1" -serde = { version = "1.0.90", features = ["derive"] } -structopt = "0.2.15" - -[patch.crates-io] -http-service = { git = "https://github.com/rustasync/http-service", branch = "master" } -http-service-hyper = { git = "https://github.com/rustasync/http-service", branch = "master" } -http-service-mock = { git = "https://github.com/rustasync/http-service", branch = "master" } +futures-util-preview = { version = "0.3.0-alpha.19", features = ["compat"] } +http-service-mock = "0.3.1" +juniper = "0.14.1" +mime = "0.3.14" +mime_guess = "2.0.1" +percent-encoding = "2.1.0" +serde = { version = "1.0.102", features = ["derive"] } +structopt = "0.3.3" diff --git a/README.md b/README.md index 548b64ba2..4c47fc8a2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Tide

- Empowering everyone to build HTTP Services. + Serve the web
@@ -13,11 +13,6 @@ Crates.io version - - - Build Status - | - + Contributing | @@ -46,14 +41,8 @@ -
- Built with 🌊 by The Rust Async Ecosystem WG -
- -## About - -A modular web framework built around async/await. It's actively being developed by the Rust Async -Ecosystem WG, and **not ready for production use yet**. +A modular web framework built around async/await. It's actively being developed +and **not ready for production use yet**. ## Examples @@ -64,21 +53,21 @@ Ecosystem WG, and **not ready for production use yet**. fn main() -> Result<(), std::io::Error> { let mut app = tide::App::new(); - app.at("/").get(async move |_| "Hello, world!"); + app.at("/").get(|_| async move { "Hello, world!" }); Ok(app.serve("127.0.0.1:8000")?) } ``` **More Examples** -- [Hello World](https://github.com/rustasync/tide/tree/master/examples/hello.rs) -- [Messages](https://github.com/rustasync/tide/blob/master/examples/messages.rs) -- [Body Types](https://github.com/rustasync/tide/blob/master/examples/body_types.rs) -- [Multipart Form](https://github.com/rustasync/tide/tree/master/examples/multipart-form/main.rs) -- [Catch All](https://github.com/rustasync/tide/tree/master/examples/catch_all.rs) -- [Cookies](https://github.com/rustasync/tide/tree/master/examples/cookies.rs) -- [Default Headers](https://github.com/rustasync/tide/tree/master/examples/default_headers.rs) -- [GraphQL](https://github.com/rustasync/tide/tree/master/examples/graphql.rs) +- [Hello World](https://github.com/http-rs/tide/tree/master/examples/hello.rs) +- [Messages](https://github.com/http-rs/tide/blob/master/examples/messages.rs) +- [Body Types](https://github.com/http-rs/tide/blob/master/examples/body_types.rs) +- [Multipart Form](https://github.com/http-rs/tide/tree/master/examples/multipart-form/main.rs) +- [Catch All](https://github.com/http-rs/tide/tree/master/examples/catch_all.rs) +- [Cookies](https://github.com/http-rs/tide/tree/master/examples/cookies.rs) +- [Default Headers](https://github.com/http-rs/tide/tree/master/examples/default_headers.rs) +- [GraphQL](https://github.com/http-rs/tide/tree/master/examples/graphql.rs) ## Resources @@ -89,18 +78,6 @@ Read about the design here: - [Middleware in Tide](https://rustasync.github.io/team/2018/11/07/tide-middleware.html) - [Tide's evolving middleware approach](https://rustasync.github.io/team/2018/11/27/tide-middleware-evolution.html) -### Supported Rust Versions - -Tide is built against the latest Rust nightly releases and as such, due to it's use of `std` futures, -it has the following specific breakpoints that align with std future API changes: - -| Tide | Rust | -| ----------- | ----------------------- | -| ≤ v0.1.0 | ≤ nightly-2019-04-07 | -| ≥ v0.1.1 | ≥ nightly-2019-04-08 | - -_**Note:** Since these are due to changes in `std`, projects with dependencies that use conflicting versions of `std::futures` will not build successfully._ - ## Contributing Want to join us? Check out our [The "Contributing" section of the @@ -112,7 +89,7 @@ guide][contributing] and take a look at some of these issues: #### Conduct The Tide project adheres to the [Contributor Covenant Code of -Conduct](https://github.com/rustasync/tide/blob/master/.github/CODE_OF_CONDUCT.md). This +Conduct](https://github.com/http-rs/tide/blob/master/.github/CODE_OF_CONDUCT.md). This describes the minimum behavior expected from all contributors. ## License @@ -130,7 +107,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. -[releases]: https://github.com/rustasync/tide/releases -[contributing]: https://github.com/rustasync/tide/blob/master/.github/CONTRIBUTING.md -[good-first-issue]: https://github.com/rustasync/tide/labels/good%20first%20issue -[help-wanted]: https://github.com/rustasync/tide/labels/help%20wanted +[releases]: https://github.com/http-rs/tide/releases +[contributing]: https://github.com/http-rs/tide/blob/master/.github/CONTRIBUTING.md +[good-first-issue]: https://github.com/http-rs/tide/labels/good%20first%20issue +[help-wanted]: https://github.com/http-rs/tide/labels/help%20wanted diff --git a/examples/body_types.rs b/examples/body_types.rs index 01c9b393c..deed774ae 100644 --- a/examples/body_types.rs +++ b/examples/body_types.rs @@ -1,9 +1,7 @@ -#![feature(async_await)] - use serde::{Deserialize, Serialize}; use tide::{ error::ResultExt, - forms::{self, ExtractForms}, + forms::{self, ContextExt}, response, App, Context, EndpointResult, }; @@ -13,28 +11,24 @@ struct Message { contents: String, } -#[allow(unused_mut)] // Workaround clippy bug async fn echo_string(mut cx: Context<()>) -> String { let msg = cx.body_string().await.unwrap(); println!("String: {}", msg); msg } -#[allow(unused_mut)] // Workaround clippy bug async fn echo_bytes(mut cx: Context<()>) -> Vec { let msg = cx.body_bytes().await.unwrap(); println!("Bytes: {:?}", msg); msg } -#[allow(unused_mut)] // Workaround clippy bug async fn echo_json(mut cx: Context<()>) -> EndpointResult { let msg = cx.body_json().await.client_err()?; println!("JSON: {:?}", msg); Ok(response::json(msg)) } -#[allow(unused_mut)] // Workaround clippy bug async fn echo_form(mut cx: Context<()>) -> EndpointResult { let msg = cx.body_form().await?; println!("Form: {:?}", msg); diff --git a/examples/catch_all.rs b/examples/catch_all.rs index 354ddbb03..c958a2205 100644 --- a/examples/catch_all.rs +++ b/examples/catch_all.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use tide::Context; async fn echo_path(cx: Context<()>) -> String { diff --git a/examples/cookies.rs b/examples/cookies.rs index 094030f27..751efe8c3 100644 --- a/examples/cookies.rs +++ b/examples/cookies.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use cookie::Cookie; use tide::{cookies::ContextExt, middleware::CookiesMiddleware, Context}; @@ -9,12 +7,10 @@ async fn retrieve_cookie(mut cx: Context<()>) -> String { format!("hello cookies: {:?}", cx.get_cookie("hello").unwrap()) } -#[allow(unused_mut)] // Workaround clippy bug async fn set_cookie(mut cx: Context<()>) { cx.set_cookie(Cookie::new("hello", "world")).unwrap(); } -#[allow(unused_mut)] // Workaround clippy bug async fn remove_cookie(mut cx: Context<()>) { cx.remove_cookie(Cookie::named("hello")).unwrap(); } diff --git a/examples/default_headers.rs b/examples/default_headers.rs index 47f13a091..a4ebce28c 100644 --- a/examples/default_headers.rs +++ b/examples/default_headers.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use tide::middleware::DefaultHeaders; fn main() { @@ -11,7 +9,7 @@ fn main() { .header("X-Server", "Tide"), ); - app.at("/").get(async move |_| "Hello, world!"); + app.at("/").get(|_| async move { "Hello, world!" }); app.serve("127.0.0.1:8000").unwrap(); } diff --git a/examples/graphql.rs b/examples/graphql.rs index aeb9abfdf..ca0e013f8 100644 --- a/examples/graphql.rs +++ b/examples/graphql.rs @@ -3,8 +3,6 @@ // // [the Juniper book]: https://graphql-rust.github.io/ -#![feature(async_await)] - use http::status::StatusCode; use juniper::graphql_object; use std::sync::{atomic, Arc}; diff --git a/examples/hello.rs b/examples/hello.rs index 030d394c1..e52a7784e 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -1,7 +1,5 @@ -#![feature(async_await)] - fn main() { let mut app = tide::App::new(); - app.at("/").get(async move |_| "Hello, world!"); + app.at("/").get(|_| async move { "Hello, world!" }); app.serve("127.0.0.1:8000").unwrap(); } diff --git a/examples/messages.rs b/examples/messages.rs index 7b8ef25dd..ffb84f160 100644 --- a/examples/messages.rs +++ b/examples/messages.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use http::status::StatusCode; use serde::{Deserialize, Serialize}; use std::sync::Mutex; @@ -39,13 +37,11 @@ impl Database { } } -#[allow(unused_mut)] // Workaround clippy bug async fn new_message(mut cx: Context) -> EndpointResult { let msg = cx.body_json().await.client_err()?; Ok(cx.state().insert(msg).to_string()) } -#[allow(unused_mut)] // Workaround clippy bug async fn set_message(mut cx: Context) -> EndpointResult<()> { let msg = cx.body_json().await.client_err()?; let id = cx.param("id").client_err()?; diff --git a/examples/multipart-form/main.rs b/examples/multipart-form/main.rs index 14ca63639..1bf6e7495 100644 --- a/examples/multipart-form/main.rs +++ b/examples/multipart-form/main.rs @@ -1,8 +1,6 @@ -#![feature(async_await)] - use serde::{Deserialize, Serialize}; use std::io::Read; -use tide::{forms::ExtractForms, response, App, Context, EndpointResult}; +use tide::{forms::ContextExt, response, App, Context, EndpointResult}; #[derive(Serialize, Deserialize, Clone)] struct Message { @@ -11,7 +9,6 @@ struct Message { file: Option, } -#[allow(unused_mut)] // Workaround clippy bug async fn upload_file(mut cx: Context<()>) -> EndpointResult { // https://stackoverflow.com/questions/43424982/how-to-parse-multipart-forms-using-abonander-multipart-with-rocket let mut message = Message { diff --git a/examples/staticfile.rs b/examples/staticfile.rs index 462a1f4bd..0f94bd8b6 100644 --- a/examples/staticfile.rs +++ b/examples/staticfile.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use bytes::Bytes; use futures_fs::FsPool; use futures_util::compat::*; @@ -68,7 +66,7 @@ impl StaticFile { } }; - let mime = mime_guess::guess_mime_type(path); + let mime = mime_guess::from_path(path).first_or_octet_stream(); let mime_str = mime.as_ref(); let size = meta.len(); diff --git a/rfcs/000-template.md b/rfcs/000-template.md deleted file mode 100644 index ce52928bf..000000000 --- a/rfcs/000-template.md +++ /dev/null @@ -1,66 +0,0 @@ -- Start Date: (fill me in with today's date, YYYY-MM-DD) -- RFC PR: (leave this empty) -- Tracking Issue: (leave this empty) - -# Summary -[summary]: #summary - -One paragraph explanation of the proposal. - -# Motivation -[motivation]: #motivation - -Why are we doing this? What use cases does it support? What problems does it -solve? What is the expected outcome? - -# Stakeholders -[stakeholders]: #stakeholders - -* Who is affected by this RFC? - -* How are we soliciting feedback on this RFC from these stakeholders? Note that - they may not be watching the RFCs repository or even aren't directly active in - the Rust Async Ecosystem working group. - -# Detailed Explanation -[detailed-explanation]: #detailed-explanation - -- Introduce and explain new concepts. - -- It should be reasonably clear how the proposal would be implemented. - -- Provide representative examples that show how this proposal would be commonly - used. - -- Corner cases should be dissected by example. - -# Drawbacks -[drawbacks]: #drawbacks - -- Why should we *not* do this? - -# Rationale and Alternatives -[alternatives]: #rationale-and-alternatives - -This is your chance to discuss your proposal in the context of the whole design -space. This is probably the most important section! - -- Why is this design the best in the space of possible designs? - -- What other designs have been considered and what is the rationale for not - choosing them? - -- What is the impact of not doing this? - -# Unresolved Questions -[unresolved]: #unresolved-questions - -- What parts of the design do you expect to resolve through the RFC process - before this gets merged? - -- What parts of the design do you expect to resolve through the implementation - of this feature? - -- What related issues do you consider out of scope for this RFC that could be - addressed in the future independently of the solution that comes out of this - RFC? diff --git a/rfcs/001-app-new.md b/rfcs/001-app-new.md deleted file mode 100644 index f8cff3830..000000000 --- a/rfcs/001-app-new.md +++ /dev/null @@ -1,93 +0,0 @@ -- Start Date: 2019-04-26 -- RFC PR: (leave this empty) -- Tracking Issue: (leave this empty) - -# Summary -[summary]: #summary - -We propose to rename the `AppData` generic argument to `State`, and expose two constructors on `App` -to create new Tide applications. - -# Motivation -[motivation]: #motivation - -With most introductory examples, passing the `AppData` parameter around isn't necessary. That's why -most examples we author use `App::new(())`. - -However this can be confusing for people new to Tide ("why is the use of that parameter?"), and even -stranger for people new to Rust ("what does `(())` mean?"). So it would be useful to have a way of -constructing new Tide applications without needing to start off by explaining what `AppData` does. - -Another thing worth thinking about here is that the `AppData` argument is rather verbose. It's also -not necessarily accurate: I'd argue that a database connection pool, or other stateful structs -aren't quite _data_. Calling them _state_ feels more accurate, which also happens to be the -terminology [Actix uses](https://actix.rs/docs/databases/). - -# Stakeholders -[stakeholders]: #stakeholders - -This affects everyone using Tide. But most generally it's geared towards improving the onboarding -experience, and first impressions for people of all skill levels. Not just for people new to Tide, -but people interested in doing web-like things in Rust in general. - -# Detailed Explanation -[detailed-explanation]: #detailed-explanation - -I propose we introduce two constructors for `App`: - -- `App::new()` creates a new application. -- `App::with_state(state)` creates a new application with state. - -If people "just want a Tide app", the `new` method should feel intuitive. But if they want to -introduce some state, the `with_state` method will be there. This should also create a clearer -relationship between the constructors, and the generic parameters we have in Tide. - -In addition -[`Context::app_data`](https://docs.rs/tide/0.1.1/tide/struct.Context.html#method.app_data) should be -renamed to `Context::state`. - -__no state__ -```rust -#![feature(async_await)] - -fn main() -> Result<(), failure::Error> { - let mut app = tide::App::new(); - app.at("/").get(async move |_| "Hello, world!"); - app.serve("127.0.0.1:8000")?; -} -``` - -__with state__ -```rust -#![feature(async_await)] - -#[derive(Default)] -struct State { - /* db connection goes here */ -} - -fn main() -> Result<(), failure::Error> { - let mut app = tide::App::with_state(State::default()); - app.at("/").get(async move |_| "Hello, world!"); - app.serve("127.0.0.1:8000")?; -} -``` - -# Drawbacks -[drawbacks]: #drawbacks - -This is a breaking change. But because it's still early days for Tide, I think right now is the -right time to propose changes like these. - -# Rationale and Alternatives -[alternatives]: #rationale-and-alternatives - -In https://github.com/rustasync/tide/pull/189 I initially proposed implementing `Default` for `App`, -but it quickly became clear that making more fundamental changes to Tide's constructors would -provide a better experience. In particular clearing up the terminology around `AppData` by calling -it `State` made all other parts fall in place naturally. - -# Unresolved Questions -[unresolved]: #unresolved-questions - -None. diff --git a/src/app.rs b/src/app.rs index 7e4273036..b76ce47d2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -30,11 +30,10 @@ use crate::{ /// on `127.0.0.1:8000` with: /// /// ```rust, no_run -/// #![feature(async_await)] /// /// let mut app = tide::App::new(); -/// app.at("/hello").get(async move |_| "Hello, world!"); -/// app.serve("127.0.0.1:8000"); +/// app.at("/hello").get(|_| async move {"Hello, world!"}); +/// app.serve("127.0.0.1:8000").unwrap(); /// ``` /// /// # Routing and parameters @@ -45,8 +44,6 @@ use crate::{ /// segments as parameters to endpoints: /// /// ```rust, no_run -/// #![feature(async_await)] -/// /// use tide::error::ResultExt; /// /// async fn hello(cx: tide::Context<()>) -> tide::EndpointResult { @@ -63,11 +60,11 @@ use crate::{ /// /// app.at("/hello/:user").get(hello); /// app.at("/goodbye/:user").get(goodbye); -/// app.at("/").get(async move |_| { +/// app.at("/").get(|_| async move { /// "Use /hello/{your name} or /goodbye/{your name}" /// }); /// -/// app.serve("127.0.0.1:8000"); +/// app.serve("127.0.0.1:8000").unwrap(); /// ``` /// /// You can learn more about routing in the [`App::at`] documentation. @@ -75,7 +72,6 @@ use crate::{ /// # Application state /// /// ```rust, no_run -/// #![feature(async_await)] /// /// use http::status::StatusCode; /// use serde::{Deserialize, Serialize}; @@ -166,9 +162,8 @@ impl App { /// respective endpoint of the selected resource. Example: /// /// ```rust,no_run - /// # #![feature(async_await)] /// # let mut app = tide::App::new(); - /// app.at("/").get(async move |_| "Hello, world!"); + /// app.at("/").get(|_| async move {"Hello, world!"}); /// ``` /// /// A path is comprised of zero or many segments, i.e. non-empty strings @@ -276,7 +271,7 @@ impl HttpService for Server { let middleware = self.middleware.clone(); let data = self.data.clone(); - box_async! { + Box::pin(async move { let fut = { let Selection { endpoint, params } = router.route(&path, method); let cx = Context::new(data, req, params); @@ -290,7 +285,7 @@ impl HttpService for Server { }; Ok(fut.await) - } + }) } } @@ -326,9 +321,9 @@ mod tests { #[test] fn simple_static() { let mut router = App::new(); - router.at("/").get(async move |_| "/"); - router.at("/foo").get(async move |_| "/foo"); - router.at("/foo/bar").get(async move |_| "/foo/bar"); + router.at("/").get(|_| async move { "/" }); + router.at("/foo").get(|_| async move { "/foo" }); + router.at("/foo/bar").get(|_| async move { "/foo/bar" }); for path in &["/", "/foo", "/foo/bar"] { let res = block_on(simulate_request(&router, path, http::Method::GET)); @@ -340,23 +335,23 @@ mod tests { #[test] fn nested_static() { let mut router = App::new(); - router.at("/a").get(async move |_| "/a"); + router.at("/a").get(|_| async move { "/a" }); router.at("/b").nest(|router| { - router.at("/").get(async move |_| "/b"); - router.at("/a").get(async move |_| "/b/a"); - router.at("/b").get(async move |_| "/b/b"); + router.at("/").get(|_| async move { "/b" }); + router.at("/a").get(|_| async move { "/b/a" }); + router.at("/b").get(|_| async move { "/b/b" }); router.at("/c").nest(|router| { - router.at("/a").get(async move |_| "/b/c/a"); - router.at("/b").get(async move |_| "/b/c/b"); + router.at("/a").get(|_| async move { "/b/c/a" }); + router.at("/b").get(|_| async move { "/b/c/b" }); }); - router.at("/d").get(async move |_| "/b/d"); + router.at("/d").get(|_| async move { "/b/d" }); }); router.at("/a/a").nest(|router| { - router.at("/a").get(async move |_| "/a/a/a"); - router.at("/b").get(async move |_| "/a/a/b"); + router.at("/a").get(|_| async move { "/a/a/a" }); + router.at("/b").get(|_| async move { "/a/a/b" }); }); router.at("/a/b").nest(|router| { - router.at("/").get(async move |_| "/a/b"); + router.at("/").get(|_| async move { "/a/b" }); }); for failing_path in &["/", "/a/a", "/a/b/a"] { @@ -382,9 +377,9 @@ mod tests { fn multiple_methods() { let mut router = App::new(); router.at("/a").nest(|router| { - router.at("/b").get(async move |_| "/a/b GET"); + router.at("/b").get(|_| async move { "/a/b GET" }); }); - router.at("/a/b").post(async move |_| "/a/b POST"); + router.at("/a/b").post(|_| async move { "/a/b POST" }); for (path, method) in &[("/a/b", http::Method::GET), ("/a/b", http::Method::POST)] { let res = block_on(simulate_request(&router, path, method.clone())); diff --git a/src/endpoint.rs b/src/endpoint.rs index f4adbfcf8..176e1e15f 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -14,13 +14,11 @@ use crate::{response::IntoResponse, Context, Response}; /// /// Endpoints are implemented as asynchronous functions that make use of language features /// currently only available in Rust Nightly. For this reason, we have to explicitly enable -/// those features with `#![feature(async_await)]`. To keep examples concise, /// the attribute will be omitted in most of the documentation. /// /// A simple endpoint that is invoked on a `GET` request and returns a `String`: /// /// ```rust, no_run -/// # #![feature(async_await)] /// async fn hello(_cx: tide::Context<()>) -> String { /// String::from("hello") /// } @@ -68,8 +66,6 @@ where type Fut = BoxFuture<'static, Response>; fn call(&self, cx: Context) -> Self::Fut { let fut = (self)(cx); - box_async! { - fut.await.into_response() - } + Box::pin(async move { fut.await.into_response() }) } } diff --git a/src/forms.rs b/src/forms.rs index b7338dab5..697027973 100644 --- a/src/forms.rs +++ b/src/forms.rs @@ -8,7 +8,7 @@ use crate::{ }; /// An extension trait for `Context`, providing form extraction. -pub trait ExtractForms { +pub trait ContextExt { /// Asynchronously extract the entire body as a single form. fn body_form(&mut self) -> BoxTryFuture; @@ -16,13 +16,15 @@ pub trait ExtractForms { fn body_multipart(&mut self) -> BoxTryFuture>>>; } -impl ExtractForms for Context { +impl ContextExt for Context { fn body_form(&mut self) -> BoxTryFuture { let body = self.take_body(); - box_async! { + Box::pin(async move { let body = body.into_vec().await.client_err()?; - Ok(serde_urlencoded::from_bytes(&body).map_err(|e| err_fmt!("could not decode form: {}", e)).client_err()?) - } + Ok(serde_urlencoded::from_bytes(&body) + .map_err(|e| err_fmt!("could not decode form: {}", e)) + .client_err()?) + }) } fn body_multipart(&mut self) -> BoxTryFuture>>> { @@ -35,11 +37,13 @@ impl ExtractForms for Context { let body = self.take_body(); - box_async! { + Box::pin(async move { let body = body.into_vec().await.client_err()?; - let boundary = boundary.ok_or_else(|| err_fmt!("no boundary found")).client_err()?; + let boundary = boundary + .ok_or_else(|| err_fmt!("no boundary found")) + .client_err()?; Ok(Multipart::with_body(Cursor::new(body), boundary)) - } + }) } } diff --git a/src/lib.rs b/src/lib.rs index ac931431d..af4d64f84 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,32 +1,15 @@ -#![cfg_attr(feature = "nightly", deny(missing_docs))] -#![cfg_attr(feature = "nightly", feature(external_doc))] -#![cfg_attr(feature = "nightly", doc(include = "../README.md"))] -#![cfg_attr(test, deny(warnings))] -#![feature(async_await, existential_type)] -#![allow(unused_variables)] -#![deny( - nonstandard_style, - rust_2018_idioms, - future_incompatible, - missing_debug_implementations -)] -// TODO: Remove this after clippy bug due to async await is resolved. -// ISSUE: https://github.com/rust-lang/rust-clippy/issues/3988 -#![allow(clippy::needless_lifetimes)] +// #![warn(missing_docs)] +#![warn(missing_debug_implementations, rust_2018_idioms)] +#![allow(clippy::mutex_atomic, clippy::module_inception)] +#![doc(test(attr(deny(rust_2018_idioms, warnings))))] +#![doc(test(attr(allow(unused_extern_crates, unused_variables))))] -//! //! Welcome to Tide. //! //! The [`App`](struct.App.html) docs are a good place to get started. //! //! -macro_rules! box_async { - {$($t:tt)*} => { - ::futures::future::FutureExt::boxed(async move { $($t)* }) - }; -} - #[macro_use] pub mod error; diff --git a/src/middleware/cookies.rs b/src/middleware/cookies.rs index 9c3dd6910..639ea4032 100644 --- a/src/middleware/cookies.rs +++ b/src/middleware/cookies.rs @@ -31,7 +31,7 @@ impl Middleware for CookiesMiddleware { mut cx: Context, next: Next<'a, Data>, ) -> BoxFuture<'a, Response> { - box_async! { + Box::pin(async move { let cookie_data = cx .extensions_mut() .remove() @@ -56,7 +56,7 @@ impl Middleware for CookiesMiddleware { } } res - } + }) } } @@ -72,23 +72,19 @@ mod tests { static COOKIE_NAME: &str = "testCookie"; /// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter. - #[allow(unused_mut)] // Workaround clippy bug async fn retrieve_cookie(mut cx: Context<()>) -> String { format!("{}", cx.get_cookie(COOKIE_NAME).unwrap().unwrap().value()) } - #[allow(unused_mut)] // Workaround clippy bug async fn set_cookie(mut cx: Context<()>) { cx.set_cookie(Cookie::new(COOKIE_NAME, "NewCookieValue")) .unwrap(); } - #[allow(unused_mut)] // Workaround clippy bug async fn remove_cookie(mut cx: Context<()>) { cx.remove_cookie(Cookie::named(COOKIE_NAME)).unwrap(); } - #[allow(unused_mut)] // Workaround clippy bug async fn set_multiple_cookie(mut cx: Context<()>) { cx.set_cookie(Cookie::new("C1", "V1")).unwrap(); cx.set_cookie(Cookie::new("C2", "V2")).unwrap(); @@ -172,5 +168,4 @@ mod tests { assert!(iter.next().is_none()); } - } diff --git a/src/middleware/default_headers.rs b/src/middleware/default_headers.rs index d7b5bffe4..e6627f82b 100644 --- a/src/middleware/default_headers.rs +++ b/src/middleware/default_headers.rs @@ -41,7 +41,7 @@ impl DefaultHeaders { impl Middleware for DefaultHeaders { fn handle<'a>(&'a self, cx: Context, next: Next<'a, Data>) -> BoxFuture<'a, Response> { - box_async! { + Box::pin(async move { let mut res = next.run(cx).await; let headers = res.headers_mut(); @@ -49,6 +49,6 @@ impl Middleware for DefaultHeaders { headers.entry(key).unwrap().or_insert_with(|| value.clone()); } res - } + }) } } diff --git a/src/middleware/logger.rs b/src/middleware/logger.rs index 3becf7928..defaed905 100644 --- a/src/middleware/logger.rs +++ b/src/middleware/logger.rs @@ -1,50 +1,50 @@ -use slog::{info, o, Drain}; -use slog_async; -use slog_term; - -use futures::future::BoxFuture; - use crate::{ middleware::{Middleware, Next}, Context, Response, }; +use futures::future::BoxFuture; -/// Root logger for Tide. Wraps over logger provided by slog.SimpleLogger -#[derive(Debug)] -pub struct RootLogger { - // drain: dyn slog::Drain, - inner_logger: slog::Logger, -} - -impl RootLogger { - pub fn new() -> RootLogger { - let decorator = slog_term::TermDecorator::new().build(); - let drain = slog_term::CompactFormat::new(decorator).build().fuse(); - let drain = slog_async::Async::new(drain).build().fuse(); - - let log = slog::Logger::root(drain, o!()); - RootLogger { inner_logger: log } +/// A simple requests logger +/// +/// # Examples +/// +/// ```rust +/// +/// let mut app = tide::App::new(); +/// app.middleware(tide::middleware::RequestLogger::new()); +/// ``` +#[derive(Debug, Clone, Default)] +pub struct RequestLogger; + +impl RequestLogger { + pub fn new() -> Self { + Self::default() } -} -impl Default for RootLogger { - fn default() -> Self { - Self::new() + async fn log_basic<'a, Data: Send + Sync + 'static>( + &'a self, + ctx: Context, + next: Next<'a, Data>, + ) -> Response { + let path = ctx.uri().path().to_owned(); + let method = ctx.method().as_str().to_owned(); + log::trace!("IN => {} {}", method, path); + let start = std::time::Instant::now(); + let res = next.run(ctx).await; + let status = res.status(); + log::info!( + "{} {} {} {}ms", + method, + path, + status.as_str(), + start.elapsed().as_millis() + ); + res } } -/// Stores information during request phase and logs information once the response -/// is generated. -impl Middleware for RootLogger { - fn handle<'a>(&'a self, cx: Context, next: Next<'a, Data>) -> BoxFuture<'a, Response> { - box_async! { - let path = cx.uri().path().to_owned(); - let method = cx.method().as_str().to_owned(); - - let res = next.run(cx).await; - let status = res.status(); - info!(self.inner_logger, "{} {} {}", method, path, status.as_str()); - res - } +impl Middleware for RequestLogger { + fn handle<'a>(&'a self, ctx: Context, next: Next<'a, Data>) -> BoxFuture<'a, Response> { + Box::pin(async move { self.log_basic(ctx, next).await }) } } diff --git a/src/middleware/mod.rs b/src/middleware/mod.rs index 64c6c5692..343a21b17 100644 --- a/src/middleware/mod.rs +++ b/src/middleware/mod.rs @@ -7,7 +7,9 @@ mod cookies; mod default_headers; mod logger; -pub use self::{cookies::CookiesMiddleware, default_headers::DefaultHeaders, logger::RootLogger}; +pub use self::{ + cookies::CookiesMiddleware, default_headers::DefaultHeaders, logger::RequestLogger, +}; /// Middleware that wraps around remaining middleware chain. pub trait Middleware: 'static + Send + Sync { diff --git a/src/router.rs b/src/router.rs index 34710110d..d3dfc1723 100644 --- a/src/router.rs +++ b/src/router.rs @@ -62,7 +62,10 @@ impl Router { } fn not_found_endpoint(_cx: Context) -> BoxFuture<'static, Response> { - box_async! { - http::Response::builder().status(http::StatusCode::NOT_FOUND).body(Body::empty()).unwrap() - } + Box::pin(async move { + http::Response::builder() + .status(http::StatusCode::NOT_FOUND) + .body(Body::empty()) + .unwrap() + }) } diff --git a/tests/wildcard.rs b/tests/wildcard.rs index 6d21ccf46..235b6fce2 100644 --- a/tests/wildcard.rs +++ b/tests/wildcard.rs @@ -1,5 +1,3 @@ -#![feature(async_await)] - use futures::executor::block_on; use http_service::Body; use http_service_mock::make_server;