devotee_backend/
middling.rs1pub trait TexelDesignatorRef<'a> {
3 type TexelRef;
5}
6
7pub trait TexelDesignatorMut<'a> {
9 type TexelMut;
11}
12
13pub type TexelRef<'a, This> = <This as TexelDesignatorRef<'a>>::TexelRef;
15
16pub type TexelMut<'a, This> = <This as TexelDesignatorMut<'a>>::TexelMut;
18
19pub trait Surface: for<'a> TexelDesignatorRef<'a> + for<'a> TexelDesignatorMut<'a> {
21 type Texel;
23
24 fn texel(&self, x: u32, y: u32) -> Option<TexelRef<'_, Self>>;
26
27 fn texel_mut(&mut self, x: u32, y: u32) -> Option<TexelMut<'_, Self>>;
29
30 fn clear(&mut self, value: Self::Texel);
32
33 fn width(&self) -> u32;
35
36 fn height(&self) -> u32;
38}
39
40pub trait InputHandler<Event, EventContext> {
42 fn handle_event(&mut self, event: Event, event_context: &EventContext) -> Option<Event>;
44
45 fn update(&mut self);
47}
48
49pub trait EventContext<EventSpace> {
51 type SurfaceSpace;
53
54 fn estimate_surface_space(&self, event_space: EventSpace) -> Self::SurfaceSpace;
56}