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 Self { client: fidl::client::sync::Client::new(channel) }
65 }
66
67 pub fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 pub fn wait_for_event(
74 &self,
75 deadline: zx::MonotonicInstant,
76 ) -> Result<AdjustEvent, fidl::Error> {
77 AdjustEvent::decode(self.client.wait_for_event::<AdjustMarker>(deadline)?)
78 }
79
80 pub fn r#report_boot_to_utc_mapping(
98 &self,
99 mut boot_reference: fidl::BootInstant,
100 mut utc_reference: i64,
101 ___deadline: zx::MonotonicInstant,
102 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
103 let _response = self.client.send_query::<
104 AdjustReportBootToUtcMappingRequest,
105 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
106 AdjustMarker,
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::NullableHandle {
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#[cfg(target_os = "fuchsia")]
132impl fidl::endpoints::FromClient for AdjustSynchronousProxy {
133 type Protocol = AdjustMarker;
134
135 fn from_client(value: fidl::endpoints::ClientEnd<AdjustMarker>) -> Self {
136 Self::new(value.into_channel())
137 }
138}
139
140#[derive(Debug, Clone)]
141pub struct AdjustProxy {
142 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
143}
144
145impl fidl::endpoints::Proxy for AdjustProxy {
146 type Protocol = AdjustMarker;
147
148 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
149 Self::new(inner)
150 }
151
152 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
153 self.client.into_channel().map_err(|client| Self { client })
154 }
155
156 fn as_channel(&self) -> &::fidl::AsyncChannel {
157 self.client.as_channel()
158 }
159}
160
161impl AdjustProxy {
162 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
164 let protocol_name = <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
165 Self { client: fidl::client::Client::new(channel, protocol_name) }
166 }
167
168 pub fn take_event_stream(&self) -> AdjustEventStream {
174 AdjustEventStream { event_receiver: self.client.take_event_receiver() }
175 }
176
177 pub fn r#report_boot_to_utc_mapping(
195 &self,
196 mut boot_reference: fidl::BootInstant,
197 mut utc_reference: i64,
198 ) -> fidl::client::QueryResponseFut<
199 AdjustReportBootToUtcMappingResult,
200 fidl::encoding::DefaultFuchsiaResourceDialect,
201 > {
202 AdjustProxyInterface::r#report_boot_to_utc_mapping(self, boot_reference, utc_reference)
203 }
204}
205
206impl AdjustProxyInterface for AdjustProxy {
207 type ReportBootToUtcMappingResponseFut = fidl::client::QueryResponseFut<
208 AdjustReportBootToUtcMappingResult,
209 fidl::encoding::DefaultFuchsiaResourceDialect,
210 >;
211 fn r#report_boot_to_utc_mapping(
212 &self,
213 mut boot_reference: fidl::BootInstant,
214 mut utc_reference: i64,
215 ) -> Self::ReportBootToUtcMappingResponseFut {
216 fn _decode(
217 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
218 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
219 let _response = fidl::client::decode_transaction_body::<
220 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
221 fidl::encoding::DefaultFuchsiaResourceDialect,
222 0x1186fc4a8c7f7fbe,
223 >(_buf?)?;
224 Ok(_response.map(|x| x))
225 }
226 self.client.send_query_and_decode::<
227 AdjustReportBootToUtcMappingRequest,
228 AdjustReportBootToUtcMappingResult,
229 >(
230 (boot_reference, utc_reference,),
231 0x1186fc4a8c7f7fbe,
232 fidl::encoding::DynamicFlags::empty(),
233 _decode,
234 )
235 }
236}
237
238pub struct AdjustEventStream {
239 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
240}
241
242impl std::marker::Unpin for AdjustEventStream {}
243
244impl futures::stream::FusedStream for AdjustEventStream {
245 fn is_terminated(&self) -> bool {
246 self.event_receiver.is_terminated()
247 }
248}
249
250impl futures::Stream for AdjustEventStream {
251 type Item = Result<AdjustEvent, fidl::Error>;
252
253 fn poll_next(
254 mut self: std::pin::Pin<&mut Self>,
255 cx: &mut std::task::Context<'_>,
256 ) -> std::task::Poll<Option<Self::Item>> {
257 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
258 &mut self.event_receiver,
259 cx
260 )?) {
261 Some(buf) => std::task::Poll::Ready(Some(AdjustEvent::decode(buf))),
262 None => std::task::Poll::Ready(None),
263 }
264 }
265}
266
267#[derive(Debug)]
268pub enum AdjustEvent {}
269
270impl AdjustEvent {
271 fn decode(
273 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
274 ) -> Result<AdjustEvent, fidl::Error> {
275 let (bytes, _handles) = buf.split_mut();
276 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
277 debug_assert_eq!(tx_header.tx_id, 0);
278 match tx_header.ordinal {
279 _ => Err(fidl::Error::UnknownOrdinal {
280 ordinal: tx_header.ordinal,
281 protocol_name: <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
282 }),
283 }
284 }
285}
286
287pub struct AdjustRequestStream {
289 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
290 is_terminated: bool,
291}
292
293impl std::marker::Unpin for AdjustRequestStream {}
294
295impl futures::stream::FusedStream for AdjustRequestStream {
296 fn is_terminated(&self) -> bool {
297 self.is_terminated
298 }
299}
300
301impl fidl::endpoints::RequestStream for AdjustRequestStream {
302 type Protocol = AdjustMarker;
303 type ControlHandle = AdjustControlHandle;
304
305 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
306 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
307 }
308
309 fn control_handle(&self) -> Self::ControlHandle {
310 AdjustControlHandle { inner: self.inner.clone() }
311 }
312
313 fn into_inner(
314 self,
315 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
316 {
317 (self.inner, self.is_terminated)
318 }
319
320 fn from_inner(
321 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
322 is_terminated: bool,
323 ) -> Self {
324 Self { inner, is_terminated }
325 }
326}
327
328impl futures::Stream for AdjustRequestStream {
329 type Item = Result<AdjustRequest, fidl::Error>;
330
331 fn poll_next(
332 mut self: std::pin::Pin<&mut Self>,
333 cx: &mut std::task::Context<'_>,
334 ) -> std::task::Poll<Option<Self::Item>> {
335 let this = &mut *self;
336 if this.inner.check_shutdown(cx) {
337 this.is_terminated = true;
338 return std::task::Poll::Ready(None);
339 }
340 if this.is_terminated {
341 panic!("polled AdjustRequestStream after completion");
342 }
343 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
344 |bytes, handles| {
345 match this.inner.channel().read_etc(cx, bytes, handles) {
346 std::task::Poll::Ready(Ok(())) => {}
347 std::task::Poll::Pending => return std::task::Poll::Pending,
348 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
349 this.is_terminated = true;
350 return std::task::Poll::Ready(None);
351 }
352 std::task::Poll::Ready(Err(e)) => {
353 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
354 e.into(),
355 ))));
356 }
357 }
358
359 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
361
362 std::task::Poll::Ready(Some(match header.ordinal {
363 0x1186fc4a8c7f7fbe => {
364 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
365 let mut req = fidl::new_empty!(
366 AdjustReportBootToUtcMappingRequest,
367 fidl::encoding::DefaultFuchsiaResourceDialect
368 );
369 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdjustReportBootToUtcMappingRequest>(&header, _body_bytes, handles, &mut req)?;
370 let control_handle = AdjustControlHandle { inner: this.inner.clone() };
371 Ok(AdjustRequest::ReportBootToUtcMapping {
372 boot_reference: req.boot_reference,
373 utc_reference: req.utc_reference,
374
375 responder: AdjustReportBootToUtcMappingResponder {
376 control_handle: std::mem::ManuallyDrop::new(control_handle),
377 tx_id: header.tx_id,
378 },
379 })
380 }
381 _ => Err(fidl::Error::UnknownOrdinal {
382 ordinal: header.ordinal,
383 protocol_name:
384 <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
385 }),
386 }))
387 },
388 )
389 }
390}
391
392#[derive(Debug)]
397pub enum AdjustRequest {
398 ReportBootToUtcMapping {
416 boot_reference: fidl::BootInstant,
417 utc_reference: i64,
418 responder: AdjustReportBootToUtcMappingResponder,
419 },
420}
421
422impl AdjustRequest {
423 #[allow(irrefutable_let_patterns)]
424 pub fn into_report_boot_to_utc_mapping(
425 self,
426 ) -> Option<(fidl::BootInstant, i64, AdjustReportBootToUtcMappingResponder)> {
427 if let AdjustRequest::ReportBootToUtcMapping { boot_reference, utc_reference, responder } =
428 self
429 {
430 Some((boot_reference, utc_reference, responder))
431 } else {
432 None
433 }
434 }
435
436 pub fn method_name(&self) -> &'static str {
438 match *self {
439 AdjustRequest::ReportBootToUtcMapping { .. } => "report_boot_to_utc_mapping",
440 }
441 }
442}
443
444#[derive(Debug, Clone)]
445pub struct AdjustControlHandle {
446 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
447}
448
449impl fidl::endpoints::ControlHandle for AdjustControlHandle {
450 fn shutdown(&self) {
451 self.inner.shutdown()
452 }
453
454 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
455 self.inner.shutdown_with_epitaph(status)
456 }
457
458 fn is_closed(&self) -> bool {
459 self.inner.channel().is_closed()
460 }
461 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
462 self.inner.channel().on_closed()
463 }
464
465 #[cfg(target_os = "fuchsia")]
466 fn signal_peer(
467 &self,
468 clear_mask: zx::Signals,
469 set_mask: zx::Signals,
470 ) -> Result<(), zx_status::Status> {
471 use fidl::Peered;
472 self.inner.channel().signal_peer(clear_mask, set_mask)
473 }
474}
475
476impl AdjustControlHandle {}
477
478#[must_use = "FIDL methods require a response to be sent"]
479#[derive(Debug)]
480pub struct AdjustReportBootToUtcMappingResponder {
481 control_handle: std::mem::ManuallyDrop<AdjustControlHandle>,
482 tx_id: u32,
483}
484
485impl std::ops::Drop for AdjustReportBootToUtcMappingResponder {
489 fn drop(&mut self) {
490 self.control_handle.shutdown();
491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
493 }
494}
495
496impl fidl::endpoints::Responder for AdjustReportBootToUtcMappingResponder {
497 type ControlHandle = AdjustControlHandle;
498
499 fn control_handle(&self) -> &AdjustControlHandle {
500 &self.control_handle
501 }
502
503 fn drop_without_shutdown(mut self) {
504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
506 std::mem::forget(self);
508 }
509}
510
511impl AdjustReportBootToUtcMappingResponder {
512 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
516 let _result = self.send_raw(result);
517 if _result.is_err() {
518 self.control_handle.shutdown();
519 }
520 self.drop_without_shutdown();
521 _result
522 }
523
524 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
526 let _result = self.send_raw(result);
527 self.drop_without_shutdown();
528 _result
529 }
530
531 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
532 self.control_handle
533 .inner
534 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
535 result,
536 self.tx_id,
537 0x1186fc4a8c7f7fbe,
538 fidl::encoding::DynamicFlags::empty(),
539 )
540 }
541}
542
543#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
544pub struct PullSourceMarker;
545
546impl fidl::endpoints::ProtocolMarker for PullSourceMarker {
547 type Proxy = PullSourceProxy;
548 type RequestStream = PullSourceRequestStream;
549 #[cfg(target_os = "fuchsia")]
550 type SynchronousProxy = PullSourceSynchronousProxy;
551
552 const DEBUG_NAME: &'static str = "fuchsia.time.external.PullSource";
553}
554impl fidl::endpoints::DiscoverableProtocolMarker for PullSourceMarker {}
555pub type PullSourceSampleResult = Result<TimeSample, Error>;
556
557pub trait PullSourceProxyInterface: Send + Sync {
558 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
559 type SampleResponseFut: std::future::Future<Output = Result<PullSourceSampleResult, fidl::Error>>
560 + Send;
561 fn r#sample(&self, urgency: Urgency) -> Self::SampleResponseFut;
562 type NextPossibleSampleTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>>
563 + Send;
564 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut;
565}
566#[derive(Debug)]
567#[cfg(target_os = "fuchsia")]
568pub struct PullSourceSynchronousProxy {
569 client: fidl::client::sync::Client,
570}
571
572#[cfg(target_os = "fuchsia")]
573impl fidl::endpoints::SynchronousProxy for PullSourceSynchronousProxy {
574 type Proxy = PullSourceProxy;
575 type Protocol = PullSourceMarker;
576
577 fn from_channel(inner: fidl::Channel) -> Self {
578 Self::new(inner)
579 }
580
581 fn into_channel(self) -> fidl::Channel {
582 self.client.into_channel()
583 }
584
585 fn as_channel(&self) -> &fidl::Channel {
586 self.client.as_channel()
587 }
588}
589
590#[cfg(target_os = "fuchsia")]
591impl PullSourceSynchronousProxy {
592 pub fn new(channel: fidl::Channel) -> Self {
593 Self { client: fidl::client::sync::Client::new(channel) }
594 }
595
596 pub fn into_channel(self) -> fidl::Channel {
597 self.client.into_channel()
598 }
599
600 pub fn wait_for_event(
603 &self,
604 deadline: zx::MonotonicInstant,
605 ) -> Result<PullSourceEvent, fidl::Error> {
606 PullSourceEvent::decode(self.client.wait_for_event::<PullSourceMarker>(deadline)?)
607 }
608
609 pub fn r#update_device_properties(
612 &self,
613 mut properties: &Properties,
614 ) -> Result<(), fidl::Error> {
615 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
616 (properties,),
617 0x63704f8bd0962f00,
618 fidl::encoding::DynamicFlags::empty(),
619 )
620 }
621
622 pub fn r#sample(
637 &self,
638 mut urgency: Urgency,
639 ___deadline: zx::MonotonicInstant,
640 ) -> Result<PullSourceSampleResult, fidl::Error> {
641 let _response = self.client.send_query::<
642 PullSourceSampleRequest,
643 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
644 PullSourceMarker,
645 >(
646 (urgency,),
647 0x2d29007d8c9cb45a,
648 fidl::encoding::DynamicFlags::empty(),
649 ___deadline,
650 )?;
651 Ok(_response.map(|x| x.sample))
652 }
653
654 pub fn r#next_possible_sample_time(
658 &self,
659 ___deadline: zx::MonotonicInstant,
660 ) -> Result<i64, fidl::Error> {
661 let _response = self.client.send_query::<
662 fidl::encoding::EmptyPayload,
663 PullSourceNextPossibleSampleTimeResponse,
664 PullSourceMarker,
665 >(
666 (),
667 0x69ca2b1fd63e88a5,
668 fidl::encoding::DynamicFlags::empty(),
669 ___deadline,
670 )?;
671 Ok(_response.next_possible_time)
672 }
673}
674
675#[cfg(target_os = "fuchsia")]
676impl From<PullSourceSynchronousProxy> for zx::NullableHandle {
677 fn from(value: PullSourceSynchronousProxy) -> Self {
678 value.into_channel().into()
679 }
680}
681
682#[cfg(target_os = "fuchsia")]
683impl From<fidl::Channel> for PullSourceSynchronousProxy {
684 fn from(value: fidl::Channel) -> Self {
685 Self::new(value)
686 }
687}
688
689#[cfg(target_os = "fuchsia")]
690impl fidl::endpoints::FromClient for PullSourceSynchronousProxy {
691 type Protocol = PullSourceMarker;
692
693 fn from_client(value: fidl::endpoints::ClientEnd<PullSourceMarker>) -> Self {
694 Self::new(value.into_channel())
695 }
696}
697
698#[derive(Debug, Clone)]
699pub struct PullSourceProxy {
700 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
701}
702
703impl fidl::endpoints::Proxy for PullSourceProxy {
704 type Protocol = PullSourceMarker;
705
706 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
707 Self::new(inner)
708 }
709
710 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
711 self.client.into_channel().map_err(|client| Self { client })
712 }
713
714 fn as_channel(&self) -> &::fidl::AsyncChannel {
715 self.client.as_channel()
716 }
717}
718
719impl PullSourceProxy {
720 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
722 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
723 Self { client: fidl::client::Client::new(channel, protocol_name) }
724 }
725
726 pub fn take_event_stream(&self) -> PullSourceEventStream {
732 PullSourceEventStream { event_receiver: self.client.take_event_receiver() }
733 }
734
735 pub fn r#update_device_properties(
738 &self,
739 mut properties: &Properties,
740 ) -> Result<(), fidl::Error> {
741 PullSourceProxyInterface::r#update_device_properties(self, properties)
742 }
743
744 pub fn r#sample(
759 &self,
760 mut urgency: Urgency,
761 ) -> fidl::client::QueryResponseFut<
762 PullSourceSampleResult,
763 fidl::encoding::DefaultFuchsiaResourceDialect,
764 > {
765 PullSourceProxyInterface::r#sample(self, urgency)
766 }
767
768 pub fn r#next_possible_sample_time(
772 &self,
773 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
774 PullSourceProxyInterface::r#next_possible_sample_time(self)
775 }
776}
777
778impl PullSourceProxyInterface for PullSourceProxy {
779 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
780 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
781 (properties,),
782 0x63704f8bd0962f00,
783 fidl::encoding::DynamicFlags::empty(),
784 )
785 }
786
787 type SampleResponseFut = fidl::client::QueryResponseFut<
788 PullSourceSampleResult,
789 fidl::encoding::DefaultFuchsiaResourceDialect,
790 >;
791 fn r#sample(&self, mut urgency: Urgency) -> Self::SampleResponseFut {
792 fn _decode(
793 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
794 ) -> Result<PullSourceSampleResult, fidl::Error> {
795 let _response = fidl::client::decode_transaction_body::<
796 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
797 fidl::encoding::DefaultFuchsiaResourceDialect,
798 0x2d29007d8c9cb45a,
799 >(_buf?)?;
800 Ok(_response.map(|x| x.sample))
801 }
802 self.client.send_query_and_decode::<PullSourceSampleRequest, PullSourceSampleResult>(
803 (urgency,),
804 0x2d29007d8c9cb45a,
805 fidl::encoding::DynamicFlags::empty(),
806 _decode,
807 )
808 }
809
810 type NextPossibleSampleTimeResponseFut =
811 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
812 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut {
813 fn _decode(
814 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
815 ) -> Result<i64, fidl::Error> {
816 let _response = fidl::client::decode_transaction_body::<
817 PullSourceNextPossibleSampleTimeResponse,
818 fidl::encoding::DefaultFuchsiaResourceDialect,
819 0x69ca2b1fd63e88a5,
820 >(_buf?)?;
821 Ok(_response.next_possible_time)
822 }
823 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
824 (),
825 0x69ca2b1fd63e88a5,
826 fidl::encoding::DynamicFlags::empty(),
827 _decode,
828 )
829 }
830}
831
832pub struct PullSourceEventStream {
833 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
834}
835
836impl std::marker::Unpin for PullSourceEventStream {}
837
838impl futures::stream::FusedStream for PullSourceEventStream {
839 fn is_terminated(&self) -> bool {
840 self.event_receiver.is_terminated()
841 }
842}
843
844impl futures::Stream for PullSourceEventStream {
845 type Item = Result<PullSourceEvent, fidl::Error>;
846
847 fn poll_next(
848 mut self: std::pin::Pin<&mut Self>,
849 cx: &mut std::task::Context<'_>,
850 ) -> std::task::Poll<Option<Self::Item>> {
851 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
852 &mut self.event_receiver,
853 cx
854 )?) {
855 Some(buf) => std::task::Poll::Ready(Some(PullSourceEvent::decode(buf))),
856 None => std::task::Poll::Ready(None),
857 }
858 }
859}
860
861#[derive(Debug)]
862pub enum PullSourceEvent {}
863
864impl PullSourceEvent {
865 fn decode(
867 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
868 ) -> Result<PullSourceEvent, fidl::Error> {
869 let (bytes, _handles) = buf.split_mut();
870 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
871 debug_assert_eq!(tx_header.tx_id, 0);
872 match tx_header.ordinal {
873 _ => Err(fidl::Error::UnknownOrdinal {
874 ordinal: tx_header.ordinal,
875 protocol_name: <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
876 }),
877 }
878 }
879}
880
881pub struct PullSourceRequestStream {
883 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
884 is_terminated: bool,
885}
886
887impl std::marker::Unpin for PullSourceRequestStream {}
888
889impl futures::stream::FusedStream for PullSourceRequestStream {
890 fn is_terminated(&self) -> bool {
891 self.is_terminated
892 }
893}
894
895impl fidl::endpoints::RequestStream for PullSourceRequestStream {
896 type Protocol = PullSourceMarker;
897 type ControlHandle = PullSourceControlHandle;
898
899 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
900 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
901 }
902
903 fn control_handle(&self) -> Self::ControlHandle {
904 PullSourceControlHandle { inner: self.inner.clone() }
905 }
906
907 fn into_inner(
908 self,
909 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
910 {
911 (self.inner, self.is_terminated)
912 }
913
914 fn from_inner(
915 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
916 is_terminated: bool,
917 ) -> Self {
918 Self { inner, is_terminated }
919 }
920}
921
922impl futures::Stream for PullSourceRequestStream {
923 type Item = Result<PullSourceRequest, fidl::Error>;
924
925 fn poll_next(
926 mut self: std::pin::Pin<&mut Self>,
927 cx: &mut std::task::Context<'_>,
928 ) -> std::task::Poll<Option<Self::Item>> {
929 let this = &mut *self;
930 if this.inner.check_shutdown(cx) {
931 this.is_terminated = true;
932 return std::task::Poll::Ready(None);
933 }
934 if this.is_terminated {
935 panic!("polled PullSourceRequestStream after completion");
936 }
937 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
938 |bytes, handles| {
939 match this.inner.channel().read_etc(cx, bytes, handles) {
940 std::task::Poll::Ready(Ok(())) => {}
941 std::task::Poll::Pending => return std::task::Poll::Pending,
942 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
943 this.is_terminated = true;
944 return std::task::Poll::Ready(None);
945 }
946 std::task::Poll::Ready(Err(e)) => {
947 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
948 e.into(),
949 ))));
950 }
951 }
952
953 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
955
956 std::task::Poll::Ready(Some(match header.ordinal {
957 0x63704f8bd0962f00 => {
958 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
959 let mut req = fidl::new_empty!(
960 TimeSourceUpdateDevicePropertiesRequest,
961 fidl::encoding::DefaultFuchsiaResourceDialect
962 );
963 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
964 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
965 Ok(PullSourceRequest::UpdateDeviceProperties {
966 properties: req.properties,
967
968 control_handle,
969 })
970 }
971 0x2d29007d8c9cb45a => {
972 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
973 let mut req = fidl::new_empty!(
974 PullSourceSampleRequest,
975 fidl::encoding::DefaultFuchsiaResourceDialect
976 );
977 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PullSourceSampleRequest>(&header, _body_bytes, handles, &mut req)?;
978 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
979 Ok(PullSourceRequest::Sample {
980 urgency: req.urgency,
981
982 responder: PullSourceSampleResponder {
983 control_handle: std::mem::ManuallyDrop::new(control_handle),
984 tx_id: header.tx_id,
985 },
986 })
987 }
988 0x69ca2b1fd63e88a5 => {
989 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
990 let mut req = fidl::new_empty!(
991 fidl::encoding::EmptyPayload,
992 fidl::encoding::DefaultFuchsiaResourceDialect
993 );
994 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
995 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
996 Ok(PullSourceRequest::NextPossibleSampleTime {
997 responder: PullSourceNextPossibleSampleTimeResponder {
998 control_handle: std::mem::ManuallyDrop::new(control_handle),
999 tx_id: header.tx_id,
1000 },
1001 })
1002 }
1003 _ => Err(fidl::Error::UnknownOrdinal {
1004 ordinal: header.ordinal,
1005 protocol_name:
1006 <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1007 }),
1008 }))
1009 },
1010 )
1011 }
1012}
1013
1014#[derive(Debug)]
1016pub enum PullSourceRequest {
1017 UpdateDeviceProperties { properties: Properties, control_handle: PullSourceControlHandle },
1020 Sample { urgency: Urgency, responder: PullSourceSampleResponder },
1035 NextPossibleSampleTime { responder: PullSourceNextPossibleSampleTimeResponder },
1039}
1040
1041impl PullSourceRequest {
1042 #[allow(irrefutable_let_patterns)]
1043 pub fn into_update_device_properties(self) -> Option<(Properties, PullSourceControlHandle)> {
1044 if let PullSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1045 Some((properties, control_handle))
1046 } else {
1047 None
1048 }
1049 }
1050
1051 #[allow(irrefutable_let_patterns)]
1052 pub fn into_sample(self) -> Option<(Urgency, PullSourceSampleResponder)> {
1053 if let PullSourceRequest::Sample { urgency, responder } = self {
1054 Some((urgency, responder))
1055 } else {
1056 None
1057 }
1058 }
1059
1060 #[allow(irrefutable_let_patterns)]
1061 pub fn into_next_possible_sample_time(
1062 self,
1063 ) -> Option<(PullSourceNextPossibleSampleTimeResponder)> {
1064 if let PullSourceRequest::NextPossibleSampleTime { responder } = self {
1065 Some((responder))
1066 } else {
1067 None
1068 }
1069 }
1070
1071 pub fn method_name(&self) -> &'static str {
1073 match *self {
1074 PullSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1075 PullSourceRequest::Sample { .. } => "sample",
1076 PullSourceRequest::NextPossibleSampleTime { .. } => "next_possible_sample_time",
1077 }
1078 }
1079}
1080
1081#[derive(Debug, Clone)]
1082pub struct PullSourceControlHandle {
1083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1084}
1085
1086impl fidl::endpoints::ControlHandle for PullSourceControlHandle {
1087 fn shutdown(&self) {
1088 self.inner.shutdown()
1089 }
1090
1091 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1092 self.inner.shutdown_with_epitaph(status)
1093 }
1094
1095 fn is_closed(&self) -> bool {
1096 self.inner.channel().is_closed()
1097 }
1098 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1099 self.inner.channel().on_closed()
1100 }
1101
1102 #[cfg(target_os = "fuchsia")]
1103 fn signal_peer(
1104 &self,
1105 clear_mask: zx::Signals,
1106 set_mask: zx::Signals,
1107 ) -> Result<(), zx_status::Status> {
1108 use fidl::Peered;
1109 self.inner.channel().signal_peer(clear_mask, set_mask)
1110 }
1111}
1112
1113impl PullSourceControlHandle {}
1114
1115#[must_use = "FIDL methods require a response to be sent"]
1116#[derive(Debug)]
1117pub struct PullSourceSampleResponder {
1118 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1119 tx_id: u32,
1120}
1121
1122impl std::ops::Drop for PullSourceSampleResponder {
1126 fn drop(&mut self) {
1127 self.control_handle.shutdown();
1128 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1130 }
1131}
1132
1133impl fidl::endpoints::Responder for PullSourceSampleResponder {
1134 type ControlHandle = PullSourceControlHandle;
1135
1136 fn control_handle(&self) -> &PullSourceControlHandle {
1137 &self.control_handle
1138 }
1139
1140 fn drop_without_shutdown(mut self) {
1141 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1143 std::mem::forget(self);
1145 }
1146}
1147
1148impl PullSourceSampleResponder {
1149 pub fn send(self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1153 let _result = self.send_raw(result);
1154 if _result.is_err() {
1155 self.control_handle.shutdown();
1156 }
1157 self.drop_without_shutdown();
1158 _result
1159 }
1160
1161 pub fn send_no_shutdown_on_err(
1163 self,
1164 mut result: Result<&TimeSample, Error>,
1165 ) -> Result<(), fidl::Error> {
1166 let _result = self.send_raw(result);
1167 self.drop_without_shutdown();
1168 _result
1169 }
1170
1171 fn send_raw(&self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1172 self.control_handle
1173 .inner
1174 .send::<fidl::encoding::ResultType<PullSourceSampleResponse, Error>>(
1175 result.map(|sample| (sample,)),
1176 self.tx_id,
1177 0x2d29007d8c9cb45a,
1178 fidl::encoding::DynamicFlags::empty(),
1179 )
1180 }
1181}
1182
1183#[must_use = "FIDL methods require a response to be sent"]
1184#[derive(Debug)]
1185pub struct PullSourceNextPossibleSampleTimeResponder {
1186 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1187 tx_id: u32,
1188}
1189
1190impl std::ops::Drop for PullSourceNextPossibleSampleTimeResponder {
1194 fn drop(&mut self) {
1195 self.control_handle.shutdown();
1196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1198 }
1199}
1200
1201impl fidl::endpoints::Responder for PullSourceNextPossibleSampleTimeResponder {
1202 type ControlHandle = PullSourceControlHandle;
1203
1204 fn control_handle(&self) -> &PullSourceControlHandle {
1205 &self.control_handle
1206 }
1207
1208 fn drop_without_shutdown(mut self) {
1209 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1211 std::mem::forget(self);
1213 }
1214}
1215
1216impl PullSourceNextPossibleSampleTimeResponder {
1217 pub fn send(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1221 let _result = self.send_raw(next_possible_time);
1222 if _result.is_err() {
1223 self.control_handle.shutdown();
1224 }
1225 self.drop_without_shutdown();
1226 _result
1227 }
1228
1229 pub fn send_no_shutdown_on_err(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1231 let _result = self.send_raw(next_possible_time);
1232 self.drop_without_shutdown();
1233 _result
1234 }
1235
1236 fn send_raw(&self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1237 self.control_handle.inner.send::<PullSourceNextPossibleSampleTimeResponse>(
1238 (next_possible_time,),
1239 self.tx_id,
1240 0x69ca2b1fd63e88a5,
1241 fidl::encoding::DynamicFlags::empty(),
1242 )
1243 }
1244}
1245
1246#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1247pub struct PushSourceMarker;
1248
1249impl fidl::endpoints::ProtocolMarker for PushSourceMarker {
1250 type Proxy = PushSourceProxy;
1251 type RequestStream = PushSourceRequestStream;
1252 #[cfg(target_os = "fuchsia")]
1253 type SynchronousProxy = PushSourceSynchronousProxy;
1254
1255 const DEBUG_NAME: &'static str = "fuchsia.time.external.PushSource";
1256}
1257impl fidl::endpoints::DiscoverableProtocolMarker for PushSourceMarker {}
1258
1259pub trait PushSourceProxyInterface: Send + Sync {
1260 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1261 type WatchSampleResponseFut: std::future::Future<Output = Result<TimeSample, fidl::Error>>
1262 + Send;
1263 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut;
1264 type WatchStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
1265 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
1266}
1267#[derive(Debug)]
1268#[cfg(target_os = "fuchsia")]
1269pub struct PushSourceSynchronousProxy {
1270 client: fidl::client::sync::Client,
1271}
1272
1273#[cfg(target_os = "fuchsia")]
1274impl fidl::endpoints::SynchronousProxy for PushSourceSynchronousProxy {
1275 type Proxy = PushSourceProxy;
1276 type Protocol = PushSourceMarker;
1277
1278 fn from_channel(inner: fidl::Channel) -> Self {
1279 Self::new(inner)
1280 }
1281
1282 fn into_channel(self) -> fidl::Channel {
1283 self.client.into_channel()
1284 }
1285
1286 fn as_channel(&self) -> &fidl::Channel {
1287 self.client.as_channel()
1288 }
1289}
1290
1291#[cfg(target_os = "fuchsia")]
1292impl PushSourceSynchronousProxy {
1293 pub fn new(channel: fidl::Channel) -> Self {
1294 Self { client: fidl::client::sync::Client::new(channel) }
1295 }
1296
1297 pub fn into_channel(self) -> fidl::Channel {
1298 self.client.into_channel()
1299 }
1300
1301 pub fn wait_for_event(
1304 &self,
1305 deadline: zx::MonotonicInstant,
1306 ) -> Result<PushSourceEvent, fidl::Error> {
1307 PushSourceEvent::decode(self.client.wait_for_event::<PushSourceMarker>(deadline)?)
1308 }
1309
1310 pub fn r#update_device_properties(
1313 &self,
1314 mut properties: &Properties,
1315 ) -> Result<(), fidl::Error> {
1316 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1317 (properties,),
1318 0x63704f8bd0962f00,
1319 fidl::encoding::DynamicFlags::empty(),
1320 )
1321 }
1322
1323 pub fn r#watch_sample(
1337 &self,
1338 ___deadline: zx::MonotonicInstant,
1339 ) -> Result<TimeSample, fidl::Error> {
1340 let _response = self.client.send_query::<
1341 fidl::encoding::EmptyPayload,
1342 PushSourceWatchSampleResponse,
1343 PushSourceMarker,
1344 >(
1345 (),
1346 0x44d515a56e8304dc,
1347 fidl::encoding::DynamicFlags::empty(),
1348 ___deadline,
1349 )?;
1350 Ok(_response.sample)
1351 }
1352
1353 pub fn r#watch_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
1362 let _response = self.client.send_query::<
1363 fidl::encoding::EmptyPayload,
1364 PushSourceWatchStatusResponse,
1365 PushSourceMarker,
1366 >(
1367 (),
1368 0x60621a545f488bb1,
1369 fidl::encoding::DynamicFlags::empty(),
1370 ___deadline,
1371 )?;
1372 Ok(_response.status)
1373 }
1374}
1375
1376#[cfg(target_os = "fuchsia")]
1377impl From<PushSourceSynchronousProxy> for zx::NullableHandle {
1378 fn from(value: PushSourceSynchronousProxy) -> Self {
1379 value.into_channel().into()
1380 }
1381}
1382
1383#[cfg(target_os = "fuchsia")]
1384impl From<fidl::Channel> for PushSourceSynchronousProxy {
1385 fn from(value: fidl::Channel) -> Self {
1386 Self::new(value)
1387 }
1388}
1389
1390#[cfg(target_os = "fuchsia")]
1391impl fidl::endpoints::FromClient for PushSourceSynchronousProxy {
1392 type Protocol = PushSourceMarker;
1393
1394 fn from_client(value: fidl::endpoints::ClientEnd<PushSourceMarker>) -> Self {
1395 Self::new(value.into_channel())
1396 }
1397}
1398
1399#[derive(Debug, Clone)]
1400pub struct PushSourceProxy {
1401 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1402}
1403
1404impl fidl::endpoints::Proxy for PushSourceProxy {
1405 type Protocol = PushSourceMarker;
1406
1407 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1408 Self::new(inner)
1409 }
1410
1411 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1412 self.client.into_channel().map_err(|client| Self { client })
1413 }
1414
1415 fn as_channel(&self) -> &::fidl::AsyncChannel {
1416 self.client.as_channel()
1417 }
1418}
1419
1420impl PushSourceProxy {
1421 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1423 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1424 Self { client: fidl::client::Client::new(channel, protocol_name) }
1425 }
1426
1427 pub fn take_event_stream(&self) -> PushSourceEventStream {
1433 PushSourceEventStream { event_receiver: self.client.take_event_receiver() }
1434 }
1435
1436 pub fn r#update_device_properties(
1439 &self,
1440 mut properties: &Properties,
1441 ) -> Result<(), fidl::Error> {
1442 PushSourceProxyInterface::r#update_device_properties(self, properties)
1443 }
1444
1445 pub fn r#watch_sample(
1459 &self,
1460 ) -> fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>
1461 {
1462 PushSourceProxyInterface::r#watch_sample(self)
1463 }
1464
1465 pub fn r#watch_status(
1474 &self,
1475 ) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
1476 PushSourceProxyInterface::r#watch_status(self)
1477 }
1478}
1479
1480impl PushSourceProxyInterface for PushSourceProxy {
1481 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
1482 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1483 (properties,),
1484 0x63704f8bd0962f00,
1485 fidl::encoding::DynamicFlags::empty(),
1486 )
1487 }
1488
1489 type WatchSampleResponseFut =
1490 fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>;
1491 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut {
1492 fn _decode(
1493 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1494 ) -> Result<TimeSample, fidl::Error> {
1495 let _response = fidl::client::decode_transaction_body::<
1496 PushSourceWatchSampleResponse,
1497 fidl::encoding::DefaultFuchsiaResourceDialect,
1498 0x44d515a56e8304dc,
1499 >(_buf?)?;
1500 Ok(_response.sample)
1501 }
1502 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TimeSample>(
1503 (),
1504 0x44d515a56e8304dc,
1505 fidl::encoding::DynamicFlags::empty(),
1506 _decode,
1507 )
1508 }
1509
1510 type WatchStatusResponseFut =
1511 fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
1512 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
1513 fn _decode(
1514 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1515 ) -> Result<Status, fidl::Error> {
1516 let _response = fidl::client::decode_transaction_body::<
1517 PushSourceWatchStatusResponse,
1518 fidl::encoding::DefaultFuchsiaResourceDialect,
1519 0x60621a545f488bb1,
1520 >(_buf?)?;
1521 Ok(_response.status)
1522 }
1523 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
1524 (),
1525 0x60621a545f488bb1,
1526 fidl::encoding::DynamicFlags::empty(),
1527 _decode,
1528 )
1529 }
1530}
1531
1532pub struct PushSourceEventStream {
1533 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1534}
1535
1536impl std::marker::Unpin for PushSourceEventStream {}
1537
1538impl futures::stream::FusedStream for PushSourceEventStream {
1539 fn is_terminated(&self) -> bool {
1540 self.event_receiver.is_terminated()
1541 }
1542}
1543
1544impl futures::Stream for PushSourceEventStream {
1545 type Item = Result<PushSourceEvent, fidl::Error>;
1546
1547 fn poll_next(
1548 mut self: std::pin::Pin<&mut Self>,
1549 cx: &mut std::task::Context<'_>,
1550 ) -> std::task::Poll<Option<Self::Item>> {
1551 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1552 &mut self.event_receiver,
1553 cx
1554 )?) {
1555 Some(buf) => std::task::Poll::Ready(Some(PushSourceEvent::decode(buf))),
1556 None => std::task::Poll::Ready(None),
1557 }
1558 }
1559}
1560
1561#[derive(Debug)]
1562pub enum PushSourceEvent {}
1563
1564impl PushSourceEvent {
1565 fn decode(
1567 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1568 ) -> Result<PushSourceEvent, fidl::Error> {
1569 let (bytes, _handles) = buf.split_mut();
1570 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1571 debug_assert_eq!(tx_header.tx_id, 0);
1572 match tx_header.ordinal {
1573 _ => Err(fidl::Error::UnknownOrdinal {
1574 ordinal: tx_header.ordinal,
1575 protocol_name: <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1576 }),
1577 }
1578 }
1579}
1580
1581pub struct PushSourceRequestStream {
1583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1584 is_terminated: bool,
1585}
1586
1587impl std::marker::Unpin for PushSourceRequestStream {}
1588
1589impl futures::stream::FusedStream for PushSourceRequestStream {
1590 fn is_terminated(&self) -> bool {
1591 self.is_terminated
1592 }
1593}
1594
1595impl fidl::endpoints::RequestStream for PushSourceRequestStream {
1596 type Protocol = PushSourceMarker;
1597 type ControlHandle = PushSourceControlHandle;
1598
1599 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1600 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1601 }
1602
1603 fn control_handle(&self) -> Self::ControlHandle {
1604 PushSourceControlHandle { inner: self.inner.clone() }
1605 }
1606
1607 fn into_inner(
1608 self,
1609 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1610 {
1611 (self.inner, self.is_terminated)
1612 }
1613
1614 fn from_inner(
1615 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1616 is_terminated: bool,
1617 ) -> Self {
1618 Self { inner, is_terminated }
1619 }
1620}
1621
1622impl futures::Stream for PushSourceRequestStream {
1623 type Item = Result<PushSourceRequest, fidl::Error>;
1624
1625 fn poll_next(
1626 mut self: std::pin::Pin<&mut Self>,
1627 cx: &mut std::task::Context<'_>,
1628 ) -> std::task::Poll<Option<Self::Item>> {
1629 let this = &mut *self;
1630 if this.inner.check_shutdown(cx) {
1631 this.is_terminated = true;
1632 return std::task::Poll::Ready(None);
1633 }
1634 if this.is_terminated {
1635 panic!("polled PushSourceRequestStream after completion");
1636 }
1637 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1638 |bytes, handles| {
1639 match this.inner.channel().read_etc(cx, bytes, handles) {
1640 std::task::Poll::Ready(Ok(())) => {}
1641 std::task::Poll::Pending => return std::task::Poll::Pending,
1642 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1643 this.is_terminated = true;
1644 return std::task::Poll::Ready(None);
1645 }
1646 std::task::Poll::Ready(Err(e)) => {
1647 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1648 e.into(),
1649 ))));
1650 }
1651 }
1652
1653 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1655
1656 std::task::Poll::Ready(Some(match header.ordinal {
1657 0x63704f8bd0962f00 => {
1658 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1659 let mut req = fidl::new_empty!(
1660 TimeSourceUpdateDevicePropertiesRequest,
1661 fidl::encoding::DefaultFuchsiaResourceDialect
1662 );
1663 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
1664 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1665 Ok(PushSourceRequest::UpdateDeviceProperties {
1666 properties: req.properties,
1667
1668 control_handle,
1669 })
1670 }
1671 0x44d515a56e8304dc => {
1672 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1673 let mut req = fidl::new_empty!(
1674 fidl::encoding::EmptyPayload,
1675 fidl::encoding::DefaultFuchsiaResourceDialect
1676 );
1677 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1678 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1679 Ok(PushSourceRequest::WatchSample {
1680 responder: PushSourceWatchSampleResponder {
1681 control_handle: std::mem::ManuallyDrop::new(control_handle),
1682 tx_id: header.tx_id,
1683 },
1684 })
1685 }
1686 0x60621a545f488bb1 => {
1687 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1688 let mut req = fidl::new_empty!(
1689 fidl::encoding::EmptyPayload,
1690 fidl::encoding::DefaultFuchsiaResourceDialect
1691 );
1692 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1693 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1694 Ok(PushSourceRequest::WatchStatus {
1695 responder: PushSourceWatchStatusResponder {
1696 control_handle: std::mem::ManuallyDrop::new(control_handle),
1697 tx_id: header.tx_id,
1698 },
1699 })
1700 }
1701 _ => Err(fidl::Error::UnknownOrdinal {
1702 ordinal: header.ordinal,
1703 protocol_name:
1704 <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1705 }),
1706 }))
1707 },
1708 )
1709 }
1710}
1711
1712#[derive(Debug)]
1718pub enum PushSourceRequest {
1719 UpdateDeviceProperties { properties: Properties, control_handle: PushSourceControlHandle },
1722 WatchSample { responder: PushSourceWatchSampleResponder },
1736 WatchStatus { responder: PushSourceWatchStatusResponder },
1745}
1746
1747impl PushSourceRequest {
1748 #[allow(irrefutable_let_patterns)]
1749 pub fn into_update_device_properties(self) -> Option<(Properties, PushSourceControlHandle)> {
1750 if let PushSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1751 Some((properties, control_handle))
1752 } else {
1753 None
1754 }
1755 }
1756
1757 #[allow(irrefutable_let_patterns)]
1758 pub fn into_watch_sample(self) -> Option<(PushSourceWatchSampleResponder)> {
1759 if let PushSourceRequest::WatchSample { responder } = self {
1760 Some((responder))
1761 } else {
1762 None
1763 }
1764 }
1765
1766 #[allow(irrefutable_let_patterns)]
1767 pub fn into_watch_status(self) -> Option<(PushSourceWatchStatusResponder)> {
1768 if let PushSourceRequest::WatchStatus { responder } = self {
1769 Some((responder))
1770 } else {
1771 None
1772 }
1773 }
1774
1775 pub fn method_name(&self) -> &'static str {
1777 match *self {
1778 PushSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1779 PushSourceRequest::WatchSample { .. } => "watch_sample",
1780 PushSourceRequest::WatchStatus { .. } => "watch_status",
1781 }
1782 }
1783}
1784
1785#[derive(Debug, Clone)]
1786pub struct PushSourceControlHandle {
1787 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1788}
1789
1790impl fidl::endpoints::ControlHandle for PushSourceControlHandle {
1791 fn shutdown(&self) {
1792 self.inner.shutdown()
1793 }
1794
1795 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1796 self.inner.shutdown_with_epitaph(status)
1797 }
1798
1799 fn is_closed(&self) -> bool {
1800 self.inner.channel().is_closed()
1801 }
1802 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1803 self.inner.channel().on_closed()
1804 }
1805
1806 #[cfg(target_os = "fuchsia")]
1807 fn signal_peer(
1808 &self,
1809 clear_mask: zx::Signals,
1810 set_mask: zx::Signals,
1811 ) -> Result<(), zx_status::Status> {
1812 use fidl::Peered;
1813 self.inner.channel().signal_peer(clear_mask, set_mask)
1814 }
1815}
1816
1817impl PushSourceControlHandle {}
1818
1819#[must_use = "FIDL methods require a response to be sent"]
1820#[derive(Debug)]
1821pub struct PushSourceWatchSampleResponder {
1822 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1823 tx_id: u32,
1824}
1825
1826impl std::ops::Drop for PushSourceWatchSampleResponder {
1830 fn drop(&mut self) {
1831 self.control_handle.shutdown();
1832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1834 }
1835}
1836
1837impl fidl::endpoints::Responder for PushSourceWatchSampleResponder {
1838 type ControlHandle = PushSourceControlHandle;
1839
1840 fn control_handle(&self) -> &PushSourceControlHandle {
1841 &self.control_handle
1842 }
1843
1844 fn drop_without_shutdown(mut self) {
1845 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1847 std::mem::forget(self);
1849 }
1850}
1851
1852impl PushSourceWatchSampleResponder {
1853 pub fn send(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1857 let _result = self.send_raw(sample);
1858 if _result.is_err() {
1859 self.control_handle.shutdown();
1860 }
1861 self.drop_without_shutdown();
1862 _result
1863 }
1864
1865 pub fn send_no_shutdown_on_err(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1867 let _result = self.send_raw(sample);
1868 self.drop_without_shutdown();
1869 _result
1870 }
1871
1872 fn send_raw(&self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1873 self.control_handle.inner.send::<PushSourceWatchSampleResponse>(
1874 (sample,),
1875 self.tx_id,
1876 0x44d515a56e8304dc,
1877 fidl::encoding::DynamicFlags::empty(),
1878 )
1879 }
1880}
1881
1882#[must_use = "FIDL methods require a response to be sent"]
1883#[derive(Debug)]
1884pub struct PushSourceWatchStatusResponder {
1885 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1886 tx_id: u32,
1887}
1888
1889impl std::ops::Drop for PushSourceWatchStatusResponder {
1893 fn drop(&mut self) {
1894 self.control_handle.shutdown();
1895 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1897 }
1898}
1899
1900impl fidl::endpoints::Responder for PushSourceWatchStatusResponder {
1901 type ControlHandle = PushSourceControlHandle;
1902
1903 fn control_handle(&self) -> &PushSourceControlHandle {
1904 &self.control_handle
1905 }
1906
1907 fn drop_without_shutdown(mut self) {
1908 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1910 std::mem::forget(self);
1912 }
1913}
1914
1915impl PushSourceWatchStatusResponder {
1916 pub fn send(self, mut status: Status) -> Result<(), fidl::Error> {
1920 let _result = self.send_raw(status);
1921 if _result.is_err() {
1922 self.control_handle.shutdown();
1923 }
1924 self.drop_without_shutdown();
1925 _result
1926 }
1927
1928 pub fn send_no_shutdown_on_err(self, mut status: Status) -> Result<(), fidl::Error> {
1930 let _result = self.send_raw(status);
1931 self.drop_without_shutdown();
1932 _result
1933 }
1934
1935 fn send_raw(&self, mut status: Status) -> Result<(), fidl::Error> {
1936 self.control_handle.inner.send::<PushSourceWatchStatusResponse>(
1937 (status,),
1938 self.tx_id,
1939 0x60621a545f488bb1,
1940 fidl::encoding::DynamicFlags::empty(),
1941 )
1942 }
1943}
1944
1945#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1946pub struct TimeSourceMarker;
1947
1948impl fidl::endpoints::ProtocolMarker for TimeSourceMarker {
1949 type Proxy = TimeSourceProxy;
1950 type RequestStream = TimeSourceRequestStream;
1951 #[cfg(target_os = "fuchsia")]
1952 type SynchronousProxy = TimeSourceSynchronousProxy;
1953
1954 const DEBUG_NAME: &'static str = "(anonymous) TimeSource";
1955}
1956
1957pub trait TimeSourceProxyInterface: Send + Sync {
1958 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1959}
1960#[derive(Debug)]
1961#[cfg(target_os = "fuchsia")]
1962pub struct TimeSourceSynchronousProxy {
1963 client: fidl::client::sync::Client,
1964}
1965
1966#[cfg(target_os = "fuchsia")]
1967impl fidl::endpoints::SynchronousProxy for TimeSourceSynchronousProxy {
1968 type Proxy = TimeSourceProxy;
1969 type Protocol = TimeSourceMarker;
1970
1971 fn from_channel(inner: fidl::Channel) -> Self {
1972 Self::new(inner)
1973 }
1974
1975 fn into_channel(self) -> fidl::Channel {
1976 self.client.into_channel()
1977 }
1978
1979 fn as_channel(&self) -> &fidl::Channel {
1980 self.client.as_channel()
1981 }
1982}
1983
1984#[cfg(target_os = "fuchsia")]
1985impl TimeSourceSynchronousProxy {
1986 pub fn new(channel: fidl::Channel) -> Self {
1987 Self { client: fidl::client::sync::Client::new(channel) }
1988 }
1989
1990 pub fn into_channel(self) -> fidl::Channel {
1991 self.client.into_channel()
1992 }
1993
1994 pub fn wait_for_event(
1997 &self,
1998 deadline: zx::MonotonicInstant,
1999 ) -> Result<TimeSourceEvent, fidl::Error> {
2000 TimeSourceEvent::decode(self.client.wait_for_event::<TimeSourceMarker>(deadline)?)
2001 }
2002
2003 pub fn r#update_device_properties(
2006 &self,
2007 mut properties: &Properties,
2008 ) -> Result<(), fidl::Error> {
2009 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2010 (properties,),
2011 0x63704f8bd0962f00,
2012 fidl::encoding::DynamicFlags::empty(),
2013 )
2014 }
2015}
2016
2017#[cfg(target_os = "fuchsia")]
2018impl From<TimeSourceSynchronousProxy> for zx::NullableHandle {
2019 fn from(value: TimeSourceSynchronousProxy) -> Self {
2020 value.into_channel().into()
2021 }
2022}
2023
2024#[cfg(target_os = "fuchsia")]
2025impl From<fidl::Channel> for TimeSourceSynchronousProxy {
2026 fn from(value: fidl::Channel) -> Self {
2027 Self::new(value)
2028 }
2029}
2030
2031#[cfg(target_os = "fuchsia")]
2032impl fidl::endpoints::FromClient for TimeSourceSynchronousProxy {
2033 type Protocol = TimeSourceMarker;
2034
2035 fn from_client(value: fidl::endpoints::ClientEnd<TimeSourceMarker>) -> Self {
2036 Self::new(value.into_channel())
2037 }
2038}
2039
2040#[derive(Debug, Clone)]
2041pub struct TimeSourceProxy {
2042 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2043}
2044
2045impl fidl::endpoints::Proxy for TimeSourceProxy {
2046 type Protocol = TimeSourceMarker;
2047
2048 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2049 Self::new(inner)
2050 }
2051
2052 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2053 self.client.into_channel().map_err(|client| Self { client })
2054 }
2055
2056 fn as_channel(&self) -> &::fidl::AsyncChannel {
2057 self.client.as_channel()
2058 }
2059}
2060
2061impl TimeSourceProxy {
2062 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2064 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2065 Self { client: fidl::client::Client::new(channel, protocol_name) }
2066 }
2067
2068 pub fn take_event_stream(&self) -> TimeSourceEventStream {
2074 TimeSourceEventStream { event_receiver: self.client.take_event_receiver() }
2075 }
2076
2077 pub fn r#update_device_properties(
2080 &self,
2081 mut properties: &Properties,
2082 ) -> Result<(), fidl::Error> {
2083 TimeSourceProxyInterface::r#update_device_properties(self, properties)
2084 }
2085}
2086
2087impl TimeSourceProxyInterface for TimeSourceProxy {
2088 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
2089 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2090 (properties,),
2091 0x63704f8bd0962f00,
2092 fidl::encoding::DynamicFlags::empty(),
2093 )
2094 }
2095}
2096
2097pub struct TimeSourceEventStream {
2098 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2099}
2100
2101impl std::marker::Unpin for TimeSourceEventStream {}
2102
2103impl futures::stream::FusedStream for TimeSourceEventStream {
2104 fn is_terminated(&self) -> bool {
2105 self.event_receiver.is_terminated()
2106 }
2107}
2108
2109impl futures::Stream for TimeSourceEventStream {
2110 type Item = Result<TimeSourceEvent, fidl::Error>;
2111
2112 fn poll_next(
2113 mut self: std::pin::Pin<&mut Self>,
2114 cx: &mut std::task::Context<'_>,
2115 ) -> std::task::Poll<Option<Self::Item>> {
2116 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2117 &mut self.event_receiver,
2118 cx
2119 )?) {
2120 Some(buf) => std::task::Poll::Ready(Some(TimeSourceEvent::decode(buf))),
2121 None => std::task::Poll::Ready(None),
2122 }
2123 }
2124}
2125
2126#[derive(Debug)]
2127pub enum TimeSourceEvent {}
2128
2129impl TimeSourceEvent {
2130 fn decode(
2132 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2133 ) -> Result<TimeSourceEvent, fidl::Error> {
2134 let (bytes, _handles) = buf.split_mut();
2135 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2136 debug_assert_eq!(tx_header.tx_id, 0);
2137 match tx_header.ordinal {
2138 _ => Err(fidl::Error::UnknownOrdinal {
2139 ordinal: tx_header.ordinal,
2140 protocol_name: <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2141 }),
2142 }
2143 }
2144}
2145
2146pub struct TimeSourceRequestStream {
2148 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2149 is_terminated: bool,
2150}
2151
2152impl std::marker::Unpin for TimeSourceRequestStream {}
2153
2154impl futures::stream::FusedStream for TimeSourceRequestStream {
2155 fn is_terminated(&self) -> bool {
2156 self.is_terminated
2157 }
2158}
2159
2160impl fidl::endpoints::RequestStream for TimeSourceRequestStream {
2161 type Protocol = TimeSourceMarker;
2162 type ControlHandle = TimeSourceControlHandle;
2163
2164 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2165 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2166 }
2167
2168 fn control_handle(&self) -> Self::ControlHandle {
2169 TimeSourceControlHandle { inner: self.inner.clone() }
2170 }
2171
2172 fn into_inner(
2173 self,
2174 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2175 {
2176 (self.inner, self.is_terminated)
2177 }
2178
2179 fn from_inner(
2180 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2181 is_terminated: bool,
2182 ) -> Self {
2183 Self { inner, is_terminated }
2184 }
2185}
2186
2187impl futures::Stream for TimeSourceRequestStream {
2188 type Item = Result<TimeSourceRequest, fidl::Error>;
2189
2190 fn poll_next(
2191 mut self: std::pin::Pin<&mut Self>,
2192 cx: &mut std::task::Context<'_>,
2193 ) -> std::task::Poll<Option<Self::Item>> {
2194 let this = &mut *self;
2195 if this.inner.check_shutdown(cx) {
2196 this.is_terminated = true;
2197 return std::task::Poll::Ready(None);
2198 }
2199 if this.is_terminated {
2200 panic!("polled TimeSourceRequestStream after completion");
2201 }
2202 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2203 |bytes, handles| {
2204 match this.inner.channel().read_etc(cx, bytes, handles) {
2205 std::task::Poll::Ready(Ok(())) => {}
2206 std::task::Poll::Pending => return std::task::Poll::Pending,
2207 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2208 this.is_terminated = true;
2209 return std::task::Poll::Ready(None);
2210 }
2211 std::task::Poll::Ready(Err(e)) => {
2212 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2213 e.into(),
2214 ))));
2215 }
2216 }
2217
2218 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2220
2221 std::task::Poll::Ready(Some(match header.ordinal {
2222 0x63704f8bd0962f00 => {
2223 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2224 let mut req = fidl::new_empty!(
2225 TimeSourceUpdateDevicePropertiesRequest,
2226 fidl::encoding::DefaultFuchsiaResourceDialect
2227 );
2228 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
2229 let control_handle = TimeSourceControlHandle { inner: this.inner.clone() };
2230 Ok(TimeSourceRequest::UpdateDeviceProperties {
2231 properties: req.properties,
2232
2233 control_handle,
2234 })
2235 }
2236 _ => Err(fidl::Error::UnknownOrdinal {
2237 ordinal: header.ordinal,
2238 protocol_name:
2239 <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2240 }),
2241 }))
2242 },
2243 )
2244 }
2245}
2246
2247#[derive(Debug)]
2250pub enum TimeSourceRequest {
2251 UpdateDeviceProperties { properties: Properties, control_handle: TimeSourceControlHandle },
2254}
2255
2256impl TimeSourceRequest {
2257 #[allow(irrefutable_let_patterns)]
2258 pub fn into_update_device_properties(self) -> Option<(Properties, TimeSourceControlHandle)> {
2259 if let TimeSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
2260 Some((properties, control_handle))
2261 } else {
2262 None
2263 }
2264 }
2265
2266 pub fn method_name(&self) -> &'static str {
2268 match *self {
2269 TimeSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
2270 }
2271 }
2272}
2273
2274#[derive(Debug, Clone)]
2275pub struct TimeSourceControlHandle {
2276 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2277}
2278
2279impl fidl::endpoints::ControlHandle for TimeSourceControlHandle {
2280 fn shutdown(&self) {
2281 self.inner.shutdown()
2282 }
2283
2284 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2285 self.inner.shutdown_with_epitaph(status)
2286 }
2287
2288 fn is_closed(&self) -> bool {
2289 self.inner.channel().is_closed()
2290 }
2291 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2292 self.inner.channel().on_closed()
2293 }
2294
2295 #[cfg(target_os = "fuchsia")]
2296 fn signal_peer(
2297 &self,
2298 clear_mask: zx::Signals,
2299 set_mask: zx::Signals,
2300 ) -> Result<(), zx_status::Status> {
2301 use fidl::Peered;
2302 self.inner.channel().signal_peer(clear_mask, set_mask)
2303 }
2304}
2305
2306impl TimeSourceControlHandle {}
2307
2308mod internal {
2309 use super::*;
2310}