pub struct IndexRoute;Expand description
Route handler for the root path serving the injected development HTML.
When the request targets index.html, returns the in-memory HTML
that has the live-reload script injected. For all other files,
reads the content from disk with path-traversal protection.
Implementations§
Source§impl IndexRoute
impl IndexRoute
Trait Implementations§
Source§impl ServerHook for IndexRoute
Implements ServerHook for IndexRoute to serve the development HTML and static assets.
impl ServerHook for IndexRoute
Implements ServerHook for IndexRoute to serve the development HTML and static assets.
When the request targets index.html, returns the in-memory HTML
that has the live-reload script injected. For all other files the
handler reads the content from disk with path-traversal protection.
Source§async fn handle(self, _: &mut Stream, ctx: &mut Context) -> Status
async fn handle(self, _: &mut Stream, ctx: &mut Context) -> Status
Handles requests for the index page and static assets with path-traversal protection.
- Empty path or
index.html- serves the in-memory HTML with live-reload script. - Other paths: reads the file from disk, validates the canonical path is within
the www directory, and sets the appropriate
Content-Typeheader.
§Arguments
self- The consumed route instance.&mut Stream- The connection stream (unused).&mut Context- The request context used to read route params and write the response.
§Returns
Status- The hook processing result.
§Panics
Does not panic; all error cases set an appropriate HTTP status code.
Auto Trait Implementations§
impl Freeze for IndexRoute
impl RefUnwindSafe for IndexRoute
impl Send for IndexRoute
impl Sync for IndexRoute
impl Unpin for IndexRoute
impl UnsafeUnpin for IndexRoute
impl UnwindSafe for IndexRoute
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendSync for T
impl<T> AnySync for T
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