5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2025-03-11 20:58:47 +03:00

fix example

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-01-13 09:59:58 +01:00 committed by Fabian Grünbichler
parent 7aee9c1f6b
commit a5b958d10c

View File

@ -12,21 +12,8 @@ async fn main() {
let mut reader = Decoder::from_tokio(file)
.await
.expect("failed to open pxar archive contents");
let mut i = 0;
while let Some(entry) = reader.next().await {
println!("{:#?}", entry.expect("failed to parse entry").path());
i += 1;
if i == 2 {
break;
}
}
// Use a Stream for the remaining entries:
use futures::stream::StreamExt;
let mut stream = reader.into_stream();
while let Some(entry) = stream.next().await {
println!("{:#?}", entry.expect("failed to parse entry").path());
}
}