1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
/// A struct that holds a value of type [`u8`]
pub struct SomeStruct {
    val: u8,
}

impl SomeStruct {
    ///Constructor: Creates and returns a new instance of SomeStruct
    pub fn new(val: u8) -> SomeStruct {
        SomeStruct { val }
    }

    /// Returns the value of val
    pub fn value(&self) -> u8 {
        self.val
    }
}