Commit Graph

22 Commits

Author SHA1 Message Date
Sergio Benitez
8ee581a697 Canonicalize template directory before globbing.
This prevents the glob from returning paths that don't include the root
template dir due to resolution of relative paths like `./foo`,
preventing #1541 from reoccurring. Furthermore, this prevents
misconfigured, non-existent template directories from silently passing
through, instead causing an error at init-time.
2021-02-19 12:50:03 -08:00
Sergio Benitez
337e8843a4 Use 'Option', 'Result' directly in 'uri!' query.
Prior to this commit, the conversion 'T -> Option<T>' was applied in
both the path and query parts of a URI in the 'uri' macro via the
'FromUriParam' trait with no implementation for 'Option<T>' directly.
This meant that it was impossible to directly render an 'Option<T>'.
This was exactly desired for the path part, where rendering a 'None'
would yield an incorrect URI, but the restriction was too strict for the
query part, where a 'None' is entirely valid. This commit makes changes
the conversion so that it only applied to path parts and adds the
identity conversions for 'Option<T>' and 'Result<T, E>' for query parts.

The side effect is a breaking change: due to conflicting impls, the 'T'
to 'Option<T>' conversion was removed for query parts. Thus, all 'uri!'
query route arguments of type 'Option' or 'Result' must now be wrapped
in 'Some' or 'Ok'. Due to new 'Option<T> <-> Result<T, E>' conversions,
either 'Some' _and_ 'Ok' work in both contexts.

Closes #1420.
2020-11-01 10:30:30 -08:00
Sergio Benitez
bbfe2ba5cc Point all docs and doc links to 'master' branch. 2020-10-21 04:54:24 -07:00
Jeb Rosen
8224a1592f Simplify language in 'responses' guide. 2020-07-22 12:28:48 -07:00
Sergio Benitez
62355b424f Remove use of stable 'proc_macro_hygiene' feature. 2020-07-11 10:48:08 -07:00
Jeb Rosen
2c82b3e1d5 Update and fix guide tests. 2020-07-11 10:07:37 -07:00
Jeb Rosen
f2487ccec5 Update the guide for async-related API changes. 2020-07-11 09:24:29 -07:00
arctic-alpaca
1e623c8aaa Fix invalid JSON data in a guide example. 2020-06-28 10:35:15 -07:00
Sergio Benitez
53353df633 Fix more broken links. 2020-03-09 02:03:38 -07:00
Sergio Benitez
39b1f2f8d0 Provide more details for opaque examples in guide.
Closes #1100.
2020-02-15 19:47:50 -08:00
Sergio Benitez
95c981de79 Test all guide code examples.
Every code example is now fully runnable and testable. As a result, all
examples are now tested and include imports. Relevant imports are shown
by default. Code examples can be expanded to show all imports.

Fixes #432.
2020-02-15 04:02:19 -08:00
Sergio Benitez
1caf87eb21 Move to 0.5.0-dev on master. 2019-05-13 16:18:48 -07:00
Jeb Rosen
0666e425fe Add a few missing pieces of 'compression' documentation. 2019-05-04 08:38:11 -07:00
Riley Watkins
4f81292830 Fix typo in responses guide: '#[responder]' -> '#[response]'. 2018-12-26 10:53:15 -08:00
Sergio Benitez
5056705884 Improve query string routing and typed URI docs. 2018-12-07 12:09:15 -08:00
Desmond
d3c161e7d6 Fix typo in responses guide: 'T he' -> 'The'. 2018-12-06 21:29:51 -08:00
Sergio Benitez
41de1e62fb Implement 'Responder' for 'Status'.
This commit obviates the following removed types:

  * response::Failure
  * response::status::NoContent
  * response::status::Reset

Closes #489.
2018-10-31 03:57:22 -07:00
Sergio Benitez
4d72a92a9c Reorganize templating sections in responses guide. 2018-10-28 20:17:42 -07:00
Sergio Benitez
38536b58b5 Improve templates guide documentation. 2018-10-26 20:52:28 -07:00
Sergio Benitez
3903ffdb47 Update guide in full for current 0.4.0-dev. 2018-10-22 14:50:57 -07:00
Sergio Benitez
2d56af504d Fix broken site URLs and typos. 2018-10-16 04:01:17 -07:00
Sergio Benitez
26ee132782 Update site content for restructure. 2018-10-15 22:53:05 -07:00