Native keep-awake guards for MoonBit on Windows, Linux, and macOS.
Dependencies
///|
test {
assert_eq(Scope::PreventSystemSleep.to_string(), "PreventSystemSleep")
}let guard = @keepawake.acquire(
reason="Rendering a large animation",
scope=@keepawake.Scope::PreventSystemAndDisplaySleep,
)
guard.release()pub(all) suberror KeepAwakeError {
BackendUnavailable(detail~ : String)
OperationFailed(operation~ : String, detail~ : String)
} derive(Eq)impl Show for KeepAwakeErrorpub type Guardtest {
assert_eq(
Scope::PreventSystemAndDisplaySleep.to_string(),
"PreventSystemAndDisplaySleep",
)
}let guard = @keepawake.acquire(
reason="Encoding a large video",
scope=@keepawake.Scope::PreventSystemAndDisplaySleep,
)
// ... perform the long-running work ...
guard.release()let default_reason : Stringlet summary = @keepawake.with_keepawake(
() => "done",
reason="Syncing local cache",
// ... perform long-running work ...
scope=@keepawake.Scope::PreventSystemSleep,
)Native keep-awake guards for MoonBit on Windows, Linux, and macOS.
Dependencies