Skip to content

Commit

Permalink
bam/record/cigar: Debug as operation results
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Feb 7, 2024
1 parent 640b05c commit 372f8c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions noodles-bam/src/record/cigar.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::{io, mem};
use std::{fmt, io, mem};

use noodles_sam::{self as sam, alignment::record::cigar::Op};

const CHUNK_SIZE: usize = mem::size_of::<u32>();

/// BAM record CIGAR operations.
#[derive(Debug, Eq, PartialEq)]
#[derive(Eq, PartialEq)]
pub struct Cigar<'a>(&'a [u8]);

impl<'a> Cigar<'a> {
Expand Down Expand Up @@ -59,6 +59,12 @@ impl<'a> AsRef<[u8]> for Cigar<'a> {
}
}

impl<'a> fmt::Debug for Cigar<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.iter()).finish()
}
}

impl<'a> TryFrom<Cigar<'a>> for sam::alignment::record_buf::Cigar {
type Error = io::Error;

Expand Down

0 comments on commit 372f8c8

Please sign in to comment.