pub struct ExampleStruct {
pub value: i32,
}
impl ExampleStruct {
pub fn new(value: i32) -> Self {
Self { value }
}
pub fn doubled(&self) -> i32 {
self.value * 2
}
}
pub enum ExampleState {
Ready,
Complete,
}
pub trait ExampleTrait {
fn describe(&self) -> &'static str;
}
impl ExampleTrait for ExampleStruct {
fn describe(&self) -> &'static str {
"example"
}
}
pub fn example_function(input: i32) -> i32 {
input + 1
}
pub fn long_example(input: i32) -> i32 {
let mut total = input;
total += 1;
total
}
pub fn use_long_example(input: i32) -> i32 {
long_example(input)
}