[]Struct rust_htslib::bam::record::CigarString

pub struct CigarString(pub Vec<Cigar>);

A CIGAR string. This type wraps around a Vec<Cigar>.

Example

use rust_htslib::bam::record::{Cigar, CigarString};

let cigar = CigarString(vec![Cigar::Match(100), Cigar::SoftClip(10)]);

// access by index
assert_eq!(cigar[0], Cigar::Match(100));
// format into classical string representation
assert_eq!(format!("{}", cigar), "100M10S");
// iterate
for op in &cigar {
   println!("{}", op);
}

Methods

impl CigarString[src]

pub fn into_view(self, pos: i32) -> CigarStringView[src]

Create a CigarStringView from this CigarString at position pos

pub fn from_alignment(alignment: &Alignment, hard_clip: bool) -> Self[src]

Calculate the bam cigar from the alignment struct. x is the target string and y is the reference. hard_clip controls how unaligned read bases are encoded in the cigar string. Set to true to use the hard clip (H) code, or false to use soft clip (S) code. See the SAM spec for more details.

pub fn from_bytes(text: &[u8]) -> Result<Self, CigarError>[src]

Create a CigarString from given bytes.

pub fn from_str(text: &str) -> Result<Self, CigarError>[src]

Create a CigarString from given str.

pub fn to_string(&self) -> String[src]

impl<'a> CigarString[src]

pub fn iter(&'a self) -> Iter<'a, Cigar>[src]

Trait Implementations

impl PartialEq<CigarString> for CigarString

impl Clone for CigarString

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<Vec<Cigar>> for CigarString

impl From<CigarString> for Vec<Cigar>

impl<'a> IntoIterator for &'a CigarString[src]

type Item = &'a Cigar

The type of the elements being iterated over.

type IntoIter = Iter<'a, Cigar>

Which kind of iterator are we turning this into?

impl Eq for CigarString

impl Deref for CigarString

type Target = Vec<Cigar>

The resulting type after dereferencing.

impl Display for CigarString[src]

impl Debug for CigarString

impl Index<usize> for CigarString

type Output = <Vec<Cigar> as Index<usize>>::Output

The returned type after indexing.

impl IndexMut<usize> for CigarString

impl Hash for CigarString

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for CigarString

impl Sync for CigarString

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]