rust/hwphysics/src/common.rs
author alfadur
Fri, 09 Nov 2018 03:36:21 +0300
changeset 14200 abbb74b9cb62
parent 14199 a4c17cfaa4c9
child 15141 febccab419b1
permissions -rw-r--r--
generalize adding data to World
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14200
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     1
pub type GearId = u16;
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     2
pub trait GearData {}
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     3
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     4
pub trait GearDataProcessor<T: GearData> {
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     5
    fn add(&mut self, gear_id: GearId, gear_data: T);
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     6
}
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     7
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     8
pub trait GearDataAggregator<T: GearData> {
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
     9
    fn find_processor(&mut self) -> &mut GearDataProcessor<T>;
abbb74b9cb62 generalize adding data to World
alfadur
parents: 14199
diff changeset
    10
}