there is something I don't understand in Rust's documentation: it's the pub keyword in front of use, what does it do?
Here is the example from Rust's documentation (Here):
mod front_of_house {
pub mod hosting {
pub fn add_to_waitlist() {
println!("Added to waitlist");
}
}
}
pub use crate::front_of_house::hosting;
pub fn eat_at_restaurant() {
hosting::add_to_waitlist();
hosting::add_to_waitlist();
hosting::add_to_waitlist();
}
when I try to make a main to interact with this I came up with:
use tests::eat_at_restaurant;
fn main() {
eat_at_restaurant();
}
but when I remove the use keyword it does the same thing and I can't in any case call hosting::add_to_waitlist from main, so what happens here ? what is the difference if I don't put the pub keyword ?