pub struct RouteDefinition { /* private fields */ }Expand description
A framework-neutral route definition.
Implementations§
Source§impl RouteDefinition
impl RouteDefinition
pub fn get<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn get_json<H, Fut, R>(path: impl Into<String>, handler: H) -> Result<Self>
pub fn get_json_with_status<H, Fut, R>( path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn sse<H, Fut, S>(path: impl Into<String>, handler: H) -> Result<Self>
pub fn post<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn post_json<T, H, Fut, R>( path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn post_json_with_status<T, H, Fut, R>( path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn put<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn put_json<T, H, Fut, R>( path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn put_json_with_status<T, H, Fut, R>( path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn patch<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn patch_json<T, H, Fut, R>( path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn patch_json_with_status<T, H, Fut, R>( path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn delete<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn delete_json<H, Fut, R>( path: impl Into<String>, handler: H, ) -> Result<Self>
pub fn delete_json_with_status<H, Fut, R>( path: impl Into<String>, status: u16, handler: H, ) -> Result<Self>
pub fn options<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
pub fn head<H>(path: impl Into<String>, handler: H) -> Result<Self>where
H: RouteHandler,
Source§impl RouteDefinition
impl RouteDefinition
pub fn new<H>(
method: HttpMethod,
path: impl Into<String>,
handler: H,
) -> Result<Self>where
H: RouteHandler,
pub fn method(&self) -> HttpMethod
pub fn path(&self) -> &str
pub fn path_shape(&self) -> String
pub fn path_param_names(&self) -> Vec<&str>
pub fn matches_path(&self, path: &str) -> bool
pub fn path_params( &self, path: &str, ) -> Result<Option<BTreeMap<String, String>>>
pub fn module_name(&self) -> Option<&str>
pub fn controller_prefix(&self) -> Option<&str>
pub fn handler(&self) -> Arc<dyn RouteHandler>
Source§impl RouteDefinition
impl RouteDefinition
pub async fn call(&self, request: BootRequest) -> Result<BootResponse>
Sourcepub async fn handle(&self, request: BootRequest) -> BootResponse
pub async fn handle(&self, request: BootRequest) -> BootResponse
Dispatch a request through this route and convert unhandled errors into Boot HTTP responses.
Source§impl RouteDefinition
impl RouteDefinition
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,
Trait Implementations§
Source§impl Clone for RouteDefinition
impl Clone for RouteDefinition
Source§fn clone(&self) -> RouteDefinition
fn clone(&self) -> RouteDefinition
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 RouteDefinition
impl !UnwindSafe for RouteDefinition
impl Freeze for RouteDefinition
impl Send for RouteDefinition
impl Sync for RouteDefinition
impl Unpin for RouteDefinition
impl UnsafeUnpin for RouteDefinition
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