Expand description
The items a transport attribute owes #[handlers] for one handler (see crate::protocol).
For #[ulo_http::get("/users/{id}")] async fn get(&self, id: Path<u64>, user: Ext<CurrentUser>) -> Result<Json<User>, UserError> inside a #[handlers] impl with one impl-level
#[interceptors(value = Timing::new())], the expansion is, in shape:
async fn get(&self, id: Path<u64>, user: Ext<CurrentUser>) -> Result<Json<User>, UserError> { .. }
#[doc(hidden)] #[allow(non_upper_case_globals)]
const __ULO_KEY_get: &'static str = <::ulo_http::Http as ::ulo::Transport>::KEY;
#[doc(hidden)] #[allow(non_upper_case_globals)]
const __ULO_CHECKS_get: () = { assert!(!(<Path<u64> as P<Http, _>>::CONSUMES_BODY && ..), "..") };
#[doc(hidden)]
fn __ulo_mount_get<__UloV0: ::ulo::Interceptor<::ulo_http::Http>>(
m: &mut ::ulo::Mount<'_>,
__ulo_shared: &::ulo::__private::Shared<(::ulo::__private::Arc<__UloV0>,)>,
) {
let (controller, method) = ::ulo::__private::__enhancer_specs!(::ulo_http::Http, "http", __ulo_shared, <tokens>);
let mut meta = ::ulo::Metadata::new(); /* meta.controller(..); meta.method(..); */
let mut dependencies = ::ulo::Dependencies::default();
<Path<u64> as P<Http, _>>::dependencies(&mut dependencies); /* one per parameter */
let handler = <transport's handler value, its call closure built from `call_body`>;
m.handler(::ulo::HandlerSpec::new("get", handler)
.controller(controller).method(method).meta(meta).route(..).shape(..).dependencies(dependencies));
}P is <transport>::__private::Param. The call closure’s body, from call_body:
let __ulo_arg0: Path<u64> = <Path<u64> as P<Http, _>>::extract(&cx).await?;
let __ulo_arg1: Ext<CurrentUser> = <Ext<CurrentUser> as P<Http, _>>::extract(&cx).await?;
let __ulo_this = <transport>::__private::controller::<Self, Http>(&cx).await?;
let __ulo_out = Self::get(&*__ulo_this, __ulo_arg0, __ulo_arg1).await;
(&&&<transport>::__private::IntoReplyProbe::<Http, _>::new(__ulo_out)).__ulo_into_reply(&cx)Parameters extract in order, inside dispatch’s call, so after every guard admits. A
self: Arc<Self> receiver is passed ::ulo::Dep::into_arc(__ulo_this).
Structs§
- MountFn
- One handler’s three owed items.
Functions§
- call_
body - The statements of the call: extract each parameter, resolve the controller, call the method,
probe the reply.
cxnames the context binding. - call_
closure move |cx: <Marker as Transport>::Cx| -> ::ulo::BoxFuture<'static, Result<Reply, ::ulo::BoxError>> { Box::pin(async move { <call_body> }) }, cloneable into the transport’s handler value.- call_
ident __ulo_call, the binding of the call closure inside the mount function.- dependencies
let mut dependencies = ::ulo::Dependencies::default();followed by each parameter’s<Ty as Param<Marker, _>>::dependencies(&mut dependencies, label);, evaluating todependencies. The label isHandlerParam::NamedwithParam::ident, so a wiring report names a parameter reading the container asparam `svc`whether the call or the container builds it; for a destructuring pattern it isHandlerParam::AtwithParam::index, printed asparam #nfrom the parameter’s position in the signature.- metadata
- A block evaluating to the handler’s
::ulo::Metadata:controller(expr)per impl-level declaration andmethod(expr)per method-level one, each spanned at its expression and compiled under its gates, built once when the handler mounts. Both are called by path: method syntax on the ownedMetadatawould reach a user trait’scontroller(&self)implemented for every type one autoref step before the inherent&mut selfmethod. - mount_
fn_ ident __ulo_mount_<name>.- mount_
param_ ident __ulo_m, the mount function’s&mut ::ulo::Mount<'_>parameter.