pub trait Shapes {
// Required methods
fn size(&self) -> (i64, i64);
fn put(&mut self, x: i64, y: i64, colour: Rgb);
// Provided methods
fn line(&mut self, x0: i64, y0: i64, x1: i64, y1: i64, colour: Rgb) { ... }
fn rect(&mut self, x: i64, y: i64, w: i64, h: i64, colour: Rgb) { ... }
fn fill_rect(&mut self, x: i64, y: i64, w: i64, h: i64, colour: Rgb) { ... }
fn circle(&mut self, cx: i64, cy: i64, r: i64, colour: Rgb) { ... }
fn fill_circle(&mut self, cx: i64, cy: i64, r: i64, colour: Rgb) { ... }
fn plot(&mut self, f: impl Fn(f64) -> f64, colour: Rgb)
where Self: Sized { ... }
}Expand description
Lines, rectangles and circles, for anything that can set a point.
Required Methods§
Provided Methods§
fn line(&mut self, x0: i64, y0: i64, x1: i64, y1: i64, colour: Rgb)
fn rect(&mut self, x: i64, y: i64, w: i64, h: i64, colour: Rgb)
fn fill_rect(&mut self, x: i64, y: i64, w: i64, h: i64, colour: Rgb)
fn circle(&mut self, cx: i64, cy: i64, r: i64, colour: Rgb)
fn fill_circle(&mut self, cx: i64, cy: i64, r: i64, colour: Rgb)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".