I am getting a cannot borrow win as immutable because it is also borrowed as mutable
as the commented line
let (mut win, thread) = raylib::init().size(800, 600).title("Demo").build();
// error at borrowing win
draw.draw_rectangle(
// here
win.get_screen_width() / 2,
0,
5,
// and here
win.get_screen_height(),
Color::WHITE,
);
draw, and what version ofraylibare you using?widthandheightbefore the method call, rather than doing it all inline.win.get_screen_width()is an immutable borrow, and so iswin.get_screen_height(). This should compile fine. The actual error comes from code you don't show here. I agree with @PeterHall, please provide a minimal reproducible example.