pub fn new() -> io::Result<Self> {
      match NonNull::new(unsafe { bam_init1() }) {
         Some(mut b) => {
            let sz = 128;
            let data = unsafe { libc::calloc(sz, 1) as *mut c_char };
            if data.is_null() {
               Err(hts_err("Failed to allocate new BamRec".to_string()))
            } else {
               unsafe { b.as_mut().data = data }
               Ok(BamRec {
                  inner: b,
                  phantom: PhantomData,
               })
            }
         }
         None => Err(hts_err("Failed to allocate new BamRec".to_string())),
      }
   }
// Unlike the default behaviour in htslib, we initialize the new data field in
// the bam1_t structure so we don't have to worry about this being zero
Unlike the default behaviour in htslib, we initialize the new data field in
the bam1_t structure so we don't have to worry about this being zero
Unlike the default behaviour in htslib we initialize the new data field in the bam1_t structure so we don ' t have to worry about this being zero
pub fn new() -> io::Result<Self> {
      match NonNull::new(unsafe { bam_init1() }) {
         Some(mut b) => {
            let sz = 128;
            let data = unsafe { libc::calloc(sz, 1) as *mut c_char };
            if data.is_null() {
               Err(hts_err("Failed to allocate new BamRec".to_string()))
            } else {
               unsafe { b.as_mut().data = data }
               Ok(BamRec {
                  inner: b,
                  phantom: PhantomData,
               })
            }
         }
         None => Err(hts_err("Failed to allocate new BamRec".to_string())),
      }
   }
pub fn new ( ) -> io :: Result < Self > { match NonNull :: new ( unsafe { bam_init1 ( ) } ) { Some ( mut b ) => { let sz = 128 ; let data = unsafe { libc :: calloc ( sz , 1 ) as * mut c_char } ; if data . is_null ( ) { Err ( hts_err ( " " . to_string ( ) ) ) } else { unsafe { b . as_mut ( ) . data = data } Ok ( BamRec { inner : b , phantom : PhantomData , } ) } } None => Err ( hts_err ( " " . to_string ( ) ) ) , } }
Unlike the default behaviour in htslib, we initialize the new data field in
the bam1_t structure so we don't have to worry about this being zero
Unlike the default behaviour in htslib we initialize the new data field in the bam1_t structure so we don ' t have to worry about this being zero