@@ -37,7 +37,7 @@ pub struct Reader {
37
37
}
38
38
39
39
impl Reader {
40
- /// Create a new Reader from path.
40
+ /// Create a new Reader from a path.
41
41
///
42
42
/// # Arguments
43
43
///
@@ -46,7 +46,7 @@ impl Reader {
46
46
Self :: new ( & path_as_bytes ( path, true ) ?)
47
47
}
48
48
49
- /// Create a new Reader from URL.
49
+ /// Create a new Reader from an URL.
50
50
///
51
51
/// # Arguments
52
52
///
@@ -55,24 +55,25 @@ impl Reader {
55
55
Self :: new ( url. as_str ( ) . as_bytes ( ) )
56
56
}
57
57
58
- /// Create a new Reader.
58
+ /// Internal function to create a Reader from some sort of path (could be file path but also URL).
59
+ /// The path or URL will be handled by the c-implementation transparently.
59
60
///
60
61
/// # Arguments
61
62
///
62
- /// * `path` - the path to open
63
+ /// * `path` - the path or URL to open
63
64
fn new ( path : & [ u8 ] ) -> Result < Self , Error > {
64
65
let cpath = ffi:: CString :: new ( path) . unwrap ( ) ;
65
66
let inner = unsafe { htslib:: fai_load ( cpath. as_ptr ( ) ) } ;
66
67
Ok ( Self { inner } )
67
68
}
68
69
69
- /// Fetches the sequence and returns it
70
+ /// Fetches the sequence and returns it.
70
71
///
71
72
/// # Arguments
72
73
///
73
74
/// * `name` - the name of the template sequence (e.g., "chr1")
74
75
/// * `begin` - the offset within the template sequence (starting with 0)
75
- /// * `end` - the end position to return
76
+ /// * `end` - the end position to return (if smaller than `begin`, the behavior is undefined).
76
77
pub fn fetch_seq < N : AsRef < str > > ( & self , name : N , begin : usize , end : usize ) -> String {
77
78
let cname = ffi:: CString :: new ( name. as_ref ( ) . as_bytes ( ) ) . unwrap ( ) ;
78
79
let len_out: i32 = 0 ;
0 commit comments