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

Function downcast_mut_second_root

libs/error-stack/tests/test_downcast.rs:61–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59
60#[test]
61fn downcast_mut_second_root() {
62 let mut report = create_report().expand();
63 report.push(create_report().attach_opaque(AttachmentA(10)));
64
65 let attachment = report
66 .downcast_mut::<AttachmentA>()
67 .expect("Attachment not found");
68 attachment.0 += 10;
69
70 let attachment = report
71 .downcast_ref::<AttachmentA>()
72 .expect("Attachment not found");
73 assert_eq!(attachment.0, 20);
74}
75
76#[test]
77fn downcast_mut_returns_outermost() {

Callers

nothing calls this directly

Calls 6

AttachmentAClass · 0.85
expandMethod · 0.80
create_reportFunction · 0.70
pushMethod · 0.65
attach_opaqueMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected