Struct genestring::Genestring
source · pub struct Genestring { /* private fields */ }
Implementations
sourceimpl Genestring
impl Genestring
sourcepub fn with_bits(count: u64) -> Genestring
pub fn with_bits(count: u64) -> Genestring
Creates a gene string capable of holding at least count
bits.
sourcepub fn writer(&mut self) -> Writer<'_>
pub fn writer(&mut self) -> Writer<'_>
Returns a helper for writing values in to the genestring.
sourcepub fn reader(&mut self) -> Reader<'_>
pub fn reader(&mut self) -> Reader<'_>
Returns a helper for reading values from the genestring.
pub fn is_empty(&self) -> bool
sourcepub fn get(&self, offset: u64, bits: u64) -> u64
pub fn get(&self, offset: u64, bits: u64) -> u64
Retrieves bits
number of bits from the string, starting at a given offset
. Panics if
bits
is larger than 64 or would otherwise go outside the bounds of the string.
sourcepub fn piece_iter(&self) -> Iter<'_, u64>
pub fn piece_iter(&self) -> Iter<'_, u64>
Provides an immutable iterator for the gene string’s internal bank of integers.
sourcepub fn piece_iter_mut(&mut self) -> IterMut<'_, u64>
pub fn piece_iter_mut(&mut self) -> IterMut<'_, u64>
Provides a mutable iterator for the gene string’s internal bank of integers.
sourcepub fn set(&mut self, offset: u64, bits: u64, value: u64)
pub fn set(&mut self, offset: u64, bits: u64, value: u64)
Assigns a value at the given bit offset and bit length.
sourcepub fn transplant(&mut self, donor: &Genestring, offset: u64, bits: u64)
pub fn transplant(&mut self, donor: &Genestring, offset: u64, bits: u64)
Copies bits from a given offset and bit length from a donor to self. Both strings do not need to be the same total length, but the range being copied must be valid and the same for both donor and self. Used to implement crossover.