graphics_rs/shapes/
text.rs

1use crate::traits::{canvas::Canvas, shape::Shape};
2
3pub struct Text {
4    text: &'static str,
5    size: usize,
6}
7
8impl Text {
9    pub fn new(text: &'static str, size: usize) -> Self {
10        Self { text, size }
11    }
12}
13
14impl Shape for Text {
15    fn draw_to(&mut self, canvas: &mut impl Canvas) {
16        for ch in self.text.chars() {
17            print!("{}", ch);
18        }
19    }
20}