Skip to content

Commit 34b8739

Browse files
committed
Add doc and smoke test
1 parent 7dfa4f9 commit 34b8739

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/macros.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ macro_rules! closure (
8989
/// // will use &[u8] as input type (use this if the compiler
9090
/// // complains about lifetime issues
9191
/// named!(my_function<&[u8]>, tag!("abcd"));
92-
/// //prefix them with 'pub' to make the functions public
92+
/// // prefix them with 'pub' to make the functions public
9393
/// named!(pub my_function, tag!("abcd"));
94+
/// // prefix them with 'pub(crate)' to make the functions public within the crate
95+
/// named!(pub(crate) my_function, tag!("abcd"));
9496
/// ```
9597
#[macro_export]
9698
macro_rules! named (
@@ -1298,6 +1300,17 @@ mod tests {
12981300
assert_eq!(res, Done(&b""[..], a));
12991301
}
13001302

1303+
mod pub_crate_named_mod {
1304+
named!(pub(crate) tst, tag!("abcd"));
1305+
}
1306+
1307+
#[test]
1308+
fn pub_crate_named_test() {
1309+
let a = &b"abcd"[..];
1310+
let res = pub_crate_named_mod::tst(a);
1311+
assert_eq!(res, Done(&b""[..], a));
1312+
}
1313+
13011314
#[test]
13021315
fn apply_test() {
13031316
fn sum2(a:u8, b:u8) -> u8 { a + b }

0 commit comments

Comments
 (0)