pub trait ActivityGovernorLocalServerHandler<___T: Transport = Channel> {
// Required methods
fn get_power_elements(
&mut self,
responder: Responder<GetPowerElements, ___T>,
) -> impl Future<Output = ()>;
fn take_wake_lease(
&mut self,
request: Request<TakeWakeLease, ___T>,
responder: Responder<TakeWakeLease, ___T>,
) -> impl Future<Output = ()>;
fn acquire_wake_lease(
&mut self,
request: Request<AcquireWakeLease, ___T>,
responder: Responder<AcquireWakeLease, ___T>,
) -> impl Future<Output = ()>;
fn acquire_long_wake_lease(
&mut self,
request: Request<AcquireLongWakeLease, ___T>,
responder: Responder<AcquireLongWakeLease, ___T>,
) -> impl Future<Output = ()>;
fn acquire_wake_lease_with_token(
&mut self,
request: Request<AcquireWakeLeaseWithToken, ___T>,
responder: Responder<AcquireWakeLeaseWithToken, ___T>,
) -> impl Future<Output = ()>;
fn take_application_activity_lease(
&mut self,
request: Request<TakeApplicationActivityLease, ___T>,
responder: Responder<TakeApplicationActivityLease, ___T>,
) -> impl Future<Output = ()>;
fn register_suspend_blocker(
&mut self,
request: Request<RegisterSuspendBlocker, ___T>,
responder: Responder<RegisterSuspendBlocker, ___T>,
) -> impl Future<Output = ()>;
// Provided method
fn on_unknown_interaction(
&mut self,
ordinal: u64,
) -> impl Future<Output = ()> { ... }
}Expand description
A server handler for the ActivityGovernor protocol.
See ActivityGovernor for more details.
Required Methods§
Sourcefn get_power_elements(
&mut self,
responder: Responder<GetPowerElements, ___T>,
) -> impl Future<Output = ()>
fn get_power_elements( &mut self, responder: Responder<GetPowerElements, ___T>, ) -> impl Future<Output = ()>
Gets the power elements owned by the activity governor.
If an error occurs while the server is registering a power element with
the power broker or an error occurs while creating a token for a power
element, then the channel to ActivityGovernor will be closed by the
server and no response will be returned.
Sourcefn take_wake_lease(
&mut self,
request: Request<TakeWakeLease, ___T>,
responder: Responder<TakeWakeLease, ___T>,
) -> impl Future<Output = ()>
fn take_wake_lease( &mut self, request: Request<TakeWakeLease, ___T>, responder: Responder<TakeWakeLease, ___T>, ) -> impl Future<Output = ()>
Creates a lease that blocks suspension of the hardware platform.
The hardware platform will not suspend as long as a valid
LeaseToken exists.
If an error occurs while creating a token for the wake lease, then the
channel to ActivityGovernor will be closed by the server and no
response will be returned.
Sourcefn acquire_wake_lease(
&mut self,
request: Request<AcquireWakeLease, ___T>,
responder: Responder<AcquireWakeLease, ___T>,
) -> impl Future<Output = ()>
fn acquire_wake_lease( &mut self, request: Request<AcquireWakeLease, ___T>, responder: Responder<AcquireWakeLease, ___T>, ) -> impl Future<Output = ()>
Creates a lease that blocks suspension of the hardware platform.
The hardware platform will not suspend as long as a valid
LeaseToken exists.
Sourcefn acquire_long_wake_lease(
&mut self,
request: Request<AcquireLongWakeLease, ___T>,
responder: Responder<AcquireLongWakeLease, ___T>,
) -> impl Future<Output = ()>
fn acquire_long_wake_lease( &mut self, request: Request<AcquireLongWakeLease, ___T>, responder: Responder<AcquireLongWakeLease, ___T>, ) -> impl Future<Output = ()>
Creates a long-term lease that blocks suspension of the hardware platform.
The hardware platform will not suspend as long as a valid
LeaseToken exists.
This is intended for leases expected to be held for extended periods. Unlike normal wake leases, the server does not monitor the duration of a long wake lease and will not log a runtime error if it exceeds preconfigured alert thresholds.
Sourcefn acquire_wake_lease_with_token(
&mut self,
request: Request<AcquireWakeLeaseWithToken, ___T>,
responder: Responder<AcquireWakeLeaseWithToken, ___T>,
) -> impl Future<Output = ()>
fn acquire_wake_lease_with_token( &mut self, request: Request<AcquireWakeLeaseWithToken, ___T>, responder: Responder<AcquireWakeLeaseWithToken, ___T>, ) -> impl Future<Output = ()>
Creates a lease that blocks suspension of the hardware platform. WARNING: Suspension can only be considered blocked after the client receives the response to this call. This means, for example, an interrupt should only be ack’ed or a different wake lease dropped only after getting an error-free response.
The hardware platform will remain resumed until server_token observes
PEER_CLOSED, indicating all handles to the client side of the
LeaseToken are closed.
Sourcefn take_application_activity_lease(
&mut self,
request: Request<TakeApplicationActivityLease, ___T>,
responder: Responder<TakeApplicationActivityLease, ___T>,
) -> impl Future<Output = ()>
fn take_application_activity_lease( &mut self, request: Request<TakeApplicationActivityLease, ___T>, responder: Responder<TakeApplicationActivityLease, ___T>, ) -> impl Future<Output = ()>
Creates a lease that blocks the system from dropping below the Application Activity ‘Active’ state. In particular, this blocks suspension of the hardware platform.
This method is not safe to call during SuspendBlocker.BeforeSuspend.
If an error occurs while creating a token for the activity lease, then the
channel to ActivityGovernor will be closed by the server and no
response will be returned.
Sourcefn register_suspend_blocker(
&mut self,
request: Request<RegisterSuspendBlocker, ___T>,
responder: Responder<RegisterSuspendBlocker, ___T>,
) -> impl Future<Output = ()>
fn register_suspend_blocker( &mut self, request: Request<RegisterSuspendBlocker, ___T>, responder: Responder<RegisterSuspendBlocker, ___T>, ) -> impl Future<Output = ()>
Registers a suspend blocker.
On successful registration, a wake lease token is returned. This token
prevents hardware platform suspension while it exists. Clients are
expected to perform any initialization of the given suspend_blocker
server while holding this token. Additionally, this means the first call
suspend_blocker will get is BeforeSuspend.
To unregister, close the SuspendBlocker channel.
If any required field of the table is missing, the error
[RegisterSuspendBlockerError.INVALID_ARGS] is returned.
If an error occurs while registering suspend_blocker, it will be
dropped, closing the channel.
Provided Methods§
fn on_unknown_interaction(&mut self, ordinal: u64) -> impl Future<Output = ()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.