pub struct FakeClockControlSynchronousProxy { /* private fields */ }
Implementations§
Source§impl FakeClockControlSynchronousProxy
impl FakeClockControlSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<FakeClockControlEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<FakeClockControlEvent, 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 advance(
&self,
increment: &Increment,
___deadline: MonotonicInstant,
) -> Result<FakeClockControlAdvanceResult, Error>
pub fn advance( &self, increment: &Increment, ___deadline: MonotonicInstant, ) -> Result<FakeClockControlAdvanceResult, Error>
Advances the fake clock increment
once.
Returns ZX_ERR_INVALID_ARGS
if the provided increment
is invalid (such as a badly formed
RandomRange). Returns ZX_ERR_ACCESS_DENIED
if called while the FakeClock is free-running.
Sourcepub fn resume_with_increments(
&self,
real: i64,
increment: &Increment,
___deadline: MonotonicInstant,
) -> Result<FakeClockControlResumeWithIncrementsResult, Error>
pub fn resume_with_increments( &self, real: i64, increment: &Increment, ___deadline: MonotonicInstant, ) -> Result<FakeClockControlResumeWithIncrementsResult, Error>
Resumes free-running increments on the fake clock.
real
is the period based on the real monotonic clock over which increment
is going to be
applied. Returns ZX_ERR_INVALID_ARGS
if the provided increment
is invalid (such as a
badly formed RandomRange).
Sourcepub fn add_stop_point(
&self,
deadline_id: &DeadlineId,
event_type: DeadlineEventType,
on_stop: EventPair,
___deadline: MonotonicInstant,
) -> Result<FakeClockControlAddStopPointResult, Error>
pub fn add_stop_point( &self, deadline_id: &DeadlineId, event_type: DeadlineEventType, on_stop: EventPair, ___deadline: MonotonicInstant, ) -> Result<FakeClockControlAddStopPointResult, Error>
Registers interest in a deadline event.
deadline_id
and event_type
identify the named deadline and the event associated with
the deadline. When the event occurs, FakeClock will signal EVENTPAIR_SIGNALED
on
on_stop
. If time is free-running, the clock is stopped. Closing the eventpair cancels
interest in the deadline. If the eventpair is closed when a deadline is reached, time is
not stopped. Note that only events that occur after AddStopPoint
is called are matched.
In addition, the EXPIRED
event is always reported, even if the component that created the
deadline does not act on the deadline expiration.
The intended use is to set a stop point using AddStopPoint
, resume running time with
ResumeWithIncrements
, then wait for the stop point to occur using the on_stop
eventpair.
Setting a stop point is only allowed while time is stopped. If time is free running when
this method is invoked ZX_ERR_ACCESS_DENIED
is returned. If a stop point is already
registered for the same event, ZX_ALREADY_BOUND
is returned.
Sourcepub fn pause(&self, ___deadline: MonotonicInstant) -> Result<(), Error>
pub fn pause(&self, ___deadline: MonotonicInstant) -> Result<(), Error>
Pauses free-running increments on the fake clock.
Sourcepub fn ignore_named_deadline(
&self,
deadline_id: &DeadlineId,
___deadline: MonotonicInstant,
) -> Result<(), Error>
pub fn ignore_named_deadline( &self, deadline_id: &DeadlineId, ___deadline: MonotonicInstant, ) -> Result<(), Error>
Instructs the fake clock to make deadlines named deadline_id
never expire.
This is a no-op if deadline_id
is already in the ignored set.
Trait Implementations§
Source§impl SynchronousProxy for FakeClockControlSynchronousProxy
impl SynchronousProxy for FakeClockControlSynchronousProxy
Source§type Proxy = FakeClockControlProxy
type Proxy = FakeClockControlProxy
Source§type Protocol = FakeClockControlMarker
type Protocol = FakeClockControlMarker
Proxy
controls.