-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write_* takes ownership of Writer #8
Comments
The function signature is:
Shouldn't it be?
|
I'm sorry if writing isn't documented well. I'm working on a next version with better docs, but it is progressing slowly. The following should work, because seq_io::fastq::write_to(&mut writer, &r.head, &r.seq, &r.qual)?; Like this, the writer is not moved to the writing function. Also note the It is even simpler to use the r.write(&mut writer)?; Did you use the Your code would then be: let mut reader = Reader::from_path("in.fastq")?;
let mut writer = BufWriter::new(File::create("out.fastq")?);
wile let Some(r) = reader.next() {
let r = r?;
r.write(&mut writer)?;
} Also note that you need to use |
Aah, it's the magic in the Write trait itself that I missed. Add the expected Thanks for the explanation :)
That one got picked up in my testing pretty quickly.
Mostly it was because the borrowed version didn't appear to implement Iter and I was switching from another fastq parsing library. |
Maybe I'm confused about the API but why do
seq_io::fast*::write_*
take ownership of the writer? Doesn't this mean you can only ever write one record? This seems problematic.The simplest reproduction example is:
which doesn't compile since
writer
was moved.The text was updated successfully, but these errors were encountered: