pub struct FakeClockProxy { /* private fields */ }
Implementations§
Source§impl FakeClockProxy
impl FakeClockProxy
Sourcepub fn take_event_stream(&self) -> FakeClockEventStream
pub fn take_event_stream(&self) -> FakeClockEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn get(&self) -> QueryResponseFut<i64, DefaultFuchsiaResourceDialect>
pub fn get(&self) -> QueryResponseFut<i64, DefaultFuchsiaResourceDialect>
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,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn reschedule_event( &self, event: EventPair, time: i64, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
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,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn cancel_event( &self, event: EventPair, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
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,
) -> QueryResponseFut<i64, DefaultFuchsiaResourceDialect>
pub fn create_named_deadline( &self, id: &DeadlineId, duration: i64, ) -> QueryResponseFut<i64, DefaultFuchsiaResourceDialect>
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 Clone for FakeClockProxy
impl Clone for FakeClockProxy
Source§fn clone(&self) -> FakeClockProxy
fn clone(&self) -> FakeClockProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FakeClockProxy
impl Debug for FakeClockProxy
Source§impl FakeClockProxyInterface for FakeClockProxy
impl FakeClockProxyInterface for FakeClockProxy
type GetResponseFut = QueryResponseFut<i64>
type RescheduleEventResponseFut = QueryResponseFut<()>
type CancelEventResponseFut = QueryResponseFut<()>
type CreateNamedDeadlineResponseFut = QueryResponseFut<i64>
fn get(&self) -> Self::GetResponseFut
fn register_event(&self, event: EventPair, time: i64) -> Result<(), Error>
fn reschedule_event( &self, event: EventPair, time: i64, ) -> Self::RescheduleEventResponseFut
fn cancel_event(&self, event: EventPair) -> Self::CancelEventResponseFut
fn create_named_deadline( &self, id: &DeadlineId, duration: i64, ) -> Self::CreateNamedDeadlineResponseFut
Source§impl Proxy for FakeClockProxy
impl Proxy for FakeClockProxy
Source§type Protocol = FakeClockMarker
type Protocol = FakeClockMarker
Proxy
controls.