summaryrefslogtreecommitdiffstats
path: root/vendor/snap/examples/decompress.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/snap/examples/decompress.rs')
-rw-r--r--vendor/snap/examples/decompress.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/snap/examples/decompress.rs b/vendor/snap/examples/decompress.rs
new file mode 100644
index 000000000..7548f2f03
--- /dev/null
+++ b/vendor/snap/examples/decompress.rs
@@ -0,0 +1,13 @@
+use snap;
+
+use std::io;
+
+fn main() {
+ let stdin = io::stdin();
+ let stdout = io::stdout();
+
+ // Wrap the stdin reader in a Snappy reader.
+ let mut rdr = snap::read::FrameDecoder::new(stdin.lock());
+ let mut wtr = stdout.lock();
+ io::copy(&mut rdr, &mut wtr).expect("I/O operation failed");
+}