pub struct StaticSurfaces { /* private fields */ }Expand description
The static surfaces of a topology, ready to answer.
Built once at startup from the resolved topology: the router holds it and asks it before its own routes, so a mount that a surface owns is never shadowed by a later arm.
Implementations§
Source§impl StaticSurfaces
impl StaticSurfaces
Sourcepub fn new(topology: &Topology, root: &Path) -> Self
pub fn new(topology: &Topology, root: &Path) -> Self
Take every static surface of topology whose directory exists, resolved against
root. A surface whose producer has not run is not mounted: the validator is where
that becomes a finding, and a router that answered 500 for it would be worse.
Sourcepub fn owns(&self, path: &str) -> bool
pub fn owns(&self, path: &str) -> bool
Does a static surface own this path — and is it not one the executable answers?
Sourcepub fn handle(&self, method: &str, path: &str) -> Option<Response>
pub fn handle(&self, method: &str, path: &str) -> Option<Response>
Answer a request a static surface owns, or None when none does.
A directory answers with its index; a path that walks out of the surface’s root, or names a media type the set does not hold, is a 404 rather than a hint about what is on the disk.