zaeleus / noodles

Bioinformatics I/O libraries in Rust
MIT License
498 stars 52 forks source link

cram/async/io/writer: Add alignment record writer #293

Closed zaeleus closed 2 months ago

zaeleus commented 2 months ago

Currently, I cannot compile the async Writer due to

error[E0308]: mismatched types
   --> noodles-util/src/alignment/async/io/writer.rs:80:63
    |
80  |             Self::Cram(writer) => writer.write_record(header, record).await,
    |                                          ------------         ^^^^^^ expected `Record`, found `&dyn Record`
    |                                          |
    |                                          arguments to this method are incorrect
    |
    = note: expected struct `noodles_cram::Record`
            found reference `&dyn noodles_sam::alignment::Record`
note: method defined here
   --> /Users/michael/Projects/noodles/noodles-cram/src/async/io/writer.rs:181:18
    |
181 |     pub async fn write_record(
    |                  ^^^^^^^^^^^^

Which is coming from the fact that cram::async::io::Writer::write_record takes a cram::Record type rather than a &dyn > sam::alignment::Record trait.

https://github.com/zaeleus/noodles/blob/174ad3c98092728a6be3feabb346619ebd14a5ad/noodles-cram/src/async/io/writer.rs#L184

Originally posted by @mbhall88 in https://github.com/zaeleus/noodles/pull/292#issue-2479959661


The async CRAM writer is missing the equivalent of cram::io::Writer::write_alignment_record.