[pbs-devel] [PATCH proxmox-backup] tools/zip: fix doc tests

Dominik Csapak d.csapak at proxmox.com
Wed Oct 21 14:14:22 CEST 2020


the doc code was not compiling and blocking cargo test

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/tools/zip.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/tools/zip.rs b/src/tools/zip.rs
index 3248239f..d651b092 100644
--- a/src/tools/zip.rs
+++ b/src/tools/zip.rs
@@ -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(())
 /// }
-- 
2.20.1






More information about the pbs-devel mailing list