Currently DnaSequence owns a Vec<Nucleotide>. But we'd also like to be able to have a DnaSequence backed by a borrowed &[Nucleotide]. Same for ProteinSequence.
Thought from @vgel: use generics, so DnaSequence<Vec<Nucleotide>> vs DnaSequence<&[Nucleotide]>, and then maybe nice aliases for these. Maybe even make DnaSequence<[Nucleotide; N]> work. This is what SmallVec does.
Alternatively, follow the Rust tradition of two typenames for borrowed vs. owned, like str vs String and Path vs PathBuf.
Currently DnaSequence owns a
Vec<Nucleotide>. But we'd also like to be able to have a DnaSequence backed by a borrowed&[Nucleotide]. Same for ProteinSequence.Thought from @vgel: use generics, so
DnaSequence<Vec<Nucleotide>>vsDnaSequence<&[Nucleotide]>, and then maybe nice aliases for these. Maybe even makeDnaSequence<[Nucleotide; N]>work. This is what SmallVec does.Alternatively, follow the Rust tradition of two typenames for borrowed vs. owned, like
strvsStringandPathvsPathBuf.