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
use read_only::embed;
mod m {
use super::embed;
#[embed]
pub struct Many {
#[readonly]
pub a: i32,
#[readonly]
pub b: f64,
pub c: bool,
#[readonly]
pub d: String,
pub e: char,
f: u8,
#[readonly]
pub g: i16,
}
impl Many {
pub fn new() -> Self {
Self {
read_only: ReadOnlyMany {
a: 1,
b: 2.0,
d: String::from("hello"),
g: 42,
},
c: true,
e: 'x',
f: 0,
}
}
}
}
fn main() {
let mut demo = m::Many::new();
let _ = demo.a + demo.b as i32;
demo.c = false;
let _ = &demo.d;
let _ = demo.e;
let _ = demo.g;
}