Mark examples as `no_run`, add to CHANGES.md.

This commit is contained in:
Daan de Graaf 2019-01-27 11:44:13 +01:00
parent c6ac5b8963
commit 3e9c53ecca
2 changed files with 14 additions and 34 deletions

View File

@ -1,5 +1,11 @@
# Changes # Changes
## [x.x.xx] - xxxx-xx-xx
### Added
* Add `from_file` and `from_file_with_config` to `NamedFile` to allow sending files without a known path. #670
## [0.7.18] - 2019-01-10 ## [0.7.18] - 2019-01-10
### Added ### Added

View File

@ -127,31 +127,18 @@ impl NamedFile {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust /// ```no_run
/// extern crate actix_web; /// extern crate actix_web;
/// ///
/// use actix_web::fs::NamedFile; /// use actix_web::fs::NamedFile;
/// use std::io::{self, Write}; /// use std::io::{self, Write};
/// use std::env; /// use std::env;
/// # use std::fs::{self, File}; /// use std::fs::File;
/// # use std::path::PathBuf;
/// #
/// # fn path() -> PathBuf {
/// # let mut path = env::temp_dir();
/// # path.push("actix-web-named-file-test-from-file");
/// # path
/// # }
/// #
/// # fn tempfile() -> Result<File, io::Error> {
/// # let file = File::create(path())?;
/// # Ok(file)
/// # }
/// ///
/// fn main() -> io::Result<()> { /// fn main() -> io::Result<()> {
/// let mut file = tempfile()?; /// let mut file = File::create("foo.txt")?;
/// file.write_all(b"Hello, world!")?; /// file.write_all(b"Hello, world!")?;
/// let named_file = NamedFile::from_file(file, "foo.txt")?; /// let named_file = NamedFile::from_file(file, "bar.txt")?;
/// # fs::remove_file(path())?;
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
@ -181,31 +168,18 @@ impl<C: StaticFileConfig> NamedFile<C> {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust /// ```no_run
/// extern crate actix_web; /// extern crate actix_web;
/// ///
/// use actix_web::fs::{DefaultConfig, NamedFile}; /// use actix_web::fs::{DefaultConfig, NamedFile};
/// use std::io::{self, Write}; /// use std::io::{self, Write};
/// use std::env; /// use std::env;
/// # use std::fs::{self, File}; /// use std::fs::File;
/// # use std::path::PathBuf;
/// #
/// # fn path() -> PathBuf {
/// # let mut path = env::temp_dir();
/// # path.push("actix-web-named-file-test-from-file-with-config");
/// # path
/// # }
/// #
/// # fn tempfile() -> Result<File, io::Error> {
/// # let file = File::create(path())?;
/// # Ok(file)
/// # }
/// ///
/// fn main() -> io::Result<()> { /// fn main() -> io::Result<()> {
/// let mut file = tempfile()?; /// let mut file = File::create("foo.txt")?;
/// file.write_all(b"Hello, world!")?; /// file.write_all(b"Hello, world!")?;
/// let named_file = NamedFile::from_file_with_config(file, "foo.txt", DefaultConfig)?; /// let named_file = NamedFile::from_file_with_config(file, "bar.txt", DefaultConfig)?;
/// # fs::remove_file(path())?;
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```