#![allow(unused)] #[macro_use] extern crate qdowncast; use qdowncast::QDowncastable; use std::any::Any; trait Store: Any { type Id: Any; } impl QDowncastable for Store where Id: Any, T: Store { qdowncastable_items!(T); } impl Store { qdowncast_method_items!(); } pub struct MyStore; impl Store for MyStore { type Id = usize; } fn as_mystore<'a>(store: &'a Store) -> Option<&'a MyStore> { store.downcast_ref() }