This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
generated from rust-lang/project-group-template
-
Notifications
You must be signed in to change notification settings - Fork 18
/
error-handling.gv
90 lines (75 loc) · 1.86 KB
/
error-handling.gv
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
digraph g {
graph [
rankdir = "LR";
// title
labelloc= "t";
label= <<b><u>Error Handling</u></b>>;
];
node [
fontsize = "13"
shape = "Mrecord"
];
T [
label = "< T >"
shape = plain
fontsize=9
id = 0
];
Result [
label = "<<Enum>>\nResult|
<f0> + Variant: Ok \l |
<f1> + Variant: Err \l"
id = 1
];
Option [
label = "<<Enum>>\nOption|
<f0> + Variant: Some \l |
<f1> + Variant: None \l"
id = 2
];
Panic [
label = "<f0> <<Macro>>\nPanic |
<f1> + Attribute: #[panic_handler] \l |
<f2> + Function: take_hook \l |
<f3> + Function: catch_unwind \l |
<f4> + Function: resume_unwind \l |
<f5> + Function: panic_any \l"
id = 3
];
PanicInfo [
label = "<f0> <<Struct>>\nPanicInfo |
<f1> + Function: location \l |
<f2> + Function: message \l |
<f3> + Function: payload \l"
id = 4
];
// Layout
// T to Option {reverse direction i.e. <-}
{T -> Option:f0 [
dir=back
label="Some(T)\nunwrap()"
fontsize=8
];
}
Result:f0 -> T [
label="Ok(T)\nunwrap()"
fontsize=8
];
Result:f1 -> Panic:f0 [
label="Err(E)\nunwrap()"
fontsize=8
];
Option:f1 -> Panic:f0:n [
label="None\nunwrap()"
fontsize=8
];
Panic:f2 -> PanicInfo:f0:n [
label="set_hook"
fontsize=8
];
Panic:f3 -> PanicInfo:f0 [
label="<<include>>"
fontsize=8
];
{rank=same; Result Option;}
}