pub struct Application { /* private fields */ }Implementations§
Source§impl Application
impl Application
Sourcepub fn new(routes: Routes) -> Result<Application, RouteBuildError>
pub fn new(routes: Routes) -> Result<Application, RouteBuildError>
Build an application from its route declarations.
§Errors
Returns a route build error when route patterns or names are invalid.
Sourcepub fn multi() -> MultiApplicationBuilder
pub fn multi() -> MultiApplicationBuilder
Start building an application composed of independently scoped modules.
pub fn max_body_size(self, bytes: usize) -> Application
pub fn header_read_timeout(self, timeout: Duration) -> Application
pub fn body_read_timeout(self, timeout: Duration) -> Application
pub fn graceful_shutdown_timeout(self, timeout: Duration) -> Application
Sourcepub const fn http_protocol(self, protocol: HttpProtocol) -> Application
pub const fn http_protocol(self, protocol: HttpProtocol) -> Application
Select which HTTP protocol versions the built-in TCP server accepts.
pub fn router(&self) -> &Router
pub async fn handle(&self, request: Request) -> Response
Sourcepub async fn bind<A>(self, address: A) -> Result<Server, ServerError>where
A: ToSocketAddrs,
pub async fn bind<A>(self, address: A) -> Result<Server, ServerError>where
A: ToSocketAddrs,
Bind the application to a TCP address without accepting connections yet.
§Errors
Returns an I/O error when the address cannot be resolved or bound.
Sourcepub async fn spawn<A>(self, address: A) -> Result<ServerHandle, ServerError>where
A: ToSocketAddrs,
pub async fn spawn<A>(self, address: A) -> Result<ServerHandle, ServerError>where
A: ToSocketAddrs,
Bind and run the application in a Tokio task.
§Errors
Returns an I/O error when the listener cannot be created.
Trait Implementations§
Source§impl Clone for Application
impl Clone for Application
Source§fn clone(&self) -> Application
fn clone(&self) -> Application
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 Application
impl !UnwindSafe for Application
impl Freeze for Application
impl Send for Application
impl Sync for Application
impl Unpin for Application
impl UnsafeUnpin for Application
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