fidl_fuchsia_hardware_hrtimer/
fidl_fuchsia_hardware_hrtimer.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_hrtimer_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceSetEventRequest {
16    pub id: u64,
17    pub event: fidl::Event,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceSetEventRequest {}
21
22#[derive(Debug, PartialEq)]
23pub struct DeviceStartAndWait2Request {
24    pub id: u64,
25    pub resolution: Resolution,
26    pub ticks: u64,
27    pub setup_keep_alive: fidl::EventPair,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for DeviceStartAndWait2Request
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct DeviceStartAndWaitRequest {
37    pub id: u64,
38    pub resolution: Resolution,
39    pub ticks: u64,
40    pub setup_event: fidl::Event,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceStartAndWaitRequest {}
44
45#[derive(Debug, PartialEq)]
46pub struct DeviceGetPropertiesResponse {
47    pub properties: Properties,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for DeviceGetPropertiesResponse
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct DeviceStartAndWait2Response {
57    pub expiration_keep_alive: fidl::EventPair,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for DeviceStartAndWait2Response
62{
63}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct DeviceStartAndWaitResponse {
67    pub keep_alive: fidl::EventPair,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
71    for DeviceStartAndWaitResponse
72{
73}
74
75/// Driver properties.
76#[derive(Debug, Default, PartialEq)]
77pub struct Properties {
78    /// Retrieves the supported timers properties.
79    ///
80    /// Optional.
81    pub timers_properties: Option<Vec<TimerProperties>>,
82    #[doc(hidden)]
83    pub __source_breaking: fidl::marker::SourceBreaking,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Properties {}
87
88#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
89pub struct DeviceMarker;
90
91impl fidl::endpoints::ProtocolMarker for DeviceMarker {
92    type Proxy = DeviceProxy;
93    type RequestStream = DeviceRequestStream;
94    #[cfg(target_os = "fuchsia")]
95    type SynchronousProxy = DeviceSynchronousProxy;
96
97    const DEBUG_NAME: &'static str = "fuchsia.hardware.hrtimer.Device";
98}
99impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
100pub type DeviceStartResult = Result<(), DriverError>;
101pub type DeviceStopResult = Result<(), DriverError>;
102pub type DeviceGetTicksLeftResult = Result<u64, DriverError>;
103pub type DeviceSetEventResult = Result<(), DriverError>;
104pub type DeviceStartAndWaitResult = Result<fidl::EventPair, DriverError>;
105pub type DeviceStartAndWait2Result = Result<fidl::EventPair, DriverError>;
106
107pub trait DeviceProxyInterface: Send + Sync {
108    type StartResponseFut: std::future::Future<Output = Result<DeviceStartResult, fidl::Error>>
109        + Send;
110    fn r#start(&self, id: u64, resolution: &Resolution, ticks: u64) -> Self::StartResponseFut;
111    type StopResponseFut: std::future::Future<Output = Result<DeviceStopResult, fidl::Error>> + Send;
112    fn r#stop(&self, id: u64) -> Self::StopResponseFut;
113    type GetTicksLeftResponseFut: std::future::Future<Output = Result<DeviceGetTicksLeftResult, fidl::Error>>
114        + Send;
115    fn r#get_ticks_left(&self, id: u64) -> Self::GetTicksLeftResponseFut;
116    type SetEventResponseFut: std::future::Future<Output = Result<DeviceSetEventResult, fidl::Error>>
117        + Send;
118    fn r#set_event(&self, id: u64, event: fidl::Event) -> Self::SetEventResponseFut;
119    type StartAndWaitResponseFut: std::future::Future<Output = Result<DeviceStartAndWaitResult, fidl::Error>>
120        + Send;
121    fn r#start_and_wait(
122        &self,
123        id: u64,
124        resolution: &Resolution,
125        ticks: u64,
126        setup_event: fidl::Event,
127    ) -> Self::StartAndWaitResponseFut;
128    type StartAndWait2ResponseFut: std::future::Future<Output = Result<DeviceStartAndWait2Result, fidl::Error>>
129        + Send;
130    fn r#start_and_wait2(
131        &self,
132        id: u64,
133        resolution: &Resolution,
134        ticks: u64,
135        setup_keep_alive: fidl::EventPair,
136    ) -> Self::StartAndWait2ResponseFut;
137    type GetPropertiesResponseFut: std::future::Future<Output = Result<Properties, fidl::Error>>
138        + Send;
139    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
140}
141#[derive(Debug)]
142#[cfg(target_os = "fuchsia")]
143pub struct DeviceSynchronousProxy {
144    client: fidl::client::sync::Client,
145}
146
147#[cfg(target_os = "fuchsia")]
148impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
149    type Proxy = DeviceProxy;
150    type Protocol = DeviceMarker;
151
152    fn from_channel(inner: fidl::Channel) -> Self {
153        Self::new(inner)
154    }
155
156    fn into_channel(self) -> fidl::Channel {
157        self.client.into_channel()
158    }
159
160    fn as_channel(&self) -> &fidl::Channel {
161        self.client.as_channel()
162    }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl DeviceSynchronousProxy {
167    pub fn new(channel: fidl::Channel) -> Self {
168        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
170    }
171
172    pub fn into_channel(self) -> fidl::Channel {
173        self.client.into_channel()
174    }
175
176    /// Waits until an event arrives and returns it. It is safe for other
177    /// threads to make concurrent requests while waiting for an event.
178    pub fn wait_for_event(
179        &self,
180        deadline: zx::MonotonicInstant,
181    ) -> Result<DeviceEvent, fidl::Error> {
182        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
183    }
184
185    /// Start the timer `id` to expire after `ticks`.
186    ///
187    /// If `ticks` is 0 then the timer will expire in 0 ticks (immediately).
188    /// If the timer `id` was already started, then the previous `Start` is canceled and the driver
189    /// will restart the timer. Note that this may race with the expiration of the previous timer,
190    /// for instance the notification process may be already started and a new `Start` call won't
191    /// be able to stop a notification that is already in flight.
192    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
193    /// If the specified `resolution` is not supported per the `resolutions` provided by
194    /// `GetProperties`, then this call will return `INVALID_ARGS`.
195    /// If the specified `ticks` is beyond the range supported for the timer as provided by
196    /// `GetProperties`, then this call will return `INVALID_ARGS`.
197    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
198    pub fn r#start(
199        &self,
200        mut id: u64,
201        mut resolution: &Resolution,
202        mut ticks: u64,
203        ___deadline: zx::MonotonicInstant,
204    ) -> Result<DeviceStartResult, fidl::Error> {
205        let _response = self.client.send_query::<
206            DeviceStartRequest,
207            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
208        >(
209            (id, resolution, ticks,),
210            0x5a0a193b0467cc8a,
211            fidl::encoding::DynamicFlags::FLEXIBLE,
212            ___deadline,
213        )?
214        .into_result::<DeviceMarker>("start")?;
215        Ok(_response.map(|x| x))
216    }
217
218    /// Stops the timer `id`.
219    ///
220    /// Note that this may race with the expiration of the timer, for instance notification via
221    /// an event set with `SetEvent` may be already in flight.
222    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
223    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
224    pub fn r#stop(
225        &self,
226        mut id: u64,
227        ___deadline: zx::MonotonicInstant,
228    ) -> Result<DeviceStopResult, fidl::Error> {
229        let _response = self.client.send_query::<
230            DeviceStopRequest,
231            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
232        >(
233            (id,),
234            0x77e4cd1c3841a0e2,
235            fidl::encoding::DynamicFlags::FLEXIBLE,
236            ___deadline,
237        )?
238        .into_result::<DeviceMarker>("stop")?;
239        Ok(_response.map(|x| x))
240    }
241
242    /// Get the current time in ticks left in timer `id` until expiration.
243    ///
244    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
245    pub fn r#get_ticks_left(
246        &self,
247        mut id: u64,
248        ___deadline: zx::MonotonicInstant,
249    ) -> Result<DeviceGetTicksLeftResult, fidl::Error> {
250        let _response = self.client.send_query::<
251            DeviceGetTicksLeftRequest,
252            fidl::encoding::FlexibleResultType<DeviceGetTicksLeftResponse, DriverError>,
253        >(
254            (id,),
255            0xde2a48ae7d4b4ea,
256            fidl::encoding::DynamicFlags::FLEXIBLE,
257            ___deadline,
258        )?
259        .into_result::<DeviceMarker>("get_ticks_left")?;
260        Ok(_response.map(|x| x.ticks))
261    }
262
263    /// Sets a Zircon Event to be notified of the timer expiration.
264    ///
265    /// The timer expiration will be notified via the ZX_EVENT_SIGNALED signal.
266    /// The client is responsible for clearing the ZX_EVENT_SIGNALED signal.
267    /// Any previously event set for the specific `id` is replaced. Note that this may race with
268    /// the event signaling from the expiration of a timer already started.
269    /// To guarantee that an event is delivered upon timer expiration, this method must be
270    /// called before calling `Start`.
271    ///
272    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
273    /// If this method is not supported for the given `id`, then this call will return
274    /// `NOT_SUPPORTED`.
275    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
276    pub fn r#set_event(
277        &self,
278        mut id: u64,
279        mut event: fidl::Event,
280        ___deadline: zx::MonotonicInstant,
281    ) -> Result<DeviceSetEventResult, fidl::Error> {
282        let _response = self.client.send_query::<
283            DeviceSetEventRequest,
284            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
285        >(
286            (id, event,),
287            0x1027024d25ffa820,
288            fidl::encoding::DynamicFlags::FLEXIBLE,
289            ___deadline,
290        )?
291        .into_result::<DeviceMarker>("set_event")?;
292        Ok(_response.map(|x| x))
293    }
294
295    /// Start the timer `id` to expire after `ticks` and waits until the timer expires with
296    /// support for preventing suspension via the Power Framework.
297    ///
298    /// The driver will signal the `setup_event` event once the timer has been setup using the
299    /// ZX_EVENT_SIGNALED signal. This allows a client to know that it is safe to allow the
300    /// system to suspend. The client is responsible for clearing this event.
301    ///
302    /// The driver will not respond to this call (hang) until the timer has triggered.
303    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
304    /// may race with the expiration of the timer.
305    ///
306    /// A driver supporting this call must be able to get a lease on a power element that keeps
307    /// the system from suspending. This lease is returned to the client via the `keep_alive`
308    /// LeaseToken channel field. When `keep_alive` is closed, then the driver lease keeping the
309    /// system from suspending will be dropped. Hence, to guarantee that the system is not
310    /// suspended by the Power Framework a client must either keep this `keep_alive` token for
311    /// as long as the system needs to not suspend, or a client must get its own lease from the
312    /// Power Framework to prevent suspension before it drops `keep_alive`.
313    ///
314    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
315    /// If this method is not supported for the given `id`, then this call will return
316    /// `NOT_SUPPORTED`.
317    /// If the driver does not have a `keep_alive` token to provide to the client, then this
318    /// call will return `BAD_STATE`.
319    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
320    pub fn r#start_and_wait(
321        &self,
322        mut id: u64,
323        mut resolution: &Resolution,
324        mut ticks: u64,
325        mut setup_event: fidl::Event,
326        ___deadline: zx::MonotonicInstant,
327    ) -> Result<DeviceStartAndWaitResult, fidl::Error> {
328        let _response = self.client.send_query::<
329            DeviceStartAndWaitRequest,
330            fidl::encoding::FlexibleResultType<DeviceStartAndWaitResponse, DriverError>,
331        >(
332            (id, resolution, ticks, setup_event,),
333            0x716f415cdf234e0f,
334            fidl::encoding::DynamicFlags::FLEXIBLE,
335            ___deadline,
336        )?
337        .into_result::<DeviceMarker>("start_and_wait")?;
338        Ok(_response.map(|x| x.keep_alive))
339    }
340
341    /// Start timer `id` and wait for it to expire after `ticks` ticks.
342    ///
343    /// The driver will not respond to this call (hang) until the timer has triggered.
344    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
345    /// may race with the expiration of the timer.
346    ///
347    /// This method keeps the system awake (prevents suspension) while the timer is setup using the
348    /// mandatory passed-in `setup_keep_alive` `LeaseToken`.
349    /// When the timer expires this method returns a second `expiration_keep_alive`
350    /// `LeaseToken` to prevent suspension at the time of expiration.
351    /// These keep alive wake lease tokens are provided by the Power Framework's System Activity
352    /// Governor. A driver supporting this call must be able to get `expiration_keep_alive` from
353    /// System Activity Governor.
354    ///
355    /// When `expiration_keep_alive` is closed, then this driver created wake lease keeping the
356    /// system from suspending at the time of the timer expiration is dropped. Hence, to guarantee
357    /// that the system is not suspended by the Power Framework a client must either keep this
358    /// `expiration_keep_alive` for as long as the system needs to stay awake, or a client must
359    /// get its own wake lease from the Power Framework before it drops `expiration_keep_alive` to
360    /// prevent suspension.
361    ///
362    /// Errors:
363    ///
364    /// * INVALID_ARGS: The specified `id` is invalid.
365    /// * NOT_SUPPORTED: This method is not supported for the given `id`.
366    /// * BAD_STATE: The driver is in a bad state, for instance it does not have an
367    ///   `expiration_keep_alive` token to provide to the client.
368    /// * INTERNAL_ERROR: The driver encountered an internal error.
369    pub fn r#start_and_wait2(
370        &self,
371        mut id: u64,
372        mut resolution: &Resolution,
373        mut ticks: u64,
374        mut setup_keep_alive: fidl::EventPair,
375        ___deadline: zx::MonotonicInstant,
376    ) -> Result<DeviceStartAndWait2Result, fidl::Error> {
377        let _response = self.client.send_query::<
378            DeviceStartAndWait2Request,
379            fidl::encoding::FlexibleResultType<DeviceStartAndWait2Response, DriverError>,
380        >(
381            (id, resolution, ticks, setup_keep_alive,),
382            0x5f2aaf21254d3238,
383            fidl::encoding::DynamicFlags::FLEXIBLE,
384            ___deadline,
385        )?
386        .into_result::<DeviceMarker>("start_and_wait2")?;
387        Ok(_response.map(|x| x.expiration_keep_alive))
388    }
389
390    /// Get driver properties.
391    pub fn r#get_properties(
392        &self,
393        ___deadline: zx::MonotonicInstant,
394    ) -> Result<Properties, fidl::Error> {
395        let _response = self.client.send_query::<
396            fidl::encoding::EmptyPayload,
397            fidl::encoding::FlexibleType<DeviceGetPropertiesResponse>,
398        >(
399            (),
400            0x6bc22ab4c9396cbb,
401            fidl::encoding::DynamicFlags::FLEXIBLE,
402            ___deadline,
403        )?
404        .into_result::<DeviceMarker>("get_properties")?;
405        Ok(_response.properties)
406    }
407}
408
409#[derive(Debug, Clone)]
410pub struct DeviceProxy {
411    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
412}
413
414impl fidl::endpoints::Proxy for DeviceProxy {
415    type Protocol = DeviceMarker;
416
417    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
418        Self::new(inner)
419    }
420
421    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
422        self.client.into_channel().map_err(|client| Self { client })
423    }
424
425    fn as_channel(&self) -> &::fidl::AsyncChannel {
426        self.client.as_channel()
427    }
428}
429
430impl DeviceProxy {
431    /// Create a new Proxy for fuchsia.hardware.hrtimer/Device.
432    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
433        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
434        Self { client: fidl::client::Client::new(channel, protocol_name) }
435    }
436
437    /// Get a Stream of events from the remote end of the protocol.
438    ///
439    /// # Panics
440    ///
441    /// Panics if the event stream was already taken.
442    pub fn take_event_stream(&self) -> DeviceEventStream {
443        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
444    }
445
446    /// Start the timer `id` to expire after `ticks`.
447    ///
448    /// If `ticks` is 0 then the timer will expire in 0 ticks (immediately).
449    /// If the timer `id` was already started, then the previous `Start` is canceled and the driver
450    /// will restart the timer. Note that this may race with the expiration of the previous timer,
451    /// for instance the notification process may be already started and a new `Start` call won't
452    /// be able to stop a notification that is already in flight.
453    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
454    /// If the specified `resolution` is not supported per the `resolutions` provided by
455    /// `GetProperties`, then this call will return `INVALID_ARGS`.
456    /// If the specified `ticks` is beyond the range supported for the timer as provided by
457    /// `GetProperties`, then this call will return `INVALID_ARGS`.
458    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
459    pub fn r#start(
460        &self,
461        mut id: u64,
462        mut resolution: &Resolution,
463        mut ticks: u64,
464    ) -> fidl::client::QueryResponseFut<
465        DeviceStartResult,
466        fidl::encoding::DefaultFuchsiaResourceDialect,
467    > {
468        DeviceProxyInterface::r#start(self, id, resolution, ticks)
469    }
470
471    /// Stops the timer `id`.
472    ///
473    /// Note that this may race with the expiration of the timer, for instance notification via
474    /// an event set with `SetEvent` may be already in flight.
475    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
476    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
477    pub fn r#stop(
478        &self,
479        mut id: u64,
480    ) -> fidl::client::QueryResponseFut<
481        DeviceStopResult,
482        fidl::encoding::DefaultFuchsiaResourceDialect,
483    > {
484        DeviceProxyInterface::r#stop(self, id)
485    }
486
487    /// Get the current time in ticks left in timer `id` until expiration.
488    ///
489    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
490    pub fn r#get_ticks_left(
491        &self,
492        mut id: u64,
493    ) -> fidl::client::QueryResponseFut<
494        DeviceGetTicksLeftResult,
495        fidl::encoding::DefaultFuchsiaResourceDialect,
496    > {
497        DeviceProxyInterface::r#get_ticks_left(self, id)
498    }
499
500    /// Sets a Zircon Event to be notified of the timer expiration.
501    ///
502    /// The timer expiration will be notified via the ZX_EVENT_SIGNALED signal.
503    /// The client is responsible for clearing the ZX_EVENT_SIGNALED signal.
504    /// Any previously event set for the specific `id` is replaced. Note that this may race with
505    /// the event signaling from the expiration of a timer already started.
506    /// To guarantee that an event is delivered upon timer expiration, this method must be
507    /// called before calling `Start`.
508    ///
509    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
510    /// If this method is not supported for the given `id`, then this call will return
511    /// `NOT_SUPPORTED`.
512    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
513    pub fn r#set_event(
514        &self,
515        mut id: u64,
516        mut event: fidl::Event,
517    ) -> fidl::client::QueryResponseFut<
518        DeviceSetEventResult,
519        fidl::encoding::DefaultFuchsiaResourceDialect,
520    > {
521        DeviceProxyInterface::r#set_event(self, id, event)
522    }
523
524    /// Start the timer `id` to expire after `ticks` and waits until the timer expires with
525    /// support for preventing suspension via the Power Framework.
526    ///
527    /// The driver will signal the `setup_event` event once the timer has been setup using the
528    /// ZX_EVENT_SIGNALED signal. This allows a client to know that it is safe to allow the
529    /// system to suspend. The client is responsible for clearing this event.
530    ///
531    /// The driver will not respond to this call (hang) until the timer has triggered.
532    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
533    /// may race with the expiration of the timer.
534    ///
535    /// A driver supporting this call must be able to get a lease on a power element that keeps
536    /// the system from suspending. This lease is returned to the client via the `keep_alive`
537    /// LeaseToken channel field. When `keep_alive` is closed, then the driver lease keeping the
538    /// system from suspending will be dropped. Hence, to guarantee that the system is not
539    /// suspended by the Power Framework a client must either keep this `keep_alive` token for
540    /// as long as the system needs to not suspend, or a client must get its own lease from the
541    /// Power Framework to prevent suspension before it drops `keep_alive`.
542    ///
543    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
544    /// If this method is not supported for the given `id`, then this call will return
545    /// `NOT_SUPPORTED`.
546    /// If the driver does not have a `keep_alive` token to provide to the client, then this
547    /// call will return `BAD_STATE`.
548    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
549    pub fn r#start_and_wait(
550        &self,
551        mut id: u64,
552        mut resolution: &Resolution,
553        mut ticks: u64,
554        mut setup_event: fidl::Event,
555    ) -> fidl::client::QueryResponseFut<
556        DeviceStartAndWaitResult,
557        fidl::encoding::DefaultFuchsiaResourceDialect,
558    > {
559        DeviceProxyInterface::r#start_and_wait(self, id, resolution, ticks, setup_event)
560    }
561
562    /// Start timer `id` and wait for it to expire after `ticks` ticks.
563    ///
564    /// The driver will not respond to this call (hang) until the timer has triggered.
565    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
566    /// may race with the expiration of the timer.
567    ///
568    /// This method keeps the system awake (prevents suspension) while the timer is setup using the
569    /// mandatory passed-in `setup_keep_alive` `LeaseToken`.
570    /// When the timer expires this method returns a second `expiration_keep_alive`
571    /// `LeaseToken` to prevent suspension at the time of expiration.
572    /// These keep alive wake lease tokens are provided by the Power Framework's System Activity
573    /// Governor. A driver supporting this call must be able to get `expiration_keep_alive` from
574    /// System Activity Governor.
575    ///
576    /// When `expiration_keep_alive` is closed, then this driver created wake lease keeping the
577    /// system from suspending at the time of the timer expiration is dropped. Hence, to guarantee
578    /// that the system is not suspended by the Power Framework a client must either keep this
579    /// `expiration_keep_alive` for as long as the system needs to stay awake, or a client must
580    /// get its own wake lease from the Power Framework before it drops `expiration_keep_alive` to
581    /// prevent suspension.
582    ///
583    /// Errors:
584    ///
585    /// * INVALID_ARGS: The specified `id` is invalid.
586    /// * NOT_SUPPORTED: This method is not supported for the given `id`.
587    /// * BAD_STATE: The driver is in a bad state, for instance it does not have an
588    ///   `expiration_keep_alive` token to provide to the client.
589    /// * INTERNAL_ERROR: The driver encountered an internal error.
590    pub fn r#start_and_wait2(
591        &self,
592        mut id: u64,
593        mut resolution: &Resolution,
594        mut ticks: u64,
595        mut setup_keep_alive: fidl::EventPair,
596    ) -> fidl::client::QueryResponseFut<
597        DeviceStartAndWait2Result,
598        fidl::encoding::DefaultFuchsiaResourceDialect,
599    > {
600        DeviceProxyInterface::r#start_and_wait2(self, id, resolution, ticks, setup_keep_alive)
601    }
602
603    /// Get driver properties.
604    pub fn r#get_properties(
605        &self,
606    ) -> fidl::client::QueryResponseFut<Properties, fidl::encoding::DefaultFuchsiaResourceDialect>
607    {
608        DeviceProxyInterface::r#get_properties(self)
609    }
610}
611
612impl DeviceProxyInterface for DeviceProxy {
613    type StartResponseFut = fidl::client::QueryResponseFut<
614        DeviceStartResult,
615        fidl::encoding::DefaultFuchsiaResourceDialect,
616    >;
617    fn r#start(
618        &self,
619        mut id: u64,
620        mut resolution: &Resolution,
621        mut ticks: u64,
622    ) -> Self::StartResponseFut {
623        fn _decode(
624            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
625        ) -> Result<DeviceStartResult, fidl::Error> {
626            let _response = fidl::client::decode_transaction_body::<
627                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
628                fidl::encoding::DefaultFuchsiaResourceDialect,
629                0x5a0a193b0467cc8a,
630            >(_buf?)?
631            .into_result::<DeviceMarker>("start")?;
632            Ok(_response.map(|x| x))
633        }
634        self.client.send_query_and_decode::<DeviceStartRequest, DeviceStartResult>(
635            (id, resolution, ticks),
636            0x5a0a193b0467cc8a,
637            fidl::encoding::DynamicFlags::FLEXIBLE,
638            _decode,
639        )
640    }
641
642    type StopResponseFut = fidl::client::QueryResponseFut<
643        DeviceStopResult,
644        fidl::encoding::DefaultFuchsiaResourceDialect,
645    >;
646    fn r#stop(&self, mut id: u64) -> Self::StopResponseFut {
647        fn _decode(
648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
649        ) -> Result<DeviceStopResult, fidl::Error> {
650            let _response = fidl::client::decode_transaction_body::<
651                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
652                fidl::encoding::DefaultFuchsiaResourceDialect,
653                0x77e4cd1c3841a0e2,
654            >(_buf?)?
655            .into_result::<DeviceMarker>("stop")?;
656            Ok(_response.map(|x| x))
657        }
658        self.client.send_query_and_decode::<DeviceStopRequest, DeviceStopResult>(
659            (id,),
660            0x77e4cd1c3841a0e2,
661            fidl::encoding::DynamicFlags::FLEXIBLE,
662            _decode,
663        )
664    }
665
666    type GetTicksLeftResponseFut = fidl::client::QueryResponseFut<
667        DeviceGetTicksLeftResult,
668        fidl::encoding::DefaultFuchsiaResourceDialect,
669    >;
670    fn r#get_ticks_left(&self, mut id: u64) -> Self::GetTicksLeftResponseFut {
671        fn _decode(
672            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
673        ) -> Result<DeviceGetTicksLeftResult, fidl::Error> {
674            let _response = fidl::client::decode_transaction_body::<
675                fidl::encoding::FlexibleResultType<DeviceGetTicksLeftResponse, DriverError>,
676                fidl::encoding::DefaultFuchsiaResourceDialect,
677                0xde2a48ae7d4b4ea,
678            >(_buf?)?
679            .into_result::<DeviceMarker>("get_ticks_left")?;
680            Ok(_response.map(|x| x.ticks))
681        }
682        self.client.send_query_and_decode::<DeviceGetTicksLeftRequest, DeviceGetTicksLeftResult>(
683            (id,),
684            0xde2a48ae7d4b4ea,
685            fidl::encoding::DynamicFlags::FLEXIBLE,
686            _decode,
687        )
688    }
689
690    type SetEventResponseFut = fidl::client::QueryResponseFut<
691        DeviceSetEventResult,
692        fidl::encoding::DefaultFuchsiaResourceDialect,
693    >;
694    fn r#set_event(&self, mut id: u64, mut event: fidl::Event) -> Self::SetEventResponseFut {
695        fn _decode(
696            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
697        ) -> Result<DeviceSetEventResult, fidl::Error> {
698            let _response = fidl::client::decode_transaction_body::<
699                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
700                fidl::encoding::DefaultFuchsiaResourceDialect,
701                0x1027024d25ffa820,
702            >(_buf?)?
703            .into_result::<DeviceMarker>("set_event")?;
704            Ok(_response.map(|x| x))
705        }
706        self.client.send_query_and_decode::<DeviceSetEventRequest, DeviceSetEventResult>(
707            (id, event),
708            0x1027024d25ffa820,
709            fidl::encoding::DynamicFlags::FLEXIBLE,
710            _decode,
711        )
712    }
713
714    type StartAndWaitResponseFut = fidl::client::QueryResponseFut<
715        DeviceStartAndWaitResult,
716        fidl::encoding::DefaultFuchsiaResourceDialect,
717    >;
718    fn r#start_and_wait(
719        &self,
720        mut id: u64,
721        mut resolution: &Resolution,
722        mut ticks: u64,
723        mut setup_event: fidl::Event,
724    ) -> Self::StartAndWaitResponseFut {
725        fn _decode(
726            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
727        ) -> Result<DeviceStartAndWaitResult, fidl::Error> {
728            let _response = fidl::client::decode_transaction_body::<
729                fidl::encoding::FlexibleResultType<DeviceStartAndWaitResponse, DriverError>,
730                fidl::encoding::DefaultFuchsiaResourceDialect,
731                0x716f415cdf234e0f,
732            >(_buf?)?
733            .into_result::<DeviceMarker>("start_and_wait")?;
734            Ok(_response.map(|x| x.keep_alive))
735        }
736        self.client.send_query_and_decode::<DeviceStartAndWaitRequest, DeviceStartAndWaitResult>(
737            (id, resolution, ticks, setup_event),
738            0x716f415cdf234e0f,
739            fidl::encoding::DynamicFlags::FLEXIBLE,
740            _decode,
741        )
742    }
743
744    type StartAndWait2ResponseFut = fidl::client::QueryResponseFut<
745        DeviceStartAndWait2Result,
746        fidl::encoding::DefaultFuchsiaResourceDialect,
747    >;
748    fn r#start_and_wait2(
749        &self,
750        mut id: u64,
751        mut resolution: &Resolution,
752        mut ticks: u64,
753        mut setup_keep_alive: fidl::EventPair,
754    ) -> Self::StartAndWait2ResponseFut {
755        fn _decode(
756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
757        ) -> Result<DeviceStartAndWait2Result, fidl::Error> {
758            let _response = fidl::client::decode_transaction_body::<
759                fidl::encoding::FlexibleResultType<DeviceStartAndWait2Response, DriverError>,
760                fidl::encoding::DefaultFuchsiaResourceDialect,
761                0x5f2aaf21254d3238,
762            >(_buf?)?
763            .into_result::<DeviceMarker>("start_and_wait2")?;
764            Ok(_response.map(|x| x.expiration_keep_alive))
765        }
766        self.client.send_query_and_decode::<DeviceStartAndWait2Request, DeviceStartAndWait2Result>(
767            (id, resolution, ticks, setup_keep_alive),
768            0x5f2aaf21254d3238,
769            fidl::encoding::DynamicFlags::FLEXIBLE,
770            _decode,
771        )
772    }
773
774    type GetPropertiesResponseFut =
775        fidl::client::QueryResponseFut<Properties, fidl::encoding::DefaultFuchsiaResourceDialect>;
776    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
777        fn _decode(
778            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
779        ) -> Result<Properties, fidl::Error> {
780            let _response = fidl::client::decode_transaction_body::<
781                fidl::encoding::FlexibleType<DeviceGetPropertiesResponse>,
782                fidl::encoding::DefaultFuchsiaResourceDialect,
783                0x6bc22ab4c9396cbb,
784            >(_buf?)?
785            .into_result::<DeviceMarker>("get_properties")?;
786            Ok(_response.properties)
787        }
788        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Properties>(
789            (),
790            0x6bc22ab4c9396cbb,
791            fidl::encoding::DynamicFlags::FLEXIBLE,
792            _decode,
793        )
794    }
795}
796
797pub struct DeviceEventStream {
798    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
799}
800
801impl std::marker::Unpin for DeviceEventStream {}
802
803impl futures::stream::FusedStream for DeviceEventStream {
804    fn is_terminated(&self) -> bool {
805        self.event_receiver.is_terminated()
806    }
807}
808
809impl futures::Stream for DeviceEventStream {
810    type Item = Result<DeviceEvent, fidl::Error>;
811
812    fn poll_next(
813        mut self: std::pin::Pin<&mut Self>,
814        cx: &mut std::task::Context<'_>,
815    ) -> std::task::Poll<Option<Self::Item>> {
816        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
817            &mut self.event_receiver,
818            cx
819        )?) {
820            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
821            None => std::task::Poll::Ready(None),
822        }
823    }
824}
825
826#[derive(Debug)]
827pub enum DeviceEvent {
828    #[non_exhaustive]
829    _UnknownEvent {
830        /// Ordinal of the event that was sent.
831        ordinal: u64,
832    },
833}
834
835impl DeviceEvent {
836    /// Decodes a message buffer as a [`DeviceEvent`].
837    fn decode(
838        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
839    ) -> Result<DeviceEvent, fidl::Error> {
840        let (bytes, _handles) = buf.split_mut();
841        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
842        debug_assert_eq!(tx_header.tx_id, 0);
843        match tx_header.ordinal {
844            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
845                Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
846            }
847            _ => Err(fidl::Error::UnknownOrdinal {
848                ordinal: tx_header.ordinal,
849                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
850            }),
851        }
852    }
853}
854
855/// A Stream of incoming requests for fuchsia.hardware.hrtimer/Device.
856pub struct DeviceRequestStream {
857    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
858    is_terminated: bool,
859}
860
861impl std::marker::Unpin for DeviceRequestStream {}
862
863impl futures::stream::FusedStream for DeviceRequestStream {
864    fn is_terminated(&self) -> bool {
865        self.is_terminated
866    }
867}
868
869impl fidl::endpoints::RequestStream for DeviceRequestStream {
870    type Protocol = DeviceMarker;
871    type ControlHandle = DeviceControlHandle;
872
873    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
874        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
875    }
876
877    fn control_handle(&self) -> Self::ControlHandle {
878        DeviceControlHandle { inner: self.inner.clone() }
879    }
880
881    fn into_inner(
882        self,
883    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
884    {
885        (self.inner, self.is_terminated)
886    }
887
888    fn from_inner(
889        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
890        is_terminated: bool,
891    ) -> Self {
892        Self { inner, is_terminated }
893    }
894}
895
896impl futures::Stream for DeviceRequestStream {
897    type Item = Result<DeviceRequest, fidl::Error>;
898
899    fn poll_next(
900        mut self: std::pin::Pin<&mut Self>,
901        cx: &mut std::task::Context<'_>,
902    ) -> std::task::Poll<Option<Self::Item>> {
903        let this = &mut *self;
904        if this.inner.check_shutdown(cx) {
905            this.is_terminated = true;
906            return std::task::Poll::Ready(None);
907        }
908        if this.is_terminated {
909            panic!("polled DeviceRequestStream after completion");
910        }
911        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
912            |bytes, handles| {
913                match this.inner.channel().read_etc(cx, bytes, handles) {
914                    std::task::Poll::Ready(Ok(())) => {}
915                    std::task::Poll::Pending => return std::task::Poll::Pending,
916                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
917                        this.is_terminated = true;
918                        return std::task::Poll::Ready(None);
919                    }
920                    std::task::Poll::Ready(Err(e)) => {
921                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
922                            e.into(),
923                        ))))
924                    }
925                }
926
927                // A message has been received from the channel
928                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
929
930                std::task::Poll::Ready(Some(match header.ordinal {
931                    0x5a0a193b0467cc8a => {
932                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
933                        let mut req = fidl::new_empty!(
934                            DeviceStartRequest,
935                            fidl::encoding::DefaultFuchsiaResourceDialect
936                        );
937                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartRequest>(&header, _body_bytes, handles, &mut req)?;
938                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
939                        Ok(DeviceRequest::Start {
940                            id: req.id,
941                            resolution: req.resolution,
942                            ticks: req.ticks,
943
944                            responder: DeviceStartResponder {
945                                control_handle: std::mem::ManuallyDrop::new(control_handle),
946                                tx_id: header.tx_id,
947                            },
948                        })
949                    }
950                    0x77e4cd1c3841a0e2 => {
951                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
952                        let mut req = fidl::new_empty!(
953                            DeviceStopRequest,
954                            fidl::encoding::DefaultFuchsiaResourceDialect
955                        );
956                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStopRequest>(&header, _body_bytes, handles, &mut req)?;
957                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
958                        Ok(DeviceRequest::Stop {
959                            id: req.id,
960
961                            responder: DeviceStopResponder {
962                                control_handle: std::mem::ManuallyDrop::new(control_handle),
963                                tx_id: header.tx_id,
964                            },
965                        })
966                    }
967                    0xde2a48ae7d4b4ea => {
968                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
969                        let mut req = fidl::new_empty!(
970                            DeviceGetTicksLeftRequest,
971                            fidl::encoding::DefaultFuchsiaResourceDialect
972                        );
973                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetTicksLeftRequest>(&header, _body_bytes, handles, &mut req)?;
974                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
975                        Ok(DeviceRequest::GetTicksLeft {
976                            id: req.id,
977
978                            responder: DeviceGetTicksLeftResponder {
979                                control_handle: std::mem::ManuallyDrop::new(control_handle),
980                                tx_id: header.tx_id,
981                            },
982                        })
983                    }
984                    0x1027024d25ffa820 => {
985                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
986                        let mut req = fidl::new_empty!(
987                            DeviceSetEventRequest,
988                            fidl::encoding::DefaultFuchsiaResourceDialect
989                        );
990                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetEventRequest>(&header, _body_bytes, handles, &mut req)?;
991                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
992                        Ok(DeviceRequest::SetEvent {
993                            id: req.id,
994                            event: req.event,
995
996                            responder: DeviceSetEventResponder {
997                                control_handle: std::mem::ManuallyDrop::new(control_handle),
998                                tx_id: header.tx_id,
999                            },
1000                        })
1001                    }
1002                    0x716f415cdf234e0f => {
1003                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1004                        let mut req = fidl::new_empty!(
1005                            DeviceStartAndWaitRequest,
1006                            fidl::encoding::DefaultFuchsiaResourceDialect
1007                        );
1008                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartAndWaitRequest>(&header, _body_bytes, handles, &mut req)?;
1009                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1010                        Ok(DeviceRequest::StartAndWait {
1011                            id: req.id,
1012                            resolution: req.resolution,
1013                            ticks: req.ticks,
1014                            setup_event: req.setup_event,
1015
1016                            responder: DeviceStartAndWaitResponder {
1017                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1018                                tx_id: header.tx_id,
1019                            },
1020                        })
1021                    }
1022                    0x5f2aaf21254d3238 => {
1023                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1024                        let mut req = fidl::new_empty!(
1025                            DeviceStartAndWait2Request,
1026                            fidl::encoding::DefaultFuchsiaResourceDialect
1027                        );
1028                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartAndWait2Request>(&header, _body_bytes, handles, &mut req)?;
1029                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1030                        Ok(DeviceRequest::StartAndWait2 {
1031                            id: req.id,
1032                            resolution: req.resolution,
1033                            ticks: req.ticks,
1034                            setup_keep_alive: req.setup_keep_alive,
1035
1036                            responder: DeviceStartAndWait2Responder {
1037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1038                                tx_id: header.tx_id,
1039                            },
1040                        })
1041                    }
1042                    0x6bc22ab4c9396cbb => {
1043                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1044                        let mut req = fidl::new_empty!(
1045                            fidl::encoding::EmptyPayload,
1046                            fidl::encoding::DefaultFuchsiaResourceDialect
1047                        );
1048                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1049                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1050                        Ok(DeviceRequest::GetProperties {
1051                            responder: DeviceGetPropertiesResponder {
1052                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1053                                tx_id: header.tx_id,
1054                            },
1055                        })
1056                    }
1057                    _ if header.tx_id == 0
1058                        && header
1059                            .dynamic_flags()
1060                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1061                    {
1062                        Ok(DeviceRequest::_UnknownMethod {
1063                            ordinal: header.ordinal,
1064                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1065                            method_type: fidl::MethodType::OneWay,
1066                        })
1067                    }
1068                    _ if header
1069                        .dynamic_flags()
1070                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1071                    {
1072                        this.inner.send_framework_err(
1073                            fidl::encoding::FrameworkErr::UnknownMethod,
1074                            header.tx_id,
1075                            header.ordinal,
1076                            header.dynamic_flags(),
1077                            (bytes, handles),
1078                        )?;
1079                        Ok(DeviceRequest::_UnknownMethod {
1080                            ordinal: header.ordinal,
1081                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1082                            method_type: fidl::MethodType::TwoWay,
1083                        })
1084                    }
1085                    _ => Err(fidl::Error::UnknownOrdinal {
1086                        ordinal: header.ordinal,
1087                        protocol_name:
1088                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1089                    }),
1090                }))
1091            },
1092        )
1093    }
1094}
1095
1096/// A driver providing high resolution timers support.
1097/// This API is intended for timers that are provided by hardware separate from the CPU
1098/// For instance this driver may abstract hardware provided by an SoC.
1099#[derive(Debug)]
1100pub enum DeviceRequest {
1101    /// Start the timer `id` to expire after `ticks`.
1102    ///
1103    /// If `ticks` is 0 then the timer will expire in 0 ticks (immediately).
1104    /// If the timer `id` was already started, then the previous `Start` is canceled and the driver
1105    /// will restart the timer. Note that this may race with the expiration of the previous timer,
1106    /// for instance the notification process may be already started and a new `Start` call won't
1107    /// be able to stop a notification that is already in flight.
1108    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
1109    /// If the specified `resolution` is not supported per the `resolutions` provided by
1110    /// `GetProperties`, then this call will return `INVALID_ARGS`.
1111    /// If the specified `ticks` is beyond the range supported for the timer as provided by
1112    /// `GetProperties`, then this call will return `INVALID_ARGS`.
1113    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
1114    Start { id: u64, resolution: Resolution, ticks: u64, responder: DeviceStartResponder },
1115    /// Stops the timer `id`.
1116    ///
1117    /// Note that this may race with the expiration of the timer, for instance notification via
1118    /// an event set with `SetEvent` may be already in flight.
1119    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
1120    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
1121    Stop { id: u64, responder: DeviceStopResponder },
1122    /// Get the current time in ticks left in timer `id` until expiration.
1123    ///
1124    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
1125    GetTicksLeft { id: u64, responder: DeviceGetTicksLeftResponder },
1126    /// Sets a Zircon Event to be notified of the timer expiration.
1127    ///
1128    /// The timer expiration will be notified via the ZX_EVENT_SIGNALED signal.
1129    /// The client is responsible for clearing the ZX_EVENT_SIGNALED signal.
1130    /// Any previously event set for the specific `id` is replaced. Note that this may race with
1131    /// the event signaling from the expiration of a timer already started.
1132    /// To guarantee that an event is delivered upon timer expiration, this method must be
1133    /// called before calling `Start`.
1134    ///
1135    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
1136    /// If this method is not supported for the given `id`, then this call will return
1137    /// `NOT_SUPPORTED`.
1138    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
1139    SetEvent { id: u64, event: fidl::Event, responder: DeviceSetEventResponder },
1140    /// Start the timer `id` to expire after `ticks` and waits until the timer expires with
1141    /// support for preventing suspension via the Power Framework.
1142    ///
1143    /// The driver will signal the `setup_event` event once the timer has been setup using the
1144    /// ZX_EVENT_SIGNALED signal. This allows a client to know that it is safe to allow the
1145    /// system to suspend. The client is responsible for clearing this event.
1146    ///
1147    /// The driver will not respond to this call (hang) until the timer has triggered.
1148    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
1149    /// may race with the expiration of the timer.
1150    ///
1151    /// A driver supporting this call must be able to get a lease on a power element that keeps
1152    /// the system from suspending. This lease is returned to the client via the `keep_alive`
1153    /// LeaseToken channel field. When `keep_alive` is closed, then the driver lease keeping the
1154    /// system from suspending will be dropped. Hence, to guarantee that the system is not
1155    /// suspended by the Power Framework a client must either keep this `keep_alive` token for
1156    /// as long as the system needs to not suspend, or a client must get its own lease from the
1157    /// Power Framework to prevent suspension before it drops `keep_alive`.
1158    ///
1159    /// If the specified `id` is invalid, then this call will return `INVALID_ARGS`.
1160    /// If this method is not supported for the given `id`, then this call will return
1161    /// `NOT_SUPPORTED`.
1162    /// If the driver does not have a `keep_alive` token to provide to the client, then this
1163    /// call will return `BAD_STATE`.
1164    /// If the driver encounters an internal error, then this call will return `INTERNAL_ERROR`.
1165    StartAndWait {
1166        id: u64,
1167        resolution: Resolution,
1168        ticks: u64,
1169        setup_event: fidl::Event,
1170        responder: DeviceStartAndWaitResponder,
1171    },
1172    /// Start timer `id` and wait for it to expire after `ticks` ticks.
1173    ///
1174    /// The driver will not respond to this call (hang) until the timer has triggered.
1175    /// Calling `Stop` on the timer will abort this call and return `CANCELED`. Note that this
1176    /// may race with the expiration of the timer.
1177    ///
1178    /// This method keeps the system awake (prevents suspension) while the timer is setup using the
1179    /// mandatory passed-in `setup_keep_alive` `LeaseToken`.
1180    /// When the timer expires this method returns a second `expiration_keep_alive`
1181    /// `LeaseToken` to prevent suspension at the time of expiration.
1182    /// These keep alive wake lease tokens are provided by the Power Framework's System Activity
1183    /// Governor. A driver supporting this call must be able to get `expiration_keep_alive` from
1184    /// System Activity Governor.
1185    ///
1186    /// When `expiration_keep_alive` is closed, then this driver created wake lease keeping the
1187    /// system from suspending at the time of the timer expiration is dropped. Hence, to guarantee
1188    /// that the system is not suspended by the Power Framework a client must either keep this
1189    /// `expiration_keep_alive` for as long as the system needs to stay awake, or a client must
1190    /// get its own wake lease from the Power Framework before it drops `expiration_keep_alive` to
1191    /// prevent suspension.
1192    ///
1193    /// Errors:
1194    ///
1195    /// * INVALID_ARGS: The specified `id` is invalid.
1196    /// * NOT_SUPPORTED: This method is not supported for the given `id`.
1197    /// * BAD_STATE: The driver is in a bad state, for instance it does not have an
1198    ///   `expiration_keep_alive` token to provide to the client.
1199    /// * INTERNAL_ERROR: The driver encountered an internal error.
1200    StartAndWait2 {
1201        id: u64,
1202        resolution: Resolution,
1203        ticks: u64,
1204        setup_keep_alive: fidl::EventPair,
1205        responder: DeviceStartAndWait2Responder,
1206    },
1207    /// Get driver properties.
1208    GetProperties { responder: DeviceGetPropertiesResponder },
1209    /// An interaction was received which does not match any known method.
1210    #[non_exhaustive]
1211    _UnknownMethod {
1212        /// Ordinal of the method that was called.
1213        ordinal: u64,
1214        control_handle: DeviceControlHandle,
1215        method_type: fidl::MethodType,
1216    },
1217}
1218
1219impl DeviceRequest {
1220    #[allow(irrefutable_let_patterns)]
1221    pub fn into_start(self) -> Option<(u64, Resolution, u64, DeviceStartResponder)> {
1222        if let DeviceRequest::Start { id, resolution, ticks, responder } = self {
1223            Some((id, resolution, ticks, responder))
1224        } else {
1225            None
1226        }
1227    }
1228
1229    #[allow(irrefutable_let_patterns)]
1230    pub fn into_stop(self) -> Option<(u64, DeviceStopResponder)> {
1231        if let DeviceRequest::Stop { id, responder } = self {
1232            Some((id, responder))
1233        } else {
1234            None
1235        }
1236    }
1237
1238    #[allow(irrefutable_let_patterns)]
1239    pub fn into_get_ticks_left(self) -> Option<(u64, DeviceGetTicksLeftResponder)> {
1240        if let DeviceRequest::GetTicksLeft { id, responder } = self {
1241            Some((id, responder))
1242        } else {
1243            None
1244        }
1245    }
1246
1247    #[allow(irrefutable_let_patterns)]
1248    pub fn into_set_event(self) -> Option<(u64, fidl::Event, DeviceSetEventResponder)> {
1249        if let DeviceRequest::SetEvent { id, event, responder } = self {
1250            Some((id, event, responder))
1251        } else {
1252            None
1253        }
1254    }
1255
1256    #[allow(irrefutable_let_patterns)]
1257    pub fn into_start_and_wait(
1258        self,
1259    ) -> Option<(u64, Resolution, u64, fidl::Event, DeviceStartAndWaitResponder)> {
1260        if let DeviceRequest::StartAndWait { id, resolution, ticks, setup_event, responder } = self
1261        {
1262            Some((id, resolution, ticks, setup_event, responder))
1263        } else {
1264            None
1265        }
1266    }
1267
1268    #[allow(irrefutable_let_patterns)]
1269    pub fn into_start_and_wait2(
1270        self,
1271    ) -> Option<(u64, Resolution, u64, fidl::EventPair, DeviceStartAndWait2Responder)> {
1272        if let DeviceRequest::StartAndWait2 { id, resolution, ticks, setup_keep_alive, responder } =
1273            self
1274        {
1275            Some((id, resolution, ticks, setup_keep_alive, responder))
1276        } else {
1277            None
1278        }
1279    }
1280
1281    #[allow(irrefutable_let_patterns)]
1282    pub fn into_get_properties(self) -> Option<(DeviceGetPropertiesResponder)> {
1283        if let DeviceRequest::GetProperties { responder } = self {
1284            Some((responder))
1285        } else {
1286            None
1287        }
1288    }
1289
1290    /// Name of the method defined in FIDL
1291    pub fn method_name(&self) -> &'static str {
1292        match *self {
1293            DeviceRequest::Start { .. } => "start",
1294            DeviceRequest::Stop { .. } => "stop",
1295            DeviceRequest::GetTicksLeft { .. } => "get_ticks_left",
1296            DeviceRequest::SetEvent { .. } => "set_event",
1297            DeviceRequest::StartAndWait { .. } => "start_and_wait",
1298            DeviceRequest::StartAndWait2 { .. } => "start_and_wait2",
1299            DeviceRequest::GetProperties { .. } => "get_properties",
1300            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1301                "unknown one-way method"
1302            }
1303            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1304                "unknown two-way method"
1305            }
1306        }
1307    }
1308}
1309
1310#[derive(Debug, Clone)]
1311pub struct DeviceControlHandle {
1312    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1313}
1314
1315impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1316    fn shutdown(&self) {
1317        self.inner.shutdown()
1318    }
1319    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1320        self.inner.shutdown_with_epitaph(status)
1321    }
1322
1323    fn is_closed(&self) -> bool {
1324        self.inner.channel().is_closed()
1325    }
1326    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1327        self.inner.channel().on_closed()
1328    }
1329
1330    #[cfg(target_os = "fuchsia")]
1331    fn signal_peer(
1332        &self,
1333        clear_mask: zx::Signals,
1334        set_mask: zx::Signals,
1335    ) -> Result<(), zx_status::Status> {
1336        use fidl::Peered;
1337        self.inner.channel().signal_peer(clear_mask, set_mask)
1338    }
1339}
1340
1341impl DeviceControlHandle {}
1342
1343#[must_use = "FIDL methods require a response to be sent"]
1344#[derive(Debug)]
1345pub struct DeviceStartResponder {
1346    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1347    tx_id: u32,
1348}
1349
1350/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1351/// if the responder is dropped without sending a response, so that the client
1352/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1353impl std::ops::Drop for DeviceStartResponder {
1354    fn drop(&mut self) {
1355        self.control_handle.shutdown();
1356        // Safety: drops once, never accessed again
1357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358    }
1359}
1360
1361impl fidl::endpoints::Responder for DeviceStartResponder {
1362    type ControlHandle = DeviceControlHandle;
1363
1364    fn control_handle(&self) -> &DeviceControlHandle {
1365        &self.control_handle
1366    }
1367
1368    fn drop_without_shutdown(mut self) {
1369        // Safety: drops once, never accessed again due to mem::forget
1370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371        // Prevent Drop from running (which would shut down the channel)
1372        std::mem::forget(self);
1373    }
1374}
1375
1376impl DeviceStartResponder {
1377    /// Sends a response to the FIDL transaction.
1378    ///
1379    /// Sets the channel to shutdown if an error occurs.
1380    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1381        let _result = self.send_raw(result);
1382        if _result.is_err() {
1383            self.control_handle.shutdown();
1384        }
1385        self.drop_without_shutdown();
1386        _result
1387    }
1388
1389    /// Similar to "send" but does not shutdown the channel if an error occurs.
1390    pub fn send_no_shutdown_on_err(
1391        self,
1392        mut result: Result<(), DriverError>,
1393    ) -> Result<(), fidl::Error> {
1394        let _result = self.send_raw(result);
1395        self.drop_without_shutdown();
1396        _result
1397    }
1398
1399    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1400        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1401            fidl::encoding::EmptyStruct,
1402            DriverError,
1403        >>(
1404            fidl::encoding::FlexibleResult::new(result),
1405            self.tx_id,
1406            0x5a0a193b0467cc8a,
1407            fidl::encoding::DynamicFlags::FLEXIBLE,
1408        )
1409    }
1410}
1411
1412#[must_use = "FIDL methods require a response to be sent"]
1413#[derive(Debug)]
1414pub struct DeviceStopResponder {
1415    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1416    tx_id: u32,
1417}
1418
1419/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1420/// if the responder is dropped without sending a response, so that the client
1421/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1422impl std::ops::Drop for DeviceStopResponder {
1423    fn drop(&mut self) {
1424        self.control_handle.shutdown();
1425        // Safety: drops once, never accessed again
1426        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1427    }
1428}
1429
1430impl fidl::endpoints::Responder for DeviceStopResponder {
1431    type ControlHandle = DeviceControlHandle;
1432
1433    fn control_handle(&self) -> &DeviceControlHandle {
1434        &self.control_handle
1435    }
1436
1437    fn drop_without_shutdown(mut self) {
1438        // Safety: drops once, never accessed again due to mem::forget
1439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1440        // Prevent Drop from running (which would shut down the channel)
1441        std::mem::forget(self);
1442    }
1443}
1444
1445impl DeviceStopResponder {
1446    /// Sends a response to the FIDL transaction.
1447    ///
1448    /// Sets the channel to shutdown if an error occurs.
1449    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1450        let _result = self.send_raw(result);
1451        if _result.is_err() {
1452            self.control_handle.shutdown();
1453        }
1454        self.drop_without_shutdown();
1455        _result
1456    }
1457
1458    /// Similar to "send" but does not shutdown the channel if an error occurs.
1459    pub fn send_no_shutdown_on_err(
1460        self,
1461        mut result: Result<(), DriverError>,
1462    ) -> Result<(), fidl::Error> {
1463        let _result = self.send_raw(result);
1464        self.drop_without_shutdown();
1465        _result
1466    }
1467
1468    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1469        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1470            fidl::encoding::EmptyStruct,
1471            DriverError,
1472        >>(
1473            fidl::encoding::FlexibleResult::new(result),
1474            self.tx_id,
1475            0x77e4cd1c3841a0e2,
1476            fidl::encoding::DynamicFlags::FLEXIBLE,
1477        )
1478    }
1479}
1480
1481#[must_use = "FIDL methods require a response to be sent"]
1482#[derive(Debug)]
1483pub struct DeviceGetTicksLeftResponder {
1484    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1485    tx_id: u32,
1486}
1487
1488/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1489/// if the responder is dropped without sending a response, so that the client
1490/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1491impl std::ops::Drop for DeviceGetTicksLeftResponder {
1492    fn drop(&mut self) {
1493        self.control_handle.shutdown();
1494        // Safety: drops once, never accessed again
1495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1496    }
1497}
1498
1499impl fidl::endpoints::Responder for DeviceGetTicksLeftResponder {
1500    type ControlHandle = DeviceControlHandle;
1501
1502    fn control_handle(&self) -> &DeviceControlHandle {
1503        &self.control_handle
1504    }
1505
1506    fn drop_without_shutdown(mut self) {
1507        // Safety: drops once, never accessed again due to mem::forget
1508        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1509        // Prevent Drop from running (which would shut down the channel)
1510        std::mem::forget(self);
1511    }
1512}
1513
1514impl DeviceGetTicksLeftResponder {
1515    /// Sends a response to the FIDL transaction.
1516    ///
1517    /// Sets the channel to shutdown if an error occurs.
1518    pub fn send(self, mut result: Result<u64, DriverError>) -> Result<(), fidl::Error> {
1519        let _result = self.send_raw(result);
1520        if _result.is_err() {
1521            self.control_handle.shutdown();
1522        }
1523        self.drop_without_shutdown();
1524        _result
1525    }
1526
1527    /// Similar to "send" but does not shutdown the channel if an error occurs.
1528    pub fn send_no_shutdown_on_err(
1529        self,
1530        mut result: Result<u64, DriverError>,
1531    ) -> Result<(), fidl::Error> {
1532        let _result = self.send_raw(result);
1533        self.drop_without_shutdown();
1534        _result
1535    }
1536
1537    fn send_raw(&self, mut result: Result<u64, DriverError>) -> Result<(), fidl::Error> {
1538        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1539            DeviceGetTicksLeftResponse,
1540            DriverError,
1541        >>(
1542            fidl::encoding::FlexibleResult::new(result.map(|ticks| (ticks,))),
1543            self.tx_id,
1544            0xde2a48ae7d4b4ea,
1545            fidl::encoding::DynamicFlags::FLEXIBLE,
1546        )
1547    }
1548}
1549
1550#[must_use = "FIDL methods require a response to be sent"]
1551#[derive(Debug)]
1552pub struct DeviceSetEventResponder {
1553    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1554    tx_id: u32,
1555}
1556
1557/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1558/// if the responder is dropped without sending a response, so that the client
1559/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1560impl std::ops::Drop for DeviceSetEventResponder {
1561    fn drop(&mut self) {
1562        self.control_handle.shutdown();
1563        // Safety: drops once, never accessed again
1564        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1565    }
1566}
1567
1568impl fidl::endpoints::Responder for DeviceSetEventResponder {
1569    type ControlHandle = DeviceControlHandle;
1570
1571    fn control_handle(&self) -> &DeviceControlHandle {
1572        &self.control_handle
1573    }
1574
1575    fn drop_without_shutdown(mut self) {
1576        // Safety: drops once, never accessed again due to mem::forget
1577        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1578        // Prevent Drop from running (which would shut down the channel)
1579        std::mem::forget(self);
1580    }
1581}
1582
1583impl DeviceSetEventResponder {
1584    /// Sends a response to the FIDL transaction.
1585    ///
1586    /// Sets the channel to shutdown if an error occurs.
1587    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1588        let _result = self.send_raw(result);
1589        if _result.is_err() {
1590            self.control_handle.shutdown();
1591        }
1592        self.drop_without_shutdown();
1593        _result
1594    }
1595
1596    /// Similar to "send" but does not shutdown the channel if an error occurs.
1597    pub fn send_no_shutdown_on_err(
1598        self,
1599        mut result: Result<(), DriverError>,
1600    ) -> Result<(), fidl::Error> {
1601        let _result = self.send_raw(result);
1602        self.drop_without_shutdown();
1603        _result
1604    }
1605
1606    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
1607        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1608            fidl::encoding::EmptyStruct,
1609            DriverError,
1610        >>(
1611            fidl::encoding::FlexibleResult::new(result),
1612            self.tx_id,
1613            0x1027024d25ffa820,
1614            fidl::encoding::DynamicFlags::FLEXIBLE,
1615        )
1616    }
1617}
1618
1619#[must_use = "FIDL methods require a response to be sent"]
1620#[derive(Debug)]
1621pub struct DeviceStartAndWaitResponder {
1622    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1623    tx_id: u32,
1624}
1625
1626/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1627/// if the responder is dropped without sending a response, so that the client
1628/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1629impl std::ops::Drop for DeviceStartAndWaitResponder {
1630    fn drop(&mut self) {
1631        self.control_handle.shutdown();
1632        // Safety: drops once, never accessed again
1633        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634    }
1635}
1636
1637impl fidl::endpoints::Responder for DeviceStartAndWaitResponder {
1638    type ControlHandle = DeviceControlHandle;
1639
1640    fn control_handle(&self) -> &DeviceControlHandle {
1641        &self.control_handle
1642    }
1643
1644    fn drop_without_shutdown(mut self) {
1645        // Safety: drops once, never accessed again due to mem::forget
1646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1647        // Prevent Drop from running (which would shut down the channel)
1648        std::mem::forget(self);
1649    }
1650}
1651
1652impl DeviceStartAndWaitResponder {
1653    /// Sends a response to the FIDL transaction.
1654    ///
1655    /// Sets the channel to shutdown if an error occurs.
1656    pub fn send(self, mut result: Result<fidl::EventPair, DriverError>) -> Result<(), fidl::Error> {
1657        let _result = self.send_raw(result);
1658        if _result.is_err() {
1659            self.control_handle.shutdown();
1660        }
1661        self.drop_without_shutdown();
1662        _result
1663    }
1664
1665    /// Similar to "send" but does not shutdown the channel if an error occurs.
1666    pub fn send_no_shutdown_on_err(
1667        self,
1668        mut result: Result<fidl::EventPair, DriverError>,
1669    ) -> Result<(), fidl::Error> {
1670        let _result = self.send_raw(result);
1671        self.drop_without_shutdown();
1672        _result
1673    }
1674
1675    fn send_raw(
1676        &self,
1677        mut result: Result<fidl::EventPair, DriverError>,
1678    ) -> Result<(), fidl::Error> {
1679        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1680            DeviceStartAndWaitResponse,
1681            DriverError,
1682        >>(
1683            fidl::encoding::FlexibleResult::new(result.map(|keep_alive| (keep_alive,))),
1684            self.tx_id,
1685            0x716f415cdf234e0f,
1686            fidl::encoding::DynamicFlags::FLEXIBLE,
1687        )
1688    }
1689}
1690
1691#[must_use = "FIDL methods require a response to be sent"]
1692#[derive(Debug)]
1693pub struct DeviceStartAndWait2Responder {
1694    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1695    tx_id: u32,
1696}
1697
1698/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1699/// if the responder is dropped without sending a response, so that the client
1700/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1701impl std::ops::Drop for DeviceStartAndWait2Responder {
1702    fn drop(&mut self) {
1703        self.control_handle.shutdown();
1704        // Safety: drops once, never accessed again
1705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1706    }
1707}
1708
1709impl fidl::endpoints::Responder for DeviceStartAndWait2Responder {
1710    type ControlHandle = DeviceControlHandle;
1711
1712    fn control_handle(&self) -> &DeviceControlHandle {
1713        &self.control_handle
1714    }
1715
1716    fn drop_without_shutdown(mut self) {
1717        // Safety: drops once, never accessed again due to mem::forget
1718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1719        // Prevent Drop from running (which would shut down the channel)
1720        std::mem::forget(self);
1721    }
1722}
1723
1724impl DeviceStartAndWait2Responder {
1725    /// Sends a response to the FIDL transaction.
1726    ///
1727    /// Sets the channel to shutdown if an error occurs.
1728    pub fn send(self, mut result: Result<fidl::EventPair, DriverError>) -> Result<(), fidl::Error> {
1729        let _result = self.send_raw(result);
1730        if _result.is_err() {
1731            self.control_handle.shutdown();
1732        }
1733        self.drop_without_shutdown();
1734        _result
1735    }
1736
1737    /// Similar to "send" but does not shutdown the channel if an error occurs.
1738    pub fn send_no_shutdown_on_err(
1739        self,
1740        mut result: Result<fidl::EventPair, DriverError>,
1741    ) -> Result<(), fidl::Error> {
1742        let _result = self.send_raw(result);
1743        self.drop_without_shutdown();
1744        _result
1745    }
1746
1747    fn send_raw(
1748        &self,
1749        mut result: Result<fidl::EventPair, DriverError>,
1750    ) -> Result<(), fidl::Error> {
1751        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1752            DeviceStartAndWait2Response,
1753            DriverError,
1754        >>(
1755            fidl::encoding::FlexibleResult::new(
1756                result.map(|expiration_keep_alive| (expiration_keep_alive,)),
1757            ),
1758            self.tx_id,
1759            0x5f2aaf21254d3238,
1760            fidl::encoding::DynamicFlags::FLEXIBLE,
1761        )
1762    }
1763}
1764
1765#[must_use = "FIDL methods require a response to be sent"]
1766#[derive(Debug)]
1767pub struct DeviceGetPropertiesResponder {
1768    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1769    tx_id: u32,
1770}
1771
1772/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1773/// if the responder is dropped without sending a response, so that the client
1774/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1775impl std::ops::Drop for DeviceGetPropertiesResponder {
1776    fn drop(&mut self) {
1777        self.control_handle.shutdown();
1778        // Safety: drops once, never accessed again
1779        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1780    }
1781}
1782
1783impl fidl::endpoints::Responder for DeviceGetPropertiesResponder {
1784    type ControlHandle = DeviceControlHandle;
1785
1786    fn control_handle(&self) -> &DeviceControlHandle {
1787        &self.control_handle
1788    }
1789
1790    fn drop_without_shutdown(mut self) {
1791        // Safety: drops once, never accessed again due to mem::forget
1792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1793        // Prevent Drop from running (which would shut down the channel)
1794        std::mem::forget(self);
1795    }
1796}
1797
1798impl DeviceGetPropertiesResponder {
1799    /// Sends a response to the FIDL transaction.
1800    ///
1801    /// Sets the channel to shutdown if an error occurs.
1802    pub fn send(self, mut properties: Properties) -> Result<(), fidl::Error> {
1803        let _result = self.send_raw(properties);
1804        if _result.is_err() {
1805            self.control_handle.shutdown();
1806        }
1807        self.drop_without_shutdown();
1808        _result
1809    }
1810
1811    /// Similar to "send" but does not shutdown the channel if an error occurs.
1812    pub fn send_no_shutdown_on_err(self, mut properties: Properties) -> Result<(), fidl::Error> {
1813        let _result = self.send_raw(properties);
1814        self.drop_without_shutdown();
1815        _result
1816    }
1817
1818    fn send_raw(&self, mut properties: Properties) -> Result<(), fidl::Error> {
1819        self.control_handle.inner.send::<fidl::encoding::FlexibleType<DeviceGetPropertiesResponse>>(
1820            fidl::encoding::Flexible::new((&mut properties,)),
1821            self.tx_id,
1822            0x6bc22ab4c9396cbb,
1823            fidl::encoding::DynamicFlags::FLEXIBLE,
1824        )
1825    }
1826}
1827
1828#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1829pub struct ServiceMarker;
1830
1831#[cfg(target_os = "fuchsia")]
1832impl fidl::endpoints::ServiceMarker for ServiceMarker {
1833    type Proxy = ServiceProxy;
1834    type Request = ServiceRequest;
1835    const SERVICE_NAME: &'static str = "fuchsia.hardware.hrtimer.Service";
1836}
1837
1838/// A request for one of the member protocols of Service.
1839///
1840#[cfg(target_os = "fuchsia")]
1841pub enum ServiceRequest {
1842    Device(DeviceRequestStream),
1843}
1844
1845#[cfg(target_os = "fuchsia")]
1846impl fidl::endpoints::ServiceRequest for ServiceRequest {
1847    type Service = ServiceMarker;
1848
1849    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1850        match name {
1851            "device" => Self::Device(
1852                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1853            ),
1854            _ => panic!("no such member protocol name for service Service"),
1855        }
1856    }
1857
1858    fn member_names() -> &'static [&'static str] {
1859        &["device"]
1860    }
1861}
1862#[cfg(target_os = "fuchsia")]
1863pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1864
1865#[cfg(target_os = "fuchsia")]
1866impl fidl::endpoints::ServiceProxy for ServiceProxy {
1867    type Service = ServiceMarker;
1868
1869    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1870        Self(opener)
1871    }
1872}
1873
1874#[cfg(target_os = "fuchsia")]
1875impl ServiceProxy {
1876    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1877        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1878        self.connect_channel_to_device(server_end)?;
1879        Ok(proxy)
1880    }
1881
1882    /// Like `connect_to_device`, but returns a sync proxy.
1883    /// See [`Self::connect_to_device`] for more details.
1884    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1885        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1886        self.connect_channel_to_device(server_end)?;
1887        Ok(proxy)
1888    }
1889
1890    /// Like `connect_to_device`, but accepts a server end.
1891    /// See [`Self::connect_to_device`] for more details.
1892    pub fn connect_channel_to_device(
1893        &self,
1894        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1895    ) -> Result<(), fidl::Error> {
1896        self.0.open_member("device", server_end.into_channel())
1897    }
1898
1899    pub fn instance_name(&self) -> &str {
1900        self.0.instance_name()
1901    }
1902}
1903
1904mod internal {
1905    use super::*;
1906
1907    impl fidl::encoding::ResourceTypeMarker for DeviceSetEventRequest {
1908        type Borrowed<'a> = &'a mut Self;
1909        fn take_or_borrow<'a>(
1910            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1911        ) -> Self::Borrowed<'a> {
1912            value
1913        }
1914    }
1915
1916    unsafe impl fidl::encoding::TypeMarker for DeviceSetEventRequest {
1917        type Owned = Self;
1918
1919        #[inline(always)]
1920        fn inline_align(_context: fidl::encoding::Context) -> usize {
1921            8
1922        }
1923
1924        #[inline(always)]
1925        fn inline_size(_context: fidl::encoding::Context) -> usize {
1926            16
1927        }
1928    }
1929
1930    unsafe impl
1931        fidl::encoding::Encode<DeviceSetEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1932        for &mut DeviceSetEventRequest
1933    {
1934        #[inline]
1935        unsafe fn encode(
1936            self,
1937            encoder: &mut fidl::encoding::Encoder<
1938                '_,
1939                fidl::encoding::DefaultFuchsiaResourceDialect,
1940            >,
1941            offset: usize,
1942            _depth: fidl::encoding::Depth,
1943        ) -> fidl::Result<()> {
1944            encoder.debug_check_bounds::<DeviceSetEventRequest>(offset);
1945            // Delegate to tuple encoding.
1946            fidl::encoding::Encode::<
1947                DeviceSetEventRequest,
1948                fidl::encoding::DefaultFuchsiaResourceDialect,
1949            >::encode(
1950                (
1951                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1952                    <fidl::encoding::HandleType<
1953                        fidl::Event,
1954                        { fidl::ObjectType::EVENT.into_raw() },
1955                        2147483648,
1956                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1957                        &mut self.event
1958                    ),
1959                ),
1960                encoder,
1961                offset,
1962                _depth,
1963            )
1964        }
1965    }
1966    unsafe impl<
1967            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1968            T1: fidl::encoding::Encode<
1969                fidl::encoding::HandleType<
1970                    fidl::Event,
1971                    { fidl::ObjectType::EVENT.into_raw() },
1972                    2147483648,
1973                >,
1974                fidl::encoding::DefaultFuchsiaResourceDialect,
1975            >,
1976        >
1977        fidl::encoding::Encode<DeviceSetEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1978        for (T0, T1)
1979    {
1980        #[inline]
1981        unsafe fn encode(
1982            self,
1983            encoder: &mut fidl::encoding::Encoder<
1984                '_,
1985                fidl::encoding::DefaultFuchsiaResourceDialect,
1986            >,
1987            offset: usize,
1988            depth: fidl::encoding::Depth,
1989        ) -> fidl::Result<()> {
1990            encoder.debug_check_bounds::<DeviceSetEventRequest>(offset);
1991            // Zero out padding regions. There's no need to apply masks
1992            // because the unmasked parts will be overwritten by fields.
1993            unsafe {
1994                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1995                (ptr as *mut u64).write_unaligned(0);
1996            }
1997            // Write the fields.
1998            self.0.encode(encoder, offset + 0, depth)?;
1999            self.1.encode(encoder, offset + 8, depth)?;
2000            Ok(())
2001        }
2002    }
2003
2004    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2005        for DeviceSetEventRequest
2006    {
2007        #[inline(always)]
2008        fn new_empty() -> Self {
2009            Self {
2010                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2011                event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2012            }
2013        }
2014
2015        #[inline]
2016        unsafe fn decode(
2017            &mut self,
2018            decoder: &mut fidl::encoding::Decoder<
2019                '_,
2020                fidl::encoding::DefaultFuchsiaResourceDialect,
2021            >,
2022            offset: usize,
2023            _depth: fidl::encoding::Depth,
2024        ) -> fidl::Result<()> {
2025            decoder.debug_check_bounds::<Self>(offset);
2026            // Verify that padding bytes are zero.
2027            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2028            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2029            let mask = 0xffffffff00000000u64;
2030            let maskedval = padval & mask;
2031            if maskedval != 0 {
2032                return Err(fidl::Error::NonZeroPadding {
2033                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2034                });
2035            }
2036            fidl::decode!(
2037                u64,
2038                fidl::encoding::DefaultFuchsiaResourceDialect,
2039                &mut self.id,
2040                decoder,
2041                offset + 0,
2042                _depth
2043            )?;
2044            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 8, _depth)?;
2045            Ok(())
2046        }
2047    }
2048
2049    impl fidl::encoding::ResourceTypeMarker for DeviceStartAndWait2Request {
2050        type Borrowed<'a> = &'a mut Self;
2051        fn take_or_borrow<'a>(
2052            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2053        ) -> Self::Borrowed<'a> {
2054            value
2055        }
2056    }
2057
2058    unsafe impl fidl::encoding::TypeMarker for DeviceStartAndWait2Request {
2059        type Owned = Self;
2060
2061        #[inline(always)]
2062        fn inline_align(_context: fidl::encoding::Context) -> usize {
2063            8
2064        }
2065
2066        #[inline(always)]
2067        fn inline_size(_context: fidl::encoding::Context) -> usize {
2068            40
2069        }
2070    }
2071
2072    unsafe impl
2073        fidl::encoding::Encode<
2074            DeviceStartAndWait2Request,
2075            fidl::encoding::DefaultFuchsiaResourceDialect,
2076        > for &mut DeviceStartAndWait2Request
2077    {
2078        #[inline]
2079        unsafe fn encode(
2080            self,
2081            encoder: &mut fidl::encoding::Encoder<
2082                '_,
2083                fidl::encoding::DefaultFuchsiaResourceDialect,
2084            >,
2085            offset: usize,
2086            _depth: fidl::encoding::Depth,
2087        ) -> fidl::Result<()> {
2088            encoder.debug_check_bounds::<DeviceStartAndWait2Request>(offset);
2089            // Delegate to tuple encoding.
2090            fidl::encoding::Encode::<
2091                DeviceStartAndWait2Request,
2092                fidl::encoding::DefaultFuchsiaResourceDialect,
2093            >::encode(
2094                (
2095                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2096                    <Resolution as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
2097                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ticks),
2098                    <fidl::encoding::HandleType<
2099                        fidl::EventPair,
2100                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2101                        16387,
2102                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2103                        &mut self.setup_keep_alive,
2104                    ),
2105                ),
2106                encoder,
2107                offset,
2108                _depth,
2109            )
2110        }
2111    }
2112    unsafe impl<
2113            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2114            T1: fidl::encoding::Encode<Resolution, fidl::encoding::DefaultFuchsiaResourceDialect>,
2115            T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2116            T3: fidl::encoding::Encode<
2117                fidl::encoding::HandleType<
2118                    fidl::EventPair,
2119                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2120                    16387,
2121                >,
2122                fidl::encoding::DefaultFuchsiaResourceDialect,
2123            >,
2124        >
2125        fidl::encoding::Encode<
2126            DeviceStartAndWait2Request,
2127            fidl::encoding::DefaultFuchsiaResourceDialect,
2128        > for (T0, T1, T2, T3)
2129    {
2130        #[inline]
2131        unsafe fn encode(
2132            self,
2133            encoder: &mut fidl::encoding::Encoder<
2134                '_,
2135                fidl::encoding::DefaultFuchsiaResourceDialect,
2136            >,
2137            offset: usize,
2138            depth: fidl::encoding::Depth,
2139        ) -> fidl::Result<()> {
2140            encoder.debug_check_bounds::<DeviceStartAndWait2Request>(offset);
2141            // Zero out padding regions. There's no need to apply masks
2142            // because the unmasked parts will be overwritten by fields.
2143            unsafe {
2144                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2145                (ptr as *mut u64).write_unaligned(0);
2146            }
2147            // Write the fields.
2148            self.0.encode(encoder, offset + 0, depth)?;
2149            self.1.encode(encoder, offset + 8, depth)?;
2150            self.2.encode(encoder, offset + 24, depth)?;
2151            self.3.encode(encoder, offset + 32, depth)?;
2152            Ok(())
2153        }
2154    }
2155
2156    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2157        for DeviceStartAndWait2Request
2158    {
2159        #[inline(always)]
2160        fn new_empty() -> Self {
2161            Self {
2162                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2163                resolution: fidl::new_empty!(
2164                    Resolution,
2165                    fidl::encoding::DefaultFuchsiaResourceDialect
2166                ),
2167                ticks: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2168                setup_keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2169            }
2170        }
2171
2172        #[inline]
2173        unsafe fn decode(
2174            &mut self,
2175            decoder: &mut fidl::encoding::Decoder<
2176                '_,
2177                fidl::encoding::DefaultFuchsiaResourceDialect,
2178            >,
2179            offset: usize,
2180            _depth: fidl::encoding::Depth,
2181        ) -> fidl::Result<()> {
2182            decoder.debug_check_bounds::<Self>(offset);
2183            // Verify that padding bytes are zero.
2184            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2185            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2186            let mask = 0xffffffff00000000u64;
2187            let maskedval = padval & mask;
2188            if maskedval != 0 {
2189                return Err(fidl::Error::NonZeroPadding {
2190                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2191                });
2192            }
2193            fidl::decode!(
2194                u64,
2195                fidl::encoding::DefaultFuchsiaResourceDialect,
2196                &mut self.id,
2197                decoder,
2198                offset + 0,
2199                _depth
2200            )?;
2201            fidl::decode!(
2202                Resolution,
2203                fidl::encoding::DefaultFuchsiaResourceDialect,
2204                &mut self.resolution,
2205                decoder,
2206                offset + 8,
2207                _depth
2208            )?;
2209            fidl::decode!(
2210                u64,
2211                fidl::encoding::DefaultFuchsiaResourceDialect,
2212                &mut self.ticks,
2213                decoder,
2214                offset + 24,
2215                _depth
2216            )?;
2217            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.setup_keep_alive, decoder, offset + 32, _depth)?;
2218            Ok(())
2219        }
2220    }
2221
2222    impl fidl::encoding::ResourceTypeMarker for DeviceStartAndWaitRequest {
2223        type Borrowed<'a> = &'a mut Self;
2224        fn take_or_borrow<'a>(
2225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2226        ) -> Self::Borrowed<'a> {
2227            value
2228        }
2229    }
2230
2231    unsafe impl fidl::encoding::TypeMarker for DeviceStartAndWaitRequest {
2232        type Owned = Self;
2233
2234        #[inline(always)]
2235        fn inline_align(_context: fidl::encoding::Context) -> usize {
2236            8
2237        }
2238
2239        #[inline(always)]
2240        fn inline_size(_context: fidl::encoding::Context) -> usize {
2241            40
2242        }
2243    }
2244
2245    unsafe impl
2246        fidl::encoding::Encode<
2247            DeviceStartAndWaitRequest,
2248            fidl::encoding::DefaultFuchsiaResourceDialect,
2249        > for &mut DeviceStartAndWaitRequest
2250    {
2251        #[inline]
2252        unsafe fn encode(
2253            self,
2254            encoder: &mut fidl::encoding::Encoder<
2255                '_,
2256                fidl::encoding::DefaultFuchsiaResourceDialect,
2257            >,
2258            offset: usize,
2259            _depth: fidl::encoding::Depth,
2260        ) -> fidl::Result<()> {
2261            encoder.debug_check_bounds::<DeviceStartAndWaitRequest>(offset);
2262            // Delegate to tuple encoding.
2263            fidl::encoding::Encode::<
2264                DeviceStartAndWaitRequest,
2265                fidl::encoding::DefaultFuchsiaResourceDialect,
2266            >::encode(
2267                (
2268                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2269                    <Resolution as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
2270                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ticks),
2271                    <fidl::encoding::HandleType<
2272                        fidl::Event,
2273                        { fidl::ObjectType::EVENT.into_raw() },
2274                        2147483648,
2275                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2276                        &mut self.setup_event
2277                    ),
2278                ),
2279                encoder,
2280                offset,
2281                _depth,
2282            )
2283        }
2284    }
2285    unsafe impl<
2286            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2287            T1: fidl::encoding::Encode<Resolution, fidl::encoding::DefaultFuchsiaResourceDialect>,
2288            T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2289            T3: fidl::encoding::Encode<
2290                fidl::encoding::HandleType<
2291                    fidl::Event,
2292                    { fidl::ObjectType::EVENT.into_raw() },
2293                    2147483648,
2294                >,
2295                fidl::encoding::DefaultFuchsiaResourceDialect,
2296            >,
2297        >
2298        fidl::encoding::Encode<
2299            DeviceStartAndWaitRequest,
2300            fidl::encoding::DefaultFuchsiaResourceDialect,
2301        > for (T0, T1, T2, T3)
2302    {
2303        #[inline]
2304        unsafe fn encode(
2305            self,
2306            encoder: &mut fidl::encoding::Encoder<
2307                '_,
2308                fidl::encoding::DefaultFuchsiaResourceDialect,
2309            >,
2310            offset: usize,
2311            depth: fidl::encoding::Depth,
2312        ) -> fidl::Result<()> {
2313            encoder.debug_check_bounds::<DeviceStartAndWaitRequest>(offset);
2314            // Zero out padding regions. There's no need to apply masks
2315            // because the unmasked parts will be overwritten by fields.
2316            unsafe {
2317                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2318                (ptr as *mut u64).write_unaligned(0);
2319            }
2320            // Write the fields.
2321            self.0.encode(encoder, offset + 0, depth)?;
2322            self.1.encode(encoder, offset + 8, depth)?;
2323            self.2.encode(encoder, offset + 24, depth)?;
2324            self.3.encode(encoder, offset + 32, depth)?;
2325            Ok(())
2326        }
2327    }
2328
2329    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2330        for DeviceStartAndWaitRequest
2331    {
2332        #[inline(always)]
2333        fn new_empty() -> Self {
2334            Self {
2335                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2336                resolution: fidl::new_empty!(
2337                    Resolution,
2338                    fidl::encoding::DefaultFuchsiaResourceDialect
2339                ),
2340                ticks: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2341                setup_event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2342            }
2343        }
2344
2345        #[inline]
2346        unsafe fn decode(
2347            &mut self,
2348            decoder: &mut fidl::encoding::Decoder<
2349                '_,
2350                fidl::encoding::DefaultFuchsiaResourceDialect,
2351            >,
2352            offset: usize,
2353            _depth: fidl::encoding::Depth,
2354        ) -> fidl::Result<()> {
2355            decoder.debug_check_bounds::<Self>(offset);
2356            // Verify that padding bytes are zero.
2357            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2358            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2359            let mask = 0xffffffff00000000u64;
2360            let maskedval = padval & mask;
2361            if maskedval != 0 {
2362                return Err(fidl::Error::NonZeroPadding {
2363                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2364                });
2365            }
2366            fidl::decode!(
2367                u64,
2368                fidl::encoding::DefaultFuchsiaResourceDialect,
2369                &mut self.id,
2370                decoder,
2371                offset + 0,
2372                _depth
2373            )?;
2374            fidl::decode!(
2375                Resolution,
2376                fidl::encoding::DefaultFuchsiaResourceDialect,
2377                &mut self.resolution,
2378                decoder,
2379                offset + 8,
2380                _depth
2381            )?;
2382            fidl::decode!(
2383                u64,
2384                fidl::encoding::DefaultFuchsiaResourceDialect,
2385                &mut self.ticks,
2386                decoder,
2387                offset + 24,
2388                _depth
2389            )?;
2390            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.setup_event, decoder, offset + 32, _depth)?;
2391            Ok(())
2392        }
2393    }
2394
2395    impl fidl::encoding::ResourceTypeMarker for DeviceGetPropertiesResponse {
2396        type Borrowed<'a> = &'a mut Self;
2397        fn take_or_borrow<'a>(
2398            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2399        ) -> Self::Borrowed<'a> {
2400            value
2401        }
2402    }
2403
2404    unsafe impl fidl::encoding::TypeMarker for DeviceGetPropertiesResponse {
2405        type Owned = Self;
2406
2407        #[inline(always)]
2408        fn inline_align(_context: fidl::encoding::Context) -> usize {
2409            8
2410        }
2411
2412        #[inline(always)]
2413        fn inline_size(_context: fidl::encoding::Context) -> usize {
2414            16
2415        }
2416    }
2417
2418    unsafe impl
2419        fidl::encoding::Encode<
2420            DeviceGetPropertiesResponse,
2421            fidl::encoding::DefaultFuchsiaResourceDialect,
2422        > for &mut DeviceGetPropertiesResponse
2423    {
2424        #[inline]
2425        unsafe fn encode(
2426            self,
2427            encoder: &mut fidl::encoding::Encoder<
2428                '_,
2429                fidl::encoding::DefaultFuchsiaResourceDialect,
2430            >,
2431            offset: usize,
2432            _depth: fidl::encoding::Depth,
2433        ) -> fidl::Result<()> {
2434            encoder.debug_check_bounds::<DeviceGetPropertiesResponse>(offset);
2435            // Delegate to tuple encoding.
2436            fidl::encoding::Encode::<
2437                DeviceGetPropertiesResponse,
2438                fidl::encoding::DefaultFuchsiaResourceDialect,
2439            >::encode(
2440                (<Properties as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2441                    &mut self.properties,
2442                ),),
2443                encoder,
2444                offset,
2445                _depth,
2446            )
2447        }
2448    }
2449    unsafe impl<T0: fidl::encoding::Encode<Properties, fidl::encoding::DefaultFuchsiaResourceDialect>>
2450        fidl::encoding::Encode<
2451            DeviceGetPropertiesResponse,
2452            fidl::encoding::DefaultFuchsiaResourceDialect,
2453        > for (T0,)
2454    {
2455        #[inline]
2456        unsafe fn encode(
2457            self,
2458            encoder: &mut fidl::encoding::Encoder<
2459                '_,
2460                fidl::encoding::DefaultFuchsiaResourceDialect,
2461            >,
2462            offset: usize,
2463            depth: fidl::encoding::Depth,
2464        ) -> fidl::Result<()> {
2465            encoder.debug_check_bounds::<DeviceGetPropertiesResponse>(offset);
2466            // Zero out padding regions. There's no need to apply masks
2467            // because the unmasked parts will be overwritten by fields.
2468            // Write the fields.
2469            self.0.encode(encoder, offset + 0, depth)?;
2470            Ok(())
2471        }
2472    }
2473
2474    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2475        for DeviceGetPropertiesResponse
2476    {
2477        #[inline(always)]
2478        fn new_empty() -> Self {
2479            Self {
2480                properties: fidl::new_empty!(
2481                    Properties,
2482                    fidl::encoding::DefaultFuchsiaResourceDialect
2483                ),
2484            }
2485        }
2486
2487        #[inline]
2488        unsafe fn decode(
2489            &mut self,
2490            decoder: &mut fidl::encoding::Decoder<
2491                '_,
2492                fidl::encoding::DefaultFuchsiaResourceDialect,
2493            >,
2494            offset: usize,
2495            _depth: fidl::encoding::Depth,
2496        ) -> fidl::Result<()> {
2497            decoder.debug_check_bounds::<Self>(offset);
2498            // Verify that padding bytes are zero.
2499            fidl::decode!(
2500                Properties,
2501                fidl::encoding::DefaultFuchsiaResourceDialect,
2502                &mut self.properties,
2503                decoder,
2504                offset + 0,
2505                _depth
2506            )?;
2507            Ok(())
2508        }
2509    }
2510
2511    impl fidl::encoding::ResourceTypeMarker for DeviceStartAndWait2Response {
2512        type Borrowed<'a> = &'a mut Self;
2513        fn take_or_borrow<'a>(
2514            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2515        ) -> Self::Borrowed<'a> {
2516            value
2517        }
2518    }
2519
2520    unsafe impl fidl::encoding::TypeMarker for DeviceStartAndWait2Response {
2521        type Owned = Self;
2522
2523        #[inline(always)]
2524        fn inline_align(_context: fidl::encoding::Context) -> usize {
2525            4
2526        }
2527
2528        #[inline(always)]
2529        fn inline_size(_context: fidl::encoding::Context) -> usize {
2530            4
2531        }
2532    }
2533
2534    unsafe impl
2535        fidl::encoding::Encode<
2536            DeviceStartAndWait2Response,
2537            fidl::encoding::DefaultFuchsiaResourceDialect,
2538        > for &mut DeviceStartAndWait2Response
2539    {
2540        #[inline]
2541        unsafe fn encode(
2542            self,
2543            encoder: &mut fidl::encoding::Encoder<
2544                '_,
2545                fidl::encoding::DefaultFuchsiaResourceDialect,
2546            >,
2547            offset: usize,
2548            _depth: fidl::encoding::Depth,
2549        ) -> fidl::Result<()> {
2550            encoder.debug_check_bounds::<DeviceStartAndWait2Response>(offset);
2551            // Delegate to tuple encoding.
2552            fidl::encoding::Encode::<
2553                DeviceStartAndWait2Response,
2554                fidl::encoding::DefaultFuchsiaResourceDialect,
2555            >::encode(
2556                (<fidl::encoding::HandleType<
2557                    fidl::EventPair,
2558                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2559                    16387,
2560                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2561                    &mut self.expiration_keep_alive,
2562                ),),
2563                encoder,
2564                offset,
2565                _depth,
2566            )
2567        }
2568    }
2569    unsafe impl<
2570            T0: fidl::encoding::Encode<
2571                fidl::encoding::HandleType<
2572                    fidl::EventPair,
2573                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2574                    16387,
2575                >,
2576                fidl::encoding::DefaultFuchsiaResourceDialect,
2577            >,
2578        >
2579        fidl::encoding::Encode<
2580            DeviceStartAndWait2Response,
2581            fidl::encoding::DefaultFuchsiaResourceDialect,
2582        > for (T0,)
2583    {
2584        #[inline]
2585        unsafe fn encode(
2586            self,
2587            encoder: &mut fidl::encoding::Encoder<
2588                '_,
2589                fidl::encoding::DefaultFuchsiaResourceDialect,
2590            >,
2591            offset: usize,
2592            depth: fidl::encoding::Depth,
2593        ) -> fidl::Result<()> {
2594            encoder.debug_check_bounds::<DeviceStartAndWait2Response>(offset);
2595            // Zero out padding regions. There's no need to apply masks
2596            // because the unmasked parts will be overwritten by fields.
2597            // Write the fields.
2598            self.0.encode(encoder, offset + 0, depth)?;
2599            Ok(())
2600        }
2601    }
2602
2603    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2604        for DeviceStartAndWait2Response
2605    {
2606        #[inline(always)]
2607        fn new_empty() -> Self {
2608            Self {
2609                expiration_keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2610            }
2611        }
2612
2613        #[inline]
2614        unsafe fn decode(
2615            &mut self,
2616            decoder: &mut fidl::encoding::Decoder<
2617                '_,
2618                fidl::encoding::DefaultFuchsiaResourceDialect,
2619            >,
2620            offset: usize,
2621            _depth: fidl::encoding::Depth,
2622        ) -> fidl::Result<()> {
2623            decoder.debug_check_bounds::<Self>(offset);
2624            // Verify that padding bytes are zero.
2625            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.expiration_keep_alive, decoder, offset + 0, _depth)?;
2626            Ok(())
2627        }
2628    }
2629
2630    impl fidl::encoding::ResourceTypeMarker for DeviceStartAndWaitResponse {
2631        type Borrowed<'a> = &'a mut Self;
2632        fn take_or_borrow<'a>(
2633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2634        ) -> Self::Borrowed<'a> {
2635            value
2636        }
2637    }
2638
2639    unsafe impl fidl::encoding::TypeMarker for DeviceStartAndWaitResponse {
2640        type Owned = Self;
2641
2642        #[inline(always)]
2643        fn inline_align(_context: fidl::encoding::Context) -> usize {
2644            4
2645        }
2646
2647        #[inline(always)]
2648        fn inline_size(_context: fidl::encoding::Context) -> usize {
2649            4
2650        }
2651    }
2652
2653    unsafe impl
2654        fidl::encoding::Encode<
2655            DeviceStartAndWaitResponse,
2656            fidl::encoding::DefaultFuchsiaResourceDialect,
2657        > for &mut DeviceStartAndWaitResponse
2658    {
2659        #[inline]
2660        unsafe fn encode(
2661            self,
2662            encoder: &mut fidl::encoding::Encoder<
2663                '_,
2664                fidl::encoding::DefaultFuchsiaResourceDialect,
2665            >,
2666            offset: usize,
2667            _depth: fidl::encoding::Depth,
2668        ) -> fidl::Result<()> {
2669            encoder.debug_check_bounds::<DeviceStartAndWaitResponse>(offset);
2670            // Delegate to tuple encoding.
2671            fidl::encoding::Encode::<
2672                DeviceStartAndWaitResponse,
2673                fidl::encoding::DefaultFuchsiaResourceDialect,
2674            >::encode(
2675                (<fidl::encoding::HandleType<
2676                    fidl::EventPair,
2677                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2678                    16387,
2679                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2680                    &mut self.keep_alive
2681                ),),
2682                encoder,
2683                offset,
2684                _depth,
2685            )
2686        }
2687    }
2688    unsafe impl<
2689            T0: fidl::encoding::Encode<
2690                fidl::encoding::HandleType<
2691                    fidl::EventPair,
2692                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2693                    16387,
2694                >,
2695                fidl::encoding::DefaultFuchsiaResourceDialect,
2696            >,
2697        >
2698        fidl::encoding::Encode<
2699            DeviceStartAndWaitResponse,
2700            fidl::encoding::DefaultFuchsiaResourceDialect,
2701        > for (T0,)
2702    {
2703        #[inline]
2704        unsafe fn encode(
2705            self,
2706            encoder: &mut fidl::encoding::Encoder<
2707                '_,
2708                fidl::encoding::DefaultFuchsiaResourceDialect,
2709            >,
2710            offset: usize,
2711            depth: fidl::encoding::Depth,
2712        ) -> fidl::Result<()> {
2713            encoder.debug_check_bounds::<DeviceStartAndWaitResponse>(offset);
2714            // Zero out padding regions. There's no need to apply masks
2715            // because the unmasked parts will be overwritten by fields.
2716            // Write the fields.
2717            self.0.encode(encoder, offset + 0, depth)?;
2718            Ok(())
2719        }
2720    }
2721
2722    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2723        for DeviceStartAndWaitResponse
2724    {
2725        #[inline(always)]
2726        fn new_empty() -> Self {
2727            Self {
2728                keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2729            }
2730        }
2731
2732        #[inline]
2733        unsafe fn decode(
2734            &mut self,
2735            decoder: &mut fidl::encoding::Decoder<
2736                '_,
2737                fidl::encoding::DefaultFuchsiaResourceDialect,
2738            >,
2739            offset: usize,
2740            _depth: fidl::encoding::Depth,
2741        ) -> fidl::Result<()> {
2742            decoder.debug_check_bounds::<Self>(offset);
2743            // Verify that padding bytes are zero.
2744            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 0, _depth)?;
2745            Ok(())
2746        }
2747    }
2748
2749    impl Properties {
2750        #[inline(always)]
2751        fn max_ordinal_present(&self) -> u64 {
2752            if let Some(_) = self.timers_properties {
2753                return 1;
2754            }
2755            0
2756        }
2757    }
2758
2759    impl fidl::encoding::ResourceTypeMarker for Properties {
2760        type Borrowed<'a> = &'a mut Self;
2761        fn take_or_borrow<'a>(
2762            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2763        ) -> Self::Borrowed<'a> {
2764            value
2765        }
2766    }
2767
2768    unsafe impl fidl::encoding::TypeMarker for Properties {
2769        type Owned = Self;
2770
2771        #[inline(always)]
2772        fn inline_align(_context: fidl::encoding::Context) -> usize {
2773            8
2774        }
2775
2776        #[inline(always)]
2777        fn inline_size(_context: fidl::encoding::Context) -> usize {
2778            16
2779        }
2780    }
2781
2782    unsafe impl fidl::encoding::Encode<Properties, fidl::encoding::DefaultFuchsiaResourceDialect>
2783        for &mut Properties
2784    {
2785        unsafe fn encode(
2786            self,
2787            encoder: &mut fidl::encoding::Encoder<
2788                '_,
2789                fidl::encoding::DefaultFuchsiaResourceDialect,
2790            >,
2791            offset: usize,
2792            mut depth: fidl::encoding::Depth,
2793        ) -> fidl::Result<()> {
2794            encoder.debug_check_bounds::<Properties>(offset);
2795            // Vector header
2796            let max_ordinal: u64 = self.max_ordinal_present();
2797            encoder.write_num(max_ordinal, offset);
2798            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2799            // Calling encoder.out_of_line_offset(0) is not allowed.
2800            if max_ordinal == 0 {
2801                return Ok(());
2802            }
2803            depth.increment()?;
2804            let envelope_size = 8;
2805            let bytes_len = max_ordinal as usize * envelope_size;
2806            #[allow(unused_variables)]
2807            let offset = encoder.out_of_line_offset(bytes_len);
2808            let mut _prev_end_offset: usize = 0;
2809            if 1 > max_ordinal {
2810                return Ok(());
2811            }
2812
2813            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2814            // are envelope_size bytes.
2815            let cur_offset: usize = (1 - 1) * envelope_size;
2816
2817            // Zero reserved fields.
2818            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2819
2820            // Safety:
2821            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2822            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2823            //   envelope_size bytes, there is always sufficient room.
2824            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TimerProperties, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2825            self.timers_properties.as_ref().map(<fidl::encoding::Vector<TimerProperties, 64> as fidl::encoding::ValueTypeMarker>::borrow),
2826            encoder, offset + cur_offset, depth
2827        )?;
2828
2829            _prev_end_offset = cur_offset + envelope_size;
2830
2831            Ok(())
2832        }
2833    }
2834
2835    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Properties {
2836        #[inline(always)]
2837        fn new_empty() -> Self {
2838            Self::default()
2839        }
2840
2841        unsafe fn decode(
2842            &mut self,
2843            decoder: &mut fidl::encoding::Decoder<
2844                '_,
2845                fidl::encoding::DefaultFuchsiaResourceDialect,
2846            >,
2847            offset: usize,
2848            mut depth: fidl::encoding::Depth,
2849        ) -> fidl::Result<()> {
2850            decoder.debug_check_bounds::<Self>(offset);
2851            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2852                None => return Err(fidl::Error::NotNullable),
2853                Some(len) => len,
2854            };
2855            // Calling decoder.out_of_line_offset(0) is not allowed.
2856            if len == 0 {
2857                return Ok(());
2858            };
2859            depth.increment()?;
2860            let envelope_size = 8;
2861            let bytes_len = len * envelope_size;
2862            let offset = decoder.out_of_line_offset(bytes_len)?;
2863            // Decode the envelope for each type.
2864            let mut _next_ordinal_to_read = 0;
2865            let mut next_offset = offset;
2866            let end_offset = offset + bytes_len;
2867            _next_ordinal_to_read += 1;
2868            if next_offset >= end_offset {
2869                return Ok(());
2870            }
2871
2872            // Decode unknown envelopes for gaps in ordinals.
2873            while _next_ordinal_to_read < 1 {
2874                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2875                _next_ordinal_to_read += 1;
2876                next_offset += envelope_size;
2877            }
2878
2879            let next_out_of_line = decoder.next_out_of_line();
2880            let handles_before = decoder.remaining_handles();
2881            if let Some((inlined, num_bytes, num_handles)) =
2882                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2883            {
2884                let member_inline_size = <fidl::encoding::Vector<TimerProperties, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2885                if inlined != (member_inline_size <= 4) {
2886                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2887                }
2888                let inner_offset;
2889                let mut inner_depth = depth.clone();
2890                if inlined {
2891                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2892                    inner_offset = next_offset;
2893                } else {
2894                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2895                    inner_depth.increment()?;
2896                }
2897                let val_ref =
2898                self.timers_properties.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<TimerProperties, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
2899                fidl::decode!(fidl::encoding::Vector<TimerProperties, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2900                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2901                {
2902                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2903                }
2904                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2905                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2906                }
2907            }
2908
2909            next_offset += envelope_size;
2910
2911            // Decode the remaining unknown envelopes.
2912            while next_offset < end_offset {
2913                _next_ordinal_to_read += 1;
2914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2915                next_offset += envelope_size;
2916            }
2917
2918            Ok(())
2919        }
2920    }
2921}