pub struct App { /* private fields */ }Expand description
A configured application. Cheap to clone.
Implementations§
Source§impl App
impl App
Sourcepub fn new(routes: Routes) -> AppBuilder
pub fn new(routes: Routes) -> AppBuilder
Start building an application from generated routes.
pub fn config(&self) -> &Config
pub fn environment(&self) -> Environment
pub fn cache(&self) -> &Cache
Sourcepub async fn handle(&self, req: Request) -> Response
pub async fn handle(&self, req: Request) -> Response
Handle one request. This is the adapter surface: the built-in server, tests and serverless adapters all call it.
Sourcepub async fn revalidate_path(&self, path: &str) -> bool
pub async fn revalidate_path(&self, path: &str) -> bool
Re-render path on its next request (ISR) and drop data-cache
entries stored under the same path key.
Sourcepub async fn revalidate_tag(&self, tag: &str) -> usize
pub async fn revalidate_tag(&self, tag: &str) -> usize
Invalidate pages and data tagged with tag. Returns the number of entries removed.
Sourcepub async fn export(&self) -> Result<ExportReport, String>
pub async fn export(&self) -> Result<ExportReport, String>
Pre-render static routes into the build output (static generation).
Source§impl App
impl App
Sourcepub async fn serve(self) -> Result<()>
pub async fn serve(self) -> Result<()>
Bind to the configured address and serve until shutdown.
Sourcepub async fn serve_listener(self, listener: TcpListener) -> Result<()>
pub async fn serve_listener(self, listener: TcpListener) -> Result<()>
Serve on an existing listener (tests, socket activation).
Sourcepub async fn handle_hyper(
&self,
req: Request<Incoming>,
remote: Option<SocketAddr>,
) -> Response<HyperBody>
pub async fn handle_hyper( &self, req: Request<Incoming>, remote: Option<SocketAddr>, ) -> Response<HyperBody>
Handle a hyper request (used by the built-in server).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for App
impl !UnwindSafe for App
impl Freeze 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