pub trait Space<W, C, O>{
type CellRepr;
type Reprer: Fn(C) -> Self::CellRepr;
// Required methods
fn world_mut(&mut self) -> &mut W;
fn world(&self) -> &W;
fn output_mut(&mut self) -> &mut O;
fn reprer(&self) -> Self::Reprer;
// Provided methods
fn draw_whole(&mut self) -> Result<(), String> { ... }
fn draw_delta(&mut self) -> Result<(), String> { ... }
fn tick_whole(&mut self) -> Result<(), String> { ... }
fn tick_delta(&mut self) -> Result<(), String> { ... }
fn replace_with_random_world(&mut self) -> Result<(), String> { ... }
fn replace_with_blank_world(&mut self) -> Result<(), String> { ... }
fn click_world(&mut self, i: Index) { ... }
}Expand description
A Space (like a Gui) where a BasicWorld can show its BasicCells It only cares about learning how to lay the cells in the world
Required Associated Types§
Sourcetype CellRepr
type CellRepr
The Space’s reprsentation of the BasicCells in the OutputField
Required Methods§
Sourcefn world_mut(&mut self) -> &mut W
fn world_mut(&mut self) -> &mut W
Get a mutable reference to the BasicWorld the Space manages
Sourcefn world(&self) -> &W
fn world(&self) -> &W
Get a shared reference to the BasicWorld the Space manages
Sourcefn output_mut(&mut self) -> &mut O
fn output_mut(&mut self) -> &mut O
Get a mutable referene to the OutputField of this Space
Provided Methods§
Sourcefn draw_whole(&mut self) -> Result<(), String>
fn draw_whole(&mut self) -> Result<(), String>
(Re)draw the whole BasicWorld in the OutputField
Sourcefn draw_delta(&mut self) -> Result<(), String>
fn draw_delta(&mut self) -> Result<(), String>
Draw only the changes that the BasicWorld experienced the previous tick
Sourcefn tick_whole(&mut self) -> Result<(), String>
fn tick_whole(&mut self) -> Result<(), String>
One tick passes in the BasicWorld and the whole BasicWorld is redrawn
Sourcefn tick_delta(&mut self) -> Result<(), String>
fn tick_delta(&mut self) -> Result<(), String>
One tick passes in the BasicWorld and only the deltas are redrawn
Sourcefn replace_with_random_world(&mut self) -> Result<(), String>
fn replace_with_random_world(&mut self) -> Result<(), String>
Replace the Space’s BasicWorld with a random one
Sourcefn replace_with_blank_world(&mut self) -> Result<(), String>
fn replace_with_blank_world(&mut self) -> Result<(), String>
Replace the Space’s BasicWorld with a blank wone
Sourcefn click_world(&mut self, i: Index)
fn click_world(&mut self, i: Index)
Propagate a click that happened on the BasicWorld at the Index (x, y)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.