use to_any::ToAny; use to_any_dervie::ToAny; #[derive(ToAny)] struct A {} trait Mock: ToAny {} impl Mock for A {} #[test] fn test_to_any_trait() { let mut a: Box = Box::new(A {}); assert!(a.to_any().downcast_ref::().is_some()); assert!(a.to_any_mut().downcast_mut::().is_some()); }