Commit Graph

627 Commits

Author SHA1 Message Date
Mikail Bagishov be933ce398 Apply clippy suggestions. 2021-06-30 14:13:19 -07:00
ThouCheese 5ebefa97c9 Impl 'std::Error' for 'serde::json::Error'. 2021-06-30 11:22:31 -07:00
Joakim Soderlund 7b9363f981 Fix typo in 'Sentinel' docs: 'INner' -> 'Inner'. 2021-06-30 11:08:20 -07:00
John-John Tedro 0ddad7a6c1 Impl 'Responder' for 'Arc<T>', 'Box<T>'. 2021-06-30 10:44:30 -07:00
PROgrm_JARvis 4339c2af48 Make '<String as FromParam>::Error' 'Infallible'.
Fixes #1679.
2021-06-30 10:27:46 -07:00
Sergio Benitez 6a3d1ac1d5 Fix 'UriDisplay<Query>' 'Json', 'MsgPack', impls.
As 'FromForm' doesn't provide access to the raw, undecoded string,
'MsgPack' cannot implement 'FromForm::from_value()'. This means that it
is not presently possible to parse a MessagePack form from a query
string. As such, the 'UriDisplay<Query>' implementation was removed.

The 'UriDisplay<Query>' for JSON was fixed such that a round-trip of a
'Json<T>' as a form works as expected.
2021-06-30 06:46:03 -07:00
Sergio Benitez bad762b8c4 Add 'rocket::serde:json::to_string()' functions. 2021-06-30 06:46:03 -07:00
Sergio Benitez 9957e00ad1 Pass type mapper directly in 'Responder' derive. 2021-06-30 06:46:03 -07:00
Sergio Benitez e141ac8a19 Add 'RawStr::percent_encode_bytes()'. 2021-06-30 06:46:01 -07:00
Sergio Benitez 01a11800ab Support all generics in 'UriDisplay' derive.
This ports the technique used for 'FromForm' and 'Responder' to the
'UriDisplay' trait derives.
2021-06-30 06:20:51 -07:00
Sergio Benitez 3ec58c3ca2 Ensure launch occurs with minimal ciphersuites.
Co-authored-by: Abdullah Alyan <AbdullahAlyan@yahoo.com>
2021-06-29 11:27:54 -07:00
Sergio Benitez f818702f9b Propagate TLS ciphersuite config to rustls.
Closes #1563.
2021-06-29 11:17:59 -07:00
Sergio Benitez dd722cdcfc Add configurable TLS ciphersuite preferences. 2021-06-29 10:35:55 -07:00
Sergio Benitez 5a2535f865 Mark 'form::ErrorKind' 'non_exhaustive'. 2021-06-29 05:06:37 -07:00
Sergio Benitez 9ce2935fe1 Impl 'Len' field validator for 'Json', 'MsgPack'. 2021-06-29 03:37:52 -07:00
Sergio Benitez 9399841b0c Fix order of indices in 'FromForm' map notes. 2021-06-29 03:37:52 -07:00
Sergio Benitez 793f421712 Support type generics, unit structs in 'FromForm'.
The 'FromFrom' derive now allows type generics in all positions using
the same automatic discovery technique as with 'Responder'. (In fact,
the technique was created for this derive.) Furthermore, 'FromForm' can
now be derived for unit structs.

Also adds a new 'try_with' form field validator.

Resolves #1695.
2021-06-29 03:37:52 -07:00
Sergio Benitez 2727d7bb7b Automatically discover 'Responder' generic bounds.
This commit presents and applies a new technique for bounding type
generics in derives. In short, for a generic `T` used in a field type of
`Field<T>`, where an eventual bound of `Responder` required, the derive
generates a bound of `Field<T>: Responder`. This removes the need for
any manually provided bounds while simultaneously allowing more
structures to typecheck. For example, generics in header components are
now fully supported.
2021-06-29 03:31:31 -07:00
Sergio Benitez 7c8c06522c Impl 'UriDisplay' for 'Vec', maps, nonzero ints. 2021-06-29 03:31:31 -07:00
Sergio Benitez ae796b41ad Impl std traits, 'UriDisplay<Query>' on 'MsgPack'.
This brings the 'MsgPack' impls to parity with 'Json'.
2021-06-29 03:31:31 -07:00
Sergio Benitez f827367df0 Expose 'serde::msgpack::to_vec()' methods. 2021-06-29 03:31:31 -07:00
Sergio Benitez fb3ae9f7db Impl std traits, 'UriDisplay<Query>' for 'Json'.
The 'Json' type now implements:

  * Clone
  * PartialEq
  * Eq
  * PartialOrd
  * Ord
  * Hash
  * UriDisplay<Query>

Method calls that resolve to a method in the set of traits above
previously resolved to the `Deref` target. For example, `foo.clone()`,
where `foo: Json<T>`, previously resolved to `<T as Clone>::clone()` but
now resolves to `<Json<T> as Clone>::clone()`.
2021-06-29 03:31:27 -07:00
Sergio Benitez 0e98177973 Reexport 'serde::json::to_value()'. 2021-06-29 03:10:13 -07:00
Sergio Benitez 00e56c9822 Use higher contrast emojis for routes, catchers. 2021-06-26 17:11:56 -07:00
Sergio Benitez 7f34aacd60 Add 'Missing', 'IndexFile' 'FileServer' options.
'Missing' allows constructing a 'FileServer' even if the supplied path
does not exist. 'IndexFile' allows serving a single file as the index of
the mount path.
2021-06-26 17:11:56 -07:00
Sergio Benitez d18103358e Allow 'len()' form field validations on 'Capped'.
This also adds more doctests for the 'with' validator.
2021-06-26 17:11:56 -07:00
Sergio Benitez a249f26164 Fix link to 'FromForm' derive in 'FromForm' docs. 2021-06-26 17:11:56 -07:00
Sergio Benitez 686a0ed964 Fix wording in 'config' docs. 2021-06-26 17:11:53 -07:00
Sergio Benitez b00c89c22f Support lifetime bounds in typed stream macros.
The syntax 'TypedStream![T + '_]' expands to:

  impl TypedStream<Item = T> + '_

This allows seamlessly borrowing in typed streams.

Also adds 'Event::empty()', for convenience.
2021-06-26 16:37:21 -07:00
Sergio Benitez 770f332832 Improve 'Responder' API docs.
The improvements are:

  * Point directly and immediately to the 'Responder' derive.
  * Provide more discussion on lifetimes.
  * Format documentation for easier scanning.
2021-06-26 12:41:42 -07:00
Sergio Benitez d34195fe11 Warn, don't error, if remote hangs up. 2021-06-26 12:05:04 -07:00
Sergio Benitez ef303d44f8 Fix 'TempFile' data guard warning formatting. 2021-06-26 12:03:52 -07:00
Sergio Benitez f3e08bf3f6 Add Markdown (text/markdown) as a known media type. 2021-06-26 12:02:19 -07:00
Sergio Benitez 9063cf0ac2 Visiting internal nodes in form field validator.
Previously, recursion into rewriting 'self' in field validations would
cease after the first function call. This meant that internal uses of
'self' were not properly rewritten. This commit ameliorates the
situation.
2021-06-26 12:00:05 -07:00
Sergio Benitez 76ec847a58 Use 'RelativePathBuf' as 'Config.temp_dir' type.
This makes a relative 'temp_dir' declared in a config file relative to
the config file itself.
2021-06-25 11:42:49 -07:00
Sergio Benitez c3ee34e295 Drop sender to prevent async client read deadlock.
Fixes #1729.

Co-authored-by: Wesley Norris <repnop@outlook.com>
2021-06-25 09:27:36 -07:00
Sergio Benitez a875da1666 Always disable colors if requested or unavailable.
Resolves #1712.
2021-06-25 09:08:49 -07:00
Jeb Rosen abf996b026 Update UI tests for latest stable. 2021-06-17 18:49:10 -07:00
timando c3dc7183f3 Fix Responder documentation: remove an outdated reference to 'Future'. 2021-06-17 17:20:04 -07:00
timando af1aa079d6 Fix a word in the 'Data::peek' docs: 'max' -> 'min'. 2021-06-14 19:36:03 -07:00
Sergio Benitez e45e164561 Improve guard forward and failure logs. 2021-06-10 01:25:49 -07:00
Sergio Benitez c2960e7e6f Uniformly implement utility traits on URI types. 2021-06-09 17:44:12 -07:00
Sergio Benitez d2c2725689 Implement 'De(Serialize)' for 'Method'. 2021-06-09 17:07:26 -07:00
Sergio Benitez c028d63e5b New version: 0.5.0-rc.1.
New contrib versions: 0.1.0-rc.1.
2021-06-09 09:52:37 -07:00
Sergio Benitez 6961a717d8 Use crates.io compatible internal package names. 2021-06-09 09:47:21 -07:00
Sergio Benitez 1aa551ada6 Ignore heartbeats in non-heartbeat SSE test. 2021-06-09 04:51:46 -07:00
Sergio Benitez 01436d2d24 Fix a ton of broken links. 2021-06-09 04:51:46 -07:00
Jeb Rosen 3b5f5afc6e Advertise HTTP/2 support via ALPN. 2021-06-09 04:51:33 -07:00
Sergio Benitez dd9629697a Use published 'devise'. 2021-06-09 00:46:28 -07:00
Sergio Benitez b19544c346 Fix doc typo: "Contracting" -> "Constructing". 2021-06-08 23:13:03 -07:00