Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::BTreeMap;
- struct World {
- entities: Vec<usize>,
- //database: BTreeMap<usize, Box<ReadValue>>,
- database: BTreeMap<usize, Box<ReadEcs<T = SourceInputGateway>>>, // Doesn't work
- }
- struct SourceInputGateway {
- entity_id: usize,
- }
- trait ReadValue {
- fn read(&self) -> f32;
- }
- impl ReadValue for SourceInputGateway {
- fn read(&self) -> f32 {
- 0.0
- }
- }
- trait ReadEcs {
- type T;
- fn read(&self) -> &Self::T;
- }
- impl ReadEcs for SourceInputGateway {
- type T = SourceInputGateway;
- fn read(&self) -> &Self::T {
- self
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement