1
0
forked from Rust/Core

refactor: Devide lib.rs into modules

This commit is contained in:
2024-01-12 11:39:38 +03:00
parent 994ae2f392
commit c6351affe3
9 changed files with 171 additions and 162 deletions

19
src/modules/threads.rs Normal file
View File

@@ -0,0 +1,19 @@
use crate::sys;
pub fn exit() -> ! {
unsafe { sys::exit() }
}
#[non_exhaustive]
pub enum Event {
Redraw,
KeyPress,
}
pub fn fetch_event() -> Option<Event> {
match unsafe { sys::wait_event() } {
1 => Some(Event::Redraw),
2 => Some(Event::KeyPress),
_ => None,
}
}