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
## [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
### Added

View File

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