Hi,
I tried the examples from this page, but I have a problem. It only works if I add "pub" in front of the Struct definition in the module
pub struct Meal {
pub taste: String,
price: u32,
}
without "pub" it doesn't work. Where is the mistake?
Hi,
I tried the examples from this page, but I have a problem. It only works if I add "pub" in front of the Struct definition in the module
pub struct Meal {
pub taste: String,
price: u32,
}
without "pub" it doesn't work. Where is the mistake?
I think the mistake is in the tutorial.
pub
means it can be used outside of this module (this file). In your case use food::Meal
requires Meal
to be pub
.
Thanks, I was a bit confused by this tutorial.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.