Skip to main content

NestApp

Type Alias NestApp 

Source
pub type NestApp<C> = App<AppRouter<RouteObject<(), Box<dyn for<'r> ServiceObject<WebContext<'r, C, RequestBody>, Response = WebResponse, Error = RouterError<Error>>>, Infallible>>>;
Expand description

type alias for concrete type of nested App.

§Example

// a function return an App instance.
fn app() -> NestApp<usize> {
    App::new().at("/index", handler_service(|_: &WebContext<'_, usize>| async { "" }))
}

// nest app would be registered with /v2 as prefix therefore "/v2/index" become accessible.
App::new().at("/v2", app()).with_state(996usize);

Aliased Type§

pub struct NestApp<C> { /* private fields */ }