Skip to content

Conversation

@swooster
Copy link
Contributor

The current version of NucleotideIter works with iterators of Nucleotide, &Nucleotide, NucleotideAmbiguous, &NucleotideAmbiguous and impl NucleotideLike, but not &impl NucleotideLike. For example the following code currently doesn't compile:

use quickdna::{NucleotideIter, NucleotideLike};

fn do_stuff(dna: &[impl NucleotideLike]) {
    dna.iter().reverse_complement();
}

This PR removes the kludgey infectious ToNucleotideLike trait I came up with and instead of relies on how type resolution of methods is a bit smarter than traits.

Unfortunately, the convenience of e.g. `.complement()` working for
both slices and owned iterators was outweighed by `ToNucleotideLike`
infecting surrounding generics. This change eliminates `ToNucleotideLike`
and makes it possible to use `NucleotideIter` when iterating over
`&[impl NucleotideLike]`.
@swooster
Copy link
Contributor Author

If this is too large to review, let me know and I may be able to split it into some smaller PRs. (no promises until I try it though)

Copy link

@franssl franssl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@swooster swooster merged commit b7c7784 into main Dec 1, 2025
8 checks passed
@swooster swooster deleted the swooster/remove-to-nucleotide-like branch December 1, 2025 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants