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_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
pub fn with_interceptor<I>(self, interceptor: I) -> Selfwhere
I: Interceptor,
pub fn with_filter<F>(self, filter: F) -> Selfwhere
F: ExceptionFilter,
pub fn get<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
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 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_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 put<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
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 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<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn delete<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
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 head<H>(self, path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
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