1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
/// # 模块
/// 
/// 本章相关包:
/// 
/// - static_hashmap
/// - static_hashmap_2015
/// - static_hashmap_2018
/// - csv_challenge
/// 
/// 请参考本书随书GitHub仓库相关源码
///
/// Basic usage: 模块可见性 Rust 2015 Edtion
///
/// ```
/// pub mod outer_mod {
///     pub(self) fn outer_mod_fn() {}
///     pub mod inner_mod {
///         // use outer_mod::outer_mod_fn;
///         // 对外层模块 `outer_mod` 可见
///         pub(in outer_mod) fn outer_mod_visible_fn() {}
///         // 对整个crate可见
///         pub(crate) fn crate_visible_fn() {}
///         // `outer_mod` 内部可见
///         pub(super) fn super_mod_visible_fn() {
///             // 访问同一模块的函数
///             inner_mod_visible_fn();
///             // 访问父模块的函数需要使用“::”前缀
///             ::outer_mod::outer_mod_fn();
///         }
///         // 仅在`inner_mod`可见
///         pub(self) fn inner_mod_visible_fn() {}
///     }
///     
///     pub fn foo() {
///         inner_mod::outer_mod_visible_fn();
///         inner_mod::crate_visible_fn();
///         inner_mod::super_mod_visible_fn();
///     
///         // 不能使用inner_mod 的私有函数
///         // inner_mod::inner_mod_visible_fn();
///     }
/// }
/// fn bar() {
///     // 该函数对整个crate可见
///     outer_mod::inner_mod::crate_visible_fn();
/// 
///     // 该函数只对outer_mod可见
///     // outer_mod::inner_mod::super_mod_visible_fn();
/// 
///     // 该函数只对outer_mod可见
///     // outer_mod::inner_mod::outer_mod_visible_fn();
///     
///     // 通过foo函数调用内部细节
///     outer_mod::foo();
/// }
/// fn main() { bar() }
/// ```
/// 
///
/// Basic usage: 模块可见性 Rust 2018 Edtion
/// 
/// 请在Play手动选择Rust edition运行
///
/// ```
/// pub mod outer_mod {
///     pub(self) fn outer_mod_fn() {}
///     
///     pub mod inner_mod {
///         // 在Rust 2018 edtion 模块系统必须使用use导入
///         use crate::outer_mod::outer_mod_fn;
///         // 对外层模块 `outer_mod` 可见
///         pub(in crate::outer_mod)  fn outer_mod_visible_fn() {}
///         // 对整个crate可见
///         pub(crate) fn crate_visible_fn() {}
///         // `outer_mod` 内部可见
///         pub(super) fn super_mod_visible_fn() {
///             // 访问同一模块的函数
///             inner_mod_visible_fn();
///             // 使用use导入了outer_mod
///             outer_mod_fn();
///         }
///         // 仅在`inner_mod`可见
///         pub(self) fn inner_mod_visible_fn() {}
///     }
///     
///     pub fn foo() {
///         inner_mod::outer_mod_visible_fn();
///         inner_mod::crate_visible_fn();
///         inner_mod::super_mod_visible_fn();
///     
///         // 不能使用inner_mod 的私有函数
///         // inner_mod::inner_mod_visible_fn();
///     }
/// }
/// fn bar() {
///     // 该函数对整个crate可见
///     outer_mod::inner_mod::crate_visible_fn();
/// 
///     // 该函数只对outer_mod可见
///     // outer_mod::inner_mod::super_mod_visible_fn();
/// 
///     // 该函数只对outer_mod可见
///     // outer_mod::inner_mod::outer_mod_visible_fn();
///     
///     // 通过foo函数调用内部细节
///     outer_mod::foo();
/// }
/// fn main() { bar() }
/// ```
pub fn visibility(){
    unimplemented!();
}