paperclip_actix::app

Struct App

source
pub struct App<T> { /* private fields */ }
Expand description

Wrapper for actix_web::App.

Implementations§

source§

impl<T> App<T>
where T: ServiceFactory<ServiceRequest, Config = (), Error = Error, InitError = ()>,

source

pub fn data_factory<F, Out, D, E>(self, data: F) -> Self
where F: Fn() -> Out + 'static, Out: Future<Output = Result<D, E>> + 'static, D: 'static, E: Debug,

Proxy for actix_web::App::data_factory.

NOTE: This doesn’t affect spec generation.

source

pub fn app_data<U: 'static>(self, data: U) -> Self

Proxy for actix_web::App::app_data.

NOTE: This doesn’t affect spec generation.

source

pub fn configure<F>(self, f: F) -> Self
where F: FnOnce(&mut ServiceConfig<'_>),

source

pub fn route(self, path: &str, route: Route) -> Self

Wrapper for actix_web::App::route.

source

pub fn service<F>(self, factory: F) -> Self
where F: Mountable + HttpServiceFactory + 'static,

source

pub fn default_service<F, U>(self, f: F) -> Self
where F: IntoServiceFactory<U, ServiceRequest>, U: ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse, Error = Error, InitError = ()> + 'static, U::InitError: Debug,

Proxy for actix_web::App::default_service.

NOTE: This doesn’t affect spec generation.

source

pub fn external_resource<N, U>(self, name: N, url: U) -> Self
where N: AsRef<str>, U: AsRef<str>,

Proxy for actix_web::App::external_resource.

NOTE: This doesn’t affect spec generation.

source

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.

source

pub fn wrap_fn<F, R, B>( self, mw: F, ) -> App<impl ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<B>, Error = Error, InitError = ()>>
where F: Fn(ServiceRequest, &T::Service) -> R + Clone + 'static, R: Future<Output = Result<ServiceResponse<B>, Error>>, B: MessageBody,

Proxy for actix_web::web::App::wrap_fn.

NOTE: This doesn’t affect spec generation.

source

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.

source

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.

source

pub fn with_raw_json_spec<F>(self, call: F) -> Self
where F: FnMut(Self, Value) -> 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.

source

pub fn with_raw_json_spec_v3<F>(self, call: F) -> Self
where F: FnMut(Self, Value) -> 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.

source

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

source

pub fn build(self) -> App<T>

Builds and returns the actix_web::App.

source

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.

Auto Trait Implementations§

§

impl<T> Freeze for App<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for App<T>

§

impl<T> !Send for App<T>

§

impl<T> !Sync for App<T>

§

impl<T> Unpin for App<T>
where T: Unpin,

§

impl<T> !UnwindSafe for App<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more