compact_genome::interface::sequence_store

Trait SequenceStore

source
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(
        &mut self,
        iter: impl IntoIterator<Item = AlphabetType::CharacterType>,
    ) -> Self::Handle;
    fn add_from_iter_u8<IteratorType: IntoIterator<Item = u8>>(
        &mut self,
        iter: IteratorType,
    ) -> Result<Self::Handle, AlphabetError>;
    fn get<'this: 'result, 'handle: 'result, 'result>(
        &'this self,
        handle: &'handle Self::Handle,
    ) -> &'result 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( &mut self, iter: impl IntoIterator<Item = AlphabetType::CharacterType>, ) -> 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.

This method expects an IntoIterator over alphabet characters.

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 IntoIterator over ASCII characters, and returns and error if any of the characters is not part of the alphabet.

source

fn get<'this: 'result, 'handle: 'result, 'result>( &'this self, handle: &'handle Self::Handle, ) -> &'result 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.

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 an error if any of the characters is not part of the alphabet.

Object Safety§

This trait is not object safe.

Implementors§

source§

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

source§

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

source§

impl<AlphabetType: Alphabet, SequenceType: OwnedGenomeSequence<AlphabetType, SubsequenceType>, SubsequenceType: GenomeSequence<AlphabetType, SubsequenceType> + ?Sized> SequenceStore<AlphabetType> for HandleSequenceStore<AlphabetType, SequenceType, SubsequenceType>

source§

type Handle = SequenceType

source§

type SequenceRef = SubsequenceType