tools/zip: fix doc tests

the doc code was not compiling and blocking cargo test

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-10-21 14:14:22 +02:00 committed by Thomas Lamprecht
parent bdc208af48
commit dc2876f6bb
1 changed files with 7 additions and 5 deletions

View 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(())
/// }