Skip to main content

Module keys

Module keys 

Source
Expand description

Transport keys (transports DESIGN §2.1, X1): the constant each transport attribute emits per handler, and the assertions #[handlers] emits over every controller-level scoped key.

A free const _ after the impl is evaluated unconditionally; inside the impl a constant needs a name, and a named associated constant is evaluated only where it is read, so a misspelled key would compile unnoticed. Const evaluation runs after every attribute has expanded, so the __ULO_KEY_* constants exist by then. A generic controller is the case a free constant cannot name: there #[handlers] emits a named associated constant and Handlers::mount reads it, which evaluates it when mount is instantiated.

A handler behind #[cfg], or whose transport attribute sits inside cfg_attr, has no __ULO_KEY_<name> or __ULO_CHECKS_<name> where its predicate fails, so every read of either carries the handler’s gates (crate::cfg::presence_gates and crate::cfg::gates_of). The key assertion is a block: its first let reads the ungated handlers’ keys, and each further let, one per gated handler, carries that handler’s gates. A handler’s key counts only in a build that compiles the handler, and a scoped key whose handlers are all compiled out fails the assertion in that build.

Structs§

Assertions
What #[handlers] emits for the X1 key assertions and for the per-handler checks constants.
GatedHandler
A handler as the assertions read it.

Functions§

assertions
The assertions for keys over handlers, the impl’s handlers. The message names the key and every handler, the gated ones apart: “htpp is not the key of any handler’s transport in this impl (handlers: get; behind cfg: get_rpc)”.
checks_const_ident
__ULO_CHECKS_<name>.
key_const
const __ULO_KEY_<name>: &'static str = <Marker as ::ulo::Transport>::KEY;, hidden, with non_upper_case_globals allowed for the method name inside it.
key_const_ident
__ULO_KEY_<name>.
scoped_keys
Every distinct transport key written at the controller tier, in the order first written, each with the span of its first occurrence.