Skip to content

Commit d97727f

Browse files
committed
feat: add doc for method
1 parent 2fb388f commit d97727f

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

minimap2-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
3434

3535
[dependencies]
3636
libz-sys = { version = "1.1", default-features = false, features = ["libc"] }
37+
paste = "1.0.15"
3738

3839
[build-dependencies]
3940
pkg-config = "0.3"

minimap2-sys/src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ unsafe impl Send for mm_idx_t {}
1212
unsafe impl Send for mm_idx_reader_t {}
1313
unsafe impl Send for mm_mapopt_t {}
1414

15+
use paste::paste;
16+
1517
impl Drop for mm_idx_t {
1618
fn drop(&mut self) {
1719
unsafe { mm_idx_destroy(self) };
@@ -30,18 +32,23 @@ impl Default for mm_mapopt_t {
3032
}
3133
}
3234

35+
3336
macro_rules! add_flag_methods {
3437
($ty:ty, $struct_name:ident, $(($set_name:ident, $unset_name:ident, $flag:expr)),+) => {
3538
impl $struct_name {
3639
$(
37-
#[inline(always)]
38-
pub fn $set_name(&mut self) {
39-
self.flag |= $flag as $ty;
40-
}
41-
42-
#[inline(always)]
43-
pub fn $unset_name(&mut self) {
44-
self.flag &= !$flag as $ty;
40+
paste! {
41+
#[inline(always)]
42+
#[doc = "Set the " $flag " flag"]
43+
pub fn $set_name(&mut self) {
44+
self.flag |= $flag as $ty;
45+
}
46+
47+
#[inline(always)]
48+
#[doc = "Unset the " $flag " flag"]
49+
pub fn $unset_name(&mut self) {
50+
self.flag &= !$flag as $ty;
51+
}
4552
}
4653
)*
4754
}

0 commit comments

Comments
 (0)