Rocket/core/codegen/tests
Sergio Benitez 64e46b7107 Introduce sentinels: auto-discovered launch abort.
Sentinels resolve a long-standing usability and functional correctness
issue in Rocket: starting an application with guards and/or responders
that depend on state that isn't available. The canonical example is the
'State' guard. Prior to this commit, an application with routes that
queried unmanaged state via 'State' would fail at runtime. With this
commit, the application refuses to launch with a detailed error message.

The 'Sentinel' docs explains it as:

    A sentinel, automatically run on ignition, can trigger a launch
    abort should an instance fail to meet arbitrary conditions. Every
    type that appears in a mounted route's type signature is eligible to
    be a sentinel. Of these, those that implement 'Sentinel' have their
    'abort()' method invoked automatically, immediately after ignition,
    once for each unique type. Sentinels inspect the finalized instance
    of 'Rocket' and can trigger a launch abort by returning 'true'.

The following types are now sentinels:

  * 'contrib::databases::Connection' (any '#[database]' type)
  * 'contrib::templates::Metadata'
  * 'contrib::templates::Template'
  * 'core::State'

The following are "specialized" sentinels, which allow sentinel
discovery even through type aliases:

  * 'Option<T>', 'Debug<T>' if 'T: Sentinel'
  * 'Result<T, E>', 'Either<T, E>' if 'T: Sentinel', 'E: Sentinel'

Closes #464.
2021-04-16 01:44:53 -07:00
..
ui-fail Introduce statically-enforced 'Rocket' phasing. 2021-04-13 19:26:45 -07:00
ui-fail-nightly Introduce sentinels: auto-discovered launch abort. 2021-04-16 01:44:53 -07:00
ui-fail-stable Introduce sentinels: auto-discovered launch abort. 2021-04-16 01:44:53 -07:00
async-entry.rs Introduce statically-enforced 'Rocket' phasing. 2021-04-13 19:26:45 -07:00
async-routes.rs Remove use of stable 'proc_macro_hygiene' feature. 2020-07-11 10:48:08 -07:00
expansion.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
from_form.rs Make 'FileName' a DST. Improve sanitization. 2021-04-03 17:09:00 -07:00
from_form_field.rs Allow several 'field' attributes in all derives. 2021-04-07 23:09:05 -07:00
responder.rs Test 'secret_key' validation, now on pre-launch. 2021-03-09 21:57:26 -08:00
route-data.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
route-format.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
route-ranking.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
route-raw.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
route.rs Introduce statically-enforced 'Rocket' phasing. 2021-04-13 19:26:45 -07:00
segment-ignore.rs Rename 'rocket::ignite()' to 'rocket::build()'. 2021-04-08 01:07:52 -07:00
typed-uris.rs Revamp codegen, fixing inconscpicuous bugs. 2021-03-04 02:01:25 -08:00
ui-fail.rs Implement codegen testing on stable. 2020-07-21 15:11:07 -07:00
uri_display.rs Allow several 'field' attributes in all derives. 2021-04-07 23:09:05 -07:00