Skip to content

Better API #18

@bovee

Description

@bovee

Rather than the callback-style we have now, it would be nice to write something like:

let processor = NeedletailFile::new("test.fasta");
assert_eq!(processor.file_type, NeedletailTypes::FASTA);
assert_eq!(processor.compression_type, NeedletailCompressionTypes::None);

while let record = processor.next()? {
   ...
}

The major issues with this are keeping the state of the iterator and the underlying buffer synced up (Rust's streaming iterator problem; this is also why we can't use for record in ...) and more importantly, the polymorphic nature of record (is it a FASTA? FASTQ? maybe we can do something clever with Into here to allow the processor to spit out a SeqRecord?). I've never been a huge fan of the callbacks and with the big v0.2.0 rewrite I think we're closer to having a decent solution here, but there's still a bit of type-fu necessary to make it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions