-
Notifications
You must be signed in to change notification settings - Fork 13
/
example.rs
59 lines (53 loc) · 1.05 KB
/
example.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#![allow(dead_code)]
fn some_fn() {
let mut val = 2;
let mut my_wrapper = MyWrapper(&mut val);
let wrapper_ref = &mut my_wrapper;
for i in 0..16 {
*wrapper_ref.0 = i;
}
}
struct MyWrapper<'a>(&'a mut u8);
struct SomeRandomStruct<'a, A> {
ernrer: u8,
feijoc: i64,
ioieoe: bool,
fewije: char,
chr_ref: &'a char,
efoiri: A,
irrfio: SomeOtherStruct,
}
struct SomeOtherStruct {
efufrr: u8,
frireg: u16,
}
union SomeUnion {
a: bool,
b: u64,
}
fn main() {
let chr = '4';
let _rer = SomeRandomStruct {
ernrer: 24,
feijoc: -34438,
ioieoe: true,
fewije: '@',
chr_ref: &chr,
efoiri: Some(2u16),
irrfio: SomeOtherStruct {
efufrr: 34,
frireg: 45804,
},
};
let u = SomeUnion { a: true };
let abc = Box::new(42);
some_fn();
let f = 1.4f64;
let _sum = 1f64
+
f;
let _s = "ieeoe";
let _bcd: Box<[u8]> = Box::new([0, 1]);
let _d = true;
format!("ewioio: {}", abc);
}