Files
termux-packages/packages/tinymist/crates-tinymist-std-src-battery.rs.patch
termux-pacman-bot 6e2184c242 bump(main/tinymist): v0.14.2 (#27400)
also add tinymist to big-pkgs.list
its build directory grows to ~8.3GiB
2025-11-24 08:06:46 +00:00

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::*;