pub struct App<T> { /* private fields */ }
Expand description
Wrapper for actix_web::App
.
Implementations§
source§impl<T> App<T>
impl<T> App<T>
sourcepub fn data_factory<F, Out, D, E>(self, data: F) -> Self
pub fn data_factory<F, Out, D, E>(self, data: F) -> Self
Proxy for actix_web::App::data_factory
.
NOTE: This doesn’t affect spec generation.
sourcepub fn app_data<U: 'static>(self, data: U) -> Self
pub fn app_data<U: 'static>(self, data: U) -> Self
Proxy for actix_web::App::app_data
.
NOTE: This doesn’t affect spec generation.
sourcepub fn configure<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut ServiceConfig<'_>),
pub fn configure<F>(self, f: F) -> Selfwhere
F: FnOnce(&mut ServiceConfig<'_>),
Wrapper for actix_web::App::configure
.
sourcepub fn route(self, path: &str, route: Route) -> Self
pub fn route(self, path: &str, route: Route) -> Self
Wrapper for actix_web::App::route
.
sourcepub fn service<F>(self, factory: F) -> Selfwhere
F: Mountable + HttpServiceFactory + 'static,
pub fn service<F>(self, factory: F) -> Selfwhere
F: Mountable + HttpServiceFactory + 'static,
Wrapper for actix_web::App::service
.
sourcepub fn default_service<F, U>(self, f: F) -> Self
pub fn default_service<F, U>(self, f: F) -> Self
Proxy for actix_web::App::default_service
.
NOTE: This doesn’t affect spec generation.
sourcepub fn external_resource<N, U>(self, name: N, url: U) -> Self
pub fn external_resource<N, U>(self, name: N, url: U) -> Self
Proxy for actix_web::App::external_resource
.
NOTE: This doesn’t affect spec generation.
sourcepub fn wrap<M, B>(
self,
mw: M,
) -> App<impl ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<B>, Error = Error, InitError = ()>>where
M: Transform<T::Service, ServiceRequest, Response = ServiceResponse<B>, Error = Error, InitError = ()> + 'static,
B: MessageBody,
pub fn wrap<M, B>(
self,
mw: M,
) -> App<impl ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<B>, Error = Error, InitError = ()>>where
M: Transform<T::Service, ServiceRequest, Response = ServiceResponse<B>, Error = Error, InitError = ()> + 'static,
B: MessageBody,
Proxy for actix_web::web::App::wrap
.
NOTE: This doesn’t affect spec generation.
sourcepub fn wrap_fn<F, R, B>(
self,
mw: F,
) -> App<impl ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<B>, Error = Error, InitError = ()>>
pub fn wrap_fn<F, R, B>( self, mw: F, ) -> App<impl ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<B>, Error = Error, InitError = ()>>
Proxy for actix_web::web::App::wrap_fn
.
NOTE: This doesn’t affect spec generation.
sourcepub fn with_json_spec_at(self, path: &str) -> Self
pub fn with_json_spec_at(self, path: &str) -> Self
Mounts the specification for all operations and definitions recorded by the wrapper and serves them in the given path as a JSON.
sourcepub fn with_json_spec_v3_at(self, path: &str) -> Self
pub fn with_json_spec_v3_at(self, path: &str) -> Self
Converts the generated v2 specification to v3 and then mounts the v3 specification for all operations and definitions recorded by the wrapper and serves them in the given path as a JSON.
sourcepub fn with_raw_json_spec<F>(self, call: F) -> Self
pub fn with_raw_json_spec<F>(self, call: F) -> Self
Calls the given function with App
and JSON Value
representing your API
specification built until now.
NOTE: Unlike with_json_spec_at
, this only has the API spec built until
this function call. Any route handler added after this call won’t affect the
spec. So, it’s important to call this function after adding all route handlers.
sourcepub fn with_raw_json_spec_v3<F>(self, call: F) -> Self
pub fn with_raw_json_spec_v3<F>(self, call: F) -> Self
Calls the given function with App
and JSON Value
representing your API
v2 specification built until now which is converted to v3.
NOTE: Unlike with_json_spec_at
, this only has the API spec built until
this function call. Any route handler added after this call won’t affect the
spec. So, it’s important to call this function after adding all route handlers.
sourcepub fn with_swagger_ui_at(self, path: &str) -> Self
pub fn with_swagger_ui_at(self, path: &str) -> Self
Exposes the previously built JSON specification with Swagger UI at the given path
NOTE: you MUST call with_json_spec_at before calling this function
sourcepub fn trim_base_path(self) -> Self
pub fn trim_base_path(self) -> Self
Trim’s the Api base path from the start of all method paths.
NOTE: much like with_raw_json_spec
this only has the API spec built until
this function call. Any route handler added after this call won’t have the base path trimmed.
So, it’s important to call this function after adding all route handlers.