3 use std::boxed::ThinBox;
9 let expected = "Foo error!";
10 let a: ThinBox<dyn Error> = ThinBox::new_unsize(Foo(expected));
12 let msg = a.to_string();
13 assert_eq!(expected, msg);
18 struct Foo(&'static str);
20 impl fmt::Display for Foo {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 write!(f, "{}", self.0)