Sheffield-iGEM / syn-zeug

A modern toolbox for synthetic biology
https://sheffield-igem.github.io/syn-zeug/
GNU Affero General Public License v3.0
6 stars 3 forks source link

feat(seq): add a `subseq` method #34

Closed TheLostLambda closed 2 years ago

TheLostLambda commented 2 years ago

I tried to avoid copying data by creating a SubSeq type:

 pub struct SubSeq<'a> {
    bytes: &'a [u8],
    kind: Kind,
    alphabet: Alphabet,
}

But lifetimes mean implementing Deref is a pain, so I can't share methods between the two like String and str unless I dabble in some unsafe code, which really isn't worth the trouble right now...

I could revisit this at some point in the future if I want to reduce the copying being done. It's also worth noting that crates automating method delegation could cut down a bit on method duplication if I skip implementing Deref.