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:
parent
9f7734abc0
commit
40a7ddad85
@ -4,10 +4,10 @@ pub mod directory;
|
|||||||
|
|
||||||
// <individual-file>
|
// <individual-file>
|
||||||
use actix_files::NamedFile;
|
use actix_files::NamedFile;
|
||||||
use actix_web::{HttpRequest, Result};
|
use actix_web::HttpRequest;
|
||||||
use std::path::PathBuf;
|
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();
|
let path: PathBuf = req.match_info().query("filename").parse().unwrap();
|
||||||
Ok(NamedFile::open(path)?)
|
Ok(NamedFile::open(path)?)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user