1
+
2
+ < style >
3
+ body { margin : 0 ; }
4
+ pre { color : # DCDCCC ; background : # 3F3F3F ; font-size : 22px ; padding : 0.4em ; }
5
+
6
+ span [variable = "vec" ] {
7
+ /* <!-- specification about this --> */
8
+ }
9
+
10
+ .lifetime {
11
+ border-right : thin solid orange;
12
+ }
13
+ .sideBySide {
14
+ display : flex;
15
+ }
16
+ .rustCode {
17
+ flex-grow : 1 ;
18
+ }
19
+
20
+ .comment { color : # 7F9F7F ; }
21
+ .string { color : # CC9393 ; }
22
+ .function { color : # 93E0E3 ; }
23
+ .parameter { color : # 94BFF3 ; }
24
+ .builtin { color : # DD6718 ; }
25
+ .text { color : # DCDCCC ; }
26
+ .attribute { color : # 94BFF3 ; }
27
+ .literal { color : # BFEBBF ; }
28
+ .macro { color : # 94BFF3 ; }
29
+ .variable { color : # DCDCCC ; }
30
+ .variable\.mut { color : # DCDCCC ; text-decoration : underline; }
31
+
32
+ .keyword { color : # F0DFAF ; }
33
+ .keyword\.unsafe { color : # DFAF8F ; }
34
+ .keyword\.control { color : # F0DFAF ; font-weight : bold; }
35
+ </ style >
36
+ < div class ="sideBySide ">
37
+ < span class ="lifetime " variable ="vec ">
38
+ < pre > < code >
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ < span class ="variable.mut " data-binding-hash ="11110498128616369639 " style ="color: hsl(20,93%,82%); "> vec</ span > < - < span class ="text "> Vec</ span > ::< span class ="text "> new</ span > ()
54
+ |
55
+ |
56
+ |
57
+ -> < span class ="keyword "> no longer used</ span >
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ </ code > </ pre >
66
+ </ span >
67
+ < span class ="lifetime " variable ="x ">
68
+ < pre > < code >
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ < span class ="variable.mut " data-binding-hash ="1627512989129656761 " style ="color: hsl(97,65%,64%); "> x</ span > < - < span class ="literal "> 42</ span >
90
+ -> < span class ="variable.mut " data-binding-hash ="3959636447297899133 " style ="color: hsl(303,50%,86%); "> y</ span >
91
+
92
+
93
+
94
+
95
+ </ code > </ pre >
96
+ </ span >
97
+ < span class ="lifetime " variable ="y ">
98
+ < pre > < code >
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ < span class ="variable.mut " data-binding-hash ="3959636447297899133 " style ="color: hsl(303,50%,86%); "> y</ span > < - from < span class ="variable.mut " data-binding-hash ="1627512989129656761 " style ="color: hsl(97,65%,64%); "> x</ span >
121
+ |
122
+ |
123
+ -> < span class ="keyword "> returned</ span >
124
+
125
+ </ code > </ pre >
126
+ </ span >
127
+ < div class ="rustCode ">
128
+ < pre > < code > < span class ="attribute "> #</ span > < span class ="attribute "> [</ span > < span class ="attribute "> derive</ span > < span class ="attribute "> (</ span > < span class ="attribute "> Clone</ span > < span class ="attribute "> ,</ span > < span class ="attribute "> </ span > < span class ="attribute "> Debug</ span > < span class ="attribute "> )</ span > < span class ="attribute "> ]</ span >
129
+ < span class ="keyword "> struct</ span > < span class ="type "> Foo</ span > {
130
+ < span class ="keyword "> pub</ span > < span class ="field "> x</ span > : < span class ="type "> i32</ span > ,
131
+ < span class ="keyword "> pub</ span > < span class ="field "> y</ span > : < span class ="type "> i32</ span > ,
132
+ }
133
+
134
+ < span class ="keyword "> fn</ span > < span class ="function "> foo</ span > << span class ="type "> T</ span > >() -> < span class ="type "> T</ span > {
135
+ < span class ="macro "> unimplemented</ span > < span class ="macro "> !</ span > ();
136
+ < span class ="function "> foo</ span > ::<< span class ="type "> i32</ span > >();
137
+ }
138
+
139
+ < span class ="comment "> // comment</ span >
140
+ < span class ="keyword "> fn</ span > < span class ="function "> main</ span > () {
141
+ < span class ="macro "> println</ span > < span class ="macro "> !</ span > (< span class ="string "> "Hello, {}!"</ span > , < span class ="literal "> 92</ span > );
142
+
143
+ < span class ="keyword "> let</ span > < span class ="keyword "> mut</ span > < span class ="variable.mut " data-binding-hash ="11110498128616369639 " style ="color: hsl(20,93%,82%); "> vec</ span > = < span class ="text "> Vec</ span > ::< span class ="text "> new</ span > ();
144
+ < span class ="keyword.control "> if</ span > < span class ="keyword "> true</ span > {
145
+ < span class ="variable.mut " data-binding-hash ="11110498128616369639 " style ="color: hsl(20,93%,82%); "> vec</ span > .< span class ="text "> push</ span > (< span class ="type "> Foo</ span > { < span class ="field "> x</ span > : < span class ="literal "> 0</ span > , < span class ="field "> y</ span > : < span class ="literal "> 1</ span > });
146
+ }
147
+ < span class ="keyword.unsafe "> unsafe</ span > { < span class ="variable.mut " data-binding-hash ="11110498128616369639 " style ="color: hsl(20,93%,82%); "> vec</ span > .< span class ="text "> set_len</ span > (< span class ="literal "> 0</ span > ); }
148
+
149
+ < span class ="keyword "> let</ span > < span class ="keyword "> mut</ span > < span class ="variable.mut " data-binding-hash ="1627512989129656761 " style ="color: hsl(97,65%,64%); "> x</ span > = < span class ="literal "> 42</ span > ;
150
+ < span class ="keyword "> let</ span > < span class ="variable.mut " data-binding-hash ="3959636447297899133 " style ="color: hsl(303,50%,86%); "> y</ span > = &< span class ="keyword "> mut</ span > < span class ="variable.mut " data-binding-hash ="1627512989129656761 " style ="color: hsl(97,65%,64%); "> x</ span > ;
151
+ < span class ="keyword "> let</ span > < span class ="variable " data-binding-hash ="5534246180748221479 " style ="color: hsl(283,85%,80%); "> z</ span > = &< span class ="variable.mut " data-binding-hash ="3959636447297899133 " style ="color: hsl(303,50%,86%); "> y</ span > ;
152
+
153
+ < span class ="variable.mut " data-binding-hash ="3959636447297899133 " style ="color: hsl(303,50%,86%); "> y</ span > ;
154
+ }</ code > </ pre >
155
+ </ div >
156
+ </ div >
0 commit comments