pub struct ControllerDefinition { /* private fields */ }Expand description
Group routes under a common HTTP prefix, similar to a Nest controller.
Implementations§
Source§impl ControllerDefinition
impl ControllerDefinition
pub fn new(prefix: impl Into<String>) -> Result<Self>
pub fn route(self, route: RouteDefinition) -> Result<Self>
pub fn with_pipe<P>(self, pipe: P) -> Selfwhere
P: Pipe,
pub fn with_middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn with_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
pub fn with_interceptor<I>(self, interceptor: I) -> Selfwhere
I: Interceptor,
pub fn with_execution_interceptor<I>(self, interceptor: I) -> Selfwhere
I: ExecutionInterceptor,
pub fn with_filter<F>(self, filter: F) -> Selfwhere
F: ExceptionFilter,
pub fn with_catch_filter<I, F>(self, kinds: I, filter: F) -> Self
pub fn with_validation(self) -> Self
pub fn with_validation_options(self, options: ValidationOptions) -> Self
pub fn with_host(self, pattern: impl Into<String>) -> Result<Self>
pub fn without_host(self) -> Self
pub fn host(&self) -> Option<&str>
pub fn with_tag(self, tag: impl Into<String>) -> Self
pub fn with_schema_component( self, name: impl Into<String>, schema: OpenApiSchema, ) -> Self
pub fn with_response_component( self, name: impl Into<String>, response: OpenApiResponse, ) -> Self
pub fn with_parameter_component( self, name: impl Into<String>, parameter: OpenApiParameter, ) -> Self
pub fn with_example_component( self, name: impl Into<String>, example: OpenApiExample, ) -> Self
pub fn try_with_example_component<T>(
self,
name: impl Into<String>,
value: T,
) -> Result<Self>where
T: Serialize,
pub fn with_request_body_component( self, name: impl Into<String>, request_body: OpenApiRequestBody, ) -> Self
pub fn with_header_component( self, name: impl Into<String>, header: OpenApiHeader, ) -> Self
pub fn with_openapi_extension_value( self, name: impl Into<String>, value: Value, ) -> Self
pub fn try_with_openapi_extension<T>(
self,
name: impl Into<String>,
value: T,
) -> Result<Self>where
T: Serialize,
pub fn hide_from_openapi(self) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_versions<I, V>(self, versions: I) -> Self
pub fn version_neutral(self) -> Self
pub fn with_serialization(self, options: SerializationOptions) -> Self
pub fn with_metadata<V>(self, key: impl Into<String>, value: V) -> Result<Self>where
V: Serialize,
pub fn with_metadata_value(self, key: impl Into<String>, value: Value) -> Self
pub fn metadata(&self) -> &BTreeMap<String, Value>
pub fn metadata_value(&self, key: &str) -> Option<&Value>
pub fn all<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn all_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn all_json<H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn all_json_with_status<H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn view<H, Fut, R>( self, method: HttpMethod, path: impl Into<String>, view: impl Into<String>, handler: H, ) -> Result<Self>
pub fn view_with_status<H, Fut, R>( self, method: HttpMethod, path: impl Into<String>, view: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn get<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn get_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn get_json<H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn get_json_with_status<H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn get_view<H, Fut, R>( self, path: impl Into<String>, view: impl Into<String>, handler: H, ) -> Result<Self>
pub fn get_view_with_status<H, Fut, R>( self, path: impl Into<String>, view: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn sse<H, Fut, S>(self, path: impl Into<String>, handler: H) -> Result<Self>
pub fn post<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn post_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn post_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn post_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn post_view<H, Fut, R>( self, path: impl Into<String>, view: impl Into<String>, handler: H, ) -> Result<Self>
pub fn post_view_with_status<H, Fut, R>( self, path: impl Into<String>, view: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn post_validated_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn post_validated_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn put<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn put_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn put_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn put_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn put_validated_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn put_validated_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn patch_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn patch_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn patch_validated_json<T, H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn patch_validated_json_with_status<T, H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn patch<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn patch_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn delete<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn delete_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn delete_json<H, Fut, R>( self, path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn delete_json_with_status<H, Fut, R>( self, path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn options<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn options_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn head<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn head_scoped<F, H>( self, path: impl Into<String>, factory: F, ) -> Result<Self>
pub fn prefix(&self) -> &str
pub fn routes(&self) -> &[RouteDefinition]
Trait Implementations§
Source§impl Clone for ControllerDefinition
impl Clone for ControllerDefinition
Source§fn clone(&self) -> ControllerDefinition
fn clone(&self) -> ControllerDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ControllerDefinition
impl !UnwindSafe for ControllerDefinition
impl Freeze for ControllerDefinition
impl Send for ControllerDefinition
impl Sync for ControllerDefinition
impl Unpin for ControllerDefinition
impl UnsafeUnpin for ControllerDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more