mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-13 21:19:04 +00:00
337e8843a4
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. |
||
---|---|---|
.. | ||
codegen | ||
http | ||
lib |