#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(improper_ctypes)]
#![allow(clippy::redundant_static_lifetimes)]
#![allow(dead_code)]
include!("../generated/hts.rs");
#[cfg(no_bam_hdr_destroy)]
pub(crate) unsafe extern "C" fn bam_hdr_destroy(h: *mut bam_hdr_t) {
sam_hdr_destroy(h as _)
}
pub(crate) mod htslib_obj {
use super::*;
pub type Bam = bam1_t;
pub type SamHeader = sam_hdr_t;
pub type BgzfFile = BGZF;
pub type HtsFile = htsFile;
pub type HtsIndex = hts_idx_t;
pub type HtsIterator = hts_itr_t;
pub type KString = kstring_t;
pub type Bcf = bcf1_t;
pub type BcfHeader = bcf_hdr_t;
pub type BcfFmt = bcf_fmt_t;
pub type BcfInfo = bcf_info_t;
impl KString {
pub fn new() -> Self {
Self {
l: 0,
m: 0,
s: std::ptr::null_mut(),
}
}
}
}
pub(crate) trait HtslibReturnValue: Sized {
fn into_hts_result(self) -> crate::HtsResult<Self>;
}
impl<T> HtslibReturnValue for *mut T {
fn into_hts_result(self) -> crate::HtsResult<Self> {
if self == std::ptr::null_mut() {
return Err(crate::HtsError::HtsLibError);
}
Ok(self)
}
}
impl HtslibReturnValue for i32 {
fn into_hts_result(self) -> crate::HtsResult<i32> {
if self < 0 {
return Err(crate::HtsError::HtsLibError);
}
Ok(self)
}
}