use information::InformationAssociator; use std::any::Any; use utilities; pub trait GeneralInformationAssociator { fn add_information(&mut self, vertex_id: usize, information: &mut Any); fn remove_information(&mut self, vertex_id: usize); } impl GeneralInformationAssociator for InformationAssociator where TBaseInformation: Any { fn add_information(&mut self, vertex_id: usize, information: &mut Any) { let self_as_base = self as &mut InformationAssociator; let information_as_base = utilities::static_cast::(information); self_as_base.add_information(vertex_id, information_as_base); } fn remove_information(&mut self, vertex_id: usize) { let self_as_base = self as &mut InformationAssociator; self_as_base.remove_information(vertex_id); } }