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