pub trait Rewriter:
Send
+ Sync
+ 'static {
// Required method
fn rewrite<'r>(
&self,
opt: Option<Rewrite<'r>>,
req: &'r Request<'_>,
) -> Option<Rewrite<'r>>;
}
Expand description
A file server Rewrite
rewriter.
A FileServer
is a sequence of Rewriter
s which transform the incoming
request path into a Rewrite
or None
. The first rewriter is called with
the request path as a Rewrite::File
. Each Rewriter
thereafter is
called in-turn with the previously returned Rewrite
, and the value
returned from the last Rewriter
is used to respond to the request. If the
final rewrite is None
or a nonexistent path or a directory, FileServer
responds with Status::NotFound
. Otherwise it responds with the file
contents, if Rewrite::File
is specified, or a redirect, if
Rewrite::Redirect
is specified.