pub
pub 用于将模块内的声明导出。
mod counter {
pub let mut value = 0;
pub fn inc(){
value += 1;
}
}
debug_print(counter.value); // 0
counter.inc();
debug_print(counter.value); // 1 pub 用于将模块内的声明导出。
mod counter {
pub let mut value = 0;
pub fn inc(){
value += 1;
}
}
debug_print(counter.value); // 0
counter.inc();
debug_print(counter.value); // 1