fix a couple of doc test by using async api

This commit is contained in:
fakeshadow 2021-10-17 21:48:41 +08:00
parent 8bc92b764f
commit cba70f682a
1 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ impl Default for Flags {
/// ///
/// #[get("/")] /// #[get("/")]
/// async fn index() -> impl Responder { /// async fn index() -> impl Responder {
/// NamedFile::open("./static/index.html") /// NamedFile::open_async("./static/index.html").await
/// } /// }
/// ``` /// ```
pub struct NamedFile { pub struct NamedFile {
@ -275,8 +275,8 @@ impl NamedFile {
/// # use std::io; /// # use std::io;
/// use actix_files::NamedFile; /// use actix_files::NamedFile;
/// ///
/// # fn path() -> io::Result<()> { /// # async fn path() -> io::Result<()> {
/// let file = NamedFile::open("test.txt")?; /// let file = NamedFile::open_async("test.txt").await?;
/// assert_eq!(file.path().as_os_str(), "foo.txt"); /// assert_eq!(file.path().as_os_str(), "foo.txt");
/// # Ok(()) /// # Ok(())
/// # } /// # }