Add missing explicit lifetime parameter to `PasteId<'_>` in pastebin guide.

This commit is contained in:
Howard Su 2020-08-03 09:28:21 +08:00 committed by Jeb Rosen
parent 83a7fc48d2
commit 2040693dab
1 changed files with 3 additions and 2 deletions

View File

@ -414,12 +414,13 @@ the `retrieve` route, preventing attacks on the `retrieve` route:
```rust
# #[macro_use] extern crate rocket;
# use std::borrow::Cow;
# use rocket::tokio::fs::File;
# type PasteId = usize;
# type PasteId<'a> = Cow<'a, str>;
#[get("/<id>")]
async fn retrieve(id: PasteId) -> Option<File> {
async fn retrieve(id: PasteId<'_>) -> Option<File> {
let filename = format!("upload/{id}", id = id);
File::open(&filename).await.ok()
}