#[derive(Debug)] pub struct Guess { value: i32, } impl Guess { pub fn new(value: i32) -> Guess { if value < 1 || value > 100 { panic!("the value entered should be within the range of 1 and 100"); } Guess { value } // return Guess value } pub fn value(&self) -> i32 { self.value } } fn main() { let m = Guess::new(5); // this is not allowed once this // struct is defined in external module. // The structure field is private. let m = Guess { value: 32, }; println!("{:?}", m); }