pub fn set_cursor_lock(locked: bool)
Expand description

Sets the cursor’s lock state. If set, the cursor will not be able to move outside of the window.

You may want to combine this with set_cursor_visible.