pub enum FakeClockRequest {
Get {
responder: FakeClockGetResponder,
},
RegisterEvent {
event: EventPair,
time: i64,
control_handle: FakeClockControlHandle,
},
RescheduleEvent {
event: EventPair,
time: i64,
responder: FakeClockRescheduleEventResponder,
},
CancelEvent {
event: EventPair,
responder: FakeClockCancelEventResponder,
},
CreateNamedDeadline {
id: DeadlineId,
duration: i64,
responder: FakeClockCreateNamedDeadlineResponder,
},
}
Expand description
Allows access to fake clocks managed by FakeClockControl
.
Variants§
Get
Gets the current time.
Fields
responder: FakeClockGetResponder
RegisterEvent
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.
RescheduleEvent
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.
CancelEvent
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.
CreateNamedDeadline
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.
Implementations§
Source§impl FakeClockRequest
impl FakeClockRequest
pub fn into_get(self) -> Option<FakeClockGetResponder>
pub fn into_register_event( self, ) -> Option<(EventPair, i64, FakeClockControlHandle)>
pub fn into_reschedule_event( self, ) -> Option<(EventPair, i64, FakeClockRescheduleEventResponder)>
pub fn into_cancel_event( self, ) -> Option<(EventPair, FakeClockCancelEventResponder)>
pub fn into_create_named_deadline( self, ) -> Option<(DeadlineId, i64, FakeClockCreateNamedDeadlineResponder)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL