/// Resolve the request by trying to find the file in the given root.
///
/// This root may be absolute or relative. The request is mapped onto the filesystem by appending
/// its URL path to the root path. If the filesystem path corresponds to a regular file, the
/// service will attempt to serve it. Otherwise, if the path corresponds to a directory containing
/// an `index.html`, the service will attempt to serve that instead.
///
/// The returned future may error for unexpected IO errors, passing on the `std::io::Error`.
/// Certain expected IO errors are handled, though, and simply reflected in the result. These are
/// `NotFound` and `PermissionDenied`.
Resolve the request by trying to find the file in the given root.
This root may be absolute or relative. The request is mapped onto the filesystem by appending
its URL path to the root path. If the filesystem path corresponds to a regular file, the
service will attempt to serve it. Otherwise, if the path corresponds to a directory containing
an `index.html`, the service will attempt to serve that instead.

The returned future may error for unexpected IO errors, passing on the `std::io::Error`.
Certain expected IO errors are handled, though, and simply reflected in the result.
Resolve the request by trying to find the file in the given root . This root may be absolute or relative . The request is mapped onto the filesystem by appending its URL path to the root path . If the filesystem path corresponds to a regular file the service will attempt to serve it . Otherwise if the path corresponds to a directory containing an ` index . html ` the service will attempt to serve that instead . The returned future may error for unexpected IO errors passing on the ` std :: io :: Error ` . Certain expected IO errors are handled though and simply reflected in the result .
pub async fn resolve<B>(
    root: impl Into<PathBuf>,
    req: &Request<B>,
) -> Result<ResolveResult, IoError> {
    // Handle only `GET`/`HEAD` and absolute paths.
    match *req.method() {
        Method::HEAD | Method::GET => {}
        _ => {
            return Ok(ResolveResult::MethodNotMatched);
        }
    }
    // Handle only simple path requests.
    if req.uri().scheme_str().is_some() || req.uri().host().is_some() {
        return Ok(ResolveResult::UriNotMatched);
    }
    resolve_path(root, req.uri().path()).await
}
pub async fn resolve < B > ( root : impl Into < PathBuf > , req : & Request < B > , ) -> Result < ResolveResult , IoError > { // Handle only `GET`/`HEAD` and absolute paths. match * req . method ( ) { Method :: HEAD | Method :: GET => { } _ => { return Ok ( ResolveResult :: MethodNotMatched ) ; } } // Handle only simple path requests. if req . uri ( ) . scheme_str ( ) . is_some ( ) || req . uri ( ) . host ( ) . is_some ( ) { return Ok ( ResolveResult :: UriNotMatched ) ; } resolve_path ( root , req . uri ( ) . path ( ) ) . await }
Resolve the request by trying to find the file in the given root.
Resolve the request by trying to find the file in the given root .
root
impl Into<PathBuf>
req
&Request<B>