rust_book_code 0.2.1

The code of rust book
Documentation
use rust_book_code::{Button, Draw, Screen};

struct SelectBox {
    width: u32,
    height: u32,
    options: Vec<String>,
}

// user impl trait Draw
impl Draw for SelectBox {
    fn draw(&self) {
        // code to actually draw a select box
    }
}

pub fn inherit_like() {
    let screen = Screen {
        components: vec![
            Box::new(SelectBox {
                width: 75,
                height: 10,
                options: vec![
                    String::from("Yes"),
                    String::from("Maybe"),
                    String::from("No"),
                ],
            }),
            Box::new(Button {
                width: 50,
                height: 10,
                label: String::from("OK"),
            }),
        ],
    };

    screen.run();
}