lyra-engine/src/ecs/resources/mod.rs

31 lines
597 B
Rust
Raw Normal View History

use std::{any::Any, collections::VecDeque};
use winit::event::WindowEvent;
pub mod window_state;
pub use window_state::*;
pub trait Resource: Send + Sync + 'static {
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
}
impl Resource for WindowEvent<'static> {
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl<T: Sync + Send + 'static> Resource for VecDeque<T> {
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}