Modules Struct Visibility

  • Just like functions, structs can declare what they want exposed outside of their module using pub
// SeaCreature struct will be usable outside of our module
pub struct SeaCreature {
    pub animal_type: String,
    pub name: String,
    pub arms: i32,
    pub legs: i32,
    // let's keep our weapon private
    weapon: String,
}