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

Function downcast_mut_deep

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

Source from the content-addressed store, hash-verified

41
42#[test]
43fn downcast_mut_deep() {
44 let mut report = create_report()
45 .attach_opaque(AttachmentA(10))
46 .change_context(ContextA(0))
47 .attach_opaque(AttachmentB(0));
48
49 let attachment = report
50 .downcast_mut::<AttachmentA>()
51 .expect("Attachment not found");
52 attachment.0 += 10;
53
54 let attachment = report
55 .downcast_ref::<AttachmentA>()
56 .expect("Attachment not found");
57 assert_eq!(attachment.0, 20);
58}
59
60#[test]
61fn downcast_mut_second_root() {

Callers

nothing calls this directly

Calls 7

AttachmentAClass · 0.85
ContextAClass · 0.85
AttachmentBClass · 0.85
create_reportFunction · 0.70
attach_opaqueMethod · 0.45
change_contextMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected