]> git.proxmox.com Git - pxar.git/commitdiff
fix example
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 13 Jan 2021 08:59:58 +0000 (09:59 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 13 Jan 2021 09:58:15 +0000 (10:58 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
examples/apxar.rs

index 03c7590cd071f3548b5dd8314057f6140b11e688..0c6224219594d2fe1aaf60529e6d78f99ddefc58 100644 (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 {
+    while let Some(entry) = reader.next().await {
         println!("{:#?}", entry.expect("failed to parse entry").path());
     }
 }