Skip to main content

fidl_test_time_realm/
fidl_test_time_realm.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_test_time_realm_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct CreateResponse {
16    /// The push source puppet. It is returned as a client_end because of
17    /// the impedance mismatch between the test realm internals and this FIDL
18    /// API.
19    pub push_source_puppet: fidl::endpoints::ClientEnd<PushSourcePuppetMarker>,
20    pub opts: CreateResponseOpts,
21    /// The cobalt metric querier. Used to collect the metrics information.
22    /// Refer to `fuchsia.metrics.test.MetricEventLoggerQuerier` docs
23    /// for usage details.
24    pub cobalt_metric_client:
25        fidl::endpoints::ClientEnd<fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateResponse {}
29
30#[derive(Debug, PartialEq)]
31pub struct GetResponse {
32    /// List the RTC updates that happened since the last call.
33    ///
34    /// If more than the maximum number of updates happened, an
35    /// error `OperationError.FAILED` will be returned instead.
36    ///
37    /// This behavior *may* be modified if we regularly start encountering
38    /// more than a maximum number of allowed updates.
39    pub updates: Vec<fidl_fuchsia_hardware_rtc::Time>,
40    /// Optionals, added for expansion.
41    pub opts: GetResponseOpts,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetResponse {}
45
46#[derive(Debug, PartialEq)]
47pub struct RealmFactoryCreateRealmRequest {
48    /// The options for creating the Timekeeper realm factory.
49    pub options: RealmOptions,
50    /// The UTC clock handle that Timekeeper will manage.
51    pub fake_utc_clock: fidl::Clock,
52    /// A standardized `RealmProxy`, for connecting to some of the
53    /// exported FIDL protocols in the created test realm.
54    ///
55    /// Use the client counterpart of this server end to request any
56    /// FIDL protocol connection for a protocol served from within the
57    /// created test realm.
58    pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62    for RealmFactoryCreateRealmRequest
63{
64}
65
66#[derive(Debug, Default, PartialEq)]
67pub struct CreateResponseOpts {
68    /// The channel for retrieving the RTC updates. To be be populated
69    /// only if the realm is created with `RealmOptions.rtc.rtc_handle`.
70    pub rtc_updates: Option<fidl::endpoints::ClientEnd<RtcUpdatesMarker>>,
71    #[doc(hidden)]
72    pub __source_breaking: fidl::marker::SourceBreaking,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateResponseOpts {}
76
77#[derive(Debug, Default, PartialEq)]
78pub struct GetRequest {
79    #[doc(hidden)]
80    pub __source_breaking: fidl::marker::SourceBreaking,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetRequest {}
84
85#[derive(Debug, Default, PartialEq)]
86pub struct GetResponseOpts {
87    #[doc(hidden)]
88    pub __source_breaking: fidl::marker::SourceBreaking,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GetResponseOpts {}
92
93#[derive(Debug, Default, PartialEq)]
94pub struct RealmOptions {
95    /// If set, the test realm will us a real reference clock handle (in
96    /// contrast to a fake handle which can be manipulated from the test
97    /// fixture).
98    pub use_real_reference_clock: Option<bool>,
99    /// Sets up the RTC clock.
100    ///
101    /// Use one of the available options:
102    /// 1. Fill in `dev_class_rtc` to inject a test RTC implementation.
103    /// 2. Fill in `initial_rtc_time` to let the test realm create
104    ///    a fake RTC that reports a specific initial reading.
105    /// 3. Do not set `rtc` at all, to let test realm start without
106    ///    *any* RTC.
107    pub rtc: Option<RtcOptions>,
108    #[doc(hidden)]
109    pub __source_breaking: fidl::marker::SourceBreaking,
110}
111
112impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
113
114#[derive(Debug)]
115pub enum RtcOptions {
116    /// The directory handle for `/dev/class/rtc`.
117    ///
118    /// This is the handle that will appear as the directory
119    /// `/dev/class/rtc` in the Timekeeper's namespace.
120    ///
121    /// The caller must set this directory up so that it serves
122    /// a RTC device (e.g. named `/dev/class/rtc/000`, and serving
123    /// the FIDL `fuchsia.hardware.rtc/Device`) from this directory.
124    ///
125    /// It is also possible to serve more RTCs from the directory, or
126    /// other files and file types at the caller's option.
127    ///
128    /// Use this option if you need to implement corner cases, or
129    /// very specific RTC behavior, such as abnormal configuration
130    /// or anomalous behavior.
131    DevClassRtc(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>),
132    /// The initial time that the fake RTC will report.
133    ///
134    /// If set, this will be the RTC time to be used for fake RTC reporting.
135    InitialRtcTime(i64),
136    #[doc(hidden)]
137    __SourceBreaking { unknown_ordinal: u64 },
138}
139
140/// Pattern that matches an unknown `RtcOptions` member.
141#[macro_export]
142macro_rules! RtcOptionsUnknown {
143    () => {
144        _
145    };
146}
147
148// Custom PartialEq so that unknown variants are not equal to themselves.
149impl PartialEq for RtcOptions {
150    fn eq(&self, other: &Self) -> bool {
151        match (self, other) {
152            (Self::DevClassRtc(x), Self::DevClassRtc(y)) => *x == *y,
153            (Self::InitialRtcTime(x), Self::InitialRtcTime(y)) => *x == *y,
154            _ => false,
155        }
156    }
157}
158
159impl RtcOptions {
160    #[inline]
161    pub fn ordinal(&self) -> u64 {
162        match *self {
163            Self::DevClassRtc(_) => 1,
164            Self::InitialRtcTime(_) => 2,
165            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
166        }
167    }
168
169    #[inline]
170    pub fn unknown_variant_for_testing() -> Self {
171        Self::__SourceBreaking { unknown_ordinal: 0 }
172    }
173
174    #[inline]
175    pub fn is_unknown(&self) -> bool {
176        match self {
177            Self::__SourceBreaking { .. } => true,
178            _ => false,
179        }
180    }
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RtcOptions {}
184
185#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
186pub struct PushSourcePuppetMarker;
187
188impl fidl::endpoints::ProtocolMarker for PushSourcePuppetMarker {
189    type Proxy = PushSourcePuppetProxy;
190    type RequestStream = PushSourcePuppetRequestStream;
191    #[cfg(target_os = "fuchsia")]
192    type SynchronousProxy = PushSourcePuppetSynchronousProxy;
193
194    const DEBUG_NAME: &'static str = "(anonymous) PushSourcePuppet";
195}
196
197pub trait PushSourcePuppetProxyInterface: Send + Sync {
198    type SetSampleResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
199    fn r#set_sample(
200        &self,
201        sample: &fidl_fuchsia_time_external::TimeSample,
202    ) -> Self::SetSampleResponseFut;
203    type SetStatusResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
204    fn r#set_status(
205        &self,
206        status: fidl_fuchsia_time_external::Status,
207    ) -> Self::SetStatusResponseFut;
208    type CrashResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
209    fn r#crash(&self) -> Self::CrashResponseFut;
210    type GetLifetimeServedConnectionsResponseFut: std::future::Future<Output = Result<u32, fidl::Error>>
211        + Send;
212    fn r#get_lifetime_served_connections(&self) -> Self::GetLifetimeServedConnectionsResponseFut;
213}
214#[derive(Debug)]
215#[cfg(target_os = "fuchsia")]
216pub struct PushSourcePuppetSynchronousProxy {
217    client: fidl::client::sync::Client,
218}
219
220#[cfg(target_os = "fuchsia")]
221impl fidl::endpoints::SynchronousProxy for PushSourcePuppetSynchronousProxy {
222    type Proxy = PushSourcePuppetProxy;
223    type Protocol = PushSourcePuppetMarker;
224
225    fn from_channel(inner: fidl::Channel) -> Self {
226        Self::new(inner)
227    }
228
229    fn into_channel(self) -> fidl::Channel {
230        self.client.into_channel()
231    }
232
233    fn as_channel(&self) -> &fidl::Channel {
234        self.client.as_channel()
235    }
236}
237
238#[cfg(target_os = "fuchsia")]
239impl PushSourcePuppetSynchronousProxy {
240    pub fn new(channel: fidl::Channel) -> Self {
241        Self { client: fidl::client::sync::Client::new(channel) }
242    }
243
244    pub fn into_channel(self) -> fidl::Channel {
245        self.client.into_channel()
246    }
247
248    /// Waits until an event arrives and returns it. It is safe for other
249    /// threads to make concurrent requests while waiting for an event.
250    pub fn wait_for_event(
251        &self,
252        deadline: zx::MonotonicInstant,
253    ) -> Result<PushSourcePuppetEvent, fidl::Error> {
254        PushSourcePuppetEvent::decode(
255            self.client.wait_for_event::<PushSourcePuppetMarker>(deadline)?,
256        )
257    }
258
259    /// Sets the next sample to be reported by the push source.
260    pub fn r#set_sample(
261        &self,
262        mut sample: &fidl_fuchsia_time_external::TimeSample,
263        ___deadline: zx::MonotonicInstant,
264    ) -> Result<(), fidl::Error> {
265        let _response = self.client.send_query::<
266            SetSampleArgs,
267            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
268            PushSourcePuppetMarker,
269        >(
270            (sample,),
271            0x2819099d8cadf9d6,
272            fidl::encoding::DynamicFlags::FLEXIBLE,
273            ___deadline,
274        )?
275        .into_result::<PushSourcePuppetMarker>("set_sample")?;
276        Ok(_response)
277    }
278
279    /// Sets the next status to be reported by the push source.
280    pub fn r#set_status(
281        &self,
282        mut status: fidl_fuchsia_time_external::Status,
283        ___deadline: zx::MonotonicInstant,
284    ) -> Result<(), fidl::Error> {
285        let _response = self.client.send_query::<
286            SetStatusArgs,
287            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
288            PushSourcePuppetMarker,
289        >(
290            (status,),
291            0x5aaa3bde01f79ca6,
292            fidl::encoding::DynamicFlags::FLEXIBLE,
293            ___deadline,
294        )?
295        .into_result::<PushSourcePuppetMarker>("set_status")?;
296        Ok(_response)
297    }
298
299    /// Deliberately crash the time source.
300    pub fn r#crash(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
301        let _response = self.client.send_query::<
302            fidl::encoding::EmptyPayload,
303            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
304            PushSourcePuppetMarker,
305        >(
306            (),
307            0x76872d19611aa8ac,
308            fidl::encoding::DynamicFlags::FLEXIBLE,
309            ___deadline,
310        )?
311        .into_result::<PushSourcePuppetMarker>("crash")?;
312        Ok(_response)
313    }
314
315    /// Returns the number of cumulative connections served during the lifetime of
316    /// the PushSourcePuppet. This allows asserting behavior, such as when
317    /// Timekeeper has restarted a connection. Timekeeper's lifetime is independent
318    /// of that of PushSourcePuppet.
319    pub fn r#get_lifetime_served_connections(
320        &self,
321        ___deadline: zx::MonotonicInstant,
322    ) -> Result<u32, fidl::Error> {
323        let _response = self.client.send_query::<
324            fidl::encoding::EmptyPayload,
325            fidl::encoding::FlexibleType<ConnectionsResponse>,
326            PushSourcePuppetMarker,
327        >(
328            (),
329            0x131f6c16b577fd05,
330            fidl::encoding::DynamicFlags::FLEXIBLE,
331            ___deadline,
332        )?
333        .into_result::<PushSourcePuppetMarker>("get_lifetime_served_connections")?;
334        Ok(_response.num_lifetime_connections)
335    }
336}
337
338#[cfg(target_os = "fuchsia")]
339impl From<PushSourcePuppetSynchronousProxy> for zx::NullableHandle {
340    fn from(value: PushSourcePuppetSynchronousProxy) -> Self {
341        value.into_channel().into()
342    }
343}
344
345#[cfg(target_os = "fuchsia")]
346impl From<fidl::Channel> for PushSourcePuppetSynchronousProxy {
347    fn from(value: fidl::Channel) -> Self {
348        Self::new(value)
349    }
350}
351
352#[cfg(target_os = "fuchsia")]
353impl fidl::endpoints::FromClient for PushSourcePuppetSynchronousProxy {
354    type Protocol = PushSourcePuppetMarker;
355
356    fn from_client(value: fidl::endpoints::ClientEnd<PushSourcePuppetMarker>) -> Self {
357        Self::new(value.into_channel())
358    }
359}
360
361#[derive(Debug, Clone)]
362pub struct PushSourcePuppetProxy {
363    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
364}
365
366impl fidl::endpoints::Proxy for PushSourcePuppetProxy {
367    type Protocol = PushSourcePuppetMarker;
368
369    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
370        Self::new(inner)
371    }
372
373    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
374        self.client.into_channel().map_err(|client| Self { client })
375    }
376
377    fn as_channel(&self) -> &::fidl::AsyncChannel {
378        self.client.as_channel()
379    }
380}
381
382impl PushSourcePuppetProxy {
383    /// Create a new Proxy for test.time.realm/PushSourcePuppet.
384    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
385        let protocol_name = <PushSourcePuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
386        Self { client: fidl::client::Client::new(channel, protocol_name) }
387    }
388
389    /// Get a Stream of events from the remote end of the protocol.
390    ///
391    /// # Panics
392    ///
393    /// Panics if the event stream was already taken.
394    pub fn take_event_stream(&self) -> PushSourcePuppetEventStream {
395        PushSourcePuppetEventStream { event_receiver: self.client.take_event_receiver() }
396    }
397
398    /// Sets the next sample to be reported by the push source.
399    pub fn r#set_sample(
400        &self,
401        mut sample: &fidl_fuchsia_time_external::TimeSample,
402    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
403        PushSourcePuppetProxyInterface::r#set_sample(self, sample)
404    }
405
406    /// Sets the next status to be reported by the push source.
407    pub fn r#set_status(
408        &self,
409        mut status: fidl_fuchsia_time_external::Status,
410    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
411        PushSourcePuppetProxyInterface::r#set_status(self, status)
412    }
413
414    /// Deliberately crash the time source.
415    pub fn r#crash(
416        &self,
417    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
418        PushSourcePuppetProxyInterface::r#crash(self)
419    }
420
421    /// Returns the number of cumulative connections served during the lifetime of
422    /// the PushSourcePuppet. This allows asserting behavior, such as when
423    /// Timekeeper has restarted a connection. Timekeeper's lifetime is independent
424    /// of that of PushSourcePuppet.
425    pub fn r#get_lifetime_served_connections(
426        &self,
427    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
428        PushSourcePuppetProxyInterface::r#get_lifetime_served_connections(self)
429    }
430}
431
432impl PushSourcePuppetProxyInterface for PushSourcePuppetProxy {
433    type SetSampleResponseFut =
434        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
435    fn r#set_sample(
436        &self,
437        mut sample: &fidl_fuchsia_time_external::TimeSample,
438    ) -> Self::SetSampleResponseFut {
439        fn _decode(
440            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
441        ) -> Result<(), fidl::Error> {
442            let _response = fidl::client::decode_transaction_body::<
443                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
444                fidl::encoding::DefaultFuchsiaResourceDialect,
445                0x2819099d8cadf9d6,
446            >(_buf?)?
447            .into_result::<PushSourcePuppetMarker>("set_sample")?;
448            Ok(_response)
449        }
450        self.client.send_query_and_decode::<SetSampleArgs, ()>(
451            (sample,),
452            0x2819099d8cadf9d6,
453            fidl::encoding::DynamicFlags::FLEXIBLE,
454            _decode,
455        )
456    }
457
458    type SetStatusResponseFut =
459        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
460    fn r#set_status(
461        &self,
462        mut status: fidl_fuchsia_time_external::Status,
463    ) -> Self::SetStatusResponseFut {
464        fn _decode(
465            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
466        ) -> Result<(), fidl::Error> {
467            let _response = fidl::client::decode_transaction_body::<
468                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
469                fidl::encoding::DefaultFuchsiaResourceDialect,
470                0x5aaa3bde01f79ca6,
471            >(_buf?)?
472            .into_result::<PushSourcePuppetMarker>("set_status")?;
473            Ok(_response)
474        }
475        self.client.send_query_and_decode::<SetStatusArgs, ()>(
476            (status,),
477            0x5aaa3bde01f79ca6,
478            fidl::encoding::DynamicFlags::FLEXIBLE,
479            _decode,
480        )
481    }
482
483    type CrashResponseFut =
484        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
485    fn r#crash(&self) -> Self::CrashResponseFut {
486        fn _decode(
487            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
488        ) -> Result<(), fidl::Error> {
489            let _response = fidl::client::decode_transaction_body::<
490                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
491                fidl::encoding::DefaultFuchsiaResourceDialect,
492                0x76872d19611aa8ac,
493            >(_buf?)?
494            .into_result::<PushSourcePuppetMarker>("crash")?;
495            Ok(_response)
496        }
497        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
498            (),
499            0x76872d19611aa8ac,
500            fidl::encoding::DynamicFlags::FLEXIBLE,
501            _decode,
502        )
503    }
504
505    type GetLifetimeServedConnectionsResponseFut =
506        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
507    fn r#get_lifetime_served_connections(&self) -> Self::GetLifetimeServedConnectionsResponseFut {
508        fn _decode(
509            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
510        ) -> Result<u32, fidl::Error> {
511            let _response = fidl::client::decode_transaction_body::<
512                fidl::encoding::FlexibleType<ConnectionsResponse>,
513                fidl::encoding::DefaultFuchsiaResourceDialect,
514                0x131f6c16b577fd05,
515            >(_buf?)?
516            .into_result::<PushSourcePuppetMarker>("get_lifetime_served_connections")?;
517            Ok(_response.num_lifetime_connections)
518        }
519        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
520            (),
521            0x131f6c16b577fd05,
522            fidl::encoding::DynamicFlags::FLEXIBLE,
523            _decode,
524        )
525    }
526}
527
528pub struct PushSourcePuppetEventStream {
529    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
530}
531
532impl std::marker::Unpin for PushSourcePuppetEventStream {}
533
534impl futures::stream::FusedStream for PushSourcePuppetEventStream {
535    fn is_terminated(&self) -> bool {
536        self.event_receiver.is_terminated()
537    }
538}
539
540impl futures::Stream for PushSourcePuppetEventStream {
541    type Item = Result<PushSourcePuppetEvent, fidl::Error>;
542
543    fn poll_next(
544        mut self: std::pin::Pin<&mut Self>,
545        cx: &mut std::task::Context<'_>,
546    ) -> std::task::Poll<Option<Self::Item>> {
547        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
548            &mut self.event_receiver,
549            cx
550        )?) {
551            Some(buf) => std::task::Poll::Ready(Some(PushSourcePuppetEvent::decode(buf))),
552            None => std::task::Poll::Ready(None),
553        }
554    }
555}
556
557#[derive(Debug)]
558pub enum PushSourcePuppetEvent {
559    #[non_exhaustive]
560    _UnknownEvent {
561        /// Ordinal of the event that was sent.
562        ordinal: u64,
563    },
564}
565
566impl PushSourcePuppetEvent {
567    /// Decodes a message buffer as a [`PushSourcePuppetEvent`].
568    fn decode(
569        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
570    ) -> Result<PushSourcePuppetEvent, fidl::Error> {
571        let (bytes, _handles) = buf.split_mut();
572        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
573        debug_assert_eq!(tx_header.tx_id, 0);
574        match tx_header.ordinal {
575            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
576                Ok(PushSourcePuppetEvent::_UnknownEvent { ordinal: tx_header.ordinal })
577            }
578            _ => Err(fidl::Error::UnknownOrdinal {
579                ordinal: tx_header.ordinal,
580                protocol_name:
581                    <PushSourcePuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
582            }),
583        }
584    }
585}
586
587/// A Stream of incoming requests for test.time.realm/PushSourcePuppet.
588pub struct PushSourcePuppetRequestStream {
589    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
590    is_terminated: bool,
591}
592
593impl std::marker::Unpin for PushSourcePuppetRequestStream {}
594
595impl futures::stream::FusedStream for PushSourcePuppetRequestStream {
596    fn is_terminated(&self) -> bool {
597        self.is_terminated
598    }
599}
600
601impl fidl::endpoints::RequestStream for PushSourcePuppetRequestStream {
602    type Protocol = PushSourcePuppetMarker;
603    type ControlHandle = PushSourcePuppetControlHandle;
604
605    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
606        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
607    }
608
609    fn control_handle(&self) -> Self::ControlHandle {
610        PushSourcePuppetControlHandle { inner: self.inner.clone() }
611    }
612
613    fn into_inner(
614        self,
615    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
616    {
617        (self.inner, self.is_terminated)
618    }
619
620    fn from_inner(
621        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
622        is_terminated: bool,
623    ) -> Self {
624        Self { inner, is_terminated }
625    }
626}
627
628impl futures::Stream for PushSourcePuppetRequestStream {
629    type Item = Result<PushSourcePuppetRequest, fidl::Error>;
630
631    fn poll_next(
632        mut self: std::pin::Pin<&mut Self>,
633        cx: &mut std::task::Context<'_>,
634    ) -> std::task::Poll<Option<Self::Item>> {
635        let this = &mut *self;
636        if this.inner.check_shutdown(cx) {
637            this.is_terminated = true;
638            return std::task::Poll::Ready(None);
639        }
640        if this.is_terminated {
641            panic!("polled PushSourcePuppetRequestStream after completion");
642        }
643        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
644            |bytes, handles| {
645                match this.inner.channel().read_etc(cx, bytes, handles) {
646                    std::task::Poll::Ready(Ok(())) => {}
647                    std::task::Poll::Pending => return std::task::Poll::Pending,
648                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
649                        this.is_terminated = true;
650                        return std::task::Poll::Ready(None);
651                    }
652                    std::task::Poll::Ready(Err(e)) => {
653                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
654                            e.into(),
655                        ))));
656                    }
657                }
658
659                // A message has been received from the channel
660                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
661
662                std::task::Poll::Ready(Some(match header.ordinal {
663                    0x2819099d8cadf9d6 => {
664                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
665                        let mut req = fidl::new_empty!(
666                            SetSampleArgs,
667                            fidl::encoding::DefaultFuchsiaResourceDialect
668                        );
669                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetSampleArgs>(&header, _body_bytes, handles, &mut req)?;
670                        let control_handle =
671                            PushSourcePuppetControlHandle { inner: this.inner.clone() };
672                        Ok(PushSourcePuppetRequest::SetSample {
673                            sample: req.sample,
674
675                            responder: PushSourcePuppetSetSampleResponder {
676                                control_handle: std::mem::ManuallyDrop::new(control_handle),
677                                tx_id: header.tx_id,
678                            },
679                        })
680                    }
681                    0x5aaa3bde01f79ca6 => {
682                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
683                        let mut req = fidl::new_empty!(
684                            SetStatusArgs,
685                            fidl::encoding::DefaultFuchsiaResourceDialect
686                        );
687                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetStatusArgs>(&header, _body_bytes, handles, &mut req)?;
688                        let control_handle =
689                            PushSourcePuppetControlHandle { inner: this.inner.clone() };
690                        Ok(PushSourcePuppetRequest::SetStatus {
691                            status: req.status,
692
693                            responder: PushSourcePuppetSetStatusResponder {
694                                control_handle: std::mem::ManuallyDrop::new(control_handle),
695                                tx_id: header.tx_id,
696                            },
697                        })
698                    }
699                    0x76872d19611aa8ac => {
700                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
701                        let mut req = fidl::new_empty!(
702                            fidl::encoding::EmptyPayload,
703                            fidl::encoding::DefaultFuchsiaResourceDialect
704                        );
705                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
706                        let control_handle =
707                            PushSourcePuppetControlHandle { inner: this.inner.clone() };
708                        Ok(PushSourcePuppetRequest::Crash {
709                            responder: PushSourcePuppetCrashResponder {
710                                control_handle: std::mem::ManuallyDrop::new(control_handle),
711                                tx_id: header.tx_id,
712                            },
713                        })
714                    }
715                    0x131f6c16b577fd05 => {
716                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
717                        let mut req = fidl::new_empty!(
718                            fidl::encoding::EmptyPayload,
719                            fidl::encoding::DefaultFuchsiaResourceDialect
720                        );
721                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
722                        let control_handle =
723                            PushSourcePuppetControlHandle { inner: this.inner.clone() };
724                        Ok(PushSourcePuppetRequest::GetLifetimeServedConnections {
725                            responder: PushSourcePuppetGetLifetimeServedConnectionsResponder {
726                                control_handle: std::mem::ManuallyDrop::new(control_handle),
727                                tx_id: header.tx_id,
728                            },
729                        })
730                    }
731                    _ if header.tx_id == 0
732                        && header
733                            .dynamic_flags()
734                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
735                    {
736                        Ok(PushSourcePuppetRequest::_UnknownMethod {
737                            ordinal: header.ordinal,
738                            control_handle: PushSourcePuppetControlHandle {
739                                inner: this.inner.clone(),
740                            },
741                            method_type: fidl::MethodType::OneWay,
742                        })
743                    }
744                    _ if header
745                        .dynamic_flags()
746                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
747                    {
748                        this.inner.send_framework_err(
749                            fidl::encoding::FrameworkErr::UnknownMethod,
750                            header.tx_id,
751                            header.ordinal,
752                            header.dynamic_flags(),
753                            (bytes, handles),
754                        )?;
755                        Ok(PushSourcePuppetRequest::_UnknownMethod {
756                            ordinal: header.ordinal,
757                            control_handle: PushSourcePuppetControlHandle {
758                                inner: this.inner.clone(),
759                            },
760                            method_type: fidl::MethodType::TwoWay,
761                        })
762                    }
763                    _ => Err(fidl::Error::UnknownOrdinal {
764                        ordinal: header.ordinal,
765                        protocol_name:
766                            <PushSourcePuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
767                    }),
768                }))
769            },
770        )
771    }
772}
773
774/// Used to manipulate the internal push source for testing.
775#[derive(Debug)]
776pub enum PushSourcePuppetRequest {
777    /// Sets the next sample to be reported by the push source.
778    SetSample {
779        sample: fidl_fuchsia_time_external::TimeSample,
780        responder: PushSourcePuppetSetSampleResponder,
781    },
782    /// Sets the next status to be reported by the push source.
783    SetStatus {
784        status: fidl_fuchsia_time_external::Status,
785        responder: PushSourcePuppetSetStatusResponder,
786    },
787    /// Deliberately crash the time source.
788    Crash { responder: PushSourcePuppetCrashResponder },
789    /// Returns the number of cumulative connections served during the lifetime of
790    /// the PushSourcePuppet. This allows asserting behavior, such as when
791    /// Timekeeper has restarted a connection. Timekeeper's lifetime is independent
792    /// of that of PushSourcePuppet.
793    GetLifetimeServedConnections {
794        responder: PushSourcePuppetGetLifetimeServedConnectionsResponder,
795    },
796    /// An interaction was received which does not match any known method.
797    #[non_exhaustive]
798    _UnknownMethod {
799        /// Ordinal of the method that was called.
800        ordinal: u64,
801        control_handle: PushSourcePuppetControlHandle,
802        method_type: fidl::MethodType,
803    },
804}
805
806impl PushSourcePuppetRequest {
807    #[allow(irrefutable_let_patterns)]
808    pub fn into_set_sample(
809        self,
810    ) -> Option<(fidl_fuchsia_time_external::TimeSample, PushSourcePuppetSetSampleResponder)> {
811        if let PushSourcePuppetRequest::SetSample { sample, responder } = self {
812            Some((sample, responder))
813        } else {
814            None
815        }
816    }
817
818    #[allow(irrefutable_let_patterns)]
819    pub fn into_set_status(
820        self,
821    ) -> Option<(fidl_fuchsia_time_external::Status, PushSourcePuppetSetStatusResponder)> {
822        if let PushSourcePuppetRequest::SetStatus { status, responder } = self {
823            Some((status, responder))
824        } else {
825            None
826        }
827    }
828
829    #[allow(irrefutable_let_patterns)]
830    pub fn into_crash(self) -> Option<(PushSourcePuppetCrashResponder)> {
831        if let PushSourcePuppetRequest::Crash { responder } = self {
832            Some((responder))
833        } else {
834            None
835        }
836    }
837
838    #[allow(irrefutable_let_patterns)]
839    pub fn into_get_lifetime_served_connections(
840        self,
841    ) -> Option<(PushSourcePuppetGetLifetimeServedConnectionsResponder)> {
842        if let PushSourcePuppetRequest::GetLifetimeServedConnections { responder } = self {
843            Some((responder))
844        } else {
845            None
846        }
847    }
848
849    /// Name of the method defined in FIDL
850    pub fn method_name(&self) -> &'static str {
851        match *self {
852            PushSourcePuppetRequest::SetSample { .. } => "set_sample",
853            PushSourcePuppetRequest::SetStatus { .. } => "set_status",
854            PushSourcePuppetRequest::Crash { .. } => "crash",
855            PushSourcePuppetRequest::GetLifetimeServedConnections { .. } => {
856                "get_lifetime_served_connections"
857            }
858            PushSourcePuppetRequest::_UnknownMethod {
859                method_type: fidl::MethodType::OneWay,
860                ..
861            } => "unknown one-way method",
862            PushSourcePuppetRequest::_UnknownMethod {
863                method_type: fidl::MethodType::TwoWay,
864                ..
865            } => "unknown two-way method",
866        }
867    }
868}
869
870#[derive(Debug, Clone)]
871pub struct PushSourcePuppetControlHandle {
872    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
873}
874
875impl PushSourcePuppetControlHandle {
876    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
877        self.inner.shutdown_with_epitaph(status.into())
878    }
879}
880
881impl fidl::endpoints::ControlHandle for PushSourcePuppetControlHandle {
882    fn shutdown(&self) {
883        self.inner.shutdown()
884    }
885
886    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
887        self.inner.shutdown_with_epitaph(status)
888    }
889
890    fn is_closed(&self) -> bool {
891        self.inner.channel().is_closed()
892    }
893    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
894        self.inner.channel().on_closed()
895    }
896
897    #[cfg(target_os = "fuchsia")]
898    fn signal_peer(
899        &self,
900        clear_mask: zx::Signals,
901        set_mask: zx::Signals,
902    ) -> Result<(), zx_status::Status> {
903        use fidl::Peered;
904        self.inner.channel().signal_peer(clear_mask, set_mask)
905    }
906}
907
908impl PushSourcePuppetControlHandle {}
909
910#[must_use = "FIDL methods require a response to be sent"]
911#[derive(Debug)]
912pub struct PushSourcePuppetSetSampleResponder {
913    control_handle: std::mem::ManuallyDrop<PushSourcePuppetControlHandle>,
914    tx_id: u32,
915}
916
917/// Set the the channel to be shutdown (see [`PushSourcePuppetControlHandle::shutdown`])
918/// if the responder is dropped without sending a response, so that the client
919/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
920impl std::ops::Drop for PushSourcePuppetSetSampleResponder {
921    fn drop(&mut self) {
922        self.control_handle.shutdown();
923        // Safety: drops once, never accessed again
924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
925    }
926}
927
928impl fidl::endpoints::Responder for PushSourcePuppetSetSampleResponder {
929    type ControlHandle = PushSourcePuppetControlHandle;
930
931    fn control_handle(&self) -> &PushSourcePuppetControlHandle {
932        &self.control_handle
933    }
934
935    fn drop_without_shutdown(mut self) {
936        // Safety: drops once, never accessed again due to mem::forget
937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
938        // Prevent Drop from running (which would shut down the channel)
939        std::mem::forget(self);
940    }
941}
942
943impl PushSourcePuppetSetSampleResponder {
944    /// Sends a response to the FIDL transaction.
945    ///
946    /// Sets the channel to shutdown if an error occurs.
947    pub fn send(self) -> Result<(), fidl::Error> {
948        let _result = self.send_raw();
949        if _result.is_err() {
950            self.control_handle.shutdown();
951        }
952        self.drop_without_shutdown();
953        _result
954    }
955
956    /// Similar to "send" but does not shutdown the channel if an error occurs.
957    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
958        let _result = self.send_raw();
959        self.drop_without_shutdown();
960        _result
961    }
962
963    fn send_raw(&self) -> Result<(), fidl::Error> {
964        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
965            fidl::encoding::Flexible::new(()),
966            self.tx_id,
967            0x2819099d8cadf9d6,
968            fidl::encoding::DynamicFlags::FLEXIBLE,
969        )
970    }
971}
972
973#[must_use = "FIDL methods require a response to be sent"]
974#[derive(Debug)]
975pub struct PushSourcePuppetSetStatusResponder {
976    control_handle: std::mem::ManuallyDrop<PushSourcePuppetControlHandle>,
977    tx_id: u32,
978}
979
980/// Set the the channel to be shutdown (see [`PushSourcePuppetControlHandle::shutdown`])
981/// if the responder is dropped without sending a response, so that the client
982/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
983impl std::ops::Drop for PushSourcePuppetSetStatusResponder {
984    fn drop(&mut self) {
985        self.control_handle.shutdown();
986        // Safety: drops once, never accessed again
987        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
988    }
989}
990
991impl fidl::endpoints::Responder for PushSourcePuppetSetStatusResponder {
992    type ControlHandle = PushSourcePuppetControlHandle;
993
994    fn control_handle(&self) -> &PushSourcePuppetControlHandle {
995        &self.control_handle
996    }
997
998    fn drop_without_shutdown(mut self) {
999        // Safety: drops once, never accessed again due to mem::forget
1000        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1001        // Prevent Drop from running (which would shut down the channel)
1002        std::mem::forget(self);
1003    }
1004}
1005
1006impl PushSourcePuppetSetStatusResponder {
1007    /// Sends a response to the FIDL transaction.
1008    ///
1009    /// Sets the channel to shutdown if an error occurs.
1010    pub fn send(self) -> Result<(), fidl::Error> {
1011        let _result = self.send_raw();
1012        if _result.is_err() {
1013            self.control_handle.shutdown();
1014        }
1015        self.drop_without_shutdown();
1016        _result
1017    }
1018
1019    /// Similar to "send" but does not shutdown the channel if an error occurs.
1020    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1021        let _result = self.send_raw();
1022        self.drop_without_shutdown();
1023        _result
1024    }
1025
1026    fn send_raw(&self) -> Result<(), fidl::Error> {
1027        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1028            fidl::encoding::Flexible::new(()),
1029            self.tx_id,
1030            0x5aaa3bde01f79ca6,
1031            fidl::encoding::DynamicFlags::FLEXIBLE,
1032        )
1033    }
1034}
1035
1036#[must_use = "FIDL methods require a response to be sent"]
1037#[derive(Debug)]
1038pub struct PushSourcePuppetCrashResponder {
1039    control_handle: std::mem::ManuallyDrop<PushSourcePuppetControlHandle>,
1040    tx_id: u32,
1041}
1042
1043/// Set the the channel to be shutdown (see [`PushSourcePuppetControlHandle::shutdown`])
1044/// if the responder is dropped without sending a response, so that the client
1045/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1046impl std::ops::Drop for PushSourcePuppetCrashResponder {
1047    fn drop(&mut self) {
1048        self.control_handle.shutdown();
1049        // Safety: drops once, never accessed again
1050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1051    }
1052}
1053
1054impl fidl::endpoints::Responder for PushSourcePuppetCrashResponder {
1055    type ControlHandle = PushSourcePuppetControlHandle;
1056
1057    fn control_handle(&self) -> &PushSourcePuppetControlHandle {
1058        &self.control_handle
1059    }
1060
1061    fn drop_without_shutdown(mut self) {
1062        // Safety: drops once, never accessed again due to mem::forget
1063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1064        // Prevent Drop from running (which would shut down the channel)
1065        std::mem::forget(self);
1066    }
1067}
1068
1069impl PushSourcePuppetCrashResponder {
1070    /// Sends a response to the FIDL transaction.
1071    ///
1072    /// Sets the channel to shutdown if an error occurs.
1073    pub fn send(self) -> Result<(), fidl::Error> {
1074        let _result = self.send_raw();
1075        if _result.is_err() {
1076            self.control_handle.shutdown();
1077        }
1078        self.drop_without_shutdown();
1079        _result
1080    }
1081
1082    /// Similar to "send" but does not shutdown the channel if an error occurs.
1083    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1084        let _result = self.send_raw();
1085        self.drop_without_shutdown();
1086        _result
1087    }
1088
1089    fn send_raw(&self) -> Result<(), fidl::Error> {
1090        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1091            fidl::encoding::Flexible::new(()),
1092            self.tx_id,
1093            0x76872d19611aa8ac,
1094            fidl::encoding::DynamicFlags::FLEXIBLE,
1095        )
1096    }
1097}
1098
1099#[must_use = "FIDL methods require a response to be sent"]
1100#[derive(Debug)]
1101pub struct PushSourcePuppetGetLifetimeServedConnectionsResponder {
1102    control_handle: std::mem::ManuallyDrop<PushSourcePuppetControlHandle>,
1103    tx_id: u32,
1104}
1105
1106/// Set the the channel to be shutdown (see [`PushSourcePuppetControlHandle::shutdown`])
1107/// if the responder is dropped without sending a response, so that the client
1108/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1109impl std::ops::Drop for PushSourcePuppetGetLifetimeServedConnectionsResponder {
1110    fn drop(&mut self) {
1111        self.control_handle.shutdown();
1112        // Safety: drops once, never accessed again
1113        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1114    }
1115}
1116
1117impl fidl::endpoints::Responder for PushSourcePuppetGetLifetimeServedConnectionsResponder {
1118    type ControlHandle = PushSourcePuppetControlHandle;
1119
1120    fn control_handle(&self) -> &PushSourcePuppetControlHandle {
1121        &self.control_handle
1122    }
1123
1124    fn drop_without_shutdown(mut self) {
1125        // Safety: drops once, never accessed again due to mem::forget
1126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1127        // Prevent Drop from running (which would shut down the channel)
1128        std::mem::forget(self);
1129    }
1130}
1131
1132impl PushSourcePuppetGetLifetimeServedConnectionsResponder {
1133    /// Sends a response to the FIDL transaction.
1134    ///
1135    /// Sets the channel to shutdown if an error occurs.
1136    pub fn send(self, mut num_lifetime_connections: u32) -> Result<(), fidl::Error> {
1137        let _result = self.send_raw(num_lifetime_connections);
1138        if _result.is_err() {
1139            self.control_handle.shutdown();
1140        }
1141        self.drop_without_shutdown();
1142        _result
1143    }
1144
1145    /// Similar to "send" but does not shutdown the channel if an error occurs.
1146    pub fn send_no_shutdown_on_err(
1147        self,
1148        mut num_lifetime_connections: u32,
1149    ) -> Result<(), fidl::Error> {
1150        let _result = self.send_raw(num_lifetime_connections);
1151        self.drop_without_shutdown();
1152        _result
1153    }
1154
1155    fn send_raw(&self, mut num_lifetime_connections: u32) -> Result<(), fidl::Error> {
1156        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ConnectionsResponse>>(
1157            fidl::encoding::Flexible::new((num_lifetime_connections,)),
1158            self.tx_id,
1159            0x131f6c16b577fd05,
1160            fidl::encoding::DynamicFlags::FLEXIBLE,
1161        )
1162    }
1163}
1164
1165#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1166pub struct RealmFactoryMarker;
1167
1168impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
1169    type Proxy = RealmFactoryProxy;
1170    type RequestStream = RealmFactoryRequestStream;
1171    #[cfg(target_os = "fuchsia")]
1172    type SynchronousProxy = RealmFactorySynchronousProxy;
1173
1174    const DEBUG_NAME: &'static str = "test.time.realm.RealmFactory";
1175}
1176impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
1177pub type RealmFactoryCreateRealmResult = Result<
1178    (
1179        fidl::endpoints::ClientEnd<PushSourcePuppetMarker>,
1180        CreateResponseOpts,
1181        fidl::endpoints::ClientEnd<fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker>,
1182    ),
1183    fidl_fuchsia_testing_harness::OperationError,
1184>;
1185
1186pub trait RealmFactoryProxyInterface: Send + Sync {
1187    type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
1188        + Send;
1189    fn r#create_realm(
1190        &self,
1191        options: RealmOptions,
1192        fake_utc_clock: fidl::Clock,
1193        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1194    ) -> Self::CreateRealmResponseFut;
1195}
1196#[derive(Debug)]
1197#[cfg(target_os = "fuchsia")]
1198pub struct RealmFactorySynchronousProxy {
1199    client: fidl::client::sync::Client,
1200}
1201
1202#[cfg(target_os = "fuchsia")]
1203impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
1204    type Proxy = RealmFactoryProxy;
1205    type Protocol = RealmFactoryMarker;
1206
1207    fn from_channel(inner: fidl::Channel) -> Self {
1208        Self::new(inner)
1209    }
1210
1211    fn into_channel(self) -> fidl::Channel {
1212        self.client.into_channel()
1213    }
1214
1215    fn as_channel(&self) -> &fidl::Channel {
1216        self.client.as_channel()
1217    }
1218}
1219
1220#[cfg(target_os = "fuchsia")]
1221impl RealmFactorySynchronousProxy {
1222    pub fn new(channel: fidl::Channel) -> Self {
1223        Self { client: fidl::client::sync::Client::new(channel) }
1224    }
1225
1226    pub fn into_channel(self) -> fidl::Channel {
1227        self.client.into_channel()
1228    }
1229
1230    /// Waits until an event arrives and returns it. It is safe for other
1231    /// threads to make concurrent requests while waiting for an event.
1232    pub fn wait_for_event(
1233        &self,
1234        deadline: zx::MonotonicInstant,
1235    ) -> Result<RealmFactoryEvent, fidl::Error> {
1236        RealmFactoryEvent::decode(self.client.wait_for_event::<RealmFactoryMarker>(deadline)?)
1237    }
1238
1239    /// Creates the realm using the given options.
1240    ///
1241    /// The obtained realm is isolated from any other realms created from repeated
1242    /// calls to `CreateRealm`.
1243    pub fn r#create_realm(
1244        &self,
1245        mut options: RealmOptions,
1246        mut fake_utc_clock: fidl::Clock,
1247        mut realm_server: fidl::endpoints::ServerEnd<
1248            fidl_fuchsia_testing_harness::RealmProxy_Marker,
1249        >,
1250        ___deadline: zx::MonotonicInstant,
1251    ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
1252        let _response = self
1253            .client
1254            .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
1255                CreateResponse,
1256                fidl_fuchsia_testing_harness::OperationError,
1257            >, RealmFactoryMarker>(
1258                (&mut options, fake_utc_clock, realm_server),
1259                0x601159669adee8b6,
1260                fidl::encoding::DynamicFlags::FLEXIBLE,
1261                ___deadline,
1262            )?
1263            .into_result::<RealmFactoryMarker>("create_realm")?;
1264        Ok(_response.map(|x| (x.push_source_puppet, x.opts, x.cobalt_metric_client)))
1265    }
1266}
1267
1268#[cfg(target_os = "fuchsia")]
1269impl From<RealmFactorySynchronousProxy> for zx::NullableHandle {
1270    fn from(value: RealmFactorySynchronousProxy) -> Self {
1271        value.into_channel().into()
1272    }
1273}
1274
1275#[cfg(target_os = "fuchsia")]
1276impl From<fidl::Channel> for RealmFactorySynchronousProxy {
1277    fn from(value: fidl::Channel) -> Self {
1278        Self::new(value)
1279    }
1280}
1281
1282#[cfg(target_os = "fuchsia")]
1283impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
1284    type Protocol = RealmFactoryMarker;
1285
1286    fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
1287        Self::new(value.into_channel())
1288    }
1289}
1290
1291#[derive(Debug, Clone)]
1292pub struct RealmFactoryProxy {
1293    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1294}
1295
1296impl fidl::endpoints::Proxy for RealmFactoryProxy {
1297    type Protocol = RealmFactoryMarker;
1298
1299    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1300        Self::new(inner)
1301    }
1302
1303    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1304        self.client.into_channel().map_err(|client| Self { client })
1305    }
1306
1307    fn as_channel(&self) -> &::fidl::AsyncChannel {
1308        self.client.as_channel()
1309    }
1310}
1311
1312impl RealmFactoryProxy {
1313    /// Create a new Proxy for test.time.realm/RealmFactory.
1314    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1315        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1316        Self { client: fidl::client::Client::new(channel, protocol_name) }
1317    }
1318
1319    /// Get a Stream of events from the remote end of the protocol.
1320    ///
1321    /// # Panics
1322    ///
1323    /// Panics if the event stream was already taken.
1324    pub fn take_event_stream(&self) -> RealmFactoryEventStream {
1325        RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
1326    }
1327
1328    /// Creates the realm using the given options.
1329    ///
1330    /// The obtained realm is isolated from any other realms created from repeated
1331    /// calls to `CreateRealm`.
1332    pub fn r#create_realm(
1333        &self,
1334        mut options: RealmOptions,
1335        mut fake_utc_clock: fidl::Clock,
1336        mut realm_server: fidl::endpoints::ServerEnd<
1337            fidl_fuchsia_testing_harness::RealmProxy_Marker,
1338        >,
1339    ) -> fidl::client::QueryResponseFut<
1340        RealmFactoryCreateRealmResult,
1341        fidl::encoding::DefaultFuchsiaResourceDialect,
1342    > {
1343        RealmFactoryProxyInterface::r#create_realm(self, options, fake_utc_clock, realm_server)
1344    }
1345}
1346
1347impl RealmFactoryProxyInterface for RealmFactoryProxy {
1348    type CreateRealmResponseFut = fidl::client::QueryResponseFut<
1349        RealmFactoryCreateRealmResult,
1350        fidl::encoding::DefaultFuchsiaResourceDialect,
1351    >;
1352    fn r#create_realm(
1353        &self,
1354        mut options: RealmOptions,
1355        mut fake_utc_clock: fidl::Clock,
1356        mut realm_server: fidl::endpoints::ServerEnd<
1357            fidl_fuchsia_testing_harness::RealmProxy_Marker,
1358        >,
1359    ) -> Self::CreateRealmResponseFut {
1360        fn _decode(
1361            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1362        ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
1363            let _response = fidl::client::decode_transaction_body::<
1364                fidl::encoding::FlexibleResultType<
1365                    CreateResponse,
1366                    fidl_fuchsia_testing_harness::OperationError,
1367                >,
1368                fidl::encoding::DefaultFuchsiaResourceDialect,
1369                0x601159669adee8b6,
1370            >(_buf?)?
1371            .into_result::<RealmFactoryMarker>("create_realm")?;
1372            Ok(_response.map(|x| (x.push_source_puppet, x.opts, x.cobalt_metric_client)))
1373        }
1374        self.client
1375            .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
1376                (&mut options, fake_utc_clock, realm_server),
1377                0x601159669adee8b6,
1378                fidl::encoding::DynamicFlags::FLEXIBLE,
1379                _decode,
1380            )
1381    }
1382}
1383
1384pub struct RealmFactoryEventStream {
1385    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1386}
1387
1388impl std::marker::Unpin for RealmFactoryEventStream {}
1389
1390impl futures::stream::FusedStream for RealmFactoryEventStream {
1391    fn is_terminated(&self) -> bool {
1392        self.event_receiver.is_terminated()
1393    }
1394}
1395
1396impl futures::Stream for RealmFactoryEventStream {
1397    type Item = Result<RealmFactoryEvent, fidl::Error>;
1398
1399    fn poll_next(
1400        mut self: std::pin::Pin<&mut Self>,
1401        cx: &mut std::task::Context<'_>,
1402    ) -> std::task::Poll<Option<Self::Item>> {
1403        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1404            &mut self.event_receiver,
1405            cx
1406        )?) {
1407            Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
1408            None => std::task::Poll::Ready(None),
1409        }
1410    }
1411}
1412
1413#[derive(Debug)]
1414pub enum RealmFactoryEvent {
1415    #[non_exhaustive]
1416    _UnknownEvent {
1417        /// Ordinal of the event that was sent.
1418        ordinal: u64,
1419    },
1420}
1421
1422impl RealmFactoryEvent {
1423    /// Decodes a message buffer as a [`RealmFactoryEvent`].
1424    fn decode(
1425        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1426    ) -> Result<RealmFactoryEvent, fidl::Error> {
1427        let (bytes, _handles) = buf.split_mut();
1428        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1429        debug_assert_eq!(tx_header.tx_id, 0);
1430        match tx_header.ordinal {
1431            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1432                Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1433            }
1434            _ => Err(fidl::Error::UnknownOrdinal {
1435                ordinal: tx_header.ordinal,
1436                protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1437            }),
1438        }
1439    }
1440}
1441
1442/// A Stream of incoming requests for test.time.realm/RealmFactory.
1443pub struct RealmFactoryRequestStream {
1444    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1445    is_terminated: bool,
1446}
1447
1448impl std::marker::Unpin for RealmFactoryRequestStream {}
1449
1450impl futures::stream::FusedStream for RealmFactoryRequestStream {
1451    fn is_terminated(&self) -> bool {
1452        self.is_terminated
1453    }
1454}
1455
1456impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
1457    type Protocol = RealmFactoryMarker;
1458    type ControlHandle = RealmFactoryControlHandle;
1459
1460    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1461        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1462    }
1463
1464    fn control_handle(&self) -> Self::ControlHandle {
1465        RealmFactoryControlHandle { inner: self.inner.clone() }
1466    }
1467
1468    fn into_inner(
1469        self,
1470    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1471    {
1472        (self.inner, self.is_terminated)
1473    }
1474
1475    fn from_inner(
1476        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1477        is_terminated: bool,
1478    ) -> Self {
1479        Self { inner, is_terminated }
1480    }
1481}
1482
1483impl futures::Stream for RealmFactoryRequestStream {
1484    type Item = Result<RealmFactoryRequest, fidl::Error>;
1485
1486    fn poll_next(
1487        mut self: std::pin::Pin<&mut Self>,
1488        cx: &mut std::task::Context<'_>,
1489    ) -> std::task::Poll<Option<Self::Item>> {
1490        let this = &mut *self;
1491        if this.inner.check_shutdown(cx) {
1492            this.is_terminated = true;
1493            return std::task::Poll::Ready(None);
1494        }
1495        if this.is_terminated {
1496            panic!("polled RealmFactoryRequestStream after completion");
1497        }
1498        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1499            |bytes, handles| {
1500                match this.inner.channel().read_etc(cx, bytes, handles) {
1501                    std::task::Poll::Ready(Ok(())) => {}
1502                    std::task::Poll::Pending => return std::task::Poll::Pending,
1503                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1504                        this.is_terminated = true;
1505                        return std::task::Poll::Ready(None);
1506                    }
1507                    std::task::Poll::Ready(Err(e)) => {
1508                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1509                            e.into(),
1510                        ))));
1511                    }
1512                }
1513
1514                // A message has been received from the channel
1515                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1516
1517                std::task::Poll::Ready(Some(match header.ordinal {
1518                    0x601159669adee8b6 => {
1519                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1520                        let mut req = fidl::new_empty!(
1521                            RealmFactoryCreateRealmRequest,
1522                            fidl::encoding::DefaultFuchsiaResourceDialect
1523                        );
1524                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
1525                        let control_handle =
1526                            RealmFactoryControlHandle { inner: this.inner.clone() };
1527                        Ok(RealmFactoryRequest::CreateRealm {
1528                            options: req.options,
1529                            fake_utc_clock: req.fake_utc_clock,
1530                            realm_server: req.realm_server,
1531
1532                            responder: RealmFactoryCreateRealmResponder {
1533                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1534                                tx_id: header.tx_id,
1535                            },
1536                        })
1537                    }
1538                    _ if header.tx_id == 0
1539                        && header
1540                            .dynamic_flags()
1541                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1542                    {
1543                        Ok(RealmFactoryRequest::_UnknownMethod {
1544                            ordinal: header.ordinal,
1545                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
1546                            method_type: fidl::MethodType::OneWay,
1547                        })
1548                    }
1549                    _ if header
1550                        .dynamic_flags()
1551                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1552                    {
1553                        this.inner.send_framework_err(
1554                            fidl::encoding::FrameworkErr::UnknownMethod,
1555                            header.tx_id,
1556                            header.ordinal,
1557                            header.dynamic_flags(),
1558                            (bytes, handles),
1559                        )?;
1560                        Ok(RealmFactoryRequest::_UnknownMethod {
1561                            ordinal: header.ordinal,
1562                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
1563                            method_type: fidl::MethodType::TwoWay,
1564                        })
1565                    }
1566                    _ => Err(fidl::Error::UnknownOrdinal {
1567                        ordinal: header.ordinal,
1568                        protocol_name:
1569                            <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1570                    }),
1571                }))
1572            },
1573        )
1574    }
1575}
1576
1577#[derive(Debug)]
1578pub enum RealmFactoryRequest {
1579    /// Creates the realm using the given options.
1580    ///
1581    /// The obtained realm is isolated from any other realms created from repeated
1582    /// calls to `CreateRealm`.
1583    CreateRealm {
1584        options: RealmOptions,
1585        fake_utc_clock: fidl::Clock,
1586        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1587        responder: RealmFactoryCreateRealmResponder,
1588    },
1589    /// An interaction was received which does not match any known method.
1590    #[non_exhaustive]
1591    _UnknownMethod {
1592        /// Ordinal of the method that was called.
1593        ordinal: u64,
1594        control_handle: RealmFactoryControlHandle,
1595        method_type: fidl::MethodType,
1596    },
1597}
1598
1599impl RealmFactoryRequest {
1600    #[allow(irrefutable_let_patterns)]
1601    pub fn into_create_realm(
1602        self,
1603    ) -> Option<(
1604        RealmOptions,
1605        fidl::Clock,
1606        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1607        RealmFactoryCreateRealmResponder,
1608    )> {
1609        if let RealmFactoryRequest::CreateRealm {
1610            options,
1611            fake_utc_clock,
1612            realm_server,
1613            responder,
1614        } = self
1615        {
1616            Some((options, fake_utc_clock, realm_server, responder))
1617        } else {
1618            None
1619        }
1620    }
1621
1622    /// Name of the method defined in FIDL
1623    pub fn method_name(&self) -> &'static str {
1624        match *self {
1625            RealmFactoryRequest::CreateRealm { .. } => "create_realm",
1626            RealmFactoryRequest::_UnknownMethod {
1627                method_type: fidl::MethodType::OneWay, ..
1628            } => "unknown one-way method",
1629            RealmFactoryRequest::_UnknownMethod {
1630                method_type: fidl::MethodType::TwoWay, ..
1631            } => "unknown two-way method",
1632        }
1633    }
1634}
1635
1636#[derive(Debug, Clone)]
1637pub struct RealmFactoryControlHandle {
1638    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1639}
1640
1641impl RealmFactoryControlHandle {
1642    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1643        self.inner.shutdown_with_epitaph(status.into())
1644    }
1645}
1646
1647impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
1648    fn shutdown(&self) {
1649        self.inner.shutdown()
1650    }
1651
1652    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1653        self.inner.shutdown_with_epitaph(status)
1654    }
1655
1656    fn is_closed(&self) -> bool {
1657        self.inner.channel().is_closed()
1658    }
1659    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1660        self.inner.channel().on_closed()
1661    }
1662
1663    #[cfg(target_os = "fuchsia")]
1664    fn signal_peer(
1665        &self,
1666        clear_mask: zx::Signals,
1667        set_mask: zx::Signals,
1668    ) -> Result<(), zx_status::Status> {
1669        use fidl::Peered;
1670        self.inner.channel().signal_peer(clear_mask, set_mask)
1671    }
1672}
1673
1674impl RealmFactoryControlHandle {}
1675
1676#[must_use = "FIDL methods require a response to be sent"]
1677#[derive(Debug)]
1678pub struct RealmFactoryCreateRealmResponder {
1679    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
1680    tx_id: u32,
1681}
1682
1683/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
1684/// if the responder is dropped without sending a response, so that the client
1685/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1686impl std::ops::Drop for RealmFactoryCreateRealmResponder {
1687    fn drop(&mut self) {
1688        self.control_handle.shutdown();
1689        // Safety: drops once, never accessed again
1690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1691    }
1692}
1693
1694impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
1695    type ControlHandle = RealmFactoryControlHandle;
1696
1697    fn control_handle(&self) -> &RealmFactoryControlHandle {
1698        &self.control_handle
1699    }
1700
1701    fn drop_without_shutdown(mut self) {
1702        // Safety: drops once, never accessed again due to mem::forget
1703        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1704        // Prevent Drop from running (which would shut down the channel)
1705        std::mem::forget(self);
1706    }
1707}
1708
1709impl RealmFactoryCreateRealmResponder {
1710    /// Sends a response to the FIDL transaction.
1711    ///
1712    /// Sets the channel to shutdown if an error occurs.
1713    pub fn send(
1714        self,
1715        mut result: Result<
1716            (
1717                fidl::endpoints::ClientEnd<PushSourcePuppetMarker>,
1718                CreateResponseOpts,
1719                fidl::endpoints::ClientEnd<
1720                    fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
1721                >,
1722            ),
1723            fidl_fuchsia_testing_harness::OperationError,
1724        >,
1725    ) -> Result<(), fidl::Error> {
1726        let _result = self.send_raw(result);
1727        if _result.is_err() {
1728            self.control_handle.shutdown();
1729        }
1730        self.drop_without_shutdown();
1731        _result
1732    }
1733
1734    /// Similar to "send" but does not shutdown the channel if an error occurs.
1735    pub fn send_no_shutdown_on_err(
1736        self,
1737        mut result: Result<
1738            (
1739                fidl::endpoints::ClientEnd<PushSourcePuppetMarker>,
1740                CreateResponseOpts,
1741                fidl::endpoints::ClientEnd<
1742                    fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
1743                >,
1744            ),
1745            fidl_fuchsia_testing_harness::OperationError,
1746        >,
1747    ) -> Result<(), fidl::Error> {
1748        let _result = self.send_raw(result);
1749        self.drop_without_shutdown();
1750        _result
1751    }
1752
1753    fn send_raw(
1754        &self,
1755        mut result: Result<
1756            (
1757                fidl::endpoints::ClientEnd<PushSourcePuppetMarker>,
1758                CreateResponseOpts,
1759                fidl::endpoints::ClientEnd<
1760                    fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
1761                >,
1762            ),
1763            fidl_fuchsia_testing_harness::OperationError,
1764        >,
1765    ) -> Result<(), fidl::Error> {
1766        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<CreateResponse, fidl_fuchsia_testing_harness::OperationError>>(
1767            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e).map(|(push_source_puppet, opts, cobalt_metric_client)| (std::mem::replace(push_source_puppet, <<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::Handle as fidl::encoding::HandleFor<fidl::encoding::DefaultFuchsiaResourceDialect>>::invalid().into()), opts, std::mem::replace(cobalt_metric_client, <<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::Handle as fidl::encoding::HandleFor<fidl::encoding::DefaultFuchsiaResourceDialect>>::invalid().into()),))),
1768            self.tx_id,
1769            0x601159669adee8b6,
1770            fidl::encoding::DynamicFlags::FLEXIBLE
1771        )
1772    }
1773}
1774
1775#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1776pub struct RtcUpdatesMarker;
1777
1778impl fidl::endpoints::ProtocolMarker for RtcUpdatesMarker {
1779    type Proxy = RtcUpdatesProxy;
1780    type RequestStream = RtcUpdatesRequestStream;
1781    #[cfg(target_os = "fuchsia")]
1782    type SynchronousProxy = RtcUpdatesSynchronousProxy;
1783
1784    const DEBUG_NAME: &'static str = "(anonymous) RtcUpdates";
1785}
1786pub type RtcUpdatesGetResult = Result<
1787    (Vec<fidl_fuchsia_hardware_rtc::Time>, GetResponseOpts),
1788    fidl_fuchsia_testing_harness::OperationError,
1789>;
1790
1791pub trait RtcUpdatesProxyInterface: Send + Sync {
1792    type GetResponseFut: std::future::Future<Output = Result<RtcUpdatesGetResult, fidl::Error>>
1793        + Send;
1794    fn r#get(&self, payload: GetRequest) -> Self::GetResponseFut;
1795}
1796#[derive(Debug)]
1797#[cfg(target_os = "fuchsia")]
1798pub struct RtcUpdatesSynchronousProxy {
1799    client: fidl::client::sync::Client,
1800}
1801
1802#[cfg(target_os = "fuchsia")]
1803impl fidl::endpoints::SynchronousProxy for RtcUpdatesSynchronousProxy {
1804    type Proxy = RtcUpdatesProxy;
1805    type Protocol = RtcUpdatesMarker;
1806
1807    fn from_channel(inner: fidl::Channel) -> Self {
1808        Self::new(inner)
1809    }
1810
1811    fn into_channel(self) -> fidl::Channel {
1812        self.client.into_channel()
1813    }
1814
1815    fn as_channel(&self) -> &fidl::Channel {
1816        self.client.as_channel()
1817    }
1818}
1819
1820#[cfg(target_os = "fuchsia")]
1821impl RtcUpdatesSynchronousProxy {
1822    pub fn new(channel: fidl::Channel) -> Self {
1823        Self { client: fidl::client::sync::Client::new(channel) }
1824    }
1825
1826    pub fn into_channel(self) -> fidl::Channel {
1827        self.client.into_channel()
1828    }
1829
1830    /// Waits until an event arrives and returns it. It is safe for other
1831    /// threads to make concurrent requests while waiting for an event.
1832    pub fn wait_for_event(
1833        &self,
1834        deadline: zx::MonotonicInstant,
1835    ) -> Result<RtcUpdatesEvent, fidl::Error> {
1836        RtcUpdatesEvent::decode(self.client.wait_for_event::<RtcUpdatesMarker>(deadline)?)
1837    }
1838
1839    /// Reads the RTC updates that the clock received so far.
1840    pub fn r#get(
1841        &self,
1842        mut payload: GetRequest,
1843        ___deadline: zx::MonotonicInstant,
1844    ) -> Result<RtcUpdatesGetResult, fidl::Error> {
1845        let _response = self
1846            .client
1847            .send_query::<GetRequest, fidl::encoding::FlexibleResultType<
1848                GetResponse,
1849                fidl_fuchsia_testing_harness::OperationError,
1850            >, RtcUpdatesMarker>(
1851                &mut payload,
1852                0x5a797db0c0d68c8a,
1853                fidl::encoding::DynamicFlags::FLEXIBLE,
1854                ___deadline,
1855            )?
1856            .into_result::<RtcUpdatesMarker>("get")?;
1857        Ok(_response.map(|x| (x.updates, x.opts)))
1858    }
1859}
1860
1861#[cfg(target_os = "fuchsia")]
1862impl From<RtcUpdatesSynchronousProxy> for zx::NullableHandle {
1863    fn from(value: RtcUpdatesSynchronousProxy) -> Self {
1864        value.into_channel().into()
1865    }
1866}
1867
1868#[cfg(target_os = "fuchsia")]
1869impl From<fidl::Channel> for RtcUpdatesSynchronousProxy {
1870    fn from(value: fidl::Channel) -> Self {
1871        Self::new(value)
1872    }
1873}
1874
1875#[cfg(target_os = "fuchsia")]
1876impl fidl::endpoints::FromClient for RtcUpdatesSynchronousProxy {
1877    type Protocol = RtcUpdatesMarker;
1878
1879    fn from_client(value: fidl::endpoints::ClientEnd<RtcUpdatesMarker>) -> Self {
1880        Self::new(value.into_channel())
1881    }
1882}
1883
1884#[derive(Debug, Clone)]
1885pub struct RtcUpdatesProxy {
1886    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1887}
1888
1889impl fidl::endpoints::Proxy for RtcUpdatesProxy {
1890    type Protocol = RtcUpdatesMarker;
1891
1892    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1893        Self::new(inner)
1894    }
1895
1896    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1897        self.client.into_channel().map_err(|client| Self { client })
1898    }
1899
1900    fn as_channel(&self) -> &::fidl::AsyncChannel {
1901        self.client.as_channel()
1902    }
1903}
1904
1905impl RtcUpdatesProxy {
1906    /// Create a new Proxy for test.time.realm/RtcUpdates.
1907    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1908        let protocol_name = <RtcUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1909        Self { client: fidl::client::Client::new(channel, protocol_name) }
1910    }
1911
1912    /// Get a Stream of events from the remote end of the protocol.
1913    ///
1914    /// # Panics
1915    ///
1916    /// Panics if the event stream was already taken.
1917    pub fn take_event_stream(&self) -> RtcUpdatesEventStream {
1918        RtcUpdatesEventStream { event_receiver: self.client.take_event_receiver() }
1919    }
1920
1921    /// Reads the RTC updates that the clock received so far.
1922    pub fn r#get(
1923        &self,
1924        mut payload: GetRequest,
1925    ) -> fidl::client::QueryResponseFut<
1926        RtcUpdatesGetResult,
1927        fidl::encoding::DefaultFuchsiaResourceDialect,
1928    > {
1929        RtcUpdatesProxyInterface::r#get(self, payload)
1930    }
1931}
1932
1933impl RtcUpdatesProxyInterface for RtcUpdatesProxy {
1934    type GetResponseFut = fidl::client::QueryResponseFut<
1935        RtcUpdatesGetResult,
1936        fidl::encoding::DefaultFuchsiaResourceDialect,
1937    >;
1938    fn r#get(&self, mut payload: GetRequest) -> Self::GetResponseFut {
1939        fn _decode(
1940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1941        ) -> Result<RtcUpdatesGetResult, fidl::Error> {
1942            let _response = fidl::client::decode_transaction_body::<
1943                fidl::encoding::FlexibleResultType<
1944                    GetResponse,
1945                    fidl_fuchsia_testing_harness::OperationError,
1946                >,
1947                fidl::encoding::DefaultFuchsiaResourceDialect,
1948                0x5a797db0c0d68c8a,
1949            >(_buf?)?
1950            .into_result::<RtcUpdatesMarker>("get")?;
1951            Ok(_response.map(|x| (x.updates, x.opts)))
1952        }
1953        self.client.send_query_and_decode::<GetRequest, RtcUpdatesGetResult>(
1954            &mut payload,
1955            0x5a797db0c0d68c8a,
1956            fidl::encoding::DynamicFlags::FLEXIBLE,
1957            _decode,
1958        )
1959    }
1960}
1961
1962pub struct RtcUpdatesEventStream {
1963    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1964}
1965
1966impl std::marker::Unpin for RtcUpdatesEventStream {}
1967
1968impl futures::stream::FusedStream for RtcUpdatesEventStream {
1969    fn is_terminated(&self) -> bool {
1970        self.event_receiver.is_terminated()
1971    }
1972}
1973
1974impl futures::Stream for RtcUpdatesEventStream {
1975    type Item = Result<RtcUpdatesEvent, fidl::Error>;
1976
1977    fn poll_next(
1978        mut self: std::pin::Pin<&mut Self>,
1979        cx: &mut std::task::Context<'_>,
1980    ) -> std::task::Poll<Option<Self::Item>> {
1981        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1982            &mut self.event_receiver,
1983            cx
1984        )?) {
1985            Some(buf) => std::task::Poll::Ready(Some(RtcUpdatesEvent::decode(buf))),
1986            None => std::task::Poll::Ready(None),
1987        }
1988    }
1989}
1990
1991#[derive(Debug)]
1992pub enum RtcUpdatesEvent {
1993    #[non_exhaustive]
1994    _UnknownEvent {
1995        /// Ordinal of the event that was sent.
1996        ordinal: u64,
1997    },
1998}
1999
2000impl RtcUpdatesEvent {
2001    /// Decodes a message buffer as a [`RtcUpdatesEvent`].
2002    fn decode(
2003        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2004    ) -> Result<RtcUpdatesEvent, fidl::Error> {
2005        let (bytes, _handles) = buf.split_mut();
2006        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2007        debug_assert_eq!(tx_header.tx_id, 0);
2008        match tx_header.ordinal {
2009            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2010                Ok(RtcUpdatesEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2011            }
2012            _ => Err(fidl::Error::UnknownOrdinal {
2013                ordinal: tx_header.ordinal,
2014                protocol_name: <RtcUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2015            }),
2016        }
2017    }
2018}
2019
2020/// A Stream of incoming requests for test.time.realm/RtcUpdates.
2021pub struct RtcUpdatesRequestStream {
2022    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2023    is_terminated: bool,
2024}
2025
2026impl std::marker::Unpin for RtcUpdatesRequestStream {}
2027
2028impl futures::stream::FusedStream for RtcUpdatesRequestStream {
2029    fn is_terminated(&self) -> bool {
2030        self.is_terminated
2031    }
2032}
2033
2034impl fidl::endpoints::RequestStream for RtcUpdatesRequestStream {
2035    type Protocol = RtcUpdatesMarker;
2036    type ControlHandle = RtcUpdatesControlHandle;
2037
2038    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2039        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2040    }
2041
2042    fn control_handle(&self) -> Self::ControlHandle {
2043        RtcUpdatesControlHandle { inner: self.inner.clone() }
2044    }
2045
2046    fn into_inner(
2047        self,
2048    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2049    {
2050        (self.inner, self.is_terminated)
2051    }
2052
2053    fn from_inner(
2054        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2055        is_terminated: bool,
2056    ) -> Self {
2057        Self { inner, is_terminated }
2058    }
2059}
2060
2061impl futures::Stream for RtcUpdatesRequestStream {
2062    type Item = Result<RtcUpdatesRequest, fidl::Error>;
2063
2064    fn poll_next(
2065        mut self: std::pin::Pin<&mut Self>,
2066        cx: &mut std::task::Context<'_>,
2067    ) -> std::task::Poll<Option<Self::Item>> {
2068        let this = &mut *self;
2069        if this.inner.check_shutdown(cx) {
2070            this.is_terminated = true;
2071            return std::task::Poll::Ready(None);
2072        }
2073        if this.is_terminated {
2074            panic!("polled RtcUpdatesRequestStream after completion");
2075        }
2076        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2077            |bytes, handles| {
2078                match this.inner.channel().read_etc(cx, bytes, handles) {
2079                    std::task::Poll::Ready(Ok(())) => {}
2080                    std::task::Poll::Pending => return std::task::Poll::Pending,
2081                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2082                        this.is_terminated = true;
2083                        return std::task::Poll::Ready(None);
2084                    }
2085                    std::task::Poll::Ready(Err(e)) => {
2086                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2087                            e.into(),
2088                        ))));
2089                    }
2090                }
2091
2092                // A message has been received from the channel
2093                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2094
2095                std::task::Poll::Ready(Some(match header.ordinal {
2096                    0x5a797db0c0d68c8a => {
2097                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2098                        let mut req = fidl::new_empty!(
2099                            GetRequest,
2100                            fidl::encoding::DefaultFuchsiaResourceDialect
2101                        );
2102                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GetRequest>(&header, _body_bytes, handles, &mut req)?;
2103                        let control_handle = RtcUpdatesControlHandle { inner: this.inner.clone() };
2104                        Ok(RtcUpdatesRequest::Get {
2105                            payload: req,
2106                            responder: RtcUpdatesGetResponder {
2107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2108                                tx_id: header.tx_id,
2109                            },
2110                        })
2111                    }
2112                    _ if header.tx_id == 0
2113                        && header
2114                            .dynamic_flags()
2115                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2116                    {
2117                        Ok(RtcUpdatesRequest::_UnknownMethod {
2118                            ordinal: header.ordinal,
2119                            control_handle: RtcUpdatesControlHandle { inner: this.inner.clone() },
2120                            method_type: fidl::MethodType::OneWay,
2121                        })
2122                    }
2123                    _ if header
2124                        .dynamic_flags()
2125                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2126                    {
2127                        this.inner.send_framework_err(
2128                            fidl::encoding::FrameworkErr::UnknownMethod,
2129                            header.tx_id,
2130                            header.ordinal,
2131                            header.dynamic_flags(),
2132                            (bytes, handles),
2133                        )?;
2134                        Ok(RtcUpdatesRequest::_UnknownMethod {
2135                            ordinal: header.ordinal,
2136                            control_handle: RtcUpdatesControlHandle { inner: this.inner.clone() },
2137                            method_type: fidl::MethodType::TwoWay,
2138                        })
2139                    }
2140                    _ => Err(fidl::Error::UnknownOrdinal {
2141                        ordinal: header.ordinal,
2142                        protocol_name:
2143                            <RtcUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2144                    }),
2145                }))
2146            },
2147        )
2148    }
2149}
2150
2151/// Used to read the RtcUpdates on the fake clock. If you need something more
2152/// complex, set `RealmOptions.rtc.rtc_handle` instead.
2153#[derive(Debug)]
2154pub enum RtcUpdatesRequest {
2155    /// Reads the RTC updates that the clock received so far.
2156    Get { payload: GetRequest, responder: RtcUpdatesGetResponder },
2157    /// An interaction was received which does not match any known method.
2158    #[non_exhaustive]
2159    _UnknownMethod {
2160        /// Ordinal of the method that was called.
2161        ordinal: u64,
2162        control_handle: RtcUpdatesControlHandle,
2163        method_type: fidl::MethodType,
2164    },
2165}
2166
2167impl RtcUpdatesRequest {
2168    #[allow(irrefutable_let_patterns)]
2169    pub fn into_get(self) -> Option<(GetRequest, RtcUpdatesGetResponder)> {
2170        if let RtcUpdatesRequest::Get { payload, responder } = self {
2171            Some((payload, responder))
2172        } else {
2173            None
2174        }
2175    }
2176
2177    /// Name of the method defined in FIDL
2178    pub fn method_name(&self) -> &'static str {
2179        match *self {
2180            RtcUpdatesRequest::Get { .. } => "get",
2181            RtcUpdatesRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2182                "unknown one-way method"
2183            }
2184            RtcUpdatesRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2185                "unknown two-way method"
2186            }
2187        }
2188    }
2189}
2190
2191#[derive(Debug, Clone)]
2192pub struct RtcUpdatesControlHandle {
2193    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2194}
2195
2196impl RtcUpdatesControlHandle {
2197    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2198        self.inner.shutdown_with_epitaph(status.into())
2199    }
2200}
2201
2202impl fidl::endpoints::ControlHandle for RtcUpdatesControlHandle {
2203    fn shutdown(&self) {
2204        self.inner.shutdown()
2205    }
2206
2207    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2208        self.inner.shutdown_with_epitaph(status)
2209    }
2210
2211    fn is_closed(&self) -> bool {
2212        self.inner.channel().is_closed()
2213    }
2214    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2215        self.inner.channel().on_closed()
2216    }
2217
2218    #[cfg(target_os = "fuchsia")]
2219    fn signal_peer(
2220        &self,
2221        clear_mask: zx::Signals,
2222        set_mask: zx::Signals,
2223    ) -> Result<(), zx_status::Status> {
2224        use fidl::Peered;
2225        self.inner.channel().signal_peer(clear_mask, set_mask)
2226    }
2227}
2228
2229impl RtcUpdatesControlHandle {}
2230
2231#[must_use = "FIDL methods require a response to be sent"]
2232#[derive(Debug)]
2233pub struct RtcUpdatesGetResponder {
2234    control_handle: std::mem::ManuallyDrop<RtcUpdatesControlHandle>,
2235    tx_id: u32,
2236}
2237
2238/// Set the the channel to be shutdown (see [`RtcUpdatesControlHandle::shutdown`])
2239/// if the responder is dropped without sending a response, so that the client
2240/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2241impl std::ops::Drop for RtcUpdatesGetResponder {
2242    fn drop(&mut self) {
2243        self.control_handle.shutdown();
2244        // Safety: drops once, never accessed again
2245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2246    }
2247}
2248
2249impl fidl::endpoints::Responder for RtcUpdatesGetResponder {
2250    type ControlHandle = RtcUpdatesControlHandle;
2251
2252    fn control_handle(&self) -> &RtcUpdatesControlHandle {
2253        &self.control_handle
2254    }
2255
2256    fn drop_without_shutdown(mut self) {
2257        // Safety: drops once, never accessed again due to mem::forget
2258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2259        // Prevent Drop from running (which would shut down the channel)
2260        std::mem::forget(self);
2261    }
2262}
2263
2264impl RtcUpdatesGetResponder {
2265    /// Sends a response to the FIDL transaction.
2266    ///
2267    /// Sets the channel to shutdown if an error occurs.
2268    pub fn send(
2269        self,
2270        mut result: Result<
2271            (&[fidl_fuchsia_hardware_rtc::Time], GetResponseOpts),
2272            fidl_fuchsia_testing_harness::OperationError,
2273        >,
2274    ) -> Result<(), fidl::Error> {
2275        let _result = self.send_raw(result);
2276        if _result.is_err() {
2277            self.control_handle.shutdown();
2278        }
2279        self.drop_without_shutdown();
2280        _result
2281    }
2282
2283    /// Similar to "send" but does not shutdown the channel if an error occurs.
2284    pub fn send_no_shutdown_on_err(
2285        self,
2286        mut result: Result<
2287            (&[fidl_fuchsia_hardware_rtc::Time], GetResponseOpts),
2288            fidl_fuchsia_testing_harness::OperationError,
2289        >,
2290    ) -> Result<(), fidl::Error> {
2291        let _result = self.send_raw(result);
2292        self.drop_without_shutdown();
2293        _result
2294    }
2295
2296    fn send_raw(
2297        &self,
2298        mut result: Result<
2299            (&[fidl_fuchsia_hardware_rtc::Time], GetResponseOpts),
2300            fidl_fuchsia_testing_harness::OperationError,
2301        >,
2302    ) -> Result<(), fidl::Error> {
2303        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2304            GetResponse,
2305            fidl_fuchsia_testing_harness::OperationError,
2306        >>(
2307            fidl::encoding::FlexibleResult::new(
2308                result.as_mut().map_err(|e| *e).map(|(updates, opts)| (*updates, opts)),
2309            ),
2310            self.tx_id,
2311            0x5a797db0c0d68c8a,
2312            fidl::encoding::DynamicFlags::FLEXIBLE,
2313        )
2314    }
2315}
2316
2317mod internal {
2318    use super::*;
2319
2320    impl fidl::encoding::ResourceTypeMarker for CreateResponse {
2321        type Borrowed<'a> = &'a mut Self;
2322        fn take_or_borrow<'a>(
2323            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2324        ) -> Self::Borrowed<'a> {
2325            value
2326        }
2327    }
2328
2329    unsafe impl fidl::encoding::TypeMarker for CreateResponse {
2330        type Owned = Self;
2331
2332        #[inline(always)]
2333        fn inline_align(_context: fidl::encoding::Context) -> usize {
2334            8
2335        }
2336
2337        #[inline(always)]
2338        fn inline_size(_context: fidl::encoding::Context) -> usize {
2339            32
2340        }
2341    }
2342
2343    unsafe impl
2344        fidl::encoding::Encode<CreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2345        for &mut CreateResponse
2346    {
2347        #[inline]
2348        unsafe fn encode(
2349            self,
2350            encoder: &mut fidl::encoding::Encoder<
2351                '_,
2352                fidl::encoding::DefaultFuchsiaResourceDialect,
2353            >,
2354            offset: usize,
2355            _depth: fidl::encoding::Depth,
2356        ) -> fidl::Result<()> {
2357            encoder.debug_check_bounds::<CreateResponse>(offset);
2358            // Delegate to tuple encoding.
2359            fidl::encoding::Encode::<CreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2360                (
2361                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PushSourcePuppetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.push_source_puppet),
2362                    <CreateResponseOpts as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.opts),
2363                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cobalt_metric_client),
2364                ),
2365                encoder, offset, _depth
2366            )
2367        }
2368    }
2369    unsafe impl<
2370        T0: fidl::encoding::Encode<
2371                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PushSourcePuppetMarker>>,
2372                fidl::encoding::DefaultFuchsiaResourceDialect,
2373            >,
2374        T1: fidl::encoding::Encode<CreateResponseOpts, fidl::encoding::DefaultFuchsiaResourceDialect>,
2375        T2: fidl::encoding::Encode<
2376                fidl::encoding::Endpoint<
2377                    fidl::endpoints::ClientEnd<
2378                        fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
2379                    >,
2380                >,
2381                fidl::encoding::DefaultFuchsiaResourceDialect,
2382            >,
2383    > fidl::encoding::Encode<CreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2384        for (T0, T1, T2)
2385    {
2386        #[inline]
2387        unsafe fn encode(
2388            self,
2389            encoder: &mut fidl::encoding::Encoder<
2390                '_,
2391                fidl::encoding::DefaultFuchsiaResourceDialect,
2392            >,
2393            offset: usize,
2394            depth: fidl::encoding::Depth,
2395        ) -> fidl::Result<()> {
2396            encoder.debug_check_bounds::<CreateResponse>(offset);
2397            // Zero out padding regions. There's no need to apply masks
2398            // because the unmasked parts will be overwritten by fields.
2399            unsafe {
2400                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2401                (ptr as *mut u64).write_unaligned(0);
2402            }
2403            unsafe {
2404                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
2405                (ptr as *mut u64).write_unaligned(0);
2406            }
2407            // Write the fields.
2408            self.0.encode(encoder, offset + 0, depth)?;
2409            self.1.encode(encoder, offset + 8, depth)?;
2410            self.2.encode(encoder, offset + 24, depth)?;
2411            Ok(())
2412        }
2413    }
2414
2415    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2416        for CreateResponse
2417    {
2418        #[inline(always)]
2419        fn new_empty() -> Self {
2420            Self {
2421                push_source_puppet: fidl::new_empty!(
2422                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PushSourcePuppetMarker>>,
2423                    fidl::encoding::DefaultFuchsiaResourceDialect
2424                ),
2425                opts: fidl::new_empty!(
2426                    CreateResponseOpts,
2427                    fidl::encoding::DefaultFuchsiaResourceDialect
2428                ),
2429                cobalt_metric_client: fidl::new_empty!(
2430                    fidl::encoding::Endpoint<
2431                        fidl::endpoints::ClientEnd<
2432                            fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
2433                        >,
2434                    >,
2435                    fidl::encoding::DefaultFuchsiaResourceDialect
2436                ),
2437            }
2438        }
2439
2440        #[inline]
2441        unsafe fn decode(
2442            &mut self,
2443            decoder: &mut fidl::encoding::Decoder<
2444                '_,
2445                fidl::encoding::DefaultFuchsiaResourceDialect,
2446            >,
2447            offset: usize,
2448            _depth: fidl::encoding::Depth,
2449        ) -> fidl::Result<()> {
2450            decoder.debug_check_bounds::<Self>(offset);
2451            // Verify that padding bytes are zero.
2452            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2453            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2454            let mask = 0xffffffff00000000u64;
2455            let maskedval = padval & mask;
2456            if maskedval != 0 {
2457                return Err(fidl::Error::NonZeroPadding {
2458                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2459                });
2460            }
2461            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
2462            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2463            let mask = 0xffffffff00000000u64;
2464            let maskedval = padval & mask;
2465            if maskedval != 0 {
2466                return Err(fidl::Error::NonZeroPadding {
2467                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
2468                });
2469            }
2470            fidl::decode!(
2471                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PushSourcePuppetMarker>>,
2472                fidl::encoding::DefaultFuchsiaResourceDialect,
2473                &mut self.push_source_puppet,
2474                decoder,
2475                offset + 0,
2476                _depth
2477            )?;
2478            fidl::decode!(
2479                CreateResponseOpts,
2480                fidl::encoding::DefaultFuchsiaResourceDialect,
2481                &mut self.opts,
2482                decoder,
2483                offset + 8,
2484                _depth
2485            )?;
2486            fidl::decode!(
2487                fidl::encoding::Endpoint<
2488                    fidl::endpoints::ClientEnd<
2489                        fidl_fuchsia_metrics_test::MetricEventLoggerQuerierMarker,
2490                    >,
2491                >,
2492                fidl::encoding::DefaultFuchsiaResourceDialect,
2493                &mut self.cobalt_metric_client,
2494                decoder,
2495                offset + 24,
2496                _depth
2497            )?;
2498            Ok(())
2499        }
2500    }
2501
2502    impl fidl::encoding::ResourceTypeMarker for GetResponse {
2503        type Borrowed<'a> = &'a mut Self;
2504        fn take_or_borrow<'a>(
2505            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2506        ) -> Self::Borrowed<'a> {
2507            value
2508        }
2509    }
2510
2511    unsafe impl fidl::encoding::TypeMarker for GetResponse {
2512        type Owned = Self;
2513
2514        #[inline(always)]
2515        fn inline_align(_context: fidl::encoding::Context) -> usize {
2516            8
2517        }
2518
2519        #[inline(always)]
2520        fn inline_size(_context: fidl::encoding::Context) -> usize {
2521            32
2522        }
2523    }
2524
2525    unsafe impl fidl::encoding::Encode<GetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2526        for &mut GetResponse
2527    {
2528        #[inline]
2529        unsafe fn encode(
2530            self,
2531            encoder: &mut fidl::encoding::Encoder<
2532                '_,
2533                fidl::encoding::DefaultFuchsiaResourceDialect,
2534            >,
2535            offset: usize,
2536            _depth: fidl::encoding::Depth,
2537        ) -> fidl::Result<()> {
2538            encoder.debug_check_bounds::<GetResponse>(offset);
2539            // Delegate to tuple encoding.
2540            fidl::encoding::Encode::<GetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2541                (
2542                    <fidl::encoding::Vector<fidl_fuchsia_hardware_rtc::Time, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.updates),
2543                    <GetResponseOpts as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.opts),
2544                ),
2545                encoder, offset, _depth
2546            )
2547        }
2548    }
2549    unsafe impl<
2550        T0: fidl::encoding::Encode<
2551                fidl::encoding::Vector<fidl_fuchsia_hardware_rtc::Time, 100>,
2552                fidl::encoding::DefaultFuchsiaResourceDialect,
2553            >,
2554        T1: fidl::encoding::Encode<GetResponseOpts, fidl::encoding::DefaultFuchsiaResourceDialect>,
2555    > fidl::encoding::Encode<GetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2556        for (T0, T1)
2557    {
2558        #[inline]
2559        unsafe fn encode(
2560            self,
2561            encoder: &mut fidl::encoding::Encoder<
2562                '_,
2563                fidl::encoding::DefaultFuchsiaResourceDialect,
2564            >,
2565            offset: usize,
2566            depth: fidl::encoding::Depth,
2567        ) -> fidl::Result<()> {
2568            encoder.debug_check_bounds::<GetResponse>(offset);
2569            // Zero out padding regions. There's no need to apply masks
2570            // because the unmasked parts will be overwritten by fields.
2571            // Write the fields.
2572            self.0.encode(encoder, offset + 0, depth)?;
2573            self.1.encode(encoder, offset + 16, depth)?;
2574            Ok(())
2575        }
2576    }
2577
2578    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GetResponse {
2579        #[inline(always)]
2580        fn new_empty() -> Self {
2581            Self {
2582                updates: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_rtc::Time, 100>, fidl::encoding::DefaultFuchsiaResourceDialect),
2583                opts: fidl::new_empty!(
2584                    GetResponseOpts,
2585                    fidl::encoding::DefaultFuchsiaResourceDialect
2586                ),
2587            }
2588        }
2589
2590        #[inline]
2591        unsafe fn decode(
2592            &mut self,
2593            decoder: &mut fidl::encoding::Decoder<
2594                '_,
2595                fidl::encoding::DefaultFuchsiaResourceDialect,
2596            >,
2597            offset: usize,
2598            _depth: fidl::encoding::Depth,
2599        ) -> fidl::Result<()> {
2600            decoder.debug_check_bounds::<Self>(offset);
2601            // Verify that padding bytes are zero.
2602            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_rtc::Time, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.updates, decoder, offset + 0, _depth)?;
2603            fidl::decode!(
2604                GetResponseOpts,
2605                fidl::encoding::DefaultFuchsiaResourceDialect,
2606                &mut self.opts,
2607                decoder,
2608                offset + 16,
2609                _depth
2610            )?;
2611            Ok(())
2612        }
2613    }
2614
2615    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
2616        type Borrowed<'a> = &'a mut Self;
2617        fn take_or_borrow<'a>(
2618            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2619        ) -> Self::Borrowed<'a> {
2620            value
2621        }
2622    }
2623
2624    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
2625        type Owned = Self;
2626
2627        #[inline(always)]
2628        fn inline_align(_context: fidl::encoding::Context) -> usize {
2629            8
2630        }
2631
2632        #[inline(always)]
2633        fn inline_size(_context: fidl::encoding::Context) -> usize {
2634            24
2635        }
2636    }
2637
2638    unsafe impl
2639        fidl::encoding::Encode<
2640            RealmFactoryCreateRealmRequest,
2641            fidl::encoding::DefaultFuchsiaResourceDialect,
2642        > for &mut RealmFactoryCreateRealmRequest
2643    {
2644        #[inline]
2645        unsafe fn encode(
2646            self,
2647            encoder: &mut fidl::encoding::Encoder<
2648                '_,
2649                fidl::encoding::DefaultFuchsiaResourceDialect,
2650            >,
2651            offset: usize,
2652            _depth: fidl::encoding::Depth,
2653        ) -> fidl::Result<()> {
2654            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
2655            // Delegate to tuple encoding.
2656            fidl::encoding::Encode::<
2657                RealmFactoryCreateRealmRequest,
2658                fidl::encoding::DefaultFuchsiaResourceDialect,
2659            >::encode(
2660                (
2661                    <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2662                        &mut self.options,
2663                    ),
2664                    <fidl::encoding::HandleType<
2665                        fidl::Clock,
2666                        { fidl::ObjectType::CLOCK.into_raw() },
2667                        2147483648,
2668                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2669                        &mut self.fake_utc_clock,
2670                    ),
2671                    <fidl::encoding::Endpoint<
2672                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
2673                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2674                        &mut self.realm_server,
2675                    ),
2676                ),
2677                encoder,
2678                offset,
2679                _depth,
2680            )
2681        }
2682    }
2683    unsafe impl<
2684        T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2685        T1: fidl::encoding::Encode<
2686                fidl::encoding::HandleType<
2687                    fidl::Clock,
2688                    { fidl::ObjectType::CLOCK.into_raw() },
2689                    2147483648,
2690                >,
2691                fidl::encoding::DefaultFuchsiaResourceDialect,
2692            >,
2693        T2: fidl::encoding::Encode<
2694                fidl::encoding::Endpoint<
2695                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
2696                >,
2697                fidl::encoding::DefaultFuchsiaResourceDialect,
2698            >,
2699    >
2700        fidl::encoding::Encode<
2701            RealmFactoryCreateRealmRequest,
2702            fidl::encoding::DefaultFuchsiaResourceDialect,
2703        > for (T0, T1, T2)
2704    {
2705        #[inline]
2706        unsafe fn encode(
2707            self,
2708            encoder: &mut fidl::encoding::Encoder<
2709                '_,
2710                fidl::encoding::DefaultFuchsiaResourceDialect,
2711            >,
2712            offset: usize,
2713            depth: fidl::encoding::Depth,
2714        ) -> fidl::Result<()> {
2715            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
2716            // Zero out padding regions. There's no need to apply masks
2717            // because the unmasked parts will be overwritten by fields.
2718            // Write the fields.
2719            self.0.encode(encoder, offset + 0, depth)?;
2720            self.1.encode(encoder, offset + 16, depth)?;
2721            self.2.encode(encoder, offset + 20, depth)?;
2722            Ok(())
2723        }
2724    }
2725
2726    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2727        for RealmFactoryCreateRealmRequest
2728    {
2729        #[inline(always)]
2730        fn new_empty() -> Self {
2731            Self {
2732                options: fidl::new_empty!(
2733                    RealmOptions,
2734                    fidl::encoding::DefaultFuchsiaResourceDialect
2735                ),
2736                fake_utc_clock: fidl::new_empty!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2737                realm_server: fidl::new_empty!(
2738                    fidl::encoding::Endpoint<
2739                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
2740                    >,
2741                    fidl::encoding::DefaultFuchsiaResourceDialect
2742                ),
2743            }
2744        }
2745
2746        #[inline]
2747        unsafe fn decode(
2748            &mut self,
2749            decoder: &mut fidl::encoding::Decoder<
2750                '_,
2751                fidl::encoding::DefaultFuchsiaResourceDialect,
2752            >,
2753            offset: usize,
2754            _depth: fidl::encoding::Depth,
2755        ) -> fidl::Result<()> {
2756            decoder.debug_check_bounds::<Self>(offset);
2757            // Verify that padding bytes are zero.
2758            fidl::decode!(
2759                RealmOptions,
2760                fidl::encoding::DefaultFuchsiaResourceDialect,
2761                &mut self.options,
2762                decoder,
2763                offset + 0,
2764                _depth
2765            )?;
2766            fidl::decode!(fidl::encoding::HandleType<fidl::Clock, { fidl::ObjectType::CLOCK.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fake_utc_clock, decoder, offset + 16, _depth)?;
2767            fidl::decode!(
2768                fidl::encoding::Endpoint<
2769                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
2770                >,
2771                fidl::encoding::DefaultFuchsiaResourceDialect,
2772                &mut self.realm_server,
2773                decoder,
2774                offset + 20,
2775                _depth
2776            )?;
2777            Ok(())
2778        }
2779    }
2780
2781    impl CreateResponseOpts {
2782        #[inline(always)]
2783        fn max_ordinal_present(&self) -> u64 {
2784            if let Some(_) = self.rtc_updates {
2785                return 1;
2786            }
2787            0
2788        }
2789    }
2790
2791    impl fidl::encoding::ResourceTypeMarker for CreateResponseOpts {
2792        type Borrowed<'a> = &'a mut Self;
2793        fn take_or_borrow<'a>(
2794            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2795        ) -> Self::Borrowed<'a> {
2796            value
2797        }
2798    }
2799
2800    unsafe impl fidl::encoding::TypeMarker for CreateResponseOpts {
2801        type Owned = Self;
2802
2803        #[inline(always)]
2804        fn inline_align(_context: fidl::encoding::Context) -> usize {
2805            8
2806        }
2807
2808        #[inline(always)]
2809        fn inline_size(_context: fidl::encoding::Context) -> usize {
2810            16
2811        }
2812    }
2813
2814    unsafe impl
2815        fidl::encoding::Encode<CreateResponseOpts, fidl::encoding::DefaultFuchsiaResourceDialect>
2816        for &mut CreateResponseOpts
2817    {
2818        unsafe fn encode(
2819            self,
2820            encoder: &mut fidl::encoding::Encoder<
2821                '_,
2822                fidl::encoding::DefaultFuchsiaResourceDialect,
2823            >,
2824            offset: usize,
2825            mut depth: fidl::encoding::Depth,
2826        ) -> fidl::Result<()> {
2827            encoder.debug_check_bounds::<CreateResponseOpts>(offset);
2828            // Vector header
2829            let max_ordinal: u64 = self.max_ordinal_present();
2830            encoder.write_num(max_ordinal, offset);
2831            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2832            // Calling encoder.out_of_line_offset(0) is not allowed.
2833            if max_ordinal == 0 {
2834                return Ok(());
2835            }
2836            depth.increment()?;
2837            let envelope_size = 8;
2838            let bytes_len = max_ordinal as usize * envelope_size;
2839            #[allow(unused_variables)]
2840            let offset = encoder.out_of_line_offset(bytes_len);
2841            let mut _prev_end_offset: usize = 0;
2842            if 1 > max_ordinal {
2843                return Ok(());
2844            }
2845
2846            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2847            // are envelope_size bytes.
2848            let cur_offset: usize = (1 - 1) * envelope_size;
2849
2850            // Zero reserved fields.
2851            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2852
2853            // Safety:
2854            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2855            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2856            //   envelope_size bytes, there is always sufficient room.
2857            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RtcUpdatesMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2858            self.rtc_updates.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RtcUpdatesMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2859            encoder, offset + cur_offset, depth
2860        )?;
2861
2862            _prev_end_offset = cur_offset + envelope_size;
2863
2864            Ok(())
2865        }
2866    }
2867
2868    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2869        for CreateResponseOpts
2870    {
2871        #[inline(always)]
2872        fn new_empty() -> Self {
2873            Self::default()
2874        }
2875
2876        unsafe fn decode(
2877            &mut self,
2878            decoder: &mut fidl::encoding::Decoder<
2879                '_,
2880                fidl::encoding::DefaultFuchsiaResourceDialect,
2881            >,
2882            offset: usize,
2883            mut depth: fidl::encoding::Depth,
2884        ) -> fidl::Result<()> {
2885            decoder.debug_check_bounds::<Self>(offset);
2886            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2887                None => return Err(fidl::Error::NotNullable),
2888                Some(len) => len,
2889            };
2890            // Calling decoder.out_of_line_offset(0) is not allowed.
2891            if len == 0 {
2892                return Ok(());
2893            };
2894            depth.increment()?;
2895            let envelope_size = 8;
2896            let bytes_len = len * envelope_size;
2897            let offset = decoder.out_of_line_offset(bytes_len)?;
2898            // Decode the envelope for each type.
2899            let mut _next_ordinal_to_read = 0;
2900            let mut next_offset = offset;
2901            let end_offset = offset + bytes_len;
2902            _next_ordinal_to_read += 1;
2903            if next_offset >= end_offset {
2904                return Ok(());
2905            }
2906
2907            // Decode unknown envelopes for gaps in ordinals.
2908            while _next_ordinal_to_read < 1 {
2909                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2910                _next_ordinal_to_read += 1;
2911                next_offset += envelope_size;
2912            }
2913
2914            let next_out_of_line = decoder.next_out_of_line();
2915            let handles_before = decoder.remaining_handles();
2916            if let Some((inlined, num_bytes, num_handles)) =
2917                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2918            {
2919                let member_inline_size = <fidl::encoding::Endpoint<
2920                    fidl::endpoints::ClientEnd<RtcUpdatesMarker>,
2921                > as fidl::encoding::TypeMarker>::inline_size(
2922                    decoder.context
2923                );
2924                if inlined != (member_inline_size <= 4) {
2925                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2926                }
2927                let inner_offset;
2928                let mut inner_depth = depth.clone();
2929                if inlined {
2930                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2931                    inner_offset = next_offset;
2932                } else {
2933                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2934                    inner_depth.increment()?;
2935                }
2936                let val_ref = self.rtc_updates.get_or_insert_with(|| {
2937                    fidl::new_empty!(
2938                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RtcUpdatesMarker>>,
2939                        fidl::encoding::DefaultFuchsiaResourceDialect
2940                    )
2941                });
2942                fidl::decode!(
2943                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RtcUpdatesMarker>>,
2944                    fidl::encoding::DefaultFuchsiaResourceDialect,
2945                    val_ref,
2946                    decoder,
2947                    inner_offset,
2948                    inner_depth
2949                )?;
2950                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2951                {
2952                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2953                }
2954                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2955                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2956                }
2957            }
2958
2959            next_offset += envelope_size;
2960
2961            // Decode the remaining unknown envelopes.
2962            while next_offset < end_offset {
2963                _next_ordinal_to_read += 1;
2964                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2965                next_offset += envelope_size;
2966            }
2967
2968            Ok(())
2969        }
2970    }
2971
2972    impl GetRequest {
2973        #[inline(always)]
2974        fn max_ordinal_present(&self) -> u64 {
2975            0
2976        }
2977    }
2978
2979    impl fidl::encoding::ResourceTypeMarker for GetRequest {
2980        type Borrowed<'a> = &'a mut Self;
2981        fn take_or_borrow<'a>(
2982            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2983        ) -> Self::Borrowed<'a> {
2984            value
2985        }
2986    }
2987
2988    unsafe impl fidl::encoding::TypeMarker for GetRequest {
2989        type Owned = Self;
2990
2991        #[inline(always)]
2992        fn inline_align(_context: fidl::encoding::Context) -> usize {
2993            8
2994        }
2995
2996        #[inline(always)]
2997        fn inline_size(_context: fidl::encoding::Context) -> usize {
2998            16
2999        }
3000    }
3001
3002    unsafe impl fidl::encoding::Encode<GetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3003        for &mut GetRequest
3004    {
3005        unsafe fn encode(
3006            self,
3007            encoder: &mut fidl::encoding::Encoder<
3008                '_,
3009                fidl::encoding::DefaultFuchsiaResourceDialect,
3010            >,
3011            offset: usize,
3012            mut depth: fidl::encoding::Depth,
3013        ) -> fidl::Result<()> {
3014            encoder.debug_check_bounds::<GetRequest>(offset);
3015            // Vector header
3016            let max_ordinal: u64 = self.max_ordinal_present();
3017            encoder.write_num(max_ordinal, offset);
3018            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3019            // Calling encoder.out_of_line_offset(0) is not allowed.
3020            if max_ordinal == 0 {
3021                return Ok(());
3022            }
3023            depth.increment()?;
3024            let envelope_size = 8;
3025            let bytes_len = max_ordinal as usize * envelope_size;
3026            #[allow(unused_variables)]
3027            let offset = encoder.out_of_line_offset(bytes_len);
3028            let mut _prev_end_offset: usize = 0;
3029
3030            Ok(())
3031        }
3032    }
3033
3034    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GetRequest {
3035        #[inline(always)]
3036        fn new_empty() -> Self {
3037            Self::default()
3038        }
3039
3040        unsafe fn decode(
3041            &mut self,
3042            decoder: &mut fidl::encoding::Decoder<
3043                '_,
3044                fidl::encoding::DefaultFuchsiaResourceDialect,
3045            >,
3046            offset: usize,
3047            mut depth: fidl::encoding::Depth,
3048        ) -> fidl::Result<()> {
3049            decoder.debug_check_bounds::<Self>(offset);
3050            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3051                None => return Err(fidl::Error::NotNullable),
3052                Some(len) => len,
3053            };
3054            // Calling decoder.out_of_line_offset(0) is not allowed.
3055            if len == 0 {
3056                return Ok(());
3057            };
3058            depth.increment()?;
3059            let envelope_size = 8;
3060            let bytes_len = len * envelope_size;
3061            let offset = decoder.out_of_line_offset(bytes_len)?;
3062            // Decode the envelope for each type.
3063            let mut _next_ordinal_to_read = 0;
3064            let mut next_offset = offset;
3065            let end_offset = offset + bytes_len;
3066
3067            // Decode the remaining unknown envelopes.
3068            while next_offset < end_offset {
3069                _next_ordinal_to_read += 1;
3070                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3071                next_offset += envelope_size;
3072            }
3073
3074            Ok(())
3075        }
3076    }
3077
3078    impl GetResponseOpts {
3079        #[inline(always)]
3080        fn max_ordinal_present(&self) -> u64 {
3081            0
3082        }
3083    }
3084
3085    impl fidl::encoding::ResourceTypeMarker for GetResponseOpts {
3086        type Borrowed<'a> = &'a mut Self;
3087        fn take_or_borrow<'a>(
3088            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3089        ) -> Self::Borrowed<'a> {
3090            value
3091        }
3092    }
3093
3094    unsafe impl fidl::encoding::TypeMarker for GetResponseOpts {
3095        type Owned = Self;
3096
3097        #[inline(always)]
3098        fn inline_align(_context: fidl::encoding::Context) -> usize {
3099            8
3100        }
3101
3102        #[inline(always)]
3103        fn inline_size(_context: fidl::encoding::Context) -> usize {
3104            16
3105        }
3106    }
3107
3108    unsafe impl
3109        fidl::encoding::Encode<GetResponseOpts, fidl::encoding::DefaultFuchsiaResourceDialect>
3110        for &mut GetResponseOpts
3111    {
3112        unsafe fn encode(
3113            self,
3114            encoder: &mut fidl::encoding::Encoder<
3115                '_,
3116                fidl::encoding::DefaultFuchsiaResourceDialect,
3117            >,
3118            offset: usize,
3119            mut depth: fidl::encoding::Depth,
3120        ) -> fidl::Result<()> {
3121            encoder.debug_check_bounds::<GetResponseOpts>(offset);
3122            // Vector header
3123            let max_ordinal: u64 = self.max_ordinal_present();
3124            encoder.write_num(max_ordinal, offset);
3125            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3126            // Calling encoder.out_of_line_offset(0) is not allowed.
3127            if max_ordinal == 0 {
3128                return Ok(());
3129            }
3130            depth.increment()?;
3131            let envelope_size = 8;
3132            let bytes_len = max_ordinal as usize * envelope_size;
3133            #[allow(unused_variables)]
3134            let offset = encoder.out_of_line_offset(bytes_len);
3135            let mut _prev_end_offset: usize = 0;
3136
3137            Ok(())
3138        }
3139    }
3140
3141    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3142        for GetResponseOpts
3143    {
3144        #[inline(always)]
3145        fn new_empty() -> Self {
3146            Self::default()
3147        }
3148
3149        unsafe fn decode(
3150            &mut self,
3151            decoder: &mut fidl::encoding::Decoder<
3152                '_,
3153                fidl::encoding::DefaultFuchsiaResourceDialect,
3154            >,
3155            offset: usize,
3156            mut depth: fidl::encoding::Depth,
3157        ) -> fidl::Result<()> {
3158            decoder.debug_check_bounds::<Self>(offset);
3159            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3160                None => return Err(fidl::Error::NotNullable),
3161                Some(len) => len,
3162            };
3163            // Calling decoder.out_of_line_offset(0) is not allowed.
3164            if len == 0 {
3165                return Ok(());
3166            };
3167            depth.increment()?;
3168            let envelope_size = 8;
3169            let bytes_len = len * envelope_size;
3170            let offset = decoder.out_of_line_offset(bytes_len)?;
3171            // Decode the envelope for each type.
3172            let mut _next_ordinal_to_read = 0;
3173            let mut next_offset = offset;
3174            let end_offset = offset + bytes_len;
3175
3176            // Decode the remaining unknown envelopes.
3177            while next_offset < end_offset {
3178                _next_ordinal_to_read += 1;
3179                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3180                next_offset += envelope_size;
3181            }
3182
3183            Ok(())
3184        }
3185    }
3186
3187    impl RealmOptions {
3188        #[inline(always)]
3189        fn max_ordinal_present(&self) -> u64 {
3190            if let Some(_) = self.rtc {
3191                return 2;
3192            }
3193            if let Some(_) = self.use_real_reference_clock {
3194                return 1;
3195            }
3196            0
3197        }
3198    }
3199
3200    impl fidl::encoding::ResourceTypeMarker for RealmOptions {
3201        type Borrowed<'a> = &'a mut Self;
3202        fn take_or_borrow<'a>(
3203            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3204        ) -> Self::Borrowed<'a> {
3205            value
3206        }
3207    }
3208
3209    unsafe impl fidl::encoding::TypeMarker for RealmOptions {
3210        type Owned = Self;
3211
3212        #[inline(always)]
3213        fn inline_align(_context: fidl::encoding::Context) -> usize {
3214            8
3215        }
3216
3217        #[inline(always)]
3218        fn inline_size(_context: fidl::encoding::Context) -> usize {
3219            16
3220        }
3221    }
3222
3223    unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3224        for &mut RealmOptions
3225    {
3226        unsafe fn encode(
3227            self,
3228            encoder: &mut fidl::encoding::Encoder<
3229                '_,
3230                fidl::encoding::DefaultFuchsiaResourceDialect,
3231            >,
3232            offset: usize,
3233            mut depth: fidl::encoding::Depth,
3234        ) -> fidl::Result<()> {
3235            encoder.debug_check_bounds::<RealmOptions>(offset);
3236            // Vector header
3237            let max_ordinal: u64 = self.max_ordinal_present();
3238            encoder.write_num(max_ordinal, offset);
3239            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3240            // Calling encoder.out_of_line_offset(0) is not allowed.
3241            if max_ordinal == 0 {
3242                return Ok(());
3243            }
3244            depth.increment()?;
3245            let envelope_size = 8;
3246            let bytes_len = max_ordinal as usize * envelope_size;
3247            #[allow(unused_variables)]
3248            let offset = encoder.out_of_line_offset(bytes_len);
3249            let mut _prev_end_offset: usize = 0;
3250            if 1 > max_ordinal {
3251                return Ok(());
3252            }
3253
3254            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3255            // are envelope_size bytes.
3256            let cur_offset: usize = (1 - 1) * envelope_size;
3257
3258            // Zero reserved fields.
3259            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3260
3261            // Safety:
3262            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3263            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3264            //   envelope_size bytes, there is always sufficient room.
3265            fidl::encoding::encode_in_envelope_optional::<
3266                bool,
3267                fidl::encoding::DefaultFuchsiaResourceDialect,
3268            >(
3269                self.use_real_reference_clock
3270                    .as_ref()
3271                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3272                encoder,
3273                offset + cur_offset,
3274                depth,
3275            )?;
3276
3277            _prev_end_offset = cur_offset + envelope_size;
3278            if 2 > max_ordinal {
3279                return Ok(());
3280            }
3281
3282            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3283            // are envelope_size bytes.
3284            let cur_offset: usize = (2 - 1) * envelope_size;
3285
3286            // Zero reserved fields.
3287            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3288
3289            // Safety:
3290            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3291            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3292            //   envelope_size bytes, there is always sufficient room.
3293            fidl::encoding::encode_in_envelope_optional::<
3294                RtcOptions,
3295                fidl::encoding::DefaultFuchsiaResourceDialect,
3296            >(
3297                self.rtc
3298                    .as_mut()
3299                    .map(<RtcOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3300                encoder,
3301                offset + cur_offset,
3302                depth,
3303            )?;
3304
3305            _prev_end_offset = cur_offset + envelope_size;
3306
3307            Ok(())
3308        }
3309    }
3310
3311    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
3312        #[inline(always)]
3313        fn new_empty() -> Self {
3314            Self::default()
3315        }
3316
3317        unsafe fn decode(
3318            &mut self,
3319            decoder: &mut fidl::encoding::Decoder<
3320                '_,
3321                fidl::encoding::DefaultFuchsiaResourceDialect,
3322            >,
3323            offset: usize,
3324            mut depth: fidl::encoding::Depth,
3325        ) -> fidl::Result<()> {
3326            decoder.debug_check_bounds::<Self>(offset);
3327            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3328                None => return Err(fidl::Error::NotNullable),
3329                Some(len) => len,
3330            };
3331            // Calling decoder.out_of_line_offset(0) is not allowed.
3332            if len == 0 {
3333                return Ok(());
3334            };
3335            depth.increment()?;
3336            let envelope_size = 8;
3337            let bytes_len = len * envelope_size;
3338            let offset = decoder.out_of_line_offset(bytes_len)?;
3339            // Decode the envelope for each type.
3340            let mut _next_ordinal_to_read = 0;
3341            let mut next_offset = offset;
3342            let end_offset = offset + bytes_len;
3343            _next_ordinal_to_read += 1;
3344            if next_offset >= end_offset {
3345                return Ok(());
3346            }
3347
3348            // Decode unknown envelopes for gaps in ordinals.
3349            while _next_ordinal_to_read < 1 {
3350                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3351                _next_ordinal_to_read += 1;
3352                next_offset += envelope_size;
3353            }
3354
3355            let next_out_of_line = decoder.next_out_of_line();
3356            let handles_before = decoder.remaining_handles();
3357            if let Some((inlined, num_bytes, num_handles)) =
3358                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3359            {
3360                let member_inline_size =
3361                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3362                if inlined != (member_inline_size <= 4) {
3363                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3364                }
3365                let inner_offset;
3366                let mut inner_depth = depth.clone();
3367                if inlined {
3368                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3369                    inner_offset = next_offset;
3370                } else {
3371                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3372                    inner_depth.increment()?;
3373                }
3374                let val_ref = self.use_real_reference_clock.get_or_insert_with(|| {
3375                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3376                });
3377                fidl::decode!(
3378                    bool,
3379                    fidl::encoding::DefaultFuchsiaResourceDialect,
3380                    val_ref,
3381                    decoder,
3382                    inner_offset,
3383                    inner_depth
3384                )?;
3385                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3386                {
3387                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3388                }
3389                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3390                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3391                }
3392            }
3393
3394            next_offset += envelope_size;
3395            _next_ordinal_to_read += 1;
3396            if next_offset >= end_offset {
3397                return Ok(());
3398            }
3399
3400            // Decode unknown envelopes for gaps in ordinals.
3401            while _next_ordinal_to_read < 2 {
3402                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3403                _next_ordinal_to_read += 1;
3404                next_offset += envelope_size;
3405            }
3406
3407            let next_out_of_line = decoder.next_out_of_line();
3408            let handles_before = decoder.remaining_handles();
3409            if let Some((inlined, num_bytes, num_handles)) =
3410                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3411            {
3412                let member_inline_size =
3413                    <RtcOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3414                if inlined != (member_inline_size <= 4) {
3415                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3416                }
3417                let inner_offset;
3418                let mut inner_depth = depth.clone();
3419                if inlined {
3420                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3421                    inner_offset = next_offset;
3422                } else {
3423                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3424                    inner_depth.increment()?;
3425                }
3426                let val_ref = self.rtc.get_or_insert_with(|| {
3427                    fidl::new_empty!(RtcOptions, fidl::encoding::DefaultFuchsiaResourceDialect)
3428                });
3429                fidl::decode!(
3430                    RtcOptions,
3431                    fidl::encoding::DefaultFuchsiaResourceDialect,
3432                    val_ref,
3433                    decoder,
3434                    inner_offset,
3435                    inner_depth
3436                )?;
3437                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3438                {
3439                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3440                }
3441                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3442                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3443                }
3444            }
3445
3446            next_offset += envelope_size;
3447
3448            // Decode the remaining unknown envelopes.
3449            while next_offset < end_offset {
3450                _next_ordinal_to_read += 1;
3451                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3452                next_offset += envelope_size;
3453            }
3454
3455            Ok(())
3456        }
3457    }
3458
3459    impl fidl::encoding::ResourceTypeMarker for RtcOptions {
3460        type Borrowed<'a> = &'a mut Self;
3461        fn take_or_borrow<'a>(
3462            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3463        ) -> Self::Borrowed<'a> {
3464            value
3465        }
3466    }
3467
3468    unsafe impl fidl::encoding::TypeMarker for RtcOptions {
3469        type Owned = Self;
3470
3471        #[inline(always)]
3472        fn inline_align(_context: fidl::encoding::Context) -> usize {
3473            8
3474        }
3475
3476        #[inline(always)]
3477        fn inline_size(_context: fidl::encoding::Context) -> usize {
3478            16
3479        }
3480    }
3481
3482    unsafe impl fidl::encoding::Encode<RtcOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3483        for &mut RtcOptions
3484    {
3485        #[inline]
3486        unsafe fn encode(
3487            self,
3488            encoder: &mut fidl::encoding::Encoder<
3489                '_,
3490                fidl::encoding::DefaultFuchsiaResourceDialect,
3491            >,
3492            offset: usize,
3493            _depth: fidl::encoding::Depth,
3494        ) -> fidl::Result<()> {
3495            encoder.debug_check_bounds::<RtcOptions>(offset);
3496            encoder.write_num::<u64>(self.ordinal(), offset);
3497            match self {
3498                RtcOptions::DevClassRtc(ref mut val) => fidl::encoding::encode_in_envelope::<
3499                    fidl::encoding::Endpoint<
3500                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3501                    >,
3502                    fidl::encoding::DefaultFuchsiaResourceDialect,
3503                >(
3504                    <fidl::encoding::Endpoint<
3505                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3506                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3507                        val
3508                    ),
3509                    encoder,
3510                    offset + 8,
3511                    _depth,
3512                ),
3513                RtcOptions::InitialRtcTime(ref val) => fidl::encoding::encode_in_envelope::<
3514                    i64,
3515                    fidl::encoding::DefaultFuchsiaResourceDialect,
3516                >(
3517                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
3518                    encoder,
3519                    offset + 8,
3520                    _depth,
3521                ),
3522                RtcOptions::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3523            }
3524        }
3525    }
3526
3527    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RtcOptions {
3528        #[inline(always)]
3529        fn new_empty() -> Self {
3530            Self::__SourceBreaking { unknown_ordinal: 0 }
3531        }
3532
3533        #[inline]
3534        unsafe fn decode(
3535            &mut self,
3536            decoder: &mut fidl::encoding::Decoder<
3537                '_,
3538                fidl::encoding::DefaultFuchsiaResourceDialect,
3539            >,
3540            offset: usize,
3541            mut depth: fidl::encoding::Depth,
3542        ) -> fidl::Result<()> {
3543            decoder.debug_check_bounds::<Self>(offset);
3544            #[allow(unused_variables)]
3545            let next_out_of_line = decoder.next_out_of_line();
3546            let handles_before = decoder.remaining_handles();
3547            let (ordinal, inlined, num_bytes, num_handles) =
3548                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3549
3550            let member_inline_size = match ordinal {
3551                1 => <fidl::encoding::Endpoint<
3552                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3553                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3554                2 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3555                0 => return Err(fidl::Error::UnknownUnionTag),
3556                _ => num_bytes as usize,
3557            };
3558
3559            if inlined != (member_inline_size <= 4) {
3560                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3561            }
3562            let _inner_offset;
3563            if inlined {
3564                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3565                _inner_offset = offset + 8;
3566            } else {
3567                depth.increment()?;
3568                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3569            }
3570            match ordinal {
3571                1 => {
3572                    #[allow(irrefutable_let_patterns)]
3573                    if let RtcOptions::DevClassRtc(_) = self {
3574                        // Do nothing, read the value into the object
3575                    } else {
3576                        // Initialize `self` to the right variant
3577                        *self = RtcOptions::DevClassRtc(fidl::new_empty!(
3578                            fidl::encoding::Endpoint<
3579                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3580                            >,
3581                            fidl::encoding::DefaultFuchsiaResourceDialect
3582                        ));
3583                    }
3584                    #[allow(irrefutable_let_patterns)]
3585                    if let RtcOptions::DevClassRtc(ref mut val) = self {
3586                        fidl::decode!(
3587                            fidl::encoding::Endpoint<
3588                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3589                            >,
3590                            fidl::encoding::DefaultFuchsiaResourceDialect,
3591                            val,
3592                            decoder,
3593                            _inner_offset,
3594                            depth
3595                        )?;
3596                    } else {
3597                        unreachable!()
3598                    }
3599                }
3600                2 => {
3601                    #[allow(irrefutable_let_patterns)]
3602                    if let RtcOptions::InitialRtcTime(_) = self {
3603                        // Do nothing, read the value into the object
3604                    } else {
3605                        // Initialize `self` to the right variant
3606                        *self = RtcOptions::InitialRtcTime(fidl::new_empty!(
3607                            i64,
3608                            fidl::encoding::DefaultFuchsiaResourceDialect
3609                        ));
3610                    }
3611                    #[allow(irrefutable_let_patterns)]
3612                    if let RtcOptions::InitialRtcTime(ref mut val) = self {
3613                        fidl::decode!(
3614                            i64,
3615                            fidl::encoding::DefaultFuchsiaResourceDialect,
3616                            val,
3617                            decoder,
3618                            _inner_offset,
3619                            depth
3620                        )?;
3621                    } else {
3622                        unreachable!()
3623                    }
3624                }
3625                #[allow(deprecated)]
3626                ordinal => {
3627                    for _ in 0..num_handles {
3628                        decoder.drop_next_handle()?;
3629                    }
3630                    *self = RtcOptions::__SourceBreaking { unknown_ordinal: ordinal };
3631                }
3632            }
3633            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3634                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3635            }
3636            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3637                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3638            }
3639            Ok(())
3640        }
3641    }
3642}