pub struct RequesterSynchronousProxy { /* private fields */ }
Implementations§
Source§impl RequesterSynchronousProxy
impl RequesterSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<RequesterEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<RequesterEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
Sourcepub fn request(
&self,
mode: SystemMode,
set: bool,
___deadline: MonotonicInstant,
) -> Result<RequesterRequestResult, Error>
pub fn request( &self, mode: SystemMode, set: bool, ___deadline: MonotonicInstant, ) -> Result<RequesterRequestResult, Error>
Requests to set or clear a system power mode.
The call returns immediately after the request has been received, validated, and accepted. Actual system changes to be applied as a result of this request will occur after the call has returned. Therefore, any errors that occur while updating clients according to the new system power mode are not propagated back to the caller. Instead, client updates are applied on a “best effort” basis.
An error returned by this method means the request itself is not valid and was rejected. Details of the specific rejection reason are reflected by the error value. In the event of an error, the channel will remain open.
A client can use this method to set or clear system power mode variants independently. For example:
// battery is below the “low” threshold Request(LOW_BATTERY, true);
// device is now plugged into the wall Request(ON_AC_POWER, true);
// battery is now above the “low” threshold Request(LOW_BATTERY, false);
mode
is theSystemMode
to request to be set or clearedset
should be true to request to setmode
, or false to clear it
- error a
ModeRequestError
value indicating why the request was rejected.
Trait Implementations§
Source§impl Debug for RequesterSynchronousProxy
impl Debug for RequesterSynchronousProxy
Source§impl SynchronousProxy for RequesterSynchronousProxy
impl SynchronousProxy for RequesterSynchronousProxy
Source§type Proxy = RequesterProxy
type Proxy = RequesterProxy
Source§type Protocol = RequesterMarker
type Protocol = RequesterMarker
Proxy
controls.