-
Notifications
You must be signed in to change notification settings - Fork 40
/
struct.rs
54 lines (40 loc) · 1.08 KB
/
struct.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
#![no_main]
#![no_std]
use ufmt::{derive::uDebug, uwrite};
use common::W;
#[derive(uDebug)]
struct Braces {}
#[derive(uDebug)]
struct Parens();
#[derive(uDebug)]
struct I32(i32);
#[derive(uDebug)]
struct Tuple(i32, i32);
#[derive(uDebug)]
struct Nested {
first: Pair,
second: Pair,
}
#[derive(Clone, Copy, uDebug)]
struct Pair {
x: i32,
y: i32,
}
#[no_mangle]
fn _start(x: i32, y: i32) {
uwrite!(&mut W, "{:?}", Braces {}).unwrap();
uwrite!(&mut W, "{:#?}", Braces {}).unwrap();
uwrite!(&mut W, "{:?}", Parens()).unwrap();
uwrite!(&mut W, "{:#?}", Parens()).unwrap();
uwrite!(&mut W, "{:?}", I32(x)).unwrap();
uwrite!(&mut W, "{:#?}", I32(x)).unwrap();
uwrite!(&mut W, "{:?}", Tuple(x, y)).unwrap();
uwrite!(&mut W, "{:#?}", Tuple(x, y)).unwrap();
let pair = Pair { x, y };
uwrite!(&mut W, "{:?}", pair).unwrap();
uwrite!(&mut W, "{:#?}", pair).unwrap();
let first = pair;
let second = pair;
uwrite!(&mut W, "{:?}", Nested { first, second }).unwrap();
uwrite!(&mut W, "{:#?}", Nested { first, second }).unwrap();
}