hello/
hello.rs

1use trait_exerci::StructType;
2use trait_exerci::TraitCanal;
3use trait_exerci::TraitKanal;
4
5// cargo run --example hello
6fn main() {
7    let instance = StructType::new(100);
8    assert_eq!(StructType::new(100), instance);
9    println!("{}", instance.get_data());
10
11    let instance = Box::new(StructType::new(101));
12    assert_eq!(Box::new(StructType::new(101)), instance);
13    println!("{}", instance.get_data());
14
15    let mut instance = StructType::new(102);
16    instance.set_data(&103);
17    assert_eq!(StructType::new(103), instance);
18    println!("{}", instance.get_data_for_all());
19
20    let mut instance = Box::new(StructType::new(104));
21    instance.set_data_for_all(&105);
22    assert_eq!(Box::new(StructType::new(105)), instance);
23    println!("{}", instance.get_data());
24
25    let instance :StructType = Default::default();
26    assert_eq!(StructType::new(0), instance);
27    println!("{}", instance.get_data());
28}