Skip to content

Commit 64da403

Browse files
committed
Update faidx documentation for clarification
1 parent 4780c0c commit 64da403

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/faidx/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct Reader {
3737
}
3838

3939
impl Reader {
40-
/// Create a new Reader from path.
40+
/// Create a new Reader from a path.
4141
///
4242
/// # Arguments
4343
///
@@ -46,7 +46,7 @@ impl Reader {
4646
Self::new(&path_as_bytes(path, true)?)
4747
}
4848

49-
/// Create a new Reader from URL.
49+
/// Create a new Reader from an URL.
5050
///
5151
/// # Arguments
5252
///
@@ -55,24 +55,25 @@ impl Reader {
5555
Self::new(url.as_str().as_bytes())
5656
}
5757

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.
5960
///
6061
/// # Arguments
6162
///
62-
/// * `path` - the path to open
63+
/// * `path` - the path or URL to open
6364
fn new(path: &[u8]) -> Result<Self, Error> {
6465
let cpath = ffi::CString::new(path).unwrap();
6566
let inner = unsafe { htslib::fai_load(cpath.as_ptr()) };
6667
Ok(Self { inner })
6768
}
6869

69-
/// Fetches the sequence and returns it
70+
/// Fetches the sequence and returns it.
7071
///
7172
/// # Arguments
7273
///
7374
/// * `name` - the name of the template sequence (e.g., "chr1")
7475
/// * `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).
7677
pub fn fetch_seq<N: AsRef<str>>(&self, name: N, begin: usize, end: usize) -> String {
7778
let cname = ffi::CString::new(name.as_ref().as_bytes()).unwrap();
7879
let len_out: i32 = 0;

0 commit comments

Comments
 (0)