pub struct FakeClockSynchronousProxy { /* private fields */ }
Implementations§
Source§impl FakeClockSynchronousProxy
impl FakeClockSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<FakeClockEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<FakeClockEvent, 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 get(&self, ___deadline: MonotonicInstant) -> Result<i64, Error>
pub fn get(&self, ___deadline: MonotonicInstant) -> Result<i64, Error>
Gets the current time.
Sourcepub fn register_event(&self, event: EventPair, time: i64) -> Result<(), Error>
pub fn register_event(&self, event: EventPair, time: i64) -> Result<(), Error>
Registers the event handle event
to be signaled with ZX_EVENTPAIR_SIGNALED
when the
provided time
is reached by the fake clock.
The FakeClock
instance will retain this event (even after it’s fired) for as long as the
client-side of the provided event pair event
is open.
Sourcepub fn reschedule_event(
&self,
event: EventPair,
time: i64,
___deadline: MonotonicInstant,
) -> Result<(), Error>
pub fn reschedule_event( &self, event: EventPair, time: i64, ___deadline: MonotonicInstant, ) -> Result<(), Error>
Reschedules an event to be signalled with ZX_EVENTPAIR_SIGNALED
at the new deadline in
time
.
event
is a duplicate of the client-side of the event pair, and it’s used to retrieve the
originally registered event through its kernel object identifier.
Sourcepub fn cancel_event(
&self,
event: EventPair,
___deadline: MonotonicInstant,
) -> Result<(), Error>
pub fn cancel_event( &self, event: EventPair, ___deadline: MonotonicInstant, ) -> Result<(), Error>
Cancels a previously registered event.
event
is a duplicate of the client-side of the event pair, and it’s used to retrieve the
originally registered event through its kernel object identifier.
Sourcepub fn create_named_deadline(
&self,
id: &DeadlineId,
duration: i64,
___deadline: MonotonicInstant,
) -> Result<i64, Error>
pub fn create_named_deadline( &self, id: &DeadlineId, duration: i64, ___deadline: MonotonicInstant, ) -> Result<i64, Error>
Calculate and set a deadline associated with an id.
The returned deadline
is calculated as duration
after the current fake time.
FakeClock emits two events: A SET
event immediately, and an EXPIRED
event when the
deadline expires. A test using FakeClockControl
may reference events related to the
deadline using a matching id
. See FakeClockControl.SetStopPoint
for information on how a
test can wait for a deadline event.
Trait Implementations§
Source§impl Debug for FakeClockSynchronousProxy
impl Debug for FakeClockSynchronousProxy
Source§impl SynchronousProxy for FakeClockSynchronousProxy
impl SynchronousProxy for FakeClockSynchronousProxy
Source§type Proxy = FakeClockProxy
type Proxy = FakeClockProxy
Source§type Protocol = FakeClockMarker
type Protocol = FakeClockMarker
Proxy
controls.