zaeleus / noodles

Bioinformatics I/O libraries in Rust
MIT License
477 stars 53 forks source link

Can support flush method on writer ? #269

Closed sharkLoc closed 2 months ago

zaeleus commented 2 months ago

Use Writer::get_mut to the get the underlying writer that implements std::io::Write, which has a flush method, e.g.,

let mut writer = Writer::new(io::sink());
writer.get_mut().flush()?;
sharkLoc commented 2 months ago

I did a test but dose not work 捕获

zaeleus commented 2 months ago

I see; thanks for the follow up. This is missing from the FASTA index writer. It's now added in ce7e5879a5a4eadfc8a73de0f8d29a042df8612a.

Do note that it's common for buffered writers to best-effort flush and close on drop, which may be a usable workaround.