File tree 1 file changed +14
-1
lines changed 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,10 @@ macro_rules! closure (
89
89
/// // will use &[u8] as input type (use this if the compiler
90
90
/// // complains about lifetime issues
91
91
/// 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
93
93
/// 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"));
94
96
/// ```
95
97
#[ macro_export]
96
98
macro_rules! named (
@@ -1298,6 +1300,17 @@ mod tests {
1298
1300
assert_eq ! ( res, Done ( & b"" [ ..] , a) ) ;
1299
1301
}
1300
1302
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
+
1301
1314
#[ test]
1302
1315
fn apply_test ( ) {
1303
1316
fn sum2 ( a : u8 , b : u8 ) -> u8 { a + b }
You can’t perform that action at this time.
0 commit comments