MCPcopy Create free account
hub / github.com/hashintel/hash / create_sources_nested

Function create_sources_nested

libs/error-stack/tests/test_debug.rs:165–212  ·  view source on GitHub ↗

Generate the `Report` for: ```text P 1 │ ▼ P 2 │ ▼ C 1 │ ▼ ┌───P 3───┐ │ │ ▼ ▼ P 4 P 5 │ │ ▼ ▼ C 2 C 10 │ │ ▼ ▼ P 6 P 7 │ │ ▼ ▼ root error 1 C 3 │ ▼ P 8 │ ▼ ┌─────────────────P 9─────────────────┬─────────────┐ │ │ │ │ │ │ │

()

Source from the content-addressed store, hash-verified

163///
164/// Legend: `P = Printable`, `C = Context`.
165fn create_sources_nested() -> Report<ContextA> {
166 let r4 = create_report()
167 .change_context(ContextA(5))
168 .attach("15")
169 .attach("14");
170
171 let r6 = create_report()
172 .change_context(ContextA(7))
173 .change_context(ContextA(6))
174 .attach("12");
175
176 let r5 = create_report().change_context(ContextA(9)).attach("11");
177
178 let mut r3 = create_report()
179 .change_context(ContextA(8))
180 .attach("13")
181 .expand();
182
183 r3.push(r4);
184 let r3 = r3.attach("10").attach("16");
185
186 let mut r2 = create_report().change_context(ContextA(4)).expand();
187
188 r2.append(r3);
189 r2.push(r5);
190 r2.push(r6);
191
192 let r2 = r2
193 .attach("9")
194 .attach("8")
195 .change_context(ContextA(3))
196 .attach("7")
197 .change_context(ContextA(10))
198 .attach("5");
199
200 let mut r1 = create_report()
201 .attach("6")
202 .change_context(ContextA(2))
203 .attach("4")
204 .expand();
205
206 r1.push(r2);
207
208 r1.attach("3")
209 .change_context(ContextA(1))
210 .attach("2")
211 .attach("1")
212}
213
214/// This is the main test, to test all different parts at once,
215/// and demonstrates that the rendering algorithm works at arbitrary depth.

Callers 2

sources_nestedFunction · 0.85
sources_nested_alternateFunction · 0.85

Calls 7

ContextAClass · 0.85
expandMethod · 0.80
create_reportFunction · 0.70
pushMethod · 0.65
appendMethod · 0.65
attachMethod · 0.45
change_contextMethod · 0.45

Tested by

no test coverage detected