mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
Moved the Wakelock trait from wakelock to embedder_trait [components/shared/embedder/lib.rs](https://github.com/servo/servo/compare/main...rovertrack:servo:issue-44239?expand=1#diff-71d8f825ba6f796e220d49bc548e9a34783586a5a597edc6311a26e31dbf7020) Added Required dependency in `components/shared/embedder/lib.rs` imported the Wakelock trait from `components/shared/embedder/lib.rs` to `components/wakelock/lib.rs` Added dependency `embedder_trait` [components/wakelock/Cargo.toml](https://github.com/servo/servo/compare/main...rovertrack:servo:issue-44239?expand=1#diff-11c410f6e5a491394348dac2f1402d2b29bdc9d2d1320059d12589eb1feb2504) Testing: All expected test pass as there is no change in flow of working Fixes: #44239 --------- Signed-off-by: Rover track <rishan.pgowda@gmail.com>
30 lines
1.0 KiB
Rust
30 lines
1.0 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
//! Platform abstraction for the Screen Wake Lock API.
|
|
//!
|
|
//! Defines [`WakeLockDelegate`], a trait for acquiring and releasing OS-level
|
|
//! wake locks. Platform-specific implementations will be added in follow-up
|
|
//! work. For now, [`DefaultWakeLockDelegate`] is the only implementation and
|
|
//! does nothing.
|
|
//!
|
|
//! <https://w3c.github.io/screen-wake-lock/>
|
|
use std::error::Error;
|
|
|
|
use embedder_traits::{WakeLockDelegate, WakeLockType};
|
|
|
|
/// A no-op [`WakeLockDelegate`] used when no platform implementation is
|
|
/// available. All operations succeed silently.
|
|
pub struct DefaultWakeLockDelegate;
|
|
|
|
impl WakeLockDelegate for DefaultWakeLockDelegate {
|
|
fn acquire(&self, _type_: WakeLockType) -> Result<(), Box<dyn Error>> {
|
|
Ok(())
|
|
}
|
|
|
|
fn release(&self, _type_: WakeLockType) -> Result<(), Box<dyn Error>> {
|
|
Ok(())
|
|
}
|
|
}
|