File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ impl Header {
2525 // header which samtools (<=1.6) will complain
2626 // about
2727 while let Some ( & last_char) = record. last ( ) {
28- if last_char== b'\n' {
28+ if last_char == b'\n' {
2929 record. pop ( ) ;
3030 } else {
3131 break ;
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ impl Drop for Reader {
171171
172172pub struct IndexedReader {
173173 bgzf : * mut htslib:: Struct_BGZF ,
174- pub header : HeaderView ,
174+ header : HeaderView ,
175175 idx : * mut htslib:: hts_idx_t ,
176176 itr : Option < * mut htslib:: hts_itr_t > ,
177177}
@@ -219,7 +219,7 @@ impl IndexedReader {
219219 if idx. is_null ( ) {
220220 Err ( IndexedReaderError :: InvalidIndex )
221221 } else {
222- Ok ( IndexedReader { bgzf : bgzf, header : HeaderView :: new ( header) , idx : idx, itr : None } )
222+ Ok ( IndexedReader { bgzf : bgzf, header : HeaderView :: new ( header) , idx : idx, itr : None } )
223223 }
224224 }
225225
@@ -660,6 +660,17 @@ impl HeaderView {
660660 }
661661}
662662
663+
664+ impl Clone for HeaderView {
665+ fn clone ( & self ) -> Self {
666+ HeaderView {
667+ inner : unsafe { htslib:: bam_hdr_dup ( self . inner ) } ,
668+ owned : true
669+ }
670+ }
671+ }
672+
673+
663674impl Drop for HeaderView {
664675 fn drop ( & mut self ) {
665676 if self . owned {
@@ -668,6 +679,7 @@ impl Drop for HeaderView {
668679 }
669680}
670681
682+
671683#[ cfg( test) ]
672684mod tests {
673685 extern crate tempdir;
You can’t perform that action at this time.
0 commit comments