blob: 53a0c6d46c35eecf7ccb1df271aa91bfbc1d5a5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
pub struct Apt(());
impl Apt {
pub fn init() -> ::Result<Apt> {
unsafe {
let r = ::libctru::aptInit();
if r < 0 {
Err(r.into())
} else {
Ok(Apt(()))
}
}
}
pub fn main_loop(&self) -> bool {
unsafe {
::libctru::aptMainLoop()
}
}
pub fn set_app_cpu_time_limit(&self, percent: u32) -> ::Result<()> {
unsafe {
let r = ::libctru::APT_SetAppCpuTimeLimit(percent);
if r < 0 {
Err(r.into())
} else {
Ok(())
}
}
}
}
impl Drop for Apt {
fn drop(&mut self) {
unsafe { ::libctru::aptExit() };
}
}
|