]> git.proxmox.com Git - proxmox-backup.git/commitdiff
tools/zip: fix doc tests
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 21 Oct 2020 12:14:22 +0000 (14:14 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Oct 2020 12:20:16 +0000 (14:20 +0200)
the doc code was not compiling and blocking cargo test

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/tools/zip.rs

index 3248239fb5297f06eb0fbe3f55bc597ff2dc2a85..d651b0922f6a1d30493b40cc473cbdff1edb4408 100644 (file)
@@ -354,21 +354,23 @@ impl ZipEntry {
 /// ```no_run
 /// use proxmox_backup::tools::zip::*;
 /// use tokio::fs::File;
+/// use tokio::prelude::*;
+/// use anyhow::{Error, Result};
 ///
-/// #[tokio::async]
-/// async fn main() ->  std::io::Result<()> {
+/// #[tokio::main]
+/// async fn main() -> Result<(), Error> {
 ///     let target = File::open("foo.zip").await?;
 ///     let mut source = File::open("foo.txt").await?;
 ///
 ///     let mut zip = ZipEncoder::new(target);
-///     zip.add_entry(ZipEntry {
+///     zip.add_entry(ZipEntry::new(
 ///         "foo.txt",
 ///         0,
 ///         0o100755,
 ///         true,
-///     }, source).await?;
+///     ), Some(source)).await?;
 ///
-///     zip.finish().await?
+///     zip.finish().await?;
 ///
 ///     Ok(())
 /// }