pub struct App { /* private fields */ }Expand description
Main application struct
Implementations§
Source§impl App
impl App
pub fn new() -> Self
Sourcepub fn max_body_size(self, size: Option<usize>) -> Self
pub fn max_body_size(self, size: Option<usize>) -> Self
Set maximum request body size in bytes (None = unlimited)
Sourcepub fn group(
self,
prefix: &str,
configure: impl FnOnce(RouteGroup) -> RouteGroup,
) -> Self
pub fn group( self, prefix: &str, configure: impl FnOnce(RouteGroup) -> RouteGroup, ) -> Self
Create a route group with a common prefix
Sourcepub fn get_with_params<F, Fut>(self, path: &str, handler: F) -> Self
pub fn get_with_params<F, Fut>(self, path: &str, handler: F) -> Self
Add GET route with path params extractor
Sourcepub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
Add middleware
Sourcepub fn serve_static(self, route_prefix: &str, dir_path: &str) -> Self
pub fn serve_static(self, route_prefix: &str, dir_path: &str) -> Self
Serve static files from a directory
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !UnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
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