Skip to main content

Crate ulo_handler_codegen

Crate ulo_handler_codegen 

Source
Expand description

A plain library of syn functions every transport’s attribute macro calls, and #[routes] with them: parameter analysis, the body-consumer check, the reply probe, the use<> rewrite on streaming returns, the __handler protocol, key and shared-value emission, the #[meta] transport probe (X24), and the cfg gates #[routes] copies from a handler (transports DESIGN §1). Not a proc-macro crate, so a user-written transport’s macro crate depends on it as the shipped ones do.

A transport attribute’s expansion, in order:

  1. protocol::take_handler_attr removes and parses the __handler tokens #[routes] appended; their absence means the attribute sits outside a #[routes] impl.
  2. params::analyze reads the receiver and the parameters.
  3. reply::rewrite_opaque_returns appends + use<> to the return position’s opaque types.
  4. The transport builds its handler value around emit::call_closure, and emit::MountFn::emit writes the three items the protocol owes.

Re-exports§

pub use paths::Paths;

Modules§

body
The single body consumer, checked at compile time and naming both parameters (transports DESIGN §2.2).
cfg
The attributes that decide whether a handler, or one of its enhancer entries, is compiled, which #[routes] copies onto every item it writes that names the handler’s generated items, and the reading of a method’s attributes through cfg_attr.
emit
The items a transport attribute owes #[routes] for one handler (see crate::protocol).
keys
Transport keys (transports DESIGN §2.1, X1): the constant each transport attribute emits per handler, and the assertions #[routes] emits over every controller-level scoped key.
params
Parameter analysis: a handler’s receiver and its parameters, each read from the call by type (transports DESIGN §2.2, §2.3).
paths
protocol
The hidden __handler protocol between #[routes] and a transport’s handler attribute (transports DESIGN §2.1, §2.5, X1, X2).
reply
The reply side of a handler: the probe that sends every error side to the error handlers whatever the return type is spelled as, and the + use<> rewrite on streaming returns (transports DESIGN §2.3).
shared
Impl-level shared values (transports DESIGN §2.1, X2).
util
Helpers every macro built on this crate uses, ulo-macros included.