Trait compact_genome::interface::sequence_store::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_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§
sourcetype Handle
type Handle
A handle to a sequence in this store. Can be used to retrieve the respective sequence.
sourcetype SequenceRef: GenomeSequence<AlphabetType, Self::SequenceRef> + ?Sized
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§
sourcefn add<Sequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized, Subsequence: GenomeSequence<AlphabetType, Subsequence> + ?Sized>(
&mut self,
s: &Sequence
) -> Self::Handle
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.
sourcefn add_from_iter_u8<IteratorType: IntoIterator<Item = u8>>(
&mut self,
iter: IteratorType
) -> Result<Self::Handle, AlphabetError>
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.
sourcefn get(&self, handle: &Self::Handle) -> &Self::SequenceRef
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§
sourcefn add_from_slice_u8(
&mut self,
slice: &[u8]
) -> Result<Self::Handle, AlphabetError>
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.