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_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]
Methods from Deref<Target = Vec<Cigar>>
pub fn capacity(&self) -> usize
1.0.0[src]
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize
1.0.0[src]
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl PartialEq for CigarString
fn eq(&self, __arg_0: &CigarString) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &CigarString) -> bool
This method tests for !=
.
impl Eq for CigarString
impl Clone for CigarString
fn clone(&self) -> CigarString
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Hash for CigarString
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Deref for CigarString
type Target = Vec<Cigar>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
Dereferences the value.
impl Index<usize> for CigarString
type Output = <Vec<Cigar> as Index<usize>>::Output
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
Performs the indexing (container[index]
) operation.
impl IndexMut<usize> for CigarString
fn index_mut(&mut self, index: usize) -> &mut Self::Output
Performs the mutable indexing (container[index]
) operation.
impl From<Vec<Cigar>> for CigarString
impl From<CigarString> for Vec<Cigar>
fn from(v: CigarString) -> Self
Performs the conversion.
impl Debug for CigarString
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?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more