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_fuchsia_time_external_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct AdjustMarker;
16
17impl fidl::endpoints::ProtocolMarker for AdjustMarker {
18 type Proxy = AdjustProxy;
19 type RequestStream = AdjustRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = AdjustSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.time.external.Adjust";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for AdjustMarker {}
26pub type AdjustReportBootToUtcMappingResult = Result<(), Error>;
27
28pub trait AdjustProxyInterface: Send + Sync {
29 type ReportBootToUtcMappingResponseFut: std::future::Future<Output = Result<AdjustReportBootToUtcMappingResult, fidl::Error>>
30 + Send;
31 fn r#report_boot_to_utc_mapping(
32 &self,
33 boot_reference: fidl::BootInstant,
34 utc_reference: i64,
35 ) -> Self::ReportBootToUtcMappingResponseFut;
36}
37#[derive(Debug)]
38#[cfg(target_os = "fuchsia")]
39pub struct AdjustSynchronousProxy {
40 client: fidl::client::sync::Client,
41}
42
43#[cfg(target_os = "fuchsia")]
44impl fidl::endpoints::SynchronousProxy for AdjustSynchronousProxy {
45 type Proxy = AdjustProxy;
46 type Protocol = AdjustMarker;
47
48 fn from_channel(inner: fidl::Channel) -> Self {
49 Self::new(inner)
50 }
51
52 fn into_channel(self) -> fidl::Channel {
53 self.client.into_channel()
54 }
55
56 fn as_channel(&self) -> &fidl::Channel {
57 self.client.as_channel()
58 }
59}
60
61#[cfg(target_os = "fuchsia")]
62impl AdjustSynchronousProxy {
63 pub fn new(channel: fidl::Channel) -> Self {
64 let protocol_name = <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
65 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
66 }
67
68 pub fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 pub fn wait_for_event(
75 &self,
76 deadline: zx::MonotonicInstant,
77 ) -> Result<AdjustEvent, fidl::Error> {
78 AdjustEvent::decode(self.client.wait_for_event(deadline)?)
79 }
80
81 pub fn r#report_boot_to_utc_mapping(
99 &self,
100 mut boot_reference: fidl::BootInstant,
101 mut utc_reference: i64,
102 ___deadline: zx::MonotonicInstant,
103 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
104 let _response = self.client.send_query::<
105 AdjustReportBootToUtcMappingRequest,
106 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
107 >(
108 (boot_reference, utc_reference,),
109 0x1186fc4a8c7f7fbe,
110 fidl::encoding::DynamicFlags::empty(),
111 ___deadline,
112 )?;
113 Ok(_response.map(|x| x))
114 }
115}
116
117#[cfg(target_os = "fuchsia")]
118impl From<AdjustSynchronousProxy> for zx::Handle {
119 fn from(value: AdjustSynchronousProxy) -> Self {
120 value.into_channel().into()
121 }
122}
123
124#[cfg(target_os = "fuchsia")]
125impl From<fidl::Channel> for AdjustSynchronousProxy {
126 fn from(value: fidl::Channel) -> Self {
127 Self::new(value)
128 }
129}
130
131#[derive(Debug, Clone)]
132pub struct AdjustProxy {
133 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for AdjustProxy {
137 type Protocol = AdjustMarker;
138
139 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140 Self::new(inner)
141 }
142
143 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144 self.client.into_channel().map_err(|client| Self { client })
145 }
146
147 fn as_channel(&self) -> &::fidl::AsyncChannel {
148 self.client.as_channel()
149 }
150}
151
152impl AdjustProxy {
153 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155 let protocol_name = <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156 Self { client: fidl::client::Client::new(channel, protocol_name) }
157 }
158
159 pub fn take_event_stream(&self) -> AdjustEventStream {
165 AdjustEventStream { event_receiver: self.client.take_event_receiver() }
166 }
167
168 pub fn r#report_boot_to_utc_mapping(
186 &self,
187 mut boot_reference: fidl::BootInstant,
188 mut utc_reference: i64,
189 ) -> fidl::client::QueryResponseFut<
190 AdjustReportBootToUtcMappingResult,
191 fidl::encoding::DefaultFuchsiaResourceDialect,
192 > {
193 AdjustProxyInterface::r#report_boot_to_utc_mapping(self, boot_reference, utc_reference)
194 }
195}
196
197impl AdjustProxyInterface for AdjustProxy {
198 type ReportBootToUtcMappingResponseFut = fidl::client::QueryResponseFut<
199 AdjustReportBootToUtcMappingResult,
200 fidl::encoding::DefaultFuchsiaResourceDialect,
201 >;
202 fn r#report_boot_to_utc_mapping(
203 &self,
204 mut boot_reference: fidl::BootInstant,
205 mut utc_reference: i64,
206 ) -> Self::ReportBootToUtcMappingResponseFut {
207 fn _decode(
208 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
209 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
210 let _response = fidl::client::decode_transaction_body::<
211 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
212 fidl::encoding::DefaultFuchsiaResourceDialect,
213 0x1186fc4a8c7f7fbe,
214 >(_buf?)?;
215 Ok(_response.map(|x| x))
216 }
217 self.client.send_query_and_decode::<
218 AdjustReportBootToUtcMappingRequest,
219 AdjustReportBootToUtcMappingResult,
220 >(
221 (boot_reference, utc_reference,),
222 0x1186fc4a8c7f7fbe,
223 fidl::encoding::DynamicFlags::empty(),
224 _decode,
225 )
226 }
227}
228
229pub struct AdjustEventStream {
230 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
231}
232
233impl std::marker::Unpin for AdjustEventStream {}
234
235impl futures::stream::FusedStream for AdjustEventStream {
236 fn is_terminated(&self) -> bool {
237 self.event_receiver.is_terminated()
238 }
239}
240
241impl futures::Stream for AdjustEventStream {
242 type Item = Result<AdjustEvent, fidl::Error>;
243
244 fn poll_next(
245 mut self: std::pin::Pin<&mut Self>,
246 cx: &mut std::task::Context<'_>,
247 ) -> std::task::Poll<Option<Self::Item>> {
248 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
249 &mut self.event_receiver,
250 cx
251 )?) {
252 Some(buf) => std::task::Poll::Ready(Some(AdjustEvent::decode(buf))),
253 None => std::task::Poll::Ready(None),
254 }
255 }
256}
257
258#[derive(Debug)]
259pub enum AdjustEvent {}
260
261impl AdjustEvent {
262 fn decode(
264 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
265 ) -> Result<AdjustEvent, fidl::Error> {
266 let (bytes, _handles) = buf.split_mut();
267 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
268 debug_assert_eq!(tx_header.tx_id, 0);
269 match tx_header.ordinal {
270 _ => Err(fidl::Error::UnknownOrdinal {
271 ordinal: tx_header.ordinal,
272 protocol_name: <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
273 }),
274 }
275 }
276}
277
278pub struct AdjustRequestStream {
280 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
281 is_terminated: bool,
282}
283
284impl std::marker::Unpin for AdjustRequestStream {}
285
286impl futures::stream::FusedStream for AdjustRequestStream {
287 fn is_terminated(&self) -> bool {
288 self.is_terminated
289 }
290}
291
292impl fidl::endpoints::RequestStream for AdjustRequestStream {
293 type Protocol = AdjustMarker;
294 type ControlHandle = AdjustControlHandle;
295
296 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
297 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
298 }
299
300 fn control_handle(&self) -> Self::ControlHandle {
301 AdjustControlHandle { inner: self.inner.clone() }
302 }
303
304 fn into_inner(
305 self,
306 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
307 {
308 (self.inner, self.is_terminated)
309 }
310
311 fn from_inner(
312 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
313 is_terminated: bool,
314 ) -> Self {
315 Self { inner, is_terminated }
316 }
317}
318
319impl futures::Stream for AdjustRequestStream {
320 type Item = Result<AdjustRequest, fidl::Error>;
321
322 fn poll_next(
323 mut self: std::pin::Pin<&mut Self>,
324 cx: &mut std::task::Context<'_>,
325 ) -> std::task::Poll<Option<Self::Item>> {
326 let this = &mut *self;
327 if this.inner.check_shutdown(cx) {
328 this.is_terminated = true;
329 return std::task::Poll::Ready(None);
330 }
331 if this.is_terminated {
332 panic!("polled AdjustRequestStream after completion");
333 }
334 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
335 |bytes, handles| {
336 match this.inner.channel().read_etc(cx, bytes, handles) {
337 std::task::Poll::Ready(Ok(())) => {}
338 std::task::Poll::Pending => return std::task::Poll::Pending,
339 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
340 this.is_terminated = true;
341 return std::task::Poll::Ready(None);
342 }
343 std::task::Poll::Ready(Err(e)) => {
344 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
345 e.into(),
346 ))))
347 }
348 }
349
350 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
352
353 std::task::Poll::Ready(Some(match header.ordinal {
354 0x1186fc4a8c7f7fbe => {
355 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
356 let mut req = fidl::new_empty!(
357 AdjustReportBootToUtcMappingRequest,
358 fidl::encoding::DefaultFuchsiaResourceDialect
359 );
360 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdjustReportBootToUtcMappingRequest>(&header, _body_bytes, handles, &mut req)?;
361 let control_handle = AdjustControlHandle { inner: this.inner.clone() };
362 Ok(AdjustRequest::ReportBootToUtcMapping {
363 boot_reference: req.boot_reference,
364 utc_reference: req.utc_reference,
365
366 responder: AdjustReportBootToUtcMappingResponder {
367 control_handle: std::mem::ManuallyDrop::new(control_handle),
368 tx_id: header.tx_id,
369 },
370 })
371 }
372 _ => Err(fidl::Error::UnknownOrdinal {
373 ordinal: header.ordinal,
374 protocol_name:
375 <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
376 }),
377 }))
378 },
379 )
380 }
381}
382
383#[derive(Debug)]
388pub enum AdjustRequest {
389 ReportBootToUtcMapping {
407 boot_reference: fidl::BootInstant,
408 utc_reference: i64,
409 responder: AdjustReportBootToUtcMappingResponder,
410 },
411}
412
413impl AdjustRequest {
414 #[allow(irrefutable_let_patterns)]
415 pub fn into_report_boot_to_utc_mapping(
416 self,
417 ) -> Option<(fidl::BootInstant, i64, AdjustReportBootToUtcMappingResponder)> {
418 if let AdjustRequest::ReportBootToUtcMapping { boot_reference, utc_reference, responder } =
419 self
420 {
421 Some((boot_reference, utc_reference, responder))
422 } else {
423 None
424 }
425 }
426
427 pub fn method_name(&self) -> &'static str {
429 match *self {
430 AdjustRequest::ReportBootToUtcMapping { .. } => "report_boot_to_utc_mapping",
431 }
432 }
433}
434
435#[derive(Debug, Clone)]
436pub struct AdjustControlHandle {
437 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
438}
439
440impl fidl::endpoints::ControlHandle for AdjustControlHandle {
441 fn shutdown(&self) {
442 self.inner.shutdown()
443 }
444 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
445 self.inner.shutdown_with_epitaph(status)
446 }
447
448 fn is_closed(&self) -> bool {
449 self.inner.channel().is_closed()
450 }
451 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
452 self.inner.channel().on_closed()
453 }
454
455 #[cfg(target_os = "fuchsia")]
456 fn signal_peer(
457 &self,
458 clear_mask: zx::Signals,
459 set_mask: zx::Signals,
460 ) -> Result<(), zx_status::Status> {
461 use fidl::Peered;
462 self.inner.channel().signal_peer(clear_mask, set_mask)
463 }
464}
465
466impl AdjustControlHandle {}
467
468#[must_use = "FIDL methods require a response to be sent"]
469#[derive(Debug)]
470pub struct AdjustReportBootToUtcMappingResponder {
471 control_handle: std::mem::ManuallyDrop<AdjustControlHandle>,
472 tx_id: u32,
473}
474
475impl std::ops::Drop for AdjustReportBootToUtcMappingResponder {
479 fn drop(&mut self) {
480 self.control_handle.shutdown();
481 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
483 }
484}
485
486impl fidl::endpoints::Responder for AdjustReportBootToUtcMappingResponder {
487 type ControlHandle = AdjustControlHandle;
488
489 fn control_handle(&self) -> &AdjustControlHandle {
490 &self.control_handle
491 }
492
493 fn drop_without_shutdown(mut self) {
494 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
496 std::mem::forget(self);
498 }
499}
500
501impl AdjustReportBootToUtcMappingResponder {
502 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
506 let _result = self.send_raw(result);
507 if _result.is_err() {
508 self.control_handle.shutdown();
509 }
510 self.drop_without_shutdown();
511 _result
512 }
513
514 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
516 let _result = self.send_raw(result);
517 self.drop_without_shutdown();
518 _result
519 }
520
521 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
522 self.control_handle
523 .inner
524 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
525 result,
526 self.tx_id,
527 0x1186fc4a8c7f7fbe,
528 fidl::encoding::DynamicFlags::empty(),
529 )
530 }
531}
532
533#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
534pub struct PullSourceMarker;
535
536impl fidl::endpoints::ProtocolMarker for PullSourceMarker {
537 type Proxy = PullSourceProxy;
538 type RequestStream = PullSourceRequestStream;
539 #[cfg(target_os = "fuchsia")]
540 type SynchronousProxy = PullSourceSynchronousProxy;
541
542 const DEBUG_NAME: &'static str = "fuchsia.time.external.PullSource";
543}
544impl fidl::endpoints::DiscoverableProtocolMarker for PullSourceMarker {}
545pub type PullSourceSampleResult = Result<TimeSample, Error>;
546
547pub trait PullSourceProxyInterface: Send + Sync {
548 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
549 type SampleResponseFut: std::future::Future<Output = Result<PullSourceSampleResult, fidl::Error>>
550 + Send;
551 fn r#sample(&self, urgency: Urgency) -> Self::SampleResponseFut;
552 type NextPossibleSampleTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>>
553 + Send;
554 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut;
555}
556#[derive(Debug)]
557#[cfg(target_os = "fuchsia")]
558pub struct PullSourceSynchronousProxy {
559 client: fidl::client::sync::Client,
560}
561
562#[cfg(target_os = "fuchsia")]
563impl fidl::endpoints::SynchronousProxy for PullSourceSynchronousProxy {
564 type Proxy = PullSourceProxy;
565 type Protocol = PullSourceMarker;
566
567 fn from_channel(inner: fidl::Channel) -> Self {
568 Self::new(inner)
569 }
570
571 fn into_channel(self) -> fidl::Channel {
572 self.client.into_channel()
573 }
574
575 fn as_channel(&self) -> &fidl::Channel {
576 self.client.as_channel()
577 }
578}
579
580#[cfg(target_os = "fuchsia")]
581impl PullSourceSynchronousProxy {
582 pub fn new(channel: fidl::Channel) -> Self {
583 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
584 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
585 }
586
587 pub fn into_channel(self) -> fidl::Channel {
588 self.client.into_channel()
589 }
590
591 pub fn wait_for_event(
594 &self,
595 deadline: zx::MonotonicInstant,
596 ) -> Result<PullSourceEvent, fidl::Error> {
597 PullSourceEvent::decode(self.client.wait_for_event(deadline)?)
598 }
599
600 pub fn r#update_device_properties(
603 &self,
604 mut properties: &Properties,
605 ) -> Result<(), fidl::Error> {
606 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
607 (properties,),
608 0x63704f8bd0962f00,
609 fidl::encoding::DynamicFlags::empty(),
610 )
611 }
612
613 pub fn r#sample(
628 &self,
629 mut urgency: Urgency,
630 ___deadline: zx::MonotonicInstant,
631 ) -> Result<PullSourceSampleResult, fidl::Error> {
632 let _response = self.client.send_query::<
633 PullSourceSampleRequest,
634 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
635 >(
636 (urgency,),
637 0x2d29007d8c9cb45a,
638 fidl::encoding::DynamicFlags::empty(),
639 ___deadline,
640 )?;
641 Ok(_response.map(|x| x.sample))
642 }
643
644 pub fn r#next_possible_sample_time(
648 &self,
649 ___deadline: zx::MonotonicInstant,
650 ) -> Result<i64, fidl::Error> {
651 let _response = self
652 .client
653 .send_query::<fidl::encoding::EmptyPayload, PullSourceNextPossibleSampleTimeResponse>(
654 (),
655 0x69ca2b1fd63e88a5,
656 fidl::encoding::DynamicFlags::empty(),
657 ___deadline,
658 )?;
659 Ok(_response.next_possible_time)
660 }
661}
662
663#[cfg(target_os = "fuchsia")]
664impl From<PullSourceSynchronousProxy> for zx::Handle {
665 fn from(value: PullSourceSynchronousProxy) -> Self {
666 value.into_channel().into()
667 }
668}
669
670#[cfg(target_os = "fuchsia")]
671impl From<fidl::Channel> for PullSourceSynchronousProxy {
672 fn from(value: fidl::Channel) -> Self {
673 Self::new(value)
674 }
675}
676
677#[derive(Debug, Clone)]
678pub struct PullSourceProxy {
679 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
680}
681
682impl fidl::endpoints::Proxy for PullSourceProxy {
683 type Protocol = PullSourceMarker;
684
685 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
686 Self::new(inner)
687 }
688
689 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
690 self.client.into_channel().map_err(|client| Self { client })
691 }
692
693 fn as_channel(&self) -> &::fidl::AsyncChannel {
694 self.client.as_channel()
695 }
696}
697
698impl PullSourceProxy {
699 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
701 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
702 Self { client: fidl::client::Client::new(channel, protocol_name) }
703 }
704
705 pub fn take_event_stream(&self) -> PullSourceEventStream {
711 PullSourceEventStream { event_receiver: self.client.take_event_receiver() }
712 }
713
714 pub fn r#update_device_properties(
717 &self,
718 mut properties: &Properties,
719 ) -> Result<(), fidl::Error> {
720 PullSourceProxyInterface::r#update_device_properties(self, properties)
721 }
722
723 pub fn r#sample(
738 &self,
739 mut urgency: Urgency,
740 ) -> fidl::client::QueryResponseFut<
741 PullSourceSampleResult,
742 fidl::encoding::DefaultFuchsiaResourceDialect,
743 > {
744 PullSourceProxyInterface::r#sample(self, urgency)
745 }
746
747 pub fn r#next_possible_sample_time(
751 &self,
752 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
753 PullSourceProxyInterface::r#next_possible_sample_time(self)
754 }
755}
756
757impl PullSourceProxyInterface for PullSourceProxy {
758 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
759 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
760 (properties,),
761 0x63704f8bd0962f00,
762 fidl::encoding::DynamicFlags::empty(),
763 )
764 }
765
766 type SampleResponseFut = fidl::client::QueryResponseFut<
767 PullSourceSampleResult,
768 fidl::encoding::DefaultFuchsiaResourceDialect,
769 >;
770 fn r#sample(&self, mut urgency: Urgency) -> Self::SampleResponseFut {
771 fn _decode(
772 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
773 ) -> Result<PullSourceSampleResult, fidl::Error> {
774 let _response = fidl::client::decode_transaction_body::<
775 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
776 fidl::encoding::DefaultFuchsiaResourceDialect,
777 0x2d29007d8c9cb45a,
778 >(_buf?)?;
779 Ok(_response.map(|x| x.sample))
780 }
781 self.client.send_query_and_decode::<PullSourceSampleRequest, PullSourceSampleResult>(
782 (urgency,),
783 0x2d29007d8c9cb45a,
784 fidl::encoding::DynamicFlags::empty(),
785 _decode,
786 )
787 }
788
789 type NextPossibleSampleTimeResponseFut =
790 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
791 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut {
792 fn _decode(
793 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
794 ) -> Result<i64, fidl::Error> {
795 let _response = fidl::client::decode_transaction_body::<
796 PullSourceNextPossibleSampleTimeResponse,
797 fidl::encoding::DefaultFuchsiaResourceDialect,
798 0x69ca2b1fd63e88a5,
799 >(_buf?)?;
800 Ok(_response.next_possible_time)
801 }
802 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
803 (),
804 0x69ca2b1fd63e88a5,
805 fidl::encoding::DynamicFlags::empty(),
806 _decode,
807 )
808 }
809}
810
811pub struct PullSourceEventStream {
812 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
813}
814
815impl std::marker::Unpin for PullSourceEventStream {}
816
817impl futures::stream::FusedStream for PullSourceEventStream {
818 fn is_terminated(&self) -> bool {
819 self.event_receiver.is_terminated()
820 }
821}
822
823impl futures::Stream for PullSourceEventStream {
824 type Item = Result<PullSourceEvent, fidl::Error>;
825
826 fn poll_next(
827 mut self: std::pin::Pin<&mut Self>,
828 cx: &mut std::task::Context<'_>,
829 ) -> std::task::Poll<Option<Self::Item>> {
830 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
831 &mut self.event_receiver,
832 cx
833 )?) {
834 Some(buf) => std::task::Poll::Ready(Some(PullSourceEvent::decode(buf))),
835 None => std::task::Poll::Ready(None),
836 }
837 }
838}
839
840#[derive(Debug)]
841pub enum PullSourceEvent {}
842
843impl PullSourceEvent {
844 fn decode(
846 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
847 ) -> Result<PullSourceEvent, fidl::Error> {
848 let (bytes, _handles) = buf.split_mut();
849 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
850 debug_assert_eq!(tx_header.tx_id, 0);
851 match tx_header.ordinal {
852 _ => Err(fidl::Error::UnknownOrdinal {
853 ordinal: tx_header.ordinal,
854 protocol_name: <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
855 }),
856 }
857 }
858}
859
860pub struct PullSourceRequestStream {
862 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
863 is_terminated: bool,
864}
865
866impl std::marker::Unpin for PullSourceRequestStream {}
867
868impl futures::stream::FusedStream for PullSourceRequestStream {
869 fn is_terminated(&self) -> bool {
870 self.is_terminated
871 }
872}
873
874impl fidl::endpoints::RequestStream for PullSourceRequestStream {
875 type Protocol = PullSourceMarker;
876 type ControlHandle = PullSourceControlHandle;
877
878 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
879 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
880 }
881
882 fn control_handle(&self) -> Self::ControlHandle {
883 PullSourceControlHandle { inner: self.inner.clone() }
884 }
885
886 fn into_inner(
887 self,
888 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
889 {
890 (self.inner, self.is_terminated)
891 }
892
893 fn from_inner(
894 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
895 is_terminated: bool,
896 ) -> Self {
897 Self { inner, is_terminated }
898 }
899}
900
901impl futures::Stream for PullSourceRequestStream {
902 type Item = Result<PullSourceRequest, fidl::Error>;
903
904 fn poll_next(
905 mut self: std::pin::Pin<&mut Self>,
906 cx: &mut std::task::Context<'_>,
907 ) -> std::task::Poll<Option<Self::Item>> {
908 let this = &mut *self;
909 if this.inner.check_shutdown(cx) {
910 this.is_terminated = true;
911 return std::task::Poll::Ready(None);
912 }
913 if this.is_terminated {
914 panic!("polled PullSourceRequestStream after completion");
915 }
916 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
917 |bytes, handles| {
918 match this.inner.channel().read_etc(cx, bytes, handles) {
919 std::task::Poll::Ready(Ok(())) => {}
920 std::task::Poll::Pending => return std::task::Poll::Pending,
921 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
922 this.is_terminated = true;
923 return std::task::Poll::Ready(None);
924 }
925 std::task::Poll::Ready(Err(e)) => {
926 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
927 e.into(),
928 ))))
929 }
930 }
931
932 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
934
935 std::task::Poll::Ready(Some(match header.ordinal {
936 0x63704f8bd0962f00 => {
937 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
938 let mut req = fidl::new_empty!(
939 TimeSourceUpdateDevicePropertiesRequest,
940 fidl::encoding::DefaultFuchsiaResourceDialect
941 );
942 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
943 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
944 Ok(PullSourceRequest::UpdateDeviceProperties {
945 properties: req.properties,
946
947 control_handle,
948 })
949 }
950 0x2d29007d8c9cb45a => {
951 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
952 let mut req = fidl::new_empty!(
953 PullSourceSampleRequest,
954 fidl::encoding::DefaultFuchsiaResourceDialect
955 );
956 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PullSourceSampleRequest>(&header, _body_bytes, handles, &mut req)?;
957 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
958 Ok(PullSourceRequest::Sample {
959 urgency: req.urgency,
960
961 responder: PullSourceSampleResponder {
962 control_handle: std::mem::ManuallyDrop::new(control_handle),
963 tx_id: header.tx_id,
964 },
965 })
966 }
967 0x69ca2b1fd63e88a5 => {
968 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
969 let mut req = fidl::new_empty!(
970 fidl::encoding::EmptyPayload,
971 fidl::encoding::DefaultFuchsiaResourceDialect
972 );
973 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
974 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
975 Ok(PullSourceRequest::NextPossibleSampleTime {
976 responder: PullSourceNextPossibleSampleTimeResponder {
977 control_handle: std::mem::ManuallyDrop::new(control_handle),
978 tx_id: header.tx_id,
979 },
980 })
981 }
982 _ => Err(fidl::Error::UnknownOrdinal {
983 ordinal: header.ordinal,
984 protocol_name:
985 <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
986 }),
987 }))
988 },
989 )
990 }
991}
992
993#[derive(Debug)]
995pub enum PullSourceRequest {
996 UpdateDeviceProperties { properties: Properties, control_handle: PullSourceControlHandle },
999 Sample { urgency: Urgency, responder: PullSourceSampleResponder },
1014 NextPossibleSampleTime { responder: PullSourceNextPossibleSampleTimeResponder },
1018}
1019
1020impl PullSourceRequest {
1021 #[allow(irrefutable_let_patterns)]
1022 pub fn into_update_device_properties(self) -> Option<(Properties, PullSourceControlHandle)> {
1023 if let PullSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1024 Some((properties, control_handle))
1025 } else {
1026 None
1027 }
1028 }
1029
1030 #[allow(irrefutable_let_patterns)]
1031 pub fn into_sample(self) -> Option<(Urgency, PullSourceSampleResponder)> {
1032 if let PullSourceRequest::Sample { urgency, responder } = self {
1033 Some((urgency, responder))
1034 } else {
1035 None
1036 }
1037 }
1038
1039 #[allow(irrefutable_let_patterns)]
1040 pub fn into_next_possible_sample_time(
1041 self,
1042 ) -> Option<(PullSourceNextPossibleSampleTimeResponder)> {
1043 if let PullSourceRequest::NextPossibleSampleTime { responder } = self {
1044 Some((responder))
1045 } else {
1046 None
1047 }
1048 }
1049
1050 pub fn method_name(&self) -> &'static str {
1052 match *self {
1053 PullSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1054 PullSourceRequest::Sample { .. } => "sample",
1055 PullSourceRequest::NextPossibleSampleTime { .. } => "next_possible_sample_time",
1056 }
1057 }
1058}
1059
1060#[derive(Debug, Clone)]
1061pub struct PullSourceControlHandle {
1062 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1063}
1064
1065impl fidl::endpoints::ControlHandle for PullSourceControlHandle {
1066 fn shutdown(&self) {
1067 self.inner.shutdown()
1068 }
1069 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1070 self.inner.shutdown_with_epitaph(status)
1071 }
1072
1073 fn is_closed(&self) -> bool {
1074 self.inner.channel().is_closed()
1075 }
1076 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1077 self.inner.channel().on_closed()
1078 }
1079
1080 #[cfg(target_os = "fuchsia")]
1081 fn signal_peer(
1082 &self,
1083 clear_mask: zx::Signals,
1084 set_mask: zx::Signals,
1085 ) -> Result<(), zx_status::Status> {
1086 use fidl::Peered;
1087 self.inner.channel().signal_peer(clear_mask, set_mask)
1088 }
1089}
1090
1091impl PullSourceControlHandle {}
1092
1093#[must_use = "FIDL methods require a response to be sent"]
1094#[derive(Debug)]
1095pub struct PullSourceSampleResponder {
1096 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1097 tx_id: u32,
1098}
1099
1100impl std::ops::Drop for PullSourceSampleResponder {
1104 fn drop(&mut self) {
1105 self.control_handle.shutdown();
1106 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1108 }
1109}
1110
1111impl fidl::endpoints::Responder for PullSourceSampleResponder {
1112 type ControlHandle = PullSourceControlHandle;
1113
1114 fn control_handle(&self) -> &PullSourceControlHandle {
1115 &self.control_handle
1116 }
1117
1118 fn drop_without_shutdown(mut self) {
1119 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1121 std::mem::forget(self);
1123 }
1124}
1125
1126impl PullSourceSampleResponder {
1127 pub fn send(self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1131 let _result = self.send_raw(result);
1132 if _result.is_err() {
1133 self.control_handle.shutdown();
1134 }
1135 self.drop_without_shutdown();
1136 _result
1137 }
1138
1139 pub fn send_no_shutdown_on_err(
1141 self,
1142 mut result: Result<&TimeSample, Error>,
1143 ) -> Result<(), fidl::Error> {
1144 let _result = self.send_raw(result);
1145 self.drop_without_shutdown();
1146 _result
1147 }
1148
1149 fn send_raw(&self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1150 self.control_handle
1151 .inner
1152 .send::<fidl::encoding::ResultType<PullSourceSampleResponse, Error>>(
1153 result.map(|sample| (sample,)),
1154 self.tx_id,
1155 0x2d29007d8c9cb45a,
1156 fidl::encoding::DynamicFlags::empty(),
1157 )
1158 }
1159}
1160
1161#[must_use = "FIDL methods require a response to be sent"]
1162#[derive(Debug)]
1163pub struct PullSourceNextPossibleSampleTimeResponder {
1164 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1165 tx_id: u32,
1166}
1167
1168impl std::ops::Drop for PullSourceNextPossibleSampleTimeResponder {
1172 fn drop(&mut self) {
1173 self.control_handle.shutdown();
1174 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1176 }
1177}
1178
1179impl fidl::endpoints::Responder for PullSourceNextPossibleSampleTimeResponder {
1180 type ControlHandle = PullSourceControlHandle;
1181
1182 fn control_handle(&self) -> &PullSourceControlHandle {
1183 &self.control_handle
1184 }
1185
1186 fn drop_without_shutdown(mut self) {
1187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189 std::mem::forget(self);
1191 }
1192}
1193
1194impl PullSourceNextPossibleSampleTimeResponder {
1195 pub fn send(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1199 let _result = self.send_raw(next_possible_time);
1200 if _result.is_err() {
1201 self.control_handle.shutdown();
1202 }
1203 self.drop_without_shutdown();
1204 _result
1205 }
1206
1207 pub fn send_no_shutdown_on_err(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1209 let _result = self.send_raw(next_possible_time);
1210 self.drop_without_shutdown();
1211 _result
1212 }
1213
1214 fn send_raw(&self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1215 self.control_handle.inner.send::<PullSourceNextPossibleSampleTimeResponse>(
1216 (next_possible_time,),
1217 self.tx_id,
1218 0x69ca2b1fd63e88a5,
1219 fidl::encoding::DynamicFlags::empty(),
1220 )
1221 }
1222}
1223
1224#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1225pub struct PushSourceMarker;
1226
1227impl fidl::endpoints::ProtocolMarker for PushSourceMarker {
1228 type Proxy = PushSourceProxy;
1229 type RequestStream = PushSourceRequestStream;
1230 #[cfg(target_os = "fuchsia")]
1231 type SynchronousProxy = PushSourceSynchronousProxy;
1232
1233 const DEBUG_NAME: &'static str = "fuchsia.time.external.PushSource";
1234}
1235impl fidl::endpoints::DiscoverableProtocolMarker for PushSourceMarker {}
1236
1237pub trait PushSourceProxyInterface: Send + Sync {
1238 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1239 type WatchSampleResponseFut: std::future::Future<Output = Result<TimeSample, fidl::Error>>
1240 + Send;
1241 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut;
1242 type WatchStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
1243 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
1244}
1245#[derive(Debug)]
1246#[cfg(target_os = "fuchsia")]
1247pub struct PushSourceSynchronousProxy {
1248 client: fidl::client::sync::Client,
1249}
1250
1251#[cfg(target_os = "fuchsia")]
1252impl fidl::endpoints::SynchronousProxy for PushSourceSynchronousProxy {
1253 type Proxy = PushSourceProxy;
1254 type Protocol = PushSourceMarker;
1255
1256 fn from_channel(inner: fidl::Channel) -> Self {
1257 Self::new(inner)
1258 }
1259
1260 fn into_channel(self) -> fidl::Channel {
1261 self.client.into_channel()
1262 }
1263
1264 fn as_channel(&self) -> &fidl::Channel {
1265 self.client.as_channel()
1266 }
1267}
1268
1269#[cfg(target_os = "fuchsia")]
1270impl PushSourceSynchronousProxy {
1271 pub fn new(channel: fidl::Channel) -> Self {
1272 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1273 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1274 }
1275
1276 pub fn into_channel(self) -> fidl::Channel {
1277 self.client.into_channel()
1278 }
1279
1280 pub fn wait_for_event(
1283 &self,
1284 deadline: zx::MonotonicInstant,
1285 ) -> Result<PushSourceEvent, fidl::Error> {
1286 PushSourceEvent::decode(self.client.wait_for_event(deadline)?)
1287 }
1288
1289 pub fn r#update_device_properties(
1292 &self,
1293 mut properties: &Properties,
1294 ) -> Result<(), fidl::Error> {
1295 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1296 (properties,),
1297 0x63704f8bd0962f00,
1298 fidl::encoding::DynamicFlags::empty(),
1299 )
1300 }
1301
1302 pub fn r#watch_sample(
1316 &self,
1317 ___deadline: zx::MonotonicInstant,
1318 ) -> Result<TimeSample, fidl::Error> {
1319 let _response =
1320 self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchSampleResponse>(
1321 (),
1322 0x44d515a56e8304dc,
1323 fidl::encoding::DynamicFlags::empty(),
1324 ___deadline,
1325 )?;
1326 Ok(_response.sample)
1327 }
1328
1329 pub fn r#watch_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
1338 let _response =
1339 self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchStatusResponse>(
1340 (),
1341 0x60621a545f488bb1,
1342 fidl::encoding::DynamicFlags::empty(),
1343 ___deadline,
1344 )?;
1345 Ok(_response.status)
1346 }
1347}
1348
1349#[cfg(target_os = "fuchsia")]
1350impl From<PushSourceSynchronousProxy> for zx::Handle {
1351 fn from(value: PushSourceSynchronousProxy) -> Self {
1352 value.into_channel().into()
1353 }
1354}
1355
1356#[cfg(target_os = "fuchsia")]
1357impl From<fidl::Channel> for PushSourceSynchronousProxy {
1358 fn from(value: fidl::Channel) -> Self {
1359 Self::new(value)
1360 }
1361}
1362
1363#[derive(Debug, Clone)]
1364pub struct PushSourceProxy {
1365 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1366}
1367
1368impl fidl::endpoints::Proxy for PushSourceProxy {
1369 type Protocol = PushSourceMarker;
1370
1371 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1372 Self::new(inner)
1373 }
1374
1375 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1376 self.client.into_channel().map_err(|client| Self { client })
1377 }
1378
1379 fn as_channel(&self) -> &::fidl::AsyncChannel {
1380 self.client.as_channel()
1381 }
1382}
1383
1384impl PushSourceProxy {
1385 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1387 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1388 Self { client: fidl::client::Client::new(channel, protocol_name) }
1389 }
1390
1391 pub fn take_event_stream(&self) -> PushSourceEventStream {
1397 PushSourceEventStream { event_receiver: self.client.take_event_receiver() }
1398 }
1399
1400 pub fn r#update_device_properties(
1403 &self,
1404 mut properties: &Properties,
1405 ) -> Result<(), fidl::Error> {
1406 PushSourceProxyInterface::r#update_device_properties(self, properties)
1407 }
1408
1409 pub fn r#watch_sample(
1423 &self,
1424 ) -> fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>
1425 {
1426 PushSourceProxyInterface::r#watch_sample(self)
1427 }
1428
1429 pub fn r#watch_status(
1438 &self,
1439 ) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
1440 PushSourceProxyInterface::r#watch_status(self)
1441 }
1442}
1443
1444impl PushSourceProxyInterface for PushSourceProxy {
1445 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
1446 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1447 (properties,),
1448 0x63704f8bd0962f00,
1449 fidl::encoding::DynamicFlags::empty(),
1450 )
1451 }
1452
1453 type WatchSampleResponseFut =
1454 fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>;
1455 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut {
1456 fn _decode(
1457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1458 ) -> Result<TimeSample, fidl::Error> {
1459 let _response = fidl::client::decode_transaction_body::<
1460 PushSourceWatchSampleResponse,
1461 fidl::encoding::DefaultFuchsiaResourceDialect,
1462 0x44d515a56e8304dc,
1463 >(_buf?)?;
1464 Ok(_response.sample)
1465 }
1466 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TimeSample>(
1467 (),
1468 0x44d515a56e8304dc,
1469 fidl::encoding::DynamicFlags::empty(),
1470 _decode,
1471 )
1472 }
1473
1474 type WatchStatusResponseFut =
1475 fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
1476 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
1477 fn _decode(
1478 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1479 ) -> Result<Status, fidl::Error> {
1480 let _response = fidl::client::decode_transaction_body::<
1481 PushSourceWatchStatusResponse,
1482 fidl::encoding::DefaultFuchsiaResourceDialect,
1483 0x60621a545f488bb1,
1484 >(_buf?)?;
1485 Ok(_response.status)
1486 }
1487 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
1488 (),
1489 0x60621a545f488bb1,
1490 fidl::encoding::DynamicFlags::empty(),
1491 _decode,
1492 )
1493 }
1494}
1495
1496pub struct PushSourceEventStream {
1497 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1498}
1499
1500impl std::marker::Unpin for PushSourceEventStream {}
1501
1502impl futures::stream::FusedStream for PushSourceEventStream {
1503 fn is_terminated(&self) -> bool {
1504 self.event_receiver.is_terminated()
1505 }
1506}
1507
1508impl futures::Stream for PushSourceEventStream {
1509 type Item = Result<PushSourceEvent, fidl::Error>;
1510
1511 fn poll_next(
1512 mut self: std::pin::Pin<&mut Self>,
1513 cx: &mut std::task::Context<'_>,
1514 ) -> std::task::Poll<Option<Self::Item>> {
1515 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1516 &mut self.event_receiver,
1517 cx
1518 )?) {
1519 Some(buf) => std::task::Poll::Ready(Some(PushSourceEvent::decode(buf))),
1520 None => std::task::Poll::Ready(None),
1521 }
1522 }
1523}
1524
1525#[derive(Debug)]
1526pub enum PushSourceEvent {}
1527
1528impl PushSourceEvent {
1529 fn decode(
1531 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1532 ) -> Result<PushSourceEvent, fidl::Error> {
1533 let (bytes, _handles) = buf.split_mut();
1534 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1535 debug_assert_eq!(tx_header.tx_id, 0);
1536 match tx_header.ordinal {
1537 _ => Err(fidl::Error::UnknownOrdinal {
1538 ordinal: tx_header.ordinal,
1539 protocol_name: <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1540 }),
1541 }
1542 }
1543}
1544
1545pub struct PushSourceRequestStream {
1547 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1548 is_terminated: bool,
1549}
1550
1551impl std::marker::Unpin for PushSourceRequestStream {}
1552
1553impl futures::stream::FusedStream for PushSourceRequestStream {
1554 fn is_terminated(&self) -> bool {
1555 self.is_terminated
1556 }
1557}
1558
1559impl fidl::endpoints::RequestStream for PushSourceRequestStream {
1560 type Protocol = PushSourceMarker;
1561 type ControlHandle = PushSourceControlHandle;
1562
1563 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1564 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1565 }
1566
1567 fn control_handle(&self) -> Self::ControlHandle {
1568 PushSourceControlHandle { inner: self.inner.clone() }
1569 }
1570
1571 fn into_inner(
1572 self,
1573 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1574 {
1575 (self.inner, self.is_terminated)
1576 }
1577
1578 fn from_inner(
1579 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1580 is_terminated: bool,
1581 ) -> Self {
1582 Self { inner, is_terminated }
1583 }
1584}
1585
1586impl futures::Stream for PushSourceRequestStream {
1587 type Item = Result<PushSourceRequest, fidl::Error>;
1588
1589 fn poll_next(
1590 mut self: std::pin::Pin<&mut Self>,
1591 cx: &mut std::task::Context<'_>,
1592 ) -> std::task::Poll<Option<Self::Item>> {
1593 let this = &mut *self;
1594 if this.inner.check_shutdown(cx) {
1595 this.is_terminated = true;
1596 return std::task::Poll::Ready(None);
1597 }
1598 if this.is_terminated {
1599 panic!("polled PushSourceRequestStream after completion");
1600 }
1601 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1602 |bytes, handles| {
1603 match this.inner.channel().read_etc(cx, bytes, handles) {
1604 std::task::Poll::Ready(Ok(())) => {}
1605 std::task::Poll::Pending => return std::task::Poll::Pending,
1606 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1607 this.is_terminated = true;
1608 return std::task::Poll::Ready(None);
1609 }
1610 std::task::Poll::Ready(Err(e)) => {
1611 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1612 e.into(),
1613 ))))
1614 }
1615 }
1616
1617 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1619
1620 std::task::Poll::Ready(Some(match header.ordinal {
1621 0x63704f8bd0962f00 => {
1622 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1623 let mut req = fidl::new_empty!(
1624 TimeSourceUpdateDevicePropertiesRequest,
1625 fidl::encoding::DefaultFuchsiaResourceDialect
1626 );
1627 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
1628 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1629 Ok(PushSourceRequest::UpdateDeviceProperties {
1630 properties: req.properties,
1631
1632 control_handle,
1633 })
1634 }
1635 0x44d515a56e8304dc => {
1636 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1637 let mut req = fidl::new_empty!(
1638 fidl::encoding::EmptyPayload,
1639 fidl::encoding::DefaultFuchsiaResourceDialect
1640 );
1641 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1642 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1643 Ok(PushSourceRequest::WatchSample {
1644 responder: PushSourceWatchSampleResponder {
1645 control_handle: std::mem::ManuallyDrop::new(control_handle),
1646 tx_id: header.tx_id,
1647 },
1648 })
1649 }
1650 0x60621a545f488bb1 => {
1651 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1652 let mut req = fidl::new_empty!(
1653 fidl::encoding::EmptyPayload,
1654 fidl::encoding::DefaultFuchsiaResourceDialect
1655 );
1656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1657 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1658 Ok(PushSourceRequest::WatchStatus {
1659 responder: PushSourceWatchStatusResponder {
1660 control_handle: std::mem::ManuallyDrop::new(control_handle),
1661 tx_id: header.tx_id,
1662 },
1663 })
1664 }
1665 _ => Err(fidl::Error::UnknownOrdinal {
1666 ordinal: header.ordinal,
1667 protocol_name:
1668 <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1669 }),
1670 }))
1671 },
1672 )
1673 }
1674}
1675
1676#[derive(Debug)]
1682pub enum PushSourceRequest {
1683 UpdateDeviceProperties { properties: Properties, control_handle: PushSourceControlHandle },
1686 WatchSample { responder: PushSourceWatchSampleResponder },
1700 WatchStatus { responder: PushSourceWatchStatusResponder },
1709}
1710
1711impl PushSourceRequest {
1712 #[allow(irrefutable_let_patterns)]
1713 pub fn into_update_device_properties(self) -> Option<(Properties, PushSourceControlHandle)> {
1714 if let PushSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1715 Some((properties, control_handle))
1716 } else {
1717 None
1718 }
1719 }
1720
1721 #[allow(irrefutable_let_patterns)]
1722 pub fn into_watch_sample(self) -> Option<(PushSourceWatchSampleResponder)> {
1723 if let PushSourceRequest::WatchSample { responder } = self {
1724 Some((responder))
1725 } else {
1726 None
1727 }
1728 }
1729
1730 #[allow(irrefutable_let_patterns)]
1731 pub fn into_watch_status(self) -> Option<(PushSourceWatchStatusResponder)> {
1732 if let PushSourceRequest::WatchStatus { responder } = self {
1733 Some((responder))
1734 } else {
1735 None
1736 }
1737 }
1738
1739 pub fn method_name(&self) -> &'static str {
1741 match *self {
1742 PushSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1743 PushSourceRequest::WatchSample { .. } => "watch_sample",
1744 PushSourceRequest::WatchStatus { .. } => "watch_status",
1745 }
1746 }
1747}
1748
1749#[derive(Debug, Clone)]
1750pub struct PushSourceControlHandle {
1751 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1752}
1753
1754impl fidl::endpoints::ControlHandle for PushSourceControlHandle {
1755 fn shutdown(&self) {
1756 self.inner.shutdown()
1757 }
1758 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1759 self.inner.shutdown_with_epitaph(status)
1760 }
1761
1762 fn is_closed(&self) -> bool {
1763 self.inner.channel().is_closed()
1764 }
1765 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1766 self.inner.channel().on_closed()
1767 }
1768
1769 #[cfg(target_os = "fuchsia")]
1770 fn signal_peer(
1771 &self,
1772 clear_mask: zx::Signals,
1773 set_mask: zx::Signals,
1774 ) -> Result<(), zx_status::Status> {
1775 use fidl::Peered;
1776 self.inner.channel().signal_peer(clear_mask, set_mask)
1777 }
1778}
1779
1780impl PushSourceControlHandle {}
1781
1782#[must_use = "FIDL methods require a response to be sent"]
1783#[derive(Debug)]
1784pub struct PushSourceWatchSampleResponder {
1785 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1786 tx_id: u32,
1787}
1788
1789impl std::ops::Drop for PushSourceWatchSampleResponder {
1793 fn drop(&mut self) {
1794 self.control_handle.shutdown();
1795 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1797 }
1798}
1799
1800impl fidl::endpoints::Responder for PushSourceWatchSampleResponder {
1801 type ControlHandle = PushSourceControlHandle;
1802
1803 fn control_handle(&self) -> &PushSourceControlHandle {
1804 &self.control_handle
1805 }
1806
1807 fn drop_without_shutdown(mut self) {
1808 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1810 std::mem::forget(self);
1812 }
1813}
1814
1815impl PushSourceWatchSampleResponder {
1816 pub fn send(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1820 let _result = self.send_raw(sample);
1821 if _result.is_err() {
1822 self.control_handle.shutdown();
1823 }
1824 self.drop_without_shutdown();
1825 _result
1826 }
1827
1828 pub fn send_no_shutdown_on_err(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1830 let _result = self.send_raw(sample);
1831 self.drop_without_shutdown();
1832 _result
1833 }
1834
1835 fn send_raw(&self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1836 self.control_handle.inner.send::<PushSourceWatchSampleResponse>(
1837 (sample,),
1838 self.tx_id,
1839 0x44d515a56e8304dc,
1840 fidl::encoding::DynamicFlags::empty(),
1841 )
1842 }
1843}
1844
1845#[must_use = "FIDL methods require a response to be sent"]
1846#[derive(Debug)]
1847pub struct PushSourceWatchStatusResponder {
1848 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1849 tx_id: u32,
1850}
1851
1852impl std::ops::Drop for PushSourceWatchStatusResponder {
1856 fn drop(&mut self) {
1857 self.control_handle.shutdown();
1858 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1860 }
1861}
1862
1863impl fidl::endpoints::Responder for PushSourceWatchStatusResponder {
1864 type ControlHandle = PushSourceControlHandle;
1865
1866 fn control_handle(&self) -> &PushSourceControlHandle {
1867 &self.control_handle
1868 }
1869
1870 fn drop_without_shutdown(mut self) {
1871 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1873 std::mem::forget(self);
1875 }
1876}
1877
1878impl PushSourceWatchStatusResponder {
1879 pub fn send(self, mut status: Status) -> Result<(), fidl::Error> {
1883 let _result = self.send_raw(status);
1884 if _result.is_err() {
1885 self.control_handle.shutdown();
1886 }
1887 self.drop_without_shutdown();
1888 _result
1889 }
1890
1891 pub fn send_no_shutdown_on_err(self, mut status: Status) -> Result<(), fidl::Error> {
1893 let _result = self.send_raw(status);
1894 self.drop_without_shutdown();
1895 _result
1896 }
1897
1898 fn send_raw(&self, mut status: Status) -> Result<(), fidl::Error> {
1899 self.control_handle.inner.send::<PushSourceWatchStatusResponse>(
1900 (status,),
1901 self.tx_id,
1902 0x60621a545f488bb1,
1903 fidl::encoding::DynamicFlags::empty(),
1904 )
1905 }
1906}
1907
1908#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1909pub struct TimeSourceMarker;
1910
1911impl fidl::endpoints::ProtocolMarker for TimeSourceMarker {
1912 type Proxy = TimeSourceProxy;
1913 type RequestStream = TimeSourceRequestStream;
1914 #[cfg(target_os = "fuchsia")]
1915 type SynchronousProxy = TimeSourceSynchronousProxy;
1916
1917 const DEBUG_NAME: &'static str = "(anonymous) TimeSource";
1918}
1919
1920pub trait TimeSourceProxyInterface: Send + Sync {
1921 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1922}
1923#[derive(Debug)]
1924#[cfg(target_os = "fuchsia")]
1925pub struct TimeSourceSynchronousProxy {
1926 client: fidl::client::sync::Client,
1927}
1928
1929#[cfg(target_os = "fuchsia")]
1930impl fidl::endpoints::SynchronousProxy for TimeSourceSynchronousProxy {
1931 type Proxy = TimeSourceProxy;
1932 type Protocol = TimeSourceMarker;
1933
1934 fn from_channel(inner: fidl::Channel) -> Self {
1935 Self::new(inner)
1936 }
1937
1938 fn into_channel(self) -> fidl::Channel {
1939 self.client.into_channel()
1940 }
1941
1942 fn as_channel(&self) -> &fidl::Channel {
1943 self.client.as_channel()
1944 }
1945}
1946
1947#[cfg(target_os = "fuchsia")]
1948impl TimeSourceSynchronousProxy {
1949 pub fn new(channel: fidl::Channel) -> Self {
1950 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1951 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1952 }
1953
1954 pub fn into_channel(self) -> fidl::Channel {
1955 self.client.into_channel()
1956 }
1957
1958 pub fn wait_for_event(
1961 &self,
1962 deadline: zx::MonotonicInstant,
1963 ) -> Result<TimeSourceEvent, fidl::Error> {
1964 TimeSourceEvent::decode(self.client.wait_for_event(deadline)?)
1965 }
1966
1967 pub fn r#update_device_properties(
1970 &self,
1971 mut properties: &Properties,
1972 ) -> Result<(), fidl::Error> {
1973 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1974 (properties,),
1975 0x63704f8bd0962f00,
1976 fidl::encoding::DynamicFlags::empty(),
1977 )
1978 }
1979}
1980
1981#[cfg(target_os = "fuchsia")]
1982impl From<TimeSourceSynchronousProxy> for zx::Handle {
1983 fn from(value: TimeSourceSynchronousProxy) -> Self {
1984 value.into_channel().into()
1985 }
1986}
1987
1988#[cfg(target_os = "fuchsia")]
1989impl From<fidl::Channel> for TimeSourceSynchronousProxy {
1990 fn from(value: fidl::Channel) -> Self {
1991 Self::new(value)
1992 }
1993}
1994
1995#[derive(Debug, Clone)]
1996pub struct TimeSourceProxy {
1997 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1998}
1999
2000impl fidl::endpoints::Proxy for TimeSourceProxy {
2001 type Protocol = TimeSourceMarker;
2002
2003 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2004 Self::new(inner)
2005 }
2006
2007 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2008 self.client.into_channel().map_err(|client| Self { client })
2009 }
2010
2011 fn as_channel(&self) -> &::fidl::AsyncChannel {
2012 self.client.as_channel()
2013 }
2014}
2015
2016impl TimeSourceProxy {
2017 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2019 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2020 Self { client: fidl::client::Client::new(channel, protocol_name) }
2021 }
2022
2023 pub fn take_event_stream(&self) -> TimeSourceEventStream {
2029 TimeSourceEventStream { event_receiver: self.client.take_event_receiver() }
2030 }
2031
2032 pub fn r#update_device_properties(
2035 &self,
2036 mut properties: &Properties,
2037 ) -> Result<(), fidl::Error> {
2038 TimeSourceProxyInterface::r#update_device_properties(self, properties)
2039 }
2040}
2041
2042impl TimeSourceProxyInterface for TimeSourceProxy {
2043 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
2044 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2045 (properties,),
2046 0x63704f8bd0962f00,
2047 fidl::encoding::DynamicFlags::empty(),
2048 )
2049 }
2050}
2051
2052pub struct TimeSourceEventStream {
2053 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2054}
2055
2056impl std::marker::Unpin for TimeSourceEventStream {}
2057
2058impl futures::stream::FusedStream for TimeSourceEventStream {
2059 fn is_terminated(&self) -> bool {
2060 self.event_receiver.is_terminated()
2061 }
2062}
2063
2064impl futures::Stream for TimeSourceEventStream {
2065 type Item = Result<TimeSourceEvent, fidl::Error>;
2066
2067 fn poll_next(
2068 mut self: std::pin::Pin<&mut Self>,
2069 cx: &mut std::task::Context<'_>,
2070 ) -> std::task::Poll<Option<Self::Item>> {
2071 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2072 &mut self.event_receiver,
2073 cx
2074 )?) {
2075 Some(buf) => std::task::Poll::Ready(Some(TimeSourceEvent::decode(buf))),
2076 None => std::task::Poll::Ready(None),
2077 }
2078 }
2079}
2080
2081#[derive(Debug)]
2082pub enum TimeSourceEvent {}
2083
2084impl TimeSourceEvent {
2085 fn decode(
2087 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2088 ) -> Result<TimeSourceEvent, fidl::Error> {
2089 let (bytes, _handles) = buf.split_mut();
2090 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2091 debug_assert_eq!(tx_header.tx_id, 0);
2092 match tx_header.ordinal {
2093 _ => Err(fidl::Error::UnknownOrdinal {
2094 ordinal: tx_header.ordinal,
2095 protocol_name: <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2096 }),
2097 }
2098 }
2099}
2100
2101pub struct TimeSourceRequestStream {
2103 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2104 is_terminated: bool,
2105}
2106
2107impl std::marker::Unpin for TimeSourceRequestStream {}
2108
2109impl futures::stream::FusedStream for TimeSourceRequestStream {
2110 fn is_terminated(&self) -> bool {
2111 self.is_terminated
2112 }
2113}
2114
2115impl fidl::endpoints::RequestStream for TimeSourceRequestStream {
2116 type Protocol = TimeSourceMarker;
2117 type ControlHandle = TimeSourceControlHandle;
2118
2119 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2120 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2121 }
2122
2123 fn control_handle(&self) -> Self::ControlHandle {
2124 TimeSourceControlHandle { inner: self.inner.clone() }
2125 }
2126
2127 fn into_inner(
2128 self,
2129 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2130 {
2131 (self.inner, self.is_terminated)
2132 }
2133
2134 fn from_inner(
2135 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2136 is_terminated: bool,
2137 ) -> Self {
2138 Self { inner, is_terminated }
2139 }
2140}
2141
2142impl futures::Stream for TimeSourceRequestStream {
2143 type Item = Result<TimeSourceRequest, fidl::Error>;
2144
2145 fn poll_next(
2146 mut self: std::pin::Pin<&mut Self>,
2147 cx: &mut std::task::Context<'_>,
2148 ) -> std::task::Poll<Option<Self::Item>> {
2149 let this = &mut *self;
2150 if this.inner.check_shutdown(cx) {
2151 this.is_terminated = true;
2152 return std::task::Poll::Ready(None);
2153 }
2154 if this.is_terminated {
2155 panic!("polled TimeSourceRequestStream after completion");
2156 }
2157 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2158 |bytes, handles| {
2159 match this.inner.channel().read_etc(cx, bytes, handles) {
2160 std::task::Poll::Ready(Ok(())) => {}
2161 std::task::Poll::Pending => return std::task::Poll::Pending,
2162 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2163 this.is_terminated = true;
2164 return std::task::Poll::Ready(None);
2165 }
2166 std::task::Poll::Ready(Err(e)) => {
2167 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2168 e.into(),
2169 ))))
2170 }
2171 }
2172
2173 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2175
2176 std::task::Poll::Ready(Some(match header.ordinal {
2177 0x63704f8bd0962f00 => {
2178 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2179 let mut req = fidl::new_empty!(
2180 TimeSourceUpdateDevicePropertiesRequest,
2181 fidl::encoding::DefaultFuchsiaResourceDialect
2182 );
2183 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
2184 let control_handle = TimeSourceControlHandle { inner: this.inner.clone() };
2185 Ok(TimeSourceRequest::UpdateDeviceProperties {
2186 properties: req.properties,
2187
2188 control_handle,
2189 })
2190 }
2191 _ => Err(fidl::Error::UnknownOrdinal {
2192 ordinal: header.ordinal,
2193 protocol_name:
2194 <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2195 }),
2196 }))
2197 },
2198 )
2199 }
2200}
2201
2202#[derive(Debug)]
2205pub enum TimeSourceRequest {
2206 UpdateDeviceProperties { properties: Properties, control_handle: TimeSourceControlHandle },
2209}
2210
2211impl TimeSourceRequest {
2212 #[allow(irrefutable_let_patterns)]
2213 pub fn into_update_device_properties(self) -> Option<(Properties, TimeSourceControlHandle)> {
2214 if let TimeSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
2215 Some((properties, control_handle))
2216 } else {
2217 None
2218 }
2219 }
2220
2221 pub fn method_name(&self) -> &'static str {
2223 match *self {
2224 TimeSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
2225 }
2226 }
2227}
2228
2229#[derive(Debug, Clone)]
2230pub struct TimeSourceControlHandle {
2231 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2232}
2233
2234impl fidl::endpoints::ControlHandle for TimeSourceControlHandle {
2235 fn shutdown(&self) {
2236 self.inner.shutdown()
2237 }
2238 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2239 self.inner.shutdown_with_epitaph(status)
2240 }
2241
2242 fn is_closed(&self) -> bool {
2243 self.inner.channel().is_closed()
2244 }
2245 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2246 self.inner.channel().on_closed()
2247 }
2248
2249 #[cfg(target_os = "fuchsia")]
2250 fn signal_peer(
2251 &self,
2252 clear_mask: zx::Signals,
2253 set_mask: zx::Signals,
2254 ) -> Result<(), zx_status::Status> {
2255 use fidl::Peered;
2256 self.inner.channel().signal_peer(clear_mask, set_mask)
2257 }
2258}
2259
2260impl TimeSourceControlHandle {}
2261
2262mod internal {
2263 use super::*;
2264}