Skip to content

Commit ded8f57

Browse files
author
Rob Patro
committed
Fix README Rust example rendering
1 parent 4a29825 commit ded8f57

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ DEFLATE explicitly, or opt into detection between gzip and zlib:
5050
```rust
5151
use rapidgzip_core::{Decoder, Format};
5252

53-
# fn main() -> Result<(), Box<dyn std::error::Error>> {
54-
let zlib = Decoder::builder().format(Format::Zlib).build()?;
55-
let raw = Decoder::builder()
56-
.format(Format::RawDeflate)
57-
.expected_uncompressed_size(Some(1_000_000))
58-
.build()?;
59-
let detected = Decoder::builder().auto_detect_format().build()?;
60-
# let _ = (zlib, raw, detected);
61-
# Ok(())
62-
# }
53+
fn main() -> Result<(), Box<dyn std::error::Error>> {
54+
let _zlib = Decoder::builder().format(Format::Zlib).build()?;
55+
let _raw = Decoder::builder()
56+
.format(Format::RawDeflate)
57+
.expected_uncompressed_size(Some(1_000_000))
58+
.build()?;
59+
let _detected = Decoder::builder().auto_detect_format().build()?;
60+
Ok(())
61+
}
6362
```
6463

6564
Auto-detection performs an exact, non-consuming two-byte check and never
@@ -248,20 +247,20 @@ an explicit operation, so ordinary decoding and its small `Copy`
248247
use rapidgzip_core::{AnalyzeOptions, Decoder};
249248
use std::fs::File;
250249
251-
# fn main() -> Result<(), Box<dyn std::error::Error>> {
252-
let source = File::open("reads.fastq.gz")?;
253-
let options = AnalyzeOptions::default()
254-
.maximum_blocks(250_000)
255-
.maximum_retained_backreferences(10_000);
256-
let analysis = Decoder::default().analyze_with_options(&source, options)?;
257-
258-
println!("{} members", analysis.streams.len());
259-
for (kind, count) in analysis.block_type_counts() {
260-
println!("{kind:?}: {count}");
250+
fn main() -> Result<(), Box<dyn std::error::Error>> {
251+
let source = File::open("reads.fastq.gz")?;
252+
let options = AnalyzeOptions::default()
253+
.maximum_blocks(250_000)
254+
.maximum_retained_backreferences(10_000);
255+
let analysis = Decoder::default().analyze_with_options(&source, options)?;
256+
257+
println!("{} members", analysis.streams.len());
258+
for (kind, count) in analysis.block_type_counts() {
259+
println!("{kind:?}: {count}");
260+
}
261+
assert_eq!(analysis.compressed_size_in_bytes, source.metadata()?.len());
262+
Ok(())
261263
}
262-
assert_eq!(analysis.compressed_size_in_bytes, source.metadata()?.len());
263-
# Ok(())
264-
# }
265264
```
266265

267266
The default result retains up to 100,000 streams, 100,000 blocks, and 1 MiB of

0 commit comments

Comments
 (0)