pub trait SequenceStore<AlphabetType: Alphabet> {
    type Handle;
    type SequenceRef: GenomeSequence<AlphabetType, Self::SequenceRef> + ?Sized;

    // Required methods
    fn add<Sequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized, Subsequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized>(
        &mut self,
        s: &Sequence
    ) -> Self::Handle;
    fn add_from_iter_u8<IteratorType: IntoIterator<Item = u8>>(
        &mut self,
        iter: IteratorType
    ) -> Result<Self::Handle, AlphabetError>;
    fn get(&self, handle: &Self::Handle) -> &Self::SequenceRef;

    // Provided method
    fn add_from_slice_u8(
        &mut self,
        slice: &[u8]
    ) -> Result<Self::Handle, AlphabetError> { ... }
}
Expand description

A store for sequence data, which gives out handles that can be used to retrieve concrete sequences.

Required Associated Types§

source

type Handle

A handle to a sequence in this store. Can be used to retrieve the respective sequence.

source

type SequenceRef: GenomeSequence<AlphabetType, Self::SequenceRef> + ?Sized

A reference to a sequence stored in this store. This trait only uses &SequenceRef, so SequenceRef should be the base type and not a reference type itself.

Required Methods§

source

fn add<Sequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized, Subsequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized>( &mut self, s: &Sequence ) -> Self::Handle

Adds a sequence to this store and returns a handle for later retrieval. Handles do not borrow the sequence store, so they can exist while the store is modified.

source

fn add_from_iter_u8<IteratorType: IntoIterator<Item = u8>>( &mut self, iter: IteratorType ) -> Result<Self::Handle, AlphabetError>

Adds a sequence to this store and returns a handle for later retrieval. Handles do not borrow the sequence store, so they can exist while the store is modified.

This method expects an IntoIter over ASCII characters, and returns None if any of the characters is not part of the alphabet.

source

fn get(&self, handle: &Self::Handle) -> &Self::SequenceRef

Returns a reference to a sequence in this store, given the handle. The reference borrows the sequence store, so it cannot be mutated while references exist. On the other hand, handles do not borrow, so they can exist while the store is modified.

Provided Methods§

source

fn add_from_slice_u8( &mut self, slice: &[u8] ) -> Result<Self::Handle, AlphabetError>

Adds a sequence to this store and returns a handle for later retrieval. Handles do not borrow the sequence store, so they can exist while the store is modified.

This method expects slice of ASCII characters, and returns None if any of the characters is not part of the alphabet.

Implementors§

source§

impl<AlphabetType: Alphabet + 'static> SequenceStore<AlphabetType> for BitVectorSequenceStore<AlphabetType>

source§

impl<AlphabetType: Alphabet + 'static> SequenceStore<AlphabetType> for VectorSequenceStore<AlphabetType>

§

type Handle = VectorSequenceStoreHandle<AlphabetType>

§

type SequenceRef = VectorSubGenome<AlphabetType>