In glfw-rs version 0.59.0, the sample provided in doc will give compile error. The code block double borrowed glfw as a mutable variable. Link: https://docs.rs/glfw/0.59.0/glfw/struct.Glfw.html#method.with_primary_monitor:~:text=pub%20fn%20with_primary_monitor%3CT%2C%20F%3E(%26mut%20self%2C%20f%3A%20F)%20%2D%3E%20T ``` glfw.with_primary_monitor(|glfw, primary_monitor| { let (mut window, events_receiver) = glfw.create_window ( vid_mode.unwrap().width, vid_mode.unwrap().height, "Hello This is FullScreen", primary_monitor.map_or(glfw::WindowMode::Windowed, |m| glfw::WindowMode::FullScreen(m)) ).expect("Failed to create GLFW window."); }; ``` instead should work in current version .