mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-02-11 12:20:52 +00:00
40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
diff --git a/crates/tinymist-std/src/battery.rs b/crates/tinymist-std/src/battery.rs
|
|
index 31046f0..ed81631 100644
|
|
--- a/crates/tinymist-std/src/battery.rs
|
|
+++ b/crates/tinymist-std/src/battery.rs
|
|
@@ -1,34 +1,9 @@
|
|
//! Battery-related utilities.
|
|
|
|
-#[cfg(feature = "system")]
|
|
-mod system {
|
|
- /// Detects if the system is currently in power saving mode.
|
|
- pub fn is_power_saving() -> bool {
|
|
- ::battery::Manager::new()
|
|
- .ok()
|
|
- .and_then(|manager| manager.batteries().ok())
|
|
- .map(|batteries| {
|
|
- let mut batteries = batteries.peekable();
|
|
- if batteries.peek().is_none() {
|
|
- return false;
|
|
- }
|
|
- batteries.all(|battery| match battery {
|
|
- Ok(bat) => matches!(bat.state(), ::battery::State::Discharging),
|
|
- Err(_) => false,
|
|
- })
|
|
- })
|
|
- .unwrap_or(false)
|
|
- }
|
|
-}
|
|
-#[cfg(feature = "system")]
|
|
-pub use system::*;
|
|
-
|
|
-#[cfg(not(feature = "system"))]
|
|
mod other {
|
|
/// Detects if the system is currently in power saving mode.
|
|
pub fn is_power_saving() -> bool {
|
|
false
|
|
}
|
|
}
|
|
-#[cfg(not(feature = "system"))]
|
|
pub use other::*;
|