Skip to main content

Shape

Trait Shape 

Source
pub trait Shape {
    // Required method
    fn draw(&self, surface: &mut dyn Surface);
}
Expand description

A value describing a figure.

It draws, and answers nothing else about itself — everything that read an extent of its own was a test or a restatement of “no position is written twice”, so a shape has the one operation and no question about itself. See Shapes in docs/model.md. A shape is constructed where it is used, drawn, and discarded: it has no mutable state and no lifecycle, so drawing the same shape twice produces the same writes.

Required Methods§

Source

fn draw(&self, surface: &mut dyn Surface)

Draws this shape’s cells into surface.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§