From ab13d73b30714d1c071482016893ef6a76945247 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sat, 22 May 2021 22:12:46 -0700 Subject: [PATCH] Prefer using 'io::Result' responder in docs. --- core/lib/src/data/limits.rs | 3 +-- site/guide/3-overview.md | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/lib/src/data/limits.rs b/core/lib/src/data/limits.rs index f7b65f1c..0af46a56 100644 --- a/core/lib/src/data/limits.rs +++ b/core/lib/src/data/limits.rs @@ -94,10 +94,9 @@ use crate::http::uncased::Uncased; /// use std::io; /// /// use rocket::data::{Data, Limits, ToByteUnit}; -/// use rocket::response::Debug; /// /// #[post("/echo", data = "")] -/// async fn echo(data: Data, limits: &Limits) -> Result> { +/// async fn echo(data: Data, limits: &Limits) -> io::Result { /// let limit = limits.get("data").unwrap_or(1.mebibytes()); /// Ok(data.open(limit).into_string().await?.value) /// } diff --git a/site/guide/3-overview.md b/site/guide/3-overview.md index 0ad54870..a01bab9f 100644 --- a/site/guide/3-overview.md +++ b/site/guide/3-overview.md @@ -298,11 +298,11 @@ necessary, you can convert a synchronous operation to an async one with ```rust # #[macro_use] extern crate rocket; use std::io; + use rocket::tokio::task::spawn_blocking; -use rocket::response::Debug; #[get("/blocking_task")] -async fn blocking_task() -> Result, Debug> { +async fn blocking_task() -> io::Result> { // In a real app, use rocket::fs::NamedFile or tokio::fs::File. let vec = spawn_blocking(|| std::fs::read("data.txt")).await .map_err(|e| io::Error::new(io::ErrorKind::Interrupted, e))??;