Use the macroquad crate to render 2D graphics in Rust with minimal boilerplate. Add the dependency to your Cargo.toml and run the following code to create a window and draw a red rectangle:
[dependencies]
macroquad = "0.4"
use macroquad::prelude::*;
#[macroquad::main("2D Graphics")]
async fn main() {
loop {
clear_background(WHITE);
draw_rect(100.0, 100.0, 200.0, 200.0, RED);
next_frame().await;
}
}