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<(BootInstant, MonotonicInstant), DefaultFuchsiaResourceDialect>
pub fn get( &self, ) -> QueryResponseFut<(BootInstant, MonotonicInstant), DefaultFuchsiaResourceDialect>
Gets the current time.
Sourcepub fn register_event_in_monotonic(
&self,
event: EventPair,
time: MonotonicInstant,
) -> Result<(), Error>
pub fn register_event_in_monotonic( &self, event: EventPair, time: MonotonicInstant, ) -> Result<(), Error>
Registers the event handle event
to be signaled with ZX_EVENTPAIR_SIGNALED
when the
provided time
is reached by the fake monotonic 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 register_event_in_boot(
&self,
event: EventPair,
time: BootInstant,
) -> Result<(), Error>
pub fn register_event_in_boot( &self, event: EventPair, time: BootInstant, ) -> Result<(), Error>
Registers the event handle event
to be signaled with ZX_EVENTPAIR_SIGNALED
when the
provided time
is reached by the fake boot 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_in_monotonic(
&self,
event: EventPair,
time: MonotonicInstant,
) -> QueryResponseFut<FakeClockRescheduleEventInMonotonicResult, DefaultFuchsiaResourceDialect>
pub fn reschedule_event_in_monotonic( &self, event: EventPair, time: MonotonicInstant, ) -> QueryResponseFut<FakeClockRescheduleEventInMonotonicResult, DefaultFuchsiaResourceDialect>
Reschedules an event to be signalled with ZX_EVENTPAIR_SIGNALED
at the new deadline in
time
on the monotonic clock.
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 reschedule_event_in_boot(
&self,
event: EventPair,
time: BootInstant,
) -> QueryResponseFut<FakeClockRescheduleEventInBootResult, DefaultFuchsiaResourceDialect>
pub fn reschedule_event_in_boot( &self, event: EventPair, time: BootInstant, ) -> QueryResponseFut<FakeClockRescheduleEventInBootResult, DefaultFuchsiaResourceDialect>
Reschedules an event to be signalled with ZX_EVENTPAIR_SIGNALED
at the new deadline in
time
on the boot clock.
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_in_monotonic(
&self,
id: &DeadlineId,
duration: i64,
) -> QueryResponseFut<MonotonicInstant, DefaultFuchsiaResourceDialect>
pub fn create_named_deadline_in_monotonic( &self, id: &DeadlineId, duration: i64, ) -> QueryResponseFut<MonotonicInstant, DefaultFuchsiaResourceDialect>
Calculate and set a deadline associated with an id on the monotonic clock.
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.
Sourcepub fn create_named_deadline_in_boot(
&self,
id: &DeadlineId,
duration: i64,
) -> QueryResponseFut<BootInstant, DefaultFuchsiaResourceDialect>
pub fn create_named_deadline_in_boot( &self, id: &DeadlineId, duration: i64, ) -> QueryResponseFut<BootInstant, DefaultFuchsiaResourceDialect>
Calculate and set a deadline associated with an id on the boot clock.
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<(Instant<BootTimeline>, Instant<MonotonicTimeline>)>
type RescheduleEventInMonotonicResponseFut = QueryResponseFut<Result<(), i32>>
type RescheduleEventInBootResponseFut = QueryResponseFut<Result<(), i32>>
type CancelEventResponseFut = QueryResponseFut<()>
type CreateNamedDeadlineInMonotonicResponseFut = QueryResponseFut<Instant<MonotonicTimeline>>
type CreateNamedDeadlineInBootResponseFut = QueryResponseFut<Instant<BootTimeline>>
fn get(&self) -> Self::GetResponseFut
fn register_event_in_monotonic( &self, event: EventPair, time: MonotonicInstant, ) -> Result<(), Error>
fn register_event_in_boot( &self, event: EventPair, time: BootInstant, ) -> Result<(), Error>
fn reschedule_event_in_monotonic( &self, event: EventPair, time: MonotonicInstant, ) -> Self::RescheduleEventInMonotonicResponseFut
fn reschedule_event_in_boot( &self, event: EventPair, time: BootInstant, ) -> Self::RescheduleEventInBootResponseFut
fn cancel_event(&self, event: EventPair) -> Self::CancelEventResponseFut
fn create_named_deadline_in_monotonic( &self, id: &DeadlineId, duration: i64, ) -> Self::CreateNamedDeadlineInMonotonicResponseFut
fn create_named_deadline_in_boot( &self, id: &DeadlineId, duration: i64, ) -> Self::CreateNamedDeadlineInBootResponseFut
Source§impl Proxy for FakeClockProxy
impl Proxy for FakeClockProxy
Source§type Protocol = FakeClockMarker
type Protocol = FakeClockMarker
Proxy
controls.