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::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 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
594 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
595 }
596
597 pub fn into_channel(self) -> fidl::Channel {
598 self.client.into_channel()
599 }
600
601 pub fn wait_for_event(
604 &self,
605 deadline: zx::MonotonicInstant,
606 ) -> Result<PullSourceEvent, fidl::Error> {
607 PullSourceEvent::decode(self.client.wait_for_event(deadline)?)
608 }
609
610 pub fn r#update_device_properties(
613 &self,
614 mut properties: &Properties,
615 ) -> Result<(), fidl::Error> {
616 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
617 (properties,),
618 0x63704f8bd0962f00,
619 fidl::encoding::DynamicFlags::empty(),
620 )
621 }
622
623 pub fn r#sample(
638 &self,
639 mut urgency: Urgency,
640 ___deadline: zx::MonotonicInstant,
641 ) -> Result<PullSourceSampleResult, fidl::Error> {
642 let _response = self.client.send_query::<
643 PullSourceSampleRequest,
644 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
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
662 .client
663 .send_query::<fidl::encoding::EmptyPayload, PullSourceNextPossibleSampleTimeResponse>(
664 (),
665 0x69ca2b1fd63e88a5,
666 fidl::encoding::DynamicFlags::empty(),
667 ___deadline,
668 )?;
669 Ok(_response.next_possible_time)
670 }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl From<PullSourceSynchronousProxy> for zx::NullableHandle {
675 fn from(value: PullSourceSynchronousProxy) -> Self {
676 value.into_channel().into()
677 }
678}
679
680#[cfg(target_os = "fuchsia")]
681impl From<fidl::Channel> for PullSourceSynchronousProxy {
682 fn from(value: fidl::Channel) -> Self {
683 Self::new(value)
684 }
685}
686
687#[cfg(target_os = "fuchsia")]
688impl fidl::endpoints::FromClient for PullSourceSynchronousProxy {
689 type Protocol = PullSourceMarker;
690
691 fn from_client(value: fidl::endpoints::ClientEnd<PullSourceMarker>) -> Self {
692 Self::new(value.into_channel())
693 }
694}
695
696#[derive(Debug, Clone)]
697pub struct PullSourceProxy {
698 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
699}
700
701impl fidl::endpoints::Proxy for PullSourceProxy {
702 type Protocol = PullSourceMarker;
703
704 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
705 Self::new(inner)
706 }
707
708 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
709 self.client.into_channel().map_err(|client| Self { client })
710 }
711
712 fn as_channel(&self) -> &::fidl::AsyncChannel {
713 self.client.as_channel()
714 }
715}
716
717impl PullSourceProxy {
718 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
720 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
721 Self { client: fidl::client::Client::new(channel, protocol_name) }
722 }
723
724 pub fn take_event_stream(&self) -> PullSourceEventStream {
730 PullSourceEventStream { event_receiver: self.client.take_event_receiver() }
731 }
732
733 pub fn r#update_device_properties(
736 &self,
737 mut properties: &Properties,
738 ) -> Result<(), fidl::Error> {
739 PullSourceProxyInterface::r#update_device_properties(self, properties)
740 }
741
742 pub fn r#sample(
757 &self,
758 mut urgency: Urgency,
759 ) -> fidl::client::QueryResponseFut<
760 PullSourceSampleResult,
761 fidl::encoding::DefaultFuchsiaResourceDialect,
762 > {
763 PullSourceProxyInterface::r#sample(self, urgency)
764 }
765
766 pub fn r#next_possible_sample_time(
770 &self,
771 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
772 PullSourceProxyInterface::r#next_possible_sample_time(self)
773 }
774}
775
776impl PullSourceProxyInterface for PullSourceProxy {
777 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
778 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
779 (properties,),
780 0x63704f8bd0962f00,
781 fidl::encoding::DynamicFlags::empty(),
782 )
783 }
784
785 type SampleResponseFut = fidl::client::QueryResponseFut<
786 PullSourceSampleResult,
787 fidl::encoding::DefaultFuchsiaResourceDialect,
788 >;
789 fn r#sample(&self, mut urgency: Urgency) -> Self::SampleResponseFut {
790 fn _decode(
791 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
792 ) -> Result<PullSourceSampleResult, fidl::Error> {
793 let _response = fidl::client::decode_transaction_body::<
794 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
795 fidl::encoding::DefaultFuchsiaResourceDialect,
796 0x2d29007d8c9cb45a,
797 >(_buf?)?;
798 Ok(_response.map(|x| x.sample))
799 }
800 self.client.send_query_and_decode::<PullSourceSampleRequest, PullSourceSampleResult>(
801 (urgency,),
802 0x2d29007d8c9cb45a,
803 fidl::encoding::DynamicFlags::empty(),
804 _decode,
805 )
806 }
807
808 type NextPossibleSampleTimeResponseFut =
809 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
810 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut {
811 fn _decode(
812 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
813 ) -> Result<i64, fidl::Error> {
814 let _response = fidl::client::decode_transaction_body::<
815 PullSourceNextPossibleSampleTimeResponse,
816 fidl::encoding::DefaultFuchsiaResourceDialect,
817 0x69ca2b1fd63e88a5,
818 >(_buf?)?;
819 Ok(_response.next_possible_time)
820 }
821 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
822 (),
823 0x69ca2b1fd63e88a5,
824 fidl::encoding::DynamicFlags::empty(),
825 _decode,
826 )
827 }
828}
829
830pub struct PullSourceEventStream {
831 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
832}
833
834impl std::marker::Unpin for PullSourceEventStream {}
835
836impl futures::stream::FusedStream for PullSourceEventStream {
837 fn is_terminated(&self) -> bool {
838 self.event_receiver.is_terminated()
839 }
840}
841
842impl futures::Stream for PullSourceEventStream {
843 type Item = Result<PullSourceEvent, fidl::Error>;
844
845 fn poll_next(
846 mut self: std::pin::Pin<&mut Self>,
847 cx: &mut std::task::Context<'_>,
848 ) -> std::task::Poll<Option<Self::Item>> {
849 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
850 &mut self.event_receiver,
851 cx
852 )?) {
853 Some(buf) => std::task::Poll::Ready(Some(PullSourceEvent::decode(buf))),
854 None => std::task::Poll::Ready(None),
855 }
856 }
857}
858
859#[derive(Debug)]
860pub enum PullSourceEvent {}
861
862impl PullSourceEvent {
863 fn decode(
865 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
866 ) -> Result<PullSourceEvent, fidl::Error> {
867 let (bytes, _handles) = buf.split_mut();
868 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
869 debug_assert_eq!(tx_header.tx_id, 0);
870 match tx_header.ordinal {
871 _ => Err(fidl::Error::UnknownOrdinal {
872 ordinal: tx_header.ordinal,
873 protocol_name: <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
874 }),
875 }
876 }
877}
878
879pub struct PullSourceRequestStream {
881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
882 is_terminated: bool,
883}
884
885impl std::marker::Unpin for PullSourceRequestStream {}
886
887impl futures::stream::FusedStream for PullSourceRequestStream {
888 fn is_terminated(&self) -> bool {
889 self.is_terminated
890 }
891}
892
893impl fidl::endpoints::RequestStream for PullSourceRequestStream {
894 type Protocol = PullSourceMarker;
895 type ControlHandle = PullSourceControlHandle;
896
897 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
898 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
899 }
900
901 fn control_handle(&self) -> Self::ControlHandle {
902 PullSourceControlHandle { inner: self.inner.clone() }
903 }
904
905 fn into_inner(
906 self,
907 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
908 {
909 (self.inner, self.is_terminated)
910 }
911
912 fn from_inner(
913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
914 is_terminated: bool,
915 ) -> Self {
916 Self { inner, is_terminated }
917 }
918}
919
920impl futures::Stream for PullSourceRequestStream {
921 type Item = Result<PullSourceRequest, fidl::Error>;
922
923 fn poll_next(
924 mut self: std::pin::Pin<&mut Self>,
925 cx: &mut std::task::Context<'_>,
926 ) -> std::task::Poll<Option<Self::Item>> {
927 let this = &mut *self;
928 if this.inner.check_shutdown(cx) {
929 this.is_terminated = true;
930 return std::task::Poll::Ready(None);
931 }
932 if this.is_terminated {
933 panic!("polled PullSourceRequestStream after completion");
934 }
935 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
936 |bytes, handles| {
937 match this.inner.channel().read_etc(cx, bytes, handles) {
938 std::task::Poll::Ready(Ok(())) => {}
939 std::task::Poll::Pending => return std::task::Poll::Pending,
940 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
941 this.is_terminated = true;
942 return std::task::Poll::Ready(None);
943 }
944 std::task::Poll::Ready(Err(e)) => {
945 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
946 e.into(),
947 ))));
948 }
949 }
950
951 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
953
954 std::task::Poll::Ready(Some(match header.ordinal {
955 0x63704f8bd0962f00 => {
956 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
957 let mut req = fidl::new_empty!(
958 TimeSourceUpdateDevicePropertiesRequest,
959 fidl::encoding::DefaultFuchsiaResourceDialect
960 );
961 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
962 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
963 Ok(PullSourceRequest::UpdateDeviceProperties {
964 properties: req.properties,
965
966 control_handle,
967 })
968 }
969 0x2d29007d8c9cb45a => {
970 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
971 let mut req = fidl::new_empty!(
972 PullSourceSampleRequest,
973 fidl::encoding::DefaultFuchsiaResourceDialect
974 );
975 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PullSourceSampleRequest>(&header, _body_bytes, handles, &mut req)?;
976 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
977 Ok(PullSourceRequest::Sample {
978 urgency: req.urgency,
979
980 responder: PullSourceSampleResponder {
981 control_handle: std::mem::ManuallyDrop::new(control_handle),
982 tx_id: header.tx_id,
983 },
984 })
985 }
986 0x69ca2b1fd63e88a5 => {
987 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
988 let mut req = fidl::new_empty!(
989 fidl::encoding::EmptyPayload,
990 fidl::encoding::DefaultFuchsiaResourceDialect
991 );
992 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
993 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
994 Ok(PullSourceRequest::NextPossibleSampleTime {
995 responder: PullSourceNextPossibleSampleTimeResponder {
996 control_handle: std::mem::ManuallyDrop::new(control_handle),
997 tx_id: header.tx_id,
998 },
999 })
1000 }
1001 _ => Err(fidl::Error::UnknownOrdinal {
1002 ordinal: header.ordinal,
1003 protocol_name:
1004 <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1005 }),
1006 }))
1007 },
1008 )
1009 }
1010}
1011
1012#[derive(Debug)]
1014pub enum PullSourceRequest {
1015 UpdateDeviceProperties { properties: Properties, control_handle: PullSourceControlHandle },
1018 Sample { urgency: Urgency, responder: PullSourceSampleResponder },
1033 NextPossibleSampleTime { responder: PullSourceNextPossibleSampleTimeResponder },
1037}
1038
1039impl PullSourceRequest {
1040 #[allow(irrefutable_let_patterns)]
1041 pub fn into_update_device_properties(self) -> Option<(Properties, PullSourceControlHandle)> {
1042 if let PullSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1043 Some((properties, control_handle))
1044 } else {
1045 None
1046 }
1047 }
1048
1049 #[allow(irrefutable_let_patterns)]
1050 pub fn into_sample(self) -> Option<(Urgency, PullSourceSampleResponder)> {
1051 if let PullSourceRequest::Sample { urgency, responder } = self {
1052 Some((urgency, responder))
1053 } else {
1054 None
1055 }
1056 }
1057
1058 #[allow(irrefutable_let_patterns)]
1059 pub fn into_next_possible_sample_time(
1060 self,
1061 ) -> Option<(PullSourceNextPossibleSampleTimeResponder)> {
1062 if let PullSourceRequest::NextPossibleSampleTime { responder } = self {
1063 Some((responder))
1064 } else {
1065 None
1066 }
1067 }
1068
1069 pub fn method_name(&self) -> &'static str {
1071 match *self {
1072 PullSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1073 PullSourceRequest::Sample { .. } => "sample",
1074 PullSourceRequest::NextPossibleSampleTime { .. } => "next_possible_sample_time",
1075 }
1076 }
1077}
1078
1079#[derive(Debug, Clone)]
1080pub struct PullSourceControlHandle {
1081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1082}
1083
1084impl fidl::endpoints::ControlHandle for PullSourceControlHandle {
1085 fn shutdown(&self) {
1086 self.inner.shutdown()
1087 }
1088
1089 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1090 self.inner.shutdown_with_epitaph(status)
1091 }
1092
1093 fn is_closed(&self) -> bool {
1094 self.inner.channel().is_closed()
1095 }
1096 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1097 self.inner.channel().on_closed()
1098 }
1099
1100 #[cfg(target_os = "fuchsia")]
1101 fn signal_peer(
1102 &self,
1103 clear_mask: zx::Signals,
1104 set_mask: zx::Signals,
1105 ) -> Result<(), zx_status::Status> {
1106 use fidl::Peered;
1107 self.inner.channel().signal_peer(clear_mask, set_mask)
1108 }
1109}
1110
1111impl PullSourceControlHandle {}
1112
1113#[must_use = "FIDL methods require a response to be sent"]
1114#[derive(Debug)]
1115pub struct PullSourceSampleResponder {
1116 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1117 tx_id: u32,
1118}
1119
1120impl std::ops::Drop for PullSourceSampleResponder {
1124 fn drop(&mut self) {
1125 self.control_handle.shutdown();
1126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128 }
1129}
1130
1131impl fidl::endpoints::Responder for PullSourceSampleResponder {
1132 type ControlHandle = PullSourceControlHandle;
1133
1134 fn control_handle(&self) -> &PullSourceControlHandle {
1135 &self.control_handle
1136 }
1137
1138 fn drop_without_shutdown(mut self) {
1139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1141 std::mem::forget(self);
1143 }
1144}
1145
1146impl PullSourceSampleResponder {
1147 pub fn send(self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1151 let _result = self.send_raw(result);
1152 if _result.is_err() {
1153 self.control_handle.shutdown();
1154 }
1155 self.drop_without_shutdown();
1156 _result
1157 }
1158
1159 pub fn send_no_shutdown_on_err(
1161 self,
1162 mut result: Result<&TimeSample, Error>,
1163 ) -> Result<(), fidl::Error> {
1164 let _result = self.send_raw(result);
1165 self.drop_without_shutdown();
1166 _result
1167 }
1168
1169 fn send_raw(&self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1170 self.control_handle
1171 .inner
1172 .send::<fidl::encoding::ResultType<PullSourceSampleResponse, Error>>(
1173 result.map(|sample| (sample,)),
1174 self.tx_id,
1175 0x2d29007d8c9cb45a,
1176 fidl::encoding::DynamicFlags::empty(),
1177 )
1178 }
1179}
1180
1181#[must_use = "FIDL methods require a response to be sent"]
1182#[derive(Debug)]
1183pub struct PullSourceNextPossibleSampleTimeResponder {
1184 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1185 tx_id: u32,
1186}
1187
1188impl std::ops::Drop for PullSourceNextPossibleSampleTimeResponder {
1192 fn drop(&mut self) {
1193 self.control_handle.shutdown();
1194 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1196 }
1197}
1198
1199impl fidl::endpoints::Responder for PullSourceNextPossibleSampleTimeResponder {
1200 type ControlHandle = PullSourceControlHandle;
1201
1202 fn control_handle(&self) -> &PullSourceControlHandle {
1203 &self.control_handle
1204 }
1205
1206 fn drop_without_shutdown(mut self) {
1207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1209 std::mem::forget(self);
1211 }
1212}
1213
1214impl PullSourceNextPossibleSampleTimeResponder {
1215 pub fn send(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1219 let _result = self.send_raw(next_possible_time);
1220 if _result.is_err() {
1221 self.control_handle.shutdown();
1222 }
1223 self.drop_without_shutdown();
1224 _result
1225 }
1226
1227 pub fn send_no_shutdown_on_err(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1229 let _result = self.send_raw(next_possible_time);
1230 self.drop_without_shutdown();
1231 _result
1232 }
1233
1234 fn send_raw(&self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1235 self.control_handle.inner.send::<PullSourceNextPossibleSampleTimeResponse>(
1236 (next_possible_time,),
1237 self.tx_id,
1238 0x69ca2b1fd63e88a5,
1239 fidl::encoding::DynamicFlags::empty(),
1240 )
1241 }
1242}
1243
1244#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1245pub struct PushSourceMarker;
1246
1247impl fidl::endpoints::ProtocolMarker for PushSourceMarker {
1248 type Proxy = PushSourceProxy;
1249 type RequestStream = PushSourceRequestStream;
1250 #[cfg(target_os = "fuchsia")]
1251 type SynchronousProxy = PushSourceSynchronousProxy;
1252
1253 const DEBUG_NAME: &'static str = "fuchsia.time.external.PushSource";
1254}
1255impl fidl::endpoints::DiscoverableProtocolMarker for PushSourceMarker {}
1256
1257pub trait PushSourceProxyInterface: Send + Sync {
1258 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1259 type WatchSampleResponseFut: std::future::Future<Output = Result<TimeSample, fidl::Error>>
1260 + Send;
1261 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut;
1262 type WatchStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
1263 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
1264}
1265#[derive(Debug)]
1266#[cfg(target_os = "fuchsia")]
1267pub struct PushSourceSynchronousProxy {
1268 client: fidl::client::sync::Client,
1269}
1270
1271#[cfg(target_os = "fuchsia")]
1272impl fidl::endpoints::SynchronousProxy for PushSourceSynchronousProxy {
1273 type Proxy = PushSourceProxy;
1274 type Protocol = PushSourceMarker;
1275
1276 fn from_channel(inner: fidl::Channel) -> Self {
1277 Self::new(inner)
1278 }
1279
1280 fn into_channel(self) -> fidl::Channel {
1281 self.client.into_channel()
1282 }
1283
1284 fn as_channel(&self) -> &fidl::Channel {
1285 self.client.as_channel()
1286 }
1287}
1288
1289#[cfg(target_os = "fuchsia")]
1290impl PushSourceSynchronousProxy {
1291 pub fn new(channel: fidl::Channel) -> Self {
1292 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1293 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1294 }
1295
1296 pub fn into_channel(self) -> fidl::Channel {
1297 self.client.into_channel()
1298 }
1299
1300 pub fn wait_for_event(
1303 &self,
1304 deadline: zx::MonotonicInstant,
1305 ) -> Result<PushSourceEvent, fidl::Error> {
1306 PushSourceEvent::decode(self.client.wait_for_event(deadline)?)
1307 }
1308
1309 pub fn r#update_device_properties(
1312 &self,
1313 mut properties: &Properties,
1314 ) -> Result<(), fidl::Error> {
1315 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1316 (properties,),
1317 0x63704f8bd0962f00,
1318 fidl::encoding::DynamicFlags::empty(),
1319 )
1320 }
1321
1322 pub fn r#watch_sample(
1336 &self,
1337 ___deadline: zx::MonotonicInstant,
1338 ) -> Result<TimeSample, fidl::Error> {
1339 let _response =
1340 self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchSampleResponse>(
1341 (),
1342 0x44d515a56e8304dc,
1343 fidl::encoding::DynamicFlags::empty(),
1344 ___deadline,
1345 )?;
1346 Ok(_response.sample)
1347 }
1348
1349 pub fn r#watch_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
1358 let _response =
1359 self.client.send_query::<fidl::encoding::EmptyPayload, PushSourceWatchStatusResponse>(
1360 (),
1361 0x60621a545f488bb1,
1362 fidl::encoding::DynamicFlags::empty(),
1363 ___deadline,
1364 )?;
1365 Ok(_response.status)
1366 }
1367}
1368
1369#[cfg(target_os = "fuchsia")]
1370impl From<PushSourceSynchronousProxy> for zx::NullableHandle {
1371 fn from(value: PushSourceSynchronousProxy) -> Self {
1372 value.into_channel().into()
1373 }
1374}
1375
1376#[cfg(target_os = "fuchsia")]
1377impl From<fidl::Channel> for PushSourceSynchronousProxy {
1378 fn from(value: fidl::Channel) -> Self {
1379 Self::new(value)
1380 }
1381}
1382
1383#[cfg(target_os = "fuchsia")]
1384impl fidl::endpoints::FromClient for PushSourceSynchronousProxy {
1385 type Protocol = PushSourceMarker;
1386
1387 fn from_client(value: fidl::endpoints::ClientEnd<PushSourceMarker>) -> Self {
1388 Self::new(value.into_channel())
1389 }
1390}
1391
1392#[derive(Debug, Clone)]
1393pub struct PushSourceProxy {
1394 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1395}
1396
1397impl fidl::endpoints::Proxy for PushSourceProxy {
1398 type Protocol = PushSourceMarker;
1399
1400 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1401 Self::new(inner)
1402 }
1403
1404 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1405 self.client.into_channel().map_err(|client| Self { client })
1406 }
1407
1408 fn as_channel(&self) -> &::fidl::AsyncChannel {
1409 self.client.as_channel()
1410 }
1411}
1412
1413impl PushSourceProxy {
1414 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1416 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1417 Self { client: fidl::client::Client::new(channel, protocol_name) }
1418 }
1419
1420 pub fn take_event_stream(&self) -> PushSourceEventStream {
1426 PushSourceEventStream { event_receiver: self.client.take_event_receiver() }
1427 }
1428
1429 pub fn r#update_device_properties(
1432 &self,
1433 mut properties: &Properties,
1434 ) -> Result<(), fidl::Error> {
1435 PushSourceProxyInterface::r#update_device_properties(self, properties)
1436 }
1437
1438 pub fn r#watch_sample(
1452 &self,
1453 ) -> fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>
1454 {
1455 PushSourceProxyInterface::r#watch_sample(self)
1456 }
1457
1458 pub fn r#watch_status(
1467 &self,
1468 ) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
1469 PushSourceProxyInterface::r#watch_status(self)
1470 }
1471}
1472
1473impl PushSourceProxyInterface for PushSourceProxy {
1474 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
1475 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1476 (properties,),
1477 0x63704f8bd0962f00,
1478 fidl::encoding::DynamicFlags::empty(),
1479 )
1480 }
1481
1482 type WatchSampleResponseFut =
1483 fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>;
1484 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut {
1485 fn _decode(
1486 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1487 ) -> Result<TimeSample, fidl::Error> {
1488 let _response = fidl::client::decode_transaction_body::<
1489 PushSourceWatchSampleResponse,
1490 fidl::encoding::DefaultFuchsiaResourceDialect,
1491 0x44d515a56e8304dc,
1492 >(_buf?)?;
1493 Ok(_response.sample)
1494 }
1495 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TimeSample>(
1496 (),
1497 0x44d515a56e8304dc,
1498 fidl::encoding::DynamicFlags::empty(),
1499 _decode,
1500 )
1501 }
1502
1503 type WatchStatusResponseFut =
1504 fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
1505 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
1506 fn _decode(
1507 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1508 ) -> Result<Status, fidl::Error> {
1509 let _response = fidl::client::decode_transaction_body::<
1510 PushSourceWatchStatusResponse,
1511 fidl::encoding::DefaultFuchsiaResourceDialect,
1512 0x60621a545f488bb1,
1513 >(_buf?)?;
1514 Ok(_response.status)
1515 }
1516 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
1517 (),
1518 0x60621a545f488bb1,
1519 fidl::encoding::DynamicFlags::empty(),
1520 _decode,
1521 )
1522 }
1523}
1524
1525pub struct PushSourceEventStream {
1526 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1527}
1528
1529impl std::marker::Unpin for PushSourceEventStream {}
1530
1531impl futures::stream::FusedStream for PushSourceEventStream {
1532 fn is_terminated(&self) -> bool {
1533 self.event_receiver.is_terminated()
1534 }
1535}
1536
1537impl futures::Stream for PushSourceEventStream {
1538 type Item = Result<PushSourceEvent, fidl::Error>;
1539
1540 fn poll_next(
1541 mut self: std::pin::Pin<&mut Self>,
1542 cx: &mut std::task::Context<'_>,
1543 ) -> std::task::Poll<Option<Self::Item>> {
1544 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1545 &mut self.event_receiver,
1546 cx
1547 )?) {
1548 Some(buf) => std::task::Poll::Ready(Some(PushSourceEvent::decode(buf))),
1549 None => std::task::Poll::Ready(None),
1550 }
1551 }
1552}
1553
1554#[derive(Debug)]
1555pub enum PushSourceEvent {}
1556
1557impl PushSourceEvent {
1558 fn decode(
1560 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1561 ) -> Result<PushSourceEvent, fidl::Error> {
1562 let (bytes, _handles) = buf.split_mut();
1563 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1564 debug_assert_eq!(tx_header.tx_id, 0);
1565 match tx_header.ordinal {
1566 _ => Err(fidl::Error::UnknownOrdinal {
1567 ordinal: tx_header.ordinal,
1568 protocol_name: <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1569 }),
1570 }
1571 }
1572}
1573
1574pub struct PushSourceRequestStream {
1576 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1577 is_terminated: bool,
1578}
1579
1580impl std::marker::Unpin for PushSourceRequestStream {}
1581
1582impl futures::stream::FusedStream for PushSourceRequestStream {
1583 fn is_terminated(&self) -> bool {
1584 self.is_terminated
1585 }
1586}
1587
1588impl fidl::endpoints::RequestStream for PushSourceRequestStream {
1589 type Protocol = PushSourceMarker;
1590 type ControlHandle = PushSourceControlHandle;
1591
1592 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1593 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1594 }
1595
1596 fn control_handle(&self) -> Self::ControlHandle {
1597 PushSourceControlHandle { inner: self.inner.clone() }
1598 }
1599
1600 fn into_inner(
1601 self,
1602 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1603 {
1604 (self.inner, self.is_terminated)
1605 }
1606
1607 fn from_inner(
1608 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1609 is_terminated: bool,
1610 ) -> Self {
1611 Self { inner, is_terminated }
1612 }
1613}
1614
1615impl futures::Stream for PushSourceRequestStream {
1616 type Item = Result<PushSourceRequest, fidl::Error>;
1617
1618 fn poll_next(
1619 mut self: std::pin::Pin<&mut Self>,
1620 cx: &mut std::task::Context<'_>,
1621 ) -> std::task::Poll<Option<Self::Item>> {
1622 let this = &mut *self;
1623 if this.inner.check_shutdown(cx) {
1624 this.is_terminated = true;
1625 return std::task::Poll::Ready(None);
1626 }
1627 if this.is_terminated {
1628 panic!("polled PushSourceRequestStream after completion");
1629 }
1630 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1631 |bytes, handles| {
1632 match this.inner.channel().read_etc(cx, bytes, handles) {
1633 std::task::Poll::Ready(Ok(())) => {}
1634 std::task::Poll::Pending => return std::task::Poll::Pending,
1635 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1636 this.is_terminated = true;
1637 return std::task::Poll::Ready(None);
1638 }
1639 std::task::Poll::Ready(Err(e)) => {
1640 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1641 e.into(),
1642 ))));
1643 }
1644 }
1645
1646 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1648
1649 std::task::Poll::Ready(Some(match header.ordinal {
1650 0x63704f8bd0962f00 => {
1651 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1652 let mut req = fidl::new_empty!(
1653 TimeSourceUpdateDevicePropertiesRequest,
1654 fidl::encoding::DefaultFuchsiaResourceDialect
1655 );
1656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
1657 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1658 Ok(PushSourceRequest::UpdateDeviceProperties {
1659 properties: req.properties,
1660
1661 control_handle,
1662 })
1663 }
1664 0x44d515a56e8304dc => {
1665 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1666 let mut req = fidl::new_empty!(
1667 fidl::encoding::EmptyPayload,
1668 fidl::encoding::DefaultFuchsiaResourceDialect
1669 );
1670 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1671 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1672 Ok(PushSourceRequest::WatchSample {
1673 responder: PushSourceWatchSampleResponder {
1674 control_handle: std::mem::ManuallyDrop::new(control_handle),
1675 tx_id: header.tx_id,
1676 },
1677 })
1678 }
1679 0x60621a545f488bb1 => {
1680 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1681 let mut req = fidl::new_empty!(
1682 fidl::encoding::EmptyPayload,
1683 fidl::encoding::DefaultFuchsiaResourceDialect
1684 );
1685 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1686 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1687 Ok(PushSourceRequest::WatchStatus {
1688 responder: PushSourceWatchStatusResponder {
1689 control_handle: std::mem::ManuallyDrop::new(control_handle),
1690 tx_id: header.tx_id,
1691 },
1692 })
1693 }
1694 _ => Err(fidl::Error::UnknownOrdinal {
1695 ordinal: header.ordinal,
1696 protocol_name:
1697 <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1698 }),
1699 }))
1700 },
1701 )
1702 }
1703}
1704
1705#[derive(Debug)]
1711pub enum PushSourceRequest {
1712 UpdateDeviceProperties { properties: Properties, control_handle: PushSourceControlHandle },
1715 WatchSample { responder: PushSourceWatchSampleResponder },
1729 WatchStatus { responder: PushSourceWatchStatusResponder },
1738}
1739
1740impl PushSourceRequest {
1741 #[allow(irrefutable_let_patterns)]
1742 pub fn into_update_device_properties(self) -> Option<(Properties, PushSourceControlHandle)> {
1743 if let PushSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1744 Some((properties, control_handle))
1745 } else {
1746 None
1747 }
1748 }
1749
1750 #[allow(irrefutable_let_patterns)]
1751 pub fn into_watch_sample(self) -> Option<(PushSourceWatchSampleResponder)> {
1752 if let PushSourceRequest::WatchSample { responder } = self {
1753 Some((responder))
1754 } else {
1755 None
1756 }
1757 }
1758
1759 #[allow(irrefutable_let_patterns)]
1760 pub fn into_watch_status(self) -> Option<(PushSourceWatchStatusResponder)> {
1761 if let PushSourceRequest::WatchStatus { responder } = self {
1762 Some((responder))
1763 } else {
1764 None
1765 }
1766 }
1767
1768 pub fn method_name(&self) -> &'static str {
1770 match *self {
1771 PushSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1772 PushSourceRequest::WatchSample { .. } => "watch_sample",
1773 PushSourceRequest::WatchStatus { .. } => "watch_status",
1774 }
1775 }
1776}
1777
1778#[derive(Debug, Clone)]
1779pub struct PushSourceControlHandle {
1780 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1781}
1782
1783impl fidl::endpoints::ControlHandle for PushSourceControlHandle {
1784 fn shutdown(&self) {
1785 self.inner.shutdown()
1786 }
1787
1788 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1789 self.inner.shutdown_with_epitaph(status)
1790 }
1791
1792 fn is_closed(&self) -> bool {
1793 self.inner.channel().is_closed()
1794 }
1795 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1796 self.inner.channel().on_closed()
1797 }
1798
1799 #[cfg(target_os = "fuchsia")]
1800 fn signal_peer(
1801 &self,
1802 clear_mask: zx::Signals,
1803 set_mask: zx::Signals,
1804 ) -> Result<(), zx_status::Status> {
1805 use fidl::Peered;
1806 self.inner.channel().signal_peer(clear_mask, set_mask)
1807 }
1808}
1809
1810impl PushSourceControlHandle {}
1811
1812#[must_use = "FIDL methods require a response to be sent"]
1813#[derive(Debug)]
1814pub struct PushSourceWatchSampleResponder {
1815 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1816 tx_id: u32,
1817}
1818
1819impl std::ops::Drop for PushSourceWatchSampleResponder {
1823 fn drop(&mut self) {
1824 self.control_handle.shutdown();
1825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1827 }
1828}
1829
1830impl fidl::endpoints::Responder for PushSourceWatchSampleResponder {
1831 type ControlHandle = PushSourceControlHandle;
1832
1833 fn control_handle(&self) -> &PushSourceControlHandle {
1834 &self.control_handle
1835 }
1836
1837 fn drop_without_shutdown(mut self) {
1838 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1840 std::mem::forget(self);
1842 }
1843}
1844
1845impl PushSourceWatchSampleResponder {
1846 pub fn send(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1850 let _result = self.send_raw(sample);
1851 if _result.is_err() {
1852 self.control_handle.shutdown();
1853 }
1854 self.drop_without_shutdown();
1855 _result
1856 }
1857
1858 pub fn send_no_shutdown_on_err(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1860 let _result = self.send_raw(sample);
1861 self.drop_without_shutdown();
1862 _result
1863 }
1864
1865 fn send_raw(&self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
1866 self.control_handle.inner.send::<PushSourceWatchSampleResponse>(
1867 (sample,),
1868 self.tx_id,
1869 0x44d515a56e8304dc,
1870 fidl::encoding::DynamicFlags::empty(),
1871 )
1872 }
1873}
1874
1875#[must_use = "FIDL methods require a response to be sent"]
1876#[derive(Debug)]
1877pub struct PushSourceWatchStatusResponder {
1878 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1879 tx_id: u32,
1880}
1881
1882impl std::ops::Drop for PushSourceWatchStatusResponder {
1886 fn drop(&mut self) {
1887 self.control_handle.shutdown();
1888 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1890 }
1891}
1892
1893impl fidl::endpoints::Responder for PushSourceWatchStatusResponder {
1894 type ControlHandle = PushSourceControlHandle;
1895
1896 fn control_handle(&self) -> &PushSourceControlHandle {
1897 &self.control_handle
1898 }
1899
1900 fn drop_without_shutdown(mut self) {
1901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1903 std::mem::forget(self);
1905 }
1906}
1907
1908impl PushSourceWatchStatusResponder {
1909 pub fn send(self, mut status: Status) -> Result<(), fidl::Error> {
1913 let _result = self.send_raw(status);
1914 if _result.is_err() {
1915 self.control_handle.shutdown();
1916 }
1917 self.drop_without_shutdown();
1918 _result
1919 }
1920
1921 pub fn send_no_shutdown_on_err(self, mut status: Status) -> Result<(), fidl::Error> {
1923 let _result = self.send_raw(status);
1924 self.drop_without_shutdown();
1925 _result
1926 }
1927
1928 fn send_raw(&self, mut status: Status) -> Result<(), fidl::Error> {
1929 self.control_handle.inner.send::<PushSourceWatchStatusResponse>(
1930 (status,),
1931 self.tx_id,
1932 0x60621a545f488bb1,
1933 fidl::encoding::DynamicFlags::empty(),
1934 )
1935 }
1936}
1937
1938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1939pub struct TimeSourceMarker;
1940
1941impl fidl::endpoints::ProtocolMarker for TimeSourceMarker {
1942 type Proxy = TimeSourceProxy;
1943 type RequestStream = TimeSourceRequestStream;
1944 #[cfg(target_os = "fuchsia")]
1945 type SynchronousProxy = TimeSourceSynchronousProxy;
1946
1947 const DEBUG_NAME: &'static str = "(anonymous) TimeSource";
1948}
1949
1950pub trait TimeSourceProxyInterface: Send + Sync {
1951 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1952}
1953#[derive(Debug)]
1954#[cfg(target_os = "fuchsia")]
1955pub struct TimeSourceSynchronousProxy {
1956 client: fidl::client::sync::Client,
1957}
1958
1959#[cfg(target_os = "fuchsia")]
1960impl fidl::endpoints::SynchronousProxy for TimeSourceSynchronousProxy {
1961 type Proxy = TimeSourceProxy;
1962 type Protocol = TimeSourceMarker;
1963
1964 fn from_channel(inner: fidl::Channel) -> Self {
1965 Self::new(inner)
1966 }
1967
1968 fn into_channel(self) -> fidl::Channel {
1969 self.client.into_channel()
1970 }
1971
1972 fn as_channel(&self) -> &fidl::Channel {
1973 self.client.as_channel()
1974 }
1975}
1976
1977#[cfg(target_os = "fuchsia")]
1978impl TimeSourceSynchronousProxy {
1979 pub fn new(channel: fidl::Channel) -> Self {
1980 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1981 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1982 }
1983
1984 pub fn into_channel(self) -> fidl::Channel {
1985 self.client.into_channel()
1986 }
1987
1988 pub fn wait_for_event(
1991 &self,
1992 deadline: zx::MonotonicInstant,
1993 ) -> Result<TimeSourceEvent, fidl::Error> {
1994 TimeSourceEvent::decode(self.client.wait_for_event(deadline)?)
1995 }
1996
1997 pub fn r#update_device_properties(
2000 &self,
2001 mut properties: &Properties,
2002 ) -> Result<(), fidl::Error> {
2003 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2004 (properties,),
2005 0x63704f8bd0962f00,
2006 fidl::encoding::DynamicFlags::empty(),
2007 )
2008 }
2009}
2010
2011#[cfg(target_os = "fuchsia")]
2012impl From<TimeSourceSynchronousProxy> for zx::NullableHandle {
2013 fn from(value: TimeSourceSynchronousProxy) -> Self {
2014 value.into_channel().into()
2015 }
2016}
2017
2018#[cfg(target_os = "fuchsia")]
2019impl From<fidl::Channel> for TimeSourceSynchronousProxy {
2020 fn from(value: fidl::Channel) -> Self {
2021 Self::new(value)
2022 }
2023}
2024
2025#[cfg(target_os = "fuchsia")]
2026impl fidl::endpoints::FromClient for TimeSourceSynchronousProxy {
2027 type Protocol = TimeSourceMarker;
2028
2029 fn from_client(value: fidl::endpoints::ClientEnd<TimeSourceMarker>) -> Self {
2030 Self::new(value.into_channel())
2031 }
2032}
2033
2034#[derive(Debug, Clone)]
2035pub struct TimeSourceProxy {
2036 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2037}
2038
2039impl fidl::endpoints::Proxy for TimeSourceProxy {
2040 type Protocol = TimeSourceMarker;
2041
2042 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2043 Self::new(inner)
2044 }
2045
2046 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2047 self.client.into_channel().map_err(|client| Self { client })
2048 }
2049
2050 fn as_channel(&self) -> &::fidl::AsyncChannel {
2051 self.client.as_channel()
2052 }
2053}
2054
2055impl TimeSourceProxy {
2056 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2058 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2059 Self { client: fidl::client::Client::new(channel, protocol_name) }
2060 }
2061
2062 pub fn take_event_stream(&self) -> TimeSourceEventStream {
2068 TimeSourceEventStream { event_receiver: self.client.take_event_receiver() }
2069 }
2070
2071 pub fn r#update_device_properties(
2074 &self,
2075 mut properties: &Properties,
2076 ) -> Result<(), fidl::Error> {
2077 TimeSourceProxyInterface::r#update_device_properties(self, properties)
2078 }
2079}
2080
2081impl TimeSourceProxyInterface for TimeSourceProxy {
2082 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
2083 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2084 (properties,),
2085 0x63704f8bd0962f00,
2086 fidl::encoding::DynamicFlags::empty(),
2087 )
2088 }
2089}
2090
2091pub struct TimeSourceEventStream {
2092 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2093}
2094
2095impl std::marker::Unpin for TimeSourceEventStream {}
2096
2097impl futures::stream::FusedStream for TimeSourceEventStream {
2098 fn is_terminated(&self) -> bool {
2099 self.event_receiver.is_terminated()
2100 }
2101}
2102
2103impl futures::Stream for TimeSourceEventStream {
2104 type Item = Result<TimeSourceEvent, fidl::Error>;
2105
2106 fn poll_next(
2107 mut self: std::pin::Pin<&mut Self>,
2108 cx: &mut std::task::Context<'_>,
2109 ) -> std::task::Poll<Option<Self::Item>> {
2110 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2111 &mut self.event_receiver,
2112 cx
2113 )?) {
2114 Some(buf) => std::task::Poll::Ready(Some(TimeSourceEvent::decode(buf))),
2115 None => std::task::Poll::Ready(None),
2116 }
2117 }
2118}
2119
2120#[derive(Debug)]
2121pub enum TimeSourceEvent {}
2122
2123impl TimeSourceEvent {
2124 fn decode(
2126 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2127 ) -> Result<TimeSourceEvent, fidl::Error> {
2128 let (bytes, _handles) = buf.split_mut();
2129 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2130 debug_assert_eq!(tx_header.tx_id, 0);
2131 match tx_header.ordinal {
2132 _ => Err(fidl::Error::UnknownOrdinal {
2133 ordinal: tx_header.ordinal,
2134 protocol_name: <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2135 }),
2136 }
2137 }
2138}
2139
2140pub struct TimeSourceRequestStream {
2142 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2143 is_terminated: bool,
2144}
2145
2146impl std::marker::Unpin for TimeSourceRequestStream {}
2147
2148impl futures::stream::FusedStream for TimeSourceRequestStream {
2149 fn is_terminated(&self) -> bool {
2150 self.is_terminated
2151 }
2152}
2153
2154impl fidl::endpoints::RequestStream for TimeSourceRequestStream {
2155 type Protocol = TimeSourceMarker;
2156 type ControlHandle = TimeSourceControlHandle;
2157
2158 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2159 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2160 }
2161
2162 fn control_handle(&self) -> Self::ControlHandle {
2163 TimeSourceControlHandle { inner: self.inner.clone() }
2164 }
2165
2166 fn into_inner(
2167 self,
2168 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2169 {
2170 (self.inner, self.is_terminated)
2171 }
2172
2173 fn from_inner(
2174 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2175 is_terminated: bool,
2176 ) -> Self {
2177 Self { inner, is_terminated }
2178 }
2179}
2180
2181impl futures::Stream for TimeSourceRequestStream {
2182 type Item = Result<TimeSourceRequest, fidl::Error>;
2183
2184 fn poll_next(
2185 mut self: std::pin::Pin<&mut Self>,
2186 cx: &mut std::task::Context<'_>,
2187 ) -> std::task::Poll<Option<Self::Item>> {
2188 let this = &mut *self;
2189 if this.inner.check_shutdown(cx) {
2190 this.is_terminated = true;
2191 return std::task::Poll::Ready(None);
2192 }
2193 if this.is_terminated {
2194 panic!("polled TimeSourceRequestStream after completion");
2195 }
2196 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2197 |bytes, handles| {
2198 match this.inner.channel().read_etc(cx, bytes, handles) {
2199 std::task::Poll::Ready(Ok(())) => {}
2200 std::task::Poll::Pending => return std::task::Poll::Pending,
2201 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2202 this.is_terminated = true;
2203 return std::task::Poll::Ready(None);
2204 }
2205 std::task::Poll::Ready(Err(e)) => {
2206 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2207 e.into(),
2208 ))));
2209 }
2210 }
2211
2212 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2214
2215 std::task::Poll::Ready(Some(match header.ordinal {
2216 0x63704f8bd0962f00 => {
2217 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2218 let mut req = fidl::new_empty!(
2219 TimeSourceUpdateDevicePropertiesRequest,
2220 fidl::encoding::DefaultFuchsiaResourceDialect
2221 );
2222 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
2223 let control_handle = TimeSourceControlHandle { inner: this.inner.clone() };
2224 Ok(TimeSourceRequest::UpdateDeviceProperties {
2225 properties: req.properties,
2226
2227 control_handle,
2228 })
2229 }
2230 _ => Err(fidl::Error::UnknownOrdinal {
2231 ordinal: header.ordinal,
2232 protocol_name:
2233 <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2234 }),
2235 }))
2236 },
2237 )
2238 }
2239}
2240
2241#[derive(Debug)]
2244pub enum TimeSourceRequest {
2245 UpdateDeviceProperties { properties: Properties, control_handle: TimeSourceControlHandle },
2248}
2249
2250impl TimeSourceRequest {
2251 #[allow(irrefutable_let_patterns)]
2252 pub fn into_update_device_properties(self) -> Option<(Properties, TimeSourceControlHandle)> {
2253 if let TimeSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
2254 Some((properties, control_handle))
2255 } else {
2256 None
2257 }
2258 }
2259
2260 pub fn method_name(&self) -> &'static str {
2262 match *self {
2263 TimeSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
2264 }
2265 }
2266}
2267
2268#[derive(Debug, Clone)]
2269pub struct TimeSourceControlHandle {
2270 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2271}
2272
2273impl fidl::endpoints::ControlHandle for TimeSourceControlHandle {
2274 fn shutdown(&self) {
2275 self.inner.shutdown()
2276 }
2277
2278 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2279 self.inner.shutdown_with_epitaph(status)
2280 }
2281
2282 fn is_closed(&self) -> bool {
2283 self.inner.channel().is_closed()
2284 }
2285 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2286 self.inner.channel().on_closed()
2287 }
2288
2289 #[cfg(target_os = "fuchsia")]
2290 fn signal_peer(
2291 &self,
2292 clear_mask: zx::Signals,
2293 set_mask: zx::Signals,
2294 ) -> Result<(), zx_status::Status> {
2295 use fidl::Peered;
2296 self.inner.channel().signal_peer(clear_mask, set_mask)
2297 }
2298}
2299
2300impl TimeSourceControlHandle {}
2301
2302mod internal {
2303 use super::*;
2304}