diff options
author | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
commit | a990de90fe41456a23e58bd087d2f107d321f3a1 (patch) | |
tree | 15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/flate2/examples | |
parent | 3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff) | |
download | fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip |
Deleted vendor folder
Diffstat (limited to 'vendor/flate2/examples')
25 files changed, 0 insertions, 469 deletions
diff --git a/vendor/flate2/examples/compress_file.rs b/vendor/flate2/examples/compress_file.rs deleted file mode 100644 index be4b81e..0000000 --- a/vendor/flate2/examples/compress_file.rs +++ /dev/null @@ -1,26 +0,0 @@ -use flate2::write::GzEncoder; -use flate2::Compression; -use std::env::args; -use std::fs::File; -use std::io::copy; -use std::io::BufReader; -use std::time::Instant; - -fn main() { - if args().len() != 3 { - eprintln!("Usage: ./compress_file `source` `target`"); - return; - } - let mut input = BufReader::new(File::open(args().nth(1).unwrap()).unwrap()); - let output = File::create(args().nth(2).unwrap()).unwrap(); - let mut encoder = GzEncoder::new(output, Compression::default()); - let start = Instant::now(); - copy(&mut input, &mut encoder).unwrap(); - let output = encoder.finish().unwrap(); - println!( - "Source len: {:?}", - input.get_ref().metadata().unwrap().len() - ); - println!("Target len: {:?}", output.metadata().unwrap().len()); - println!("Elapsed: {:?}", start.elapsed()); -} diff --git a/vendor/flate2/examples/decompress_file.rs b/vendor/flate2/examples/decompress_file.rs deleted file mode 100644 index 6b2ede9..0000000 --- a/vendor/flate2/examples/decompress_file.rs +++ /dev/null @@ -1,23 +0,0 @@ -use flate2::bufread; -use std::env::args; -use std::fs::File; -use std::io::copy; -use std::io::BufReader; -use std::time::Instant; - -fn main() { - // E.g. `cargo run --example decompress_file examples/hello_world.txt.gz hello_world.txt` - if args().len() != 3 { - eprintln!("Usage: ./decompress_file `source` `target`"); - return; - } - let input = BufReader::new(File::open(args().nth(1).unwrap()).unwrap()); - let mut output = File::create(args().nth(2).unwrap()).unwrap(); - let source_len = input.get_ref().metadata().unwrap().len(); - let start = Instant::now(); - let mut decoder = bufread::GzDecoder::new(input); - copy(&mut decoder, &mut output).unwrap(); - println!("Source len: {:?}", source_len); - println!("Target len: {:?}", output.metadata().unwrap().len()); - println!("Elapsed: {:?}", start.elapsed()); -} diff --git a/vendor/flate2/examples/deflatedecoder-bufread.rs b/vendor/flate2/examples/deflatedecoder-bufread.rs deleted file mode 100644 index 6b8e7fe..0000000 --- a/vendor/flate2/examples/deflatedecoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::DeflateDecoder; -use flate2::write::DeflateEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Deflate Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut deflater = DeflateDecoder::new(&bytes[..]); - let mut s = String::new(); - deflater.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/deflatedecoder-read.rs b/vendor/flate2/examples/deflatedecoder-read.rs deleted file mode 100644 index 1bc83bc..0000000 --- a/vendor/flate2/examples/deflatedecoder-read.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::read::DeflateDecoder; -use flate2::write::DeflateEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Deflate Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut deflater = DeflateDecoder::new(&bytes[..]); - let mut s = String::new(); - deflater.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/deflatedecoder-write.rs b/vendor/flate2/examples/deflatedecoder-write.rs deleted file mode 100644 index b9ba7a3..0000000 --- a/vendor/flate2/examples/deflatedecoder-write.rs +++ /dev/null @@ -1,24 +0,0 @@ -use flate2::write::DeflateDecoder; -use flate2::write::DeflateEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Deflate Encoded vector of bytes and returns a string or error -// Here Vec<u8> implements Write -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut writer = Vec::new(); - let mut deflater = DeflateDecoder::new(writer); - deflater.write_all(&bytes[..])?; - writer = deflater.finish()?; - let return_string = String::from_utf8(writer).expect("String parsing error"); - Ok(return_string) -} diff --git a/vendor/flate2/examples/deflateencoder-bufread.rs b/vendor/flate2/examples/deflateencoder-bufread.rs deleted file mode 100644 index bff1848..0000000 --- a/vendor/flate2/examples/deflateencoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::DeflateEncoder; -use flate2::Compression; -use std::fs::File; -use std::io; -use std::io::prelude::*; -use std::io::BufReader; - -// Open file and debug print the contents compressed with Deflate -fn main() { - println!("{:?}", open_hello_world().unwrap()); -} - -// Opens sample file, compresses the contents and returns a Vector or error -// File wrapped in a BufReader implements Bufread -fn open_hello_world() -> io::Result<Vec<u8>> { - let f = File::open("examples/hello_world.txt")?; - let b = BufReader::new(f); - let mut deflater = DeflateEncoder::new(b, Compression::fast()); - let mut buffer = Vec::new(); - deflater.read_to_end(&mut buffer)?; - Ok(buffer) -} diff --git a/vendor/flate2/examples/deflateencoder-read.rs b/vendor/flate2/examples/deflateencoder-read.rs deleted file mode 100644 index 366c60c..0000000 --- a/vendor/flate2/examples/deflateencoder-read.rs +++ /dev/null @@ -1,18 +0,0 @@ -use flate2::read::DeflateEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Print the Deflate compressed representation of hello world -fn main() { - println!("{:?}", deflateencoder_read_hello_world().unwrap()); -} - -// Return a vector containing the Deflate compressed version of hello world -fn deflateencoder_read_hello_world() -> io::Result<Vec<u8>> { - let mut result = Vec::new(); - let c = b"hello world"; - let mut deflater = DeflateEncoder::new(&c[..], Compression::fast()); - deflater.read_to_end(&mut result)?; - Ok(result) -} diff --git a/vendor/flate2/examples/deflateencoder-write.rs b/vendor/flate2/examples/deflateencoder-write.rs deleted file mode 100644 index f998e1a..0000000 --- a/vendor/flate2/examples/deflateencoder-write.rs +++ /dev/null @@ -1,10 +0,0 @@ -use flate2::write::DeflateEncoder; -use flate2::Compression; -use std::io::prelude::*; - -// Vec<u8> implements Write to print the compressed bytes of sample string -fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - println!("{:?}", e.finish().unwrap()); -} diff --git a/vendor/flate2/examples/gzbuilder.rs b/vendor/flate2/examples/gzbuilder.rs deleted file mode 100644 index c072508..0000000 --- a/vendor/flate2/examples/gzbuilder.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::Compression; -use flate2::GzBuilder; -use std::fs::File; -use std::io; -use std::io::prelude::*; - -// Compresses content of a text file into a gzip file -fn main() { - sample_builder().unwrap(); -} - -// GzBuilder opens a file and writes a sample string using Builder pattern -fn sample_builder() -> Result<(), io::Error> { - let f = File::create("examples/hello_world.txt.gz")?; - let mut gz = GzBuilder::new() - .filename("hello_world.txt") - .comment("test file, please delete") - .write(f, Compression::default()); - gz.write_all(b"hello world")?; - gz.finish()?; - Ok(()) -} diff --git a/vendor/flate2/examples/gzdecoder-bufread.rs b/vendor/flate2/examples/gzdecoder-bufread.rs deleted file mode 100644 index 06d0448..0000000 --- a/vendor/flate2/examples/gzdecoder-bufread.rs +++ /dev/null @@ -1,21 +0,0 @@ -use flate2::write::GzEncoder; -use flate2::{bufread, Compression}; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Gz Encoded vector of bytes and returns a string or error -// Here &[u8] implements BufRead -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = bufread::GzDecoder::new(&bytes[..]); - let mut s = String::new(); - gz.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/gzdecoder-read.rs b/vendor/flate2/examples/gzdecoder-read.rs deleted file mode 100644 index fbd05be..0000000 --- a/vendor/flate2/examples/gzdecoder-read.rs +++ /dev/null @@ -1,21 +0,0 @@ -use flate2::write::GzEncoder; -use flate2::{read, Compression}; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Gz Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = read::GzDecoder::new(&bytes[..]); - let mut s = String::new(); - gz.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/gzdecoder-write.rs b/vendor/flate2/examples/gzdecoder-write.rs deleted file mode 100644 index 6cee8f8..0000000 --- a/vendor/flate2/examples/gzdecoder-write.rs +++ /dev/null @@ -1,24 +0,0 @@ -use flate2::write::{GzDecoder, GzEncoder}; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_writer(bytes).unwrap()); -} - -// Uncompresses a Gz Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_writer(bytes: Vec<u8>) -> io::Result<String> { - let mut writer = Vec::new(); - let mut decoder = GzDecoder::new(writer); - decoder.write_all(&bytes[..])?; - decoder.try_finish()?; - writer = decoder.finish()?; - let return_string = String::from_utf8(writer).expect("String parsing error"); - Ok(return_string) -} diff --git a/vendor/flate2/examples/gzencoder-bufread.rs b/vendor/flate2/examples/gzencoder-bufread.rs deleted file mode 100644 index 2214e2d..0000000 --- a/vendor/flate2/examples/gzencoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::GzEncoder; -use flate2::Compression; -use std::fs::File; -use std::io; -use std::io::prelude::*; -use std::io::BufReader; - -// Open file and debug print the contents compressed with gzip -fn main() { - println!("{:?}", open_hello_world().unwrap()); -} - -// Opens sample file, compresses the contents and returns a Vector or error -// File wrapped in a BufReader implements Bufread -fn open_hello_world() -> io::Result<Vec<u8>> { - let f = File::open("examples/hello_world.txt")?; - let b = BufReader::new(f); - let mut gz = GzEncoder::new(b, Compression::fast()); - let mut buffer = Vec::new(); - gz.read_to_end(&mut buffer)?; - Ok(buffer) -} diff --git a/vendor/flate2/examples/gzencoder-read.rs b/vendor/flate2/examples/gzencoder-read.rs deleted file mode 100644 index ee13848..0000000 --- a/vendor/flate2/examples/gzencoder-read.rs +++ /dev/null @@ -1,18 +0,0 @@ -use flate2::read::GzEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Print the GZ compressed representation of hello world -fn main() { - println!("{:?}", gzencoder_read_hello_world().unwrap()); -} - -// Return a vector containing the GZ compressed version of hello world -fn gzencoder_read_hello_world() -> io::Result<Vec<u8>> { - let mut result = Vec::new(); - let c = b"hello world"; - let mut z = GzEncoder::new(&c[..], Compression::fast()); - z.read_to_end(&mut result)?; - Ok(result) -} diff --git a/vendor/flate2/examples/gzencoder-write.rs b/vendor/flate2/examples/gzencoder-write.rs deleted file mode 100644 index cee01d1..0000000 --- a/vendor/flate2/examples/gzencoder-write.rs +++ /dev/null @@ -1,10 +0,0 @@ -use flate2::write::GzEncoder; -use flate2::Compression; -use std::io::prelude::*; - -// Vec<u8> implements Write to print the compressed bytes of sample string -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - println!("{:?}", e.finish().unwrap()); -} diff --git a/vendor/flate2/examples/gzmultidecoder-bufread.rs b/vendor/flate2/examples/gzmultidecoder-bufread.rs deleted file mode 100644 index 692b6f5..0000000 --- a/vendor/flate2/examples/gzmultidecoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::MultiGzDecoder; -use flate2::write::GzEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Gz Encoded vector of bytes and returns a string or error -// Here &[u8] implements BufRead -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = MultiGzDecoder::new(&bytes[..]); - let mut s = String::new(); - gz.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/gzmultidecoder-read.rs b/vendor/flate2/examples/gzmultidecoder-read.rs deleted file mode 100644 index c59561d..0000000 --- a/vendor/flate2/examples/gzmultidecoder-read.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::read::MultiGzDecoder; -use flate2::write::GzEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Gz Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = MultiGzDecoder::new(&bytes[..]); - let mut s = String::new(); - gz.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/hello_world.txt b/vendor/flate2/examples/hello_world.txt deleted file mode 100644 index 557db03..0000000 --- a/vendor/flate2/examples/hello_world.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/vendor/flate2/examples/hello_world.txt.gz b/vendor/flate2/examples/hello_world.txt.gz Binary files differdeleted file mode 100644 index bab9799..0000000 --- a/vendor/flate2/examples/hello_world.txt.gz +++ /dev/null diff --git a/vendor/flate2/examples/zlibdecoder-bufread.rs b/vendor/flate2/examples/zlibdecoder-bufread.rs deleted file mode 100644 index 82620c5..0000000 --- a/vendor/flate2/examples/zlibdecoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::ZlibDecoder; -use flate2::write::ZlibEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_bufreader(bytes).unwrap()); -} - -// Uncompresses a Zlib Encoded vector of bytes and returns a string or error -// Here &[u8] implements BufRead -fn decode_bufreader(bytes: Vec<u8>) -> io::Result<String> { - let mut z = ZlibDecoder::new(&bytes[..]); - let mut s = String::new(); - z.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/zlibdecoder-read.rs b/vendor/flate2/examples/zlibdecoder-read.rs deleted file mode 100644 index 3d4cda7..0000000 --- a/vendor/flate2/examples/zlibdecoder-read.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::read::ZlibDecoder; -use flate2::write::ZlibEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Zlib Encoded vector of bytes and returns a string or error -// Here &[u8] implements Read -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut z = ZlibDecoder::new(&bytes[..]); - let mut s = String::new(); - z.read_to_string(&mut s)?; - Ok(s) -} diff --git a/vendor/flate2/examples/zlibdecoder-write.rs b/vendor/flate2/examples/zlibdecoder-write.rs deleted file mode 100644 index 7f5afbe..0000000 --- a/vendor/flate2/examples/zlibdecoder-write.rs +++ /dev/null @@ -1,24 +0,0 @@ -use flate2::write::ZlibDecoder; -use flate2::write::ZlibEncoder; -use flate2::Compression; -use std::io; -use std::io::prelude::*; - -// Compress a sample string and print it after transformation. -fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - let bytes = e.finish().unwrap(); - println!("{}", decode_reader(bytes).unwrap()); -} - -// Uncompresses a Zlib Encoded vector of bytes and returns a string or error -// Here Vec<u8> implements Write -fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut writer = Vec::new(); - let mut z = ZlibDecoder::new(writer); - z.write_all(&bytes[..])?; - writer = z.finish()?; - let return_string = String::from_utf8(writer).expect("String parsing error"); - Ok(return_string) -} diff --git a/vendor/flate2/examples/zlibencoder-bufread.rs b/vendor/flate2/examples/zlibencoder-bufread.rs deleted file mode 100644 index e5e17f5..0000000 --- a/vendor/flate2/examples/zlibencoder-bufread.rs +++ /dev/null @@ -1,22 +0,0 @@ -use flate2::bufread::ZlibEncoder; -use flate2::Compression; -use std::fs::File; -use std::io; -use std::io::prelude::*; -use std::io::BufReader; - -// Open file and debug print the contents compressed with zlib -fn main() { - println!("{:?}", open_hello_world().unwrap()); -} - -// Opens sample file, compresses the contents and returns a Vector or error -// File wrapped in a BufReader implements Bufread -fn open_hello_world() -> io::Result<Vec<u8>> { - let f = File::open("examples/hello_world.txt")?; - let b = BufReader::new(f); - let mut z = ZlibEncoder::new(b, Compression::fast()); - let mut buffer = Vec::new(); - z.read_to_end(&mut buffer)?; - Ok(buffer) -} diff --git a/vendor/flate2/examples/zlibencoder-read.rs b/vendor/flate2/examples/zlibencoder-read.rs deleted file mode 100644 index f833a50..0000000 --- a/vendor/flate2/examples/zlibencoder-read.rs +++ /dev/null @@ -1,19 +0,0 @@ -use flate2::read::ZlibEncoder; -use flate2::Compression; -use std::fs::File; -use std::io::prelude::*; - -// Open file and debug print the compressed contents -fn main() { - println!("{:?}", open_hello_world().unwrap()); -} - -// Opens sample file, compresses the contents and returns a Vector or error -// File implements Read -fn open_hello_world() -> std::io::Result<Vec<u8>> { - let f = File::open("examples/hello_world.txt")?; - let mut z = ZlibEncoder::new(f, Compression::fast()); - let mut result = Vec::new(); - z.read_to_end(&mut result)?; - Ok(result) -} diff --git a/vendor/flate2/examples/zlibencoder-write.rs b/vendor/flate2/examples/zlibencoder-write.rs deleted file mode 100644 index 3e3548f..0000000 --- a/vendor/flate2/examples/zlibencoder-write.rs +++ /dev/null @@ -1,10 +0,0 @@ -use flate2::write::ZlibEncoder; -use flate2::Compression; -use std::io::prelude::*; - -// Vec<u8> implements Write to print the compressed bytes of sample string -fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); - e.write_all(b"Hello World").unwrap(); - println!("{:?}", e.finish().unwrap()); -} |