1
0
mirror of https://github.com/actix/actix-website synced 2024-11-23 16:31:08 +01:00

docs: clearer use of actix_web::Result

This commit is contained in:
Rob Ede 2024-02-06 14:49:02 +00:00
parent 9f7734abc0
commit 40a7ddad85
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -4,10 +4,10 @@ pub mod directory;
// <individual-file>
use actix_files::NamedFile;
use actix_web::{HttpRequest, Result};
use actix_web::HttpRequest;
use std::path::PathBuf;
async fn index(req: HttpRequest) -> Result<NamedFile> {
async fn index(req: HttpRequest) -> actix_web::Result<NamedFile> {
let path: PathBuf = req.match_info().query("filename").parse().unwrap();
Ok(NamedFile::open(path)?)
}