Michael Howell
c9d0af09d6
Use 'AsyncSeek' for sized bodies in 'Response's.
...
In order to avoid making 'ResponseBuilder::sized_body' an asynchronous
function, the seeking is deferred until finalization. 'finalize()' is
replaced with '.await', and 'ResponseBuilder::ok()' is an 'async fn'.
2020-07-11 09:24:29 -07:00
Jeb Rosen
70096c1bd4
Revert on_response lifetimes to more closely match 0.4.
2020-07-11 09:24:29 -07:00
Jeb Rosen
4bb4c61528
Allow implementations of on_request fairings to return a Future that borrows from self, request, and data.
2020-07-11 09:24:29 -07:00
Jeb Rosen
468f4d9314
Simplify FromRequestAsync trait definition.
2020-07-11 09:24:29 -07:00
Paolo Barbolini
003bf77c29
Upgrade to tokio 0.2.0.
...
* Update 'tokio', 'tokio-rustls', and 'hyper'.
* Remove unused dependencies on some `futures-*` crates.
* Rework 'spawn_on', which is now 'serve'.
* Simplify Ctrl-C handling.
2020-07-11 09:24:29 -07:00
Jeb Rosen
7c4cd068d1
Update for rust-lang/rust#64856 .
...
Raise the nightly version to one that accepts '...(format!(...)).await'.
This additionally reverts commit bdbf80f2da
.
2020-07-11 09:24:29 -07:00
Follpvosten
189fd65b17
Add 'Request::local_cache_async' for use in async request guards.
2020-07-11 09:24:29 -07:00
Jeb Rosen
ea06878581
Update 'hyper', 'futures-*-preview', and 'tokio-*' dependencies.
...
Use I/O traits and types from 'tokio-io' as much as possible.
A few adapters only exist in futures-io-preview and use
futures-tokio-compat as a bridge for now.
2020-07-11 09:24:29 -07:00
Jeb Rosen
62a99e9e49
Fix a minor compilation error, possibly caused by rust-lang/rust#64292 .
2020-07-11 09:24:28 -07:00
Jeb Rosen
77a64c73bb
Fix some launch error handling in tests and examples.
2020-07-11 09:24:28 -07:00
Jacob Pratt
cd6a80c230
Implement an API to request a graceful shutdown.
...
Additionally listen for Ctrl-C as a shutdown signal by default.
2020-07-11 09:24:28 -07:00
Jeb Rosen
facc00454c
Re-enable the entire test suite:
...
* Disable compression tests
* Finish migrating all other examples and tests
2020-07-11 09:24:28 -07:00
Jacob Pratt
05426881b0
Use 'File' from 'async_std' instead of from 'tokio'.
...
Additionally pin tokio to '=0.2.0-alpha.2'; before this change cargo
selects '0.2.0-alpha.3' which hyper does not compile against.
2020-07-11 09:24:28 -07:00
Jeb Rosen
1f0577bfc5
Update remaining examples for async.
2020-07-11 09:24:28 -07:00
Jeb Rosen
560f0977d3
Revamp testing system for async.
...
* body_string_wait and body_bytes_wait are removed; use `.await` instead
* `dispatch()` is now an async fn and must be .await-ed
* Add `#[rocket::async_test]` macro, similar in purpose to `tokio::test`
* Tests now use either `rocket::async_test(async { })` or
`#[rocket::async_test]` in order to `.await` the futures returned
from `dispatch()` and `body_{string,bytes}()`
* Update 'test.sh' to reflect the tests that should be passing.
Broken:
* Cloned dispatch and mut_dispatch() with a live previous response now both fail, due to a (partial) check for mutable aliasing in LocalRequest.
* Some tests are still failing and need example-specific changes.
2020-07-11 09:24:28 -07:00
Jacob Pratt
e44c5896b8
Remove stabilized 'async_await' feature gate and update the minimum nightly version.
2020-07-11 09:24:28 -07:00
Jeb Rosen
8c8598b4fd
Fix 'static_files' and 'serve' tests.
2020-07-11 09:24:28 -07:00
Jeb Rosen
094146b929
Update 'fairings' example for async.
2020-07-11 09:24:28 -07:00
Jeb Rosen
bc404f1f6d
Use 'body_string_wait' in all example tests.
2020-07-11 09:24:28 -07:00
Redrield
5e578e9c3b
Upgrade 'msgpack' for async in contrib and examples.
2020-07-11 09:24:28 -07:00
Jeb Rosen
6044961680
Update parts of contrib and associated tests and examples:
...
* json
* templates
* helmet
* databases
* serve
* examples/cookies
* examples/handlebars_templates
* examples/json
* examples/session
* examples/static_files
* examples/tera_templates
2020-07-11 09:24:28 -07:00
Jeb Rosen
5d439bafc0
Convert core to async and add support for async routes.
...
Minimum rustc bump required for rust-lang/rust#61775
2020-07-11 09:24:28 -07:00
gcarq
86d0bdddb2
Replace manual ASCII checks with 'std::char' calls.
2020-06-22 05:07:14 -07:00
Sergio Benitez
e1a3d2b6e8
Fix minor formatting issues in 'todo' example.
2020-06-08 12:18:34 -07:00
Sergio Benitez
a4f5be93ef
Clean up todo example.
2020-06-08 12:12:02 -07:00
Cedric Hutchings
da34b66eb4
Use 'Result's instead of 'bool's in todo example.
2020-06-08 12:11:41 -07:00
Ning Sun
bbad427079
Update 'handlebars' to 3.0.
2020-06-08 11:41:01 -07:00
Giles Cope
ff4b63c0be
Add field renaming to query params example.
2020-03-24 16:21:43 -07:00
Razican
f4bb8bb511
Update depedencies:
...
* contrib: 'rmp-serde', 'tera', 'memcache', 'mysql', 'postgres', 'redis'.
* examples: 'parking-lot', 'rand'
2020-01-19 11:01:11 -08:00
Paolo Barbolini
cd5f96ae15
Update 'uuid', 'unicode-xid', and 'base64' dependencies.
2019-11-30 09:33:14 -08:00
Jeb Rosen
e04bceb81e
Call iter() instead of into_iter() on arrays ( rust-lang/rust#66145 ).
2019-11-28 12:41:26 -08:00
Jacob Pratt
e3c1a4ad3a
Remove use of the 'try_trait' feature.
...
Add the 'try_outcome' macro to replace uses of '?' on 'Outcome'.
2019-09-18 18:43:16 -07:00
Sergio Benitez
2537a1164d
Remove 'Result' specialization. Add 'Debug' responder.
...
This removes all uses of specialization in Rocket.
2019-09-09 21:57:33 -07:00
Sergio Benitez
22da02fa64
Remove double semicolons; silence test warnings.
2019-09-09 16:57:03 -07:00
Pieter Frenssen
1383671090
Do not display 'Error:' on a successful logout in the 'session' example.
2019-08-12 17:39:52 -07:00
Jeb Rosen
3e4f8453ce
Remove use of the 'decl_macro' feature.
...
Also removes one internal use in the 'typed-uris' codegen test.
2019-07-19 11:39:56 -07:00
Jeb Rosen
2f458b5217
Remove dependence on 'decl_macro' in codegen.
...
The generated 'uri' helper macros are now re-exports of 'macro_rules'
macros, made possible by the stable 'uniform_paths' feature.
2019-07-19 11:38:35 -07:00
Jacob Pratt
34a741a26e
Remove use of '!' type in favor of 'Infallible'.
...
This removes the use of and dependence on the 'never_type' feature.
2019-07-09 15:10:51 -07:00
Sergio Benitez
7f2c9f426c
Fix tests for Windows.
2019-07-06 00:59:01 -07:00
Sergio Benitez
da7e022f99
Add Rust 2015 example.
2019-06-25 11:30:43 -07:00
Jeb Rosen
d9f989a496
Migrate all examples to Rust 2018.
2019-06-25 11:30:43 -07:00
Sergio Benitez
8434a98d5c
Set Content-Type on 'MsgPack' responses.
...
Fixes #1009 .
2019-05-23 17:18:17 -07:00
Sergio Benitez
23f5ebcc4f
Update 'parking_lot' to 0.8 in 'todo' example.
2019-05-16 13:50:54 -07:00
Sergio Benitez
868a7e6425
Update 'crossbeam' to 0.7 in 'managed_queue' example.
2019-05-16 13:50:54 -07:00
Leonora Tindall
c6c0b3a6e1
Update 'rusqlite' dependency to 0.16.
2019-05-16 13:50:54 -07:00
jeb
b9c3a5c64b
Remove test bootstrapping.
2019-02-08 16:50:14 -08:00
Sergio Benitez
fbcb99669e
Update deprecated 'trim_right()' to 'trim_end()'.
2019-02-06 19:39:44 -08:00
Sergio Benitez
76c830a467
Update 'base64', 'crossbeam', 'rand' dependencies.
2018-11-18 03:47:12 -08:00
Linus Unnebäck
53758c6dd7
Introduce the 'private-cookies' feature.
2018-11-08 23:38:18 -08:00
Sergio Benitez
1bb23b8115
Rename 'space_helmet' to 'helmet'. Rework API.
2018-11-08 20:35:30 -08:00