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, PartialEq)]
15pub struct PullSourceShutdownResponse {
16 pub escrow_token: fidl_fuchsia_inspect::EscrowToken,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for PullSourceShutdownResponse
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct AdjustMarker;
26
27impl fidl::endpoints::ProtocolMarker for AdjustMarker {
28 type Proxy = AdjustProxy;
29 type RequestStream = AdjustRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = AdjustSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "fuchsia.time.external.Adjust";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for AdjustMarker {}
36pub type AdjustReportBootToUtcMappingResult = Result<(), Error>;
37
38pub trait AdjustProxyInterface: Send + Sync {
39 type ReportBootToUtcMappingResponseFut: std::future::Future<Output = Result<AdjustReportBootToUtcMappingResult, fidl::Error>>
40 + Send;
41 fn r#report_boot_to_utc_mapping(
42 &self,
43 boot_reference: fidl::BootInstant,
44 utc_reference: i64,
45 ) -> Self::ReportBootToUtcMappingResponseFut;
46}
47#[derive(Debug)]
48#[cfg(target_os = "fuchsia")]
49pub struct AdjustSynchronousProxy {
50 client: fidl::client::sync::Client,
51}
52
53#[cfg(target_os = "fuchsia")]
54impl fidl::endpoints::SynchronousProxy for AdjustSynchronousProxy {
55 type Proxy = AdjustProxy;
56 type Protocol = AdjustMarker;
57
58 fn from_channel(inner: fidl::Channel) -> Self {
59 Self::new(inner)
60 }
61
62 fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 fn as_channel(&self) -> &fidl::Channel {
67 self.client.as_channel()
68 }
69}
70
71#[cfg(target_os = "fuchsia")]
72impl AdjustSynchronousProxy {
73 pub fn new(channel: fidl::Channel) -> Self {
74 Self { client: fidl::client::sync::Client::new(channel) }
75 }
76
77 pub fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 pub fn wait_for_event(
84 &self,
85 deadline: zx::MonotonicInstant,
86 ) -> Result<AdjustEvent, fidl::Error> {
87 AdjustEvent::decode(self.client.wait_for_event::<AdjustMarker>(deadline)?)
88 }
89
90 pub fn r#report_boot_to_utc_mapping(
108 &self,
109 mut boot_reference: fidl::BootInstant,
110 mut utc_reference: i64,
111 ___deadline: zx::MonotonicInstant,
112 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
113 let _response = self.client.send_query::<
114 AdjustReportBootToUtcMappingRequest,
115 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
116 AdjustMarker,
117 >(
118 (boot_reference, utc_reference,),
119 0x1186fc4a8c7f7fbe,
120 fidl::encoding::DynamicFlags::empty(),
121 ___deadline,
122 )?;
123 Ok(_response.map(|x| x))
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<AdjustSynchronousProxy> for zx::NullableHandle {
129 fn from(value: AdjustSynchronousProxy) -> Self {
130 value.into_channel().into()
131 }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl From<fidl::Channel> for AdjustSynchronousProxy {
136 fn from(value: fidl::Channel) -> Self {
137 Self::new(value)
138 }
139}
140
141#[cfg(target_os = "fuchsia")]
142impl fidl::endpoints::FromClient for AdjustSynchronousProxy {
143 type Protocol = AdjustMarker;
144
145 fn from_client(value: fidl::endpoints::ClientEnd<AdjustMarker>) -> Self {
146 Self::new(value.into_channel())
147 }
148}
149
150#[derive(Debug, Clone)]
151pub struct AdjustProxy {
152 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
153}
154
155impl fidl::endpoints::Proxy for AdjustProxy {
156 type Protocol = AdjustMarker;
157
158 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
159 Self::new(inner)
160 }
161
162 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
163 self.client.into_channel().map_err(|client| Self { client })
164 }
165
166 fn as_channel(&self) -> &::fidl::AsyncChannel {
167 self.client.as_channel()
168 }
169}
170
171impl AdjustProxy {
172 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
174 let protocol_name = <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
175 Self { client: fidl::client::Client::new(channel, protocol_name) }
176 }
177
178 pub fn take_event_stream(&self) -> AdjustEventStream {
184 AdjustEventStream { event_receiver: self.client.take_event_receiver() }
185 }
186
187 pub fn r#report_boot_to_utc_mapping(
205 &self,
206 mut boot_reference: fidl::BootInstant,
207 mut utc_reference: i64,
208 ) -> fidl::client::QueryResponseFut<
209 AdjustReportBootToUtcMappingResult,
210 fidl::encoding::DefaultFuchsiaResourceDialect,
211 > {
212 AdjustProxyInterface::r#report_boot_to_utc_mapping(self, boot_reference, utc_reference)
213 }
214}
215
216impl AdjustProxyInterface for AdjustProxy {
217 type ReportBootToUtcMappingResponseFut = fidl::client::QueryResponseFut<
218 AdjustReportBootToUtcMappingResult,
219 fidl::encoding::DefaultFuchsiaResourceDialect,
220 >;
221 fn r#report_boot_to_utc_mapping(
222 &self,
223 mut boot_reference: fidl::BootInstant,
224 mut utc_reference: i64,
225 ) -> Self::ReportBootToUtcMappingResponseFut {
226 fn _decode(
227 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
228 ) -> Result<AdjustReportBootToUtcMappingResult, fidl::Error> {
229 let _response = fidl::client::decode_transaction_body::<
230 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
231 fidl::encoding::DefaultFuchsiaResourceDialect,
232 0x1186fc4a8c7f7fbe,
233 >(_buf?)?;
234 Ok(_response.map(|x| x))
235 }
236 self.client.send_query_and_decode::<
237 AdjustReportBootToUtcMappingRequest,
238 AdjustReportBootToUtcMappingResult,
239 >(
240 (boot_reference, utc_reference,),
241 0x1186fc4a8c7f7fbe,
242 fidl::encoding::DynamicFlags::empty(),
243 _decode,
244 )
245 }
246}
247
248pub struct AdjustEventStream {
249 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
250}
251
252impl std::marker::Unpin for AdjustEventStream {}
253
254impl futures::stream::FusedStream for AdjustEventStream {
255 fn is_terminated(&self) -> bool {
256 self.event_receiver.is_terminated()
257 }
258}
259
260impl futures::Stream for AdjustEventStream {
261 type Item = Result<AdjustEvent, fidl::Error>;
262
263 fn poll_next(
264 mut self: std::pin::Pin<&mut Self>,
265 cx: &mut std::task::Context<'_>,
266 ) -> std::task::Poll<Option<Self::Item>> {
267 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
268 &mut self.event_receiver,
269 cx
270 )?) {
271 Some(buf) => std::task::Poll::Ready(Some(AdjustEvent::decode(buf))),
272 None => std::task::Poll::Ready(None),
273 }
274 }
275}
276
277#[derive(Debug)]
278pub enum AdjustEvent {}
279
280impl AdjustEvent {
281 fn decode(
283 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
284 ) -> Result<AdjustEvent, fidl::Error> {
285 let (bytes, _handles) = buf.split_mut();
286 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
287 debug_assert_eq!(tx_header.tx_id, 0);
288 match tx_header.ordinal {
289 _ => Err(fidl::Error::UnknownOrdinal {
290 ordinal: tx_header.ordinal,
291 protocol_name: <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
292 }),
293 }
294 }
295}
296
297pub struct AdjustRequestStream {
299 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
300 is_terminated: bool,
301}
302
303impl std::marker::Unpin for AdjustRequestStream {}
304
305impl futures::stream::FusedStream for AdjustRequestStream {
306 fn is_terminated(&self) -> bool {
307 self.is_terminated
308 }
309}
310
311impl fidl::endpoints::RequestStream for AdjustRequestStream {
312 type Protocol = AdjustMarker;
313 type ControlHandle = AdjustControlHandle;
314
315 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
316 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
317 }
318
319 fn control_handle(&self) -> Self::ControlHandle {
320 AdjustControlHandle { inner: self.inner.clone() }
321 }
322
323 fn into_inner(
324 self,
325 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
326 {
327 (self.inner, self.is_terminated)
328 }
329
330 fn from_inner(
331 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
332 is_terminated: bool,
333 ) -> Self {
334 Self { inner, is_terminated }
335 }
336}
337
338impl futures::Stream for AdjustRequestStream {
339 type Item = Result<AdjustRequest, fidl::Error>;
340
341 fn poll_next(
342 mut self: std::pin::Pin<&mut Self>,
343 cx: &mut std::task::Context<'_>,
344 ) -> std::task::Poll<Option<Self::Item>> {
345 let this = &mut *self;
346 if this.inner.check_shutdown(cx) {
347 this.is_terminated = true;
348 return std::task::Poll::Ready(None);
349 }
350 if this.is_terminated {
351 panic!("polled AdjustRequestStream after completion");
352 }
353 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
354 |bytes, handles| {
355 match this.inner.channel().read_etc(cx, bytes, handles) {
356 std::task::Poll::Ready(Ok(())) => {}
357 std::task::Poll::Pending => return std::task::Poll::Pending,
358 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
359 this.is_terminated = true;
360 return std::task::Poll::Ready(None);
361 }
362 std::task::Poll::Ready(Err(e)) => {
363 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
364 e.into(),
365 ))));
366 }
367 }
368
369 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
371
372 std::task::Poll::Ready(Some(match header.ordinal {
373 0x1186fc4a8c7f7fbe => {
374 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
375 let mut req = fidl::new_empty!(
376 AdjustReportBootToUtcMappingRequest,
377 fidl::encoding::DefaultFuchsiaResourceDialect
378 );
379 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdjustReportBootToUtcMappingRequest>(&header, _body_bytes, handles, &mut req)?;
380 let control_handle = AdjustControlHandle { inner: this.inner.clone() };
381 Ok(AdjustRequest::ReportBootToUtcMapping {
382 boot_reference: req.boot_reference,
383 utc_reference: req.utc_reference,
384
385 responder: AdjustReportBootToUtcMappingResponder {
386 control_handle: std::mem::ManuallyDrop::new(control_handle),
387 tx_id: header.tx_id,
388 },
389 })
390 }
391 _ => Err(fidl::Error::UnknownOrdinal {
392 ordinal: header.ordinal,
393 protocol_name:
394 <AdjustMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
395 }),
396 }))
397 },
398 )
399 }
400}
401
402#[derive(Debug)]
407pub enum AdjustRequest {
408 ReportBootToUtcMapping {
426 boot_reference: fidl::BootInstant,
427 utc_reference: i64,
428 responder: AdjustReportBootToUtcMappingResponder,
429 },
430}
431
432impl AdjustRequest {
433 #[allow(irrefutable_let_patterns)]
434 pub fn into_report_boot_to_utc_mapping(
435 self,
436 ) -> Option<(fidl::BootInstant, i64, AdjustReportBootToUtcMappingResponder)> {
437 if let AdjustRequest::ReportBootToUtcMapping { boot_reference, utc_reference, responder } =
438 self
439 {
440 Some((boot_reference, utc_reference, responder))
441 } else {
442 None
443 }
444 }
445
446 pub fn method_name(&self) -> &'static str {
448 match *self {
449 AdjustRequest::ReportBootToUtcMapping { .. } => "report_boot_to_utc_mapping",
450 }
451 }
452}
453
454#[derive(Debug, Clone)]
455pub struct AdjustControlHandle {
456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
457}
458
459impl fidl::endpoints::ControlHandle for AdjustControlHandle {
460 fn shutdown(&self) {
461 self.inner.shutdown()
462 }
463
464 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
465 self.inner.shutdown_with_epitaph(status)
466 }
467
468 fn is_closed(&self) -> bool {
469 self.inner.channel().is_closed()
470 }
471 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
472 self.inner.channel().on_closed()
473 }
474
475 #[cfg(target_os = "fuchsia")]
476 fn signal_peer(
477 &self,
478 clear_mask: zx::Signals,
479 set_mask: zx::Signals,
480 ) -> Result<(), zx_status::Status> {
481 use fidl::Peered;
482 self.inner.channel().signal_peer(clear_mask, set_mask)
483 }
484}
485
486impl AdjustControlHandle {}
487
488#[must_use = "FIDL methods require a response to be sent"]
489#[derive(Debug)]
490pub struct AdjustReportBootToUtcMappingResponder {
491 control_handle: std::mem::ManuallyDrop<AdjustControlHandle>,
492 tx_id: u32,
493}
494
495impl std::ops::Drop for AdjustReportBootToUtcMappingResponder {
499 fn drop(&mut self) {
500 self.control_handle.shutdown();
501 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
503 }
504}
505
506impl fidl::endpoints::Responder for AdjustReportBootToUtcMappingResponder {
507 type ControlHandle = AdjustControlHandle;
508
509 fn control_handle(&self) -> &AdjustControlHandle {
510 &self.control_handle
511 }
512
513 fn drop_without_shutdown(mut self) {
514 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
516 std::mem::forget(self);
518 }
519}
520
521impl AdjustReportBootToUtcMappingResponder {
522 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
526 let _result = self.send_raw(result);
527 if _result.is_err() {
528 self.control_handle.shutdown();
529 }
530 self.drop_without_shutdown();
531 _result
532 }
533
534 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
536 let _result = self.send_raw(result);
537 self.drop_without_shutdown();
538 _result
539 }
540
541 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
542 self.control_handle
543 .inner
544 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
545 result,
546 self.tx_id,
547 0x1186fc4a8c7f7fbe,
548 fidl::encoding::DynamicFlags::empty(),
549 )
550 }
551}
552
553#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
554pub struct PullSourceMarker;
555
556impl fidl::endpoints::ProtocolMarker for PullSourceMarker {
557 type Proxy = PullSourceProxy;
558 type RequestStream = PullSourceRequestStream;
559 #[cfg(target_os = "fuchsia")]
560 type SynchronousProxy = PullSourceSynchronousProxy;
561
562 const DEBUG_NAME: &'static str = "fuchsia.time.external.PullSource";
563}
564impl fidl::endpoints::DiscoverableProtocolMarker for PullSourceMarker {}
565pub type PullSourceSampleResult = Result<TimeSample, Error>;
566pub type PullSourceShutdownResult = Result<fidl_fuchsia_inspect::EscrowToken, EscrowError>;
567
568pub trait PullSourceProxyInterface: Send + Sync {
569 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
570 type SampleResponseFut: std::future::Future<Output = Result<PullSourceSampleResult, fidl::Error>>
571 + Send;
572 fn r#sample(&self, urgency: Urgency) -> Self::SampleResponseFut;
573 type NextPossibleSampleTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>>
574 + Send;
575 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut;
576 type ShutdownResponseFut: std::future::Future<Output = Result<PullSourceShutdownResult, fidl::Error>>
577 + Send;
578 fn r#shutdown(&self) -> Self::ShutdownResponseFut;
579}
580#[derive(Debug)]
581#[cfg(target_os = "fuchsia")]
582pub struct PullSourceSynchronousProxy {
583 client: fidl::client::sync::Client,
584}
585
586#[cfg(target_os = "fuchsia")]
587impl fidl::endpoints::SynchronousProxy for PullSourceSynchronousProxy {
588 type Proxy = PullSourceProxy;
589 type Protocol = PullSourceMarker;
590
591 fn from_channel(inner: fidl::Channel) -> Self {
592 Self::new(inner)
593 }
594
595 fn into_channel(self) -> fidl::Channel {
596 self.client.into_channel()
597 }
598
599 fn as_channel(&self) -> &fidl::Channel {
600 self.client.as_channel()
601 }
602}
603
604#[cfg(target_os = "fuchsia")]
605impl PullSourceSynchronousProxy {
606 pub fn new(channel: fidl::Channel) -> Self {
607 Self { client: fidl::client::sync::Client::new(channel) }
608 }
609
610 pub fn into_channel(self) -> fidl::Channel {
611 self.client.into_channel()
612 }
613
614 pub fn wait_for_event(
617 &self,
618 deadline: zx::MonotonicInstant,
619 ) -> Result<PullSourceEvent, fidl::Error> {
620 PullSourceEvent::decode(self.client.wait_for_event::<PullSourceMarker>(deadline)?)
621 }
622
623 pub fn r#update_device_properties(
626 &self,
627 mut properties: &Properties,
628 ) -> Result<(), fidl::Error> {
629 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
630 (properties,),
631 0x63704f8bd0962f00,
632 fidl::encoding::DynamicFlags::empty(),
633 )
634 }
635
636 pub fn r#sample(
651 &self,
652 mut urgency: Urgency,
653 ___deadline: zx::MonotonicInstant,
654 ) -> Result<PullSourceSampleResult, fidl::Error> {
655 let _response = self.client.send_query::<
656 PullSourceSampleRequest,
657 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
658 PullSourceMarker,
659 >(
660 (urgency,),
661 0x2d29007d8c9cb45a,
662 fidl::encoding::DynamicFlags::empty(),
663 ___deadline,
664 )?;
665 Ok(_response.map(|x| x.sample))
666 }
667
668 pub fn r#next_possible_sample_time(
672 &self,
673 ___deadline: zx::MonotonicInstant,
674 ) -> Result<i64, fidl::Error> {
675 let _response = self.client.send_query::<
676 fidl::encoding::EmptyPayload,
677 PullSourceNextPossibleSampleTimeResponse,
678 PullSourceMarker,
679 >(
680 (),
681 0x69ca2b1fd63e88a5,
682 fidl::encoding::DynamicFlags::empty(),
683 ___deadline,
684 )?;
685 Ok(_response.next_possible_time)
686 }
687
688 pub fn r#shutdown(
693 &self,
694 ___deadline: zx::MonotonicInstant,
695 ) -> Result<PullSourceShutdownResult, fidl::Error> {
696 let _response = self.client.send_query::<
697 fidl::encoding::EmptyPayload,
698 fidl::encoding::ResultType<PullSourceShutdownResponse, EscrowError>,
699 PullSourceMarker,
700 >(
701 (),
702 0x5af7be0454cfa942,
703 fidl::encoding::DynamicFlags::empty(),
704 ___deadline,
705 )?;
706 Ok(_response.map(|x| x.escrow_token))
707 }
708}
709
710#[cfg(target_os = "fuchsia")]
711impl From<PullSourceSynchronousProxy> for zx::NullableHandle {
712 fn from(value: PullSourceSynchronousProxy) -> Self {
713 value.into_channel().into()
714 }
715}
716
717#[cfg(target_os = "fuchsia")]
718impl From<fidl::Channel> for PullSourceSynchronousProxy {
719 fn from(value: fidl::Channel) -> Self {
720 Self::new(value)
721 }
722}
723
724#[cfg(target_os = "fuchsia")]
725impl fidl::endpoints::FromClient for PullSourceSynchronousProxy {
726 type Protocol = PullSourceMarker;
727
728 fn from_client(value: fidl::endpoints::ClientEnd<PullSourceMarker>) -> Self {
729 Self::new(value.into_channel())
730 }
731}
732
733#[derive(Debug, Clone)]
734pub struct PullSourceProxy {
735 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
736}
737
738impl fidl::endpoints::Proxy for PullSourceProxy {
739 type Protocol = PullSourceMarker;
740
741 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
742 Self::new(inner)
743 }
744
745 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
746 self.client.into_channel().map_err(|client| Self { client })
747 }
748
749 fn as_channel(&self) -> &::fidl::AsyncChannel {
750 self.client.as_channel()
751 }
752}
753
754impl PullSourceProxy {
755 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
757 let protocol_name = <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
758 Self { client: fidl::client::Client::new(channel, protocol_name) }
759 }
760
761 pub fn take_event_stream(&self) -> PullSourceEventStream {
767 PullSourceEventStream { event_receiver: self.client.take_event_receiver() }
768 }
769
770 pub fn r#update_device_properties(
773 &self,
774 mut properties: &Properties,
775 ) -> Result<(), fidl::Error> {
776 PullSourceProxyInterface::r#update_device_properties(self, properties)
777 }
778
779 pub fn r#sample(
794 &self,
795 mut urgency: Urgency,
796 ) -> fidl::client::QueryResponseFut<
797 PullSourceSampleResult,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 > {
800 PullSourceProxyInterface::r#sample(self, urgency)
801 }
802
803 pub fn r#next_possible_sample_time(
807 &self,
808 ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
809 PullSourceProxyInterface::r#next_possible_sample_time(self)
810 }
811
812 pub fn r#shutdown(
817 &self,
818 ) -> fidl::client::QueryResponseFut<
819 PullSourceShutdownResult,
820 fidl::encoding::DefaultFuchsiaResourceDialect,
821 > {
822 PullSourceProxyInterface::r#shutdown(self)
823 }
824}
825
826impl PullSourceProxyInterface for PullSourceProxy {
827 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
828 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
829 (properties,),
830 0x63704f8bd0962f00,
831 fidl::encoding::DynamicFlags::empty(),
832 )
833 }
834
835 type SampleResponseFut = fidl::client::QueryResponseFut<
836 PullSourceSampleResult,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 >;
839 fn r#sample(&self, mut urgency: Urgency) -> Self::SampleResponseFut {
840 fn _decode(
841 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
842 ) -> Result<PullSourceSampleResult, fidl::Error> {
843 let _response = fidl::client::decode_transaction_body::<
844 fidl::encoding::ResultType<PullSourceSampleResponse, Error>,
845 fidl::encoding::DefaultFuchsiaResourceDialect,
846 0x2d29007d8c9cb45a,
847 >(_buf?)?;
848 Ok(_response.map(|x| x.sample))
849 }
850 self.client.send_query_and_decode::<PullSourceSampleRequest, PullSourceSampleResult>(
851 (urgency,),
852 0x2d29007d8c9cb45a,
853 fidl::encoding::DynamicFlags::empty(),
854 _decode,
855 )
856 }
857
858 type NextPossibleSampleTimeResponseFut =
859 fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
860 fn r#next_possible_sample_time(&self) -> Self::NextPossibleSampleTimeResponseFut {
861 fn _decode(
862 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
863 ) -> Result<i64, fidl::Error> {
864 let _response = fidl::client::decode_transaction_body::<
865 PullSourceNextPossibleSampleTimeResponse,
866 fidl::encoding::DefaultFuchsiaResourceDialect,
867 0x69ca2b1fd63e88a5,
868 >(_buf?)?;
869 Ok(_response.next_possible_time)
870 }
871 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
872 (),
873 0x69ca2b1fd63e88a5,
874 fidl::encoding::DynamicFlags::empty(),
875 _decode,
876 )
877 }
878
879 type ShutdownResponseFut = fidl::client::QueryResponseFut<
880 PullSourceShutdownResult,
881 fidl::encoding::DefaultFuchsiaResourceDialect,
882 >;
883 fn r#shutdown(&self) -> Self::ShutdownResponseFut {
884 fn _decode(
885 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
886 ) -> Result<PullSourceShutdownResult, fidl::Error> {
887 let _response = fidl::client::decode_transaction_body::<
888 fidl::encoding::ResultType<PullSourceShutdownResponse, EscrowError>,
889 fidl::encoding::DefaultFuchsiaResourceDialect,
890 0x5af7be0454cfa942,
891 >(_buf?)?;
892 Ok(_response.map(|x| x.escrow_token))
893 }
894 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PullSourceShutdownResult>(
895 (),
896 0x5af7be0454cfa942,
897 fidl::encoding::DynamicFlags::empty(),
898 _decode,
899 )
900 }
901}
902
903pub struct PullSourceEventStream {
904 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
905}
906
907impl std::marker::Unpin for PullSourceEventStream {}
908
909impl futures::stream::FusedStream for PullSourceEventStream {
910 fn is_terminated(&self) -> bool {
911 self.event_receiver.is_terminated()
912 }
913}
914
915impl futures::Stream for PullSourceEventStream {
916 type Item = Result<PullSourceEvent, fidl::Error>;
917
918 fn poll_next(
919 mut self: std::pin::Pin<&mut Self>,
920 cx: &mut std::task::Context<'_>,
921 ) -> std::task::Poll<Option<Self::Item>> {
922 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
923 &mut self.event_receiver,
924 cx
925 )?) {
926 Some(buf) => std::task::Poll::Ready(Some(PullSourceEvent::decode(buf))),
927 None => std::task::Poll::Ready(None),
928 }
929 }
930}
931
932#[derive(Debug)]
933pub enum PullSourceEvent {}
934
935impl PullSourceEvent {
936 fn decode(
938 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
939 ) -> Result<PullSourceEvent, fidl::Error> {
940 let (bytes, _handles) = buf.split_mut();
941 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
942 debug_assert_eq!(tx_header.tx_id, 0);
943 match tx_header.ordinal {
944 _ => Err(fidl::Error::UnknownOrdinal {
945 ordinal: tx_header.ordinal,
946 protocol_name: <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
947 }),
948 }
949 }
950}
951
952pub struct PullSourceRequestStream {
954 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
955 is_terminated: bool,
956}
957
958impl std::marker::Unpin for PullSourceRequestStream {}
959
960impl futures::stream::FusedStream for PullSourceRequestStream {
961 fn is_terminated(&self) -> bool {
962 self.is_terminated
963 }
964}
965
966impl fidl::endpoints::RequestStream for PullSourceRequestStream {
967 type Protocol = PullSourceMarker;
968 type ControlHandle = PullSourceControlHandle;
969
970 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
971 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
972 }
973
974 fn control_handle(&self) -> Self::ControlHandle {
975 PullSourceControlHandle { inner: self.inner.clone() }
976 }
977
978 fn into_inner(
979 self,
980 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
981 {
982 (self.inner, self.is_terminated)
983 }
984
985 fn from_inner(
986 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
987 is_terminated: bool,
988 ) -> Self {
989 Self { inner, is_terminated }
990 }
991}
992
993impl futures::Stream for PullSourceRequestStream {
994 type Item = Result<PullSourceRequest, fidl::Error>;
995
996 fn poll_next(
997 mut self: std::pin::Pin<&mut Self>,
998 cx: &mut std::task::Context<'_>,
999 ) -> std::task::Poll<Option<Self::Item>> {
1000 let this = &mut *self;
1001 if this.inner.check_shutdown(cx) {
1002 this.is_terminated = true;
1003 return std::task::Poll::Ready(None);
1004 }
1005 if this.is_terminated {
1006 panic!("polled PullSourceRequestStream after completion");
1007 }
1008 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1009 |bytes, handles| {
1010 match this.inner.channel().read_etc(cx, bytes, handles) {
1011 std::task::Poll::Ready(Ok(())) => {}
1012 std::task::Poll::Pending => return std::task::Poll::Pending,
1013 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1014 this.is_terminated = true;
1015 return std::task::Poll::Ready(None);
1016 }
1017 std::task::Poll::Ready(Err(e)) => {
1018 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1019 e.into(),
1020 ))));
1021 }
1022 }
1023
1024 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1026
1027 std::task::Poll::Ready(Some(match header.ordinal {
1028 0x63704f8bd0962f00 => {
1029 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1030 let mut req = fidl::new_empty!(
1031 TimeSourceUpdateDevicePropertiesRequest,
1032 fidl::encoding::DefaultFuchsiaResourceDialect
1033 );
1034 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
1035 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
1036 Ok(PullSourceRequest::UpdateDeviceProperties {
1037 properties: req.properties,
1038
1039 control_handle,
1040 })
1041 }
1042 0x2d29007d8c9cb45a => {
1043 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1044 let mut req = fidl::new_empty!(
1045 PullSourceSampleRequest,
1046 fidl::encoding::DefaultFuchsiaResourceDialect
1047 );
1048 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PullSourceSampleRequest>(&header, _body_bytes, handles, &mut req)?;
1049 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
1050 Ok(PullSourceRequest::Sample {
1051 urgency: req.urgency,
1052
1053 responder: PullSourceSampleResponder {
1054 control_handle: std::mem::ManuallyDrop::new(control_handle),
1055 tx_id: header.tx_id,
1056 },
1057 })
1058 }
1059 0x69ca2b1fd63e88a5 => {
1060 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1061 let mut req = fidl::new_empty!(
1062 fidl::encoding::EmptyPayload,
1063 fidl::encoding::DefaultFuchsiaResourceDialect
1064 );
1065 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1066 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
1067 Ok(PullSourceRequest::NextPossibleSampleTime {
1068 responder: PullSourceNextPossibleSampleTimeResponder {
1069 control_handle: std::mem::ManuallyDrop::new(control_handle),
1070 tx_id: header.tx_id,
1071 },
1072 })
1073 }
1074 0x5af7be0454cfa942 => {
1075 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1076 let mut req = fidl::new_empty!(
1077 fidl::encoding::EmptyPayload,
1078 fidl::encoding::DefaultFuchsiaResourceDialect
1079 );
1080 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1081 let control_handle = PullSourceControlHandle { inner: this.inner.clone() };
1082 Ok(PullSourceRequest::Shutdown {
1083 responder: PullSourceShutdownResponder {
1084 control_handle: std::mem::ManuallyDrop::new(control_handle),
1085 tx_id: header.tx_id,
1086 },
1087 })
1088 }
1089 _ => Err(fidl::Error::UnknownOrdinal {
1090 ordinal: header.ordinal,
1091 protocol_name:
1092 <PullSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1093 }),
1094 }))
1095 },
1096 )
1097 }
1098}
1099
1100#[derive(Debug)]
1102pub enum PullSourceRequest {
1103 UpdateDeviceProperties { properties: Properties, control_handle: PullSourceControlHandle },
1106 Sample { urgency: Urgency, responder: PullSourceSampleResponder },
1121 NextPossibleSampleTime { responder: PullSourceNextPossibleSampleTimeResponder },
1125 Shutdown { responder: PullSourceShutdownResponder },
1130}
1131
1132impl PullSourceRequest {
1133 #[allow(irrefutable_let_patterns)]
1134 pub fn into_update_device_properties(self) -> Option<(Properties, PullSourceControlHandle)> {
1135 if let PullSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1136 Some((properties, control_handle))
1137 } else {
1138 None
1139 }
1140 }
1141
1142 #[allow(irrefutable_let_patterns)]
1143 pub fn into_sample(self) -> Option<(Urgency, PullSourceSampleResponder)> {
1144 if let PullSourceRequest::Sample { urgency, responder } = self {
1145 Some((urgency, responder))
1146 } else {
1147 None
1148 }
1149 }
1150
1151 #[allow(irrefutable_let_patterns)]
1152 pub fn into_next_possible_sample_time(
1153 self,
1154 ) -> Option<(PullSourceNextPossibleSampleTimeResponder)> {
1155 if let PullSourceRequest::NextPossibleSampleTime { responder } = self {
1156 Some((responder))
1157 } else {
1158 None
1159 }
1160 }
1161
1162 #[allow(irrefutable_let_patterns)]
1163 pub fn into_shutdown(self) -> Option<(PullSourceShutdownResponder)> {
1164 if let PullSourceRequest::Shutdown { responder } = self { Some((responder)) } else { None }
1165 }
1166
1167 pub fn method_name(&self) -> &'static str {
1169 match *self {
1170 PullSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1171 PullSourceRequest::Sample { .. } => "sample",
1172 PullSourceRequest::NextPossibleSampleTime { .. } => "next_possible_sample_time",
1173 PullSourceRequest::Shutdown { .. } => "shutdown",
1174 }
1175 }
1176}
1177
1178#[derive(Debug, Clone)]
1179pub struct PullSourceControlHandle {
1180 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1181}
1182
1183impl fidl::endpoints::ControlHandle for PullSourceControlHandle {
1184 fn shutdown(&self) {
1185 self.inner.shutdown()
1186 }
1187
1188 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1189 self.inner.shutdown_with_epitaph(status)
1190 }
1191
1192 fn is_closed(&self) -> bool {
1193 self.inner.channel().is_closed()
1194 }
1195 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1196 self.inner.channel().on_closed()
1197 }
1198
1199 #[cfg(target_os = "fuchsia")]
1200 fn signal_peer(
1201 &self,
1202 clear_mask: zx::Signals,
1203 set_mask: zx::Signals,
1204 ) -> Result<(), zx_status::Status> {
1205 use fidl::Peered;
1206 self.inner.channel().signal_peer(clear_mask, set_mask)
1207 }
1208}
1209
1210impl PullSourceControlHandle {}
1211
1212#[must_use = "FIDL methods require a response to be sent"]
1213#[derive(Debug)]
1214pub struct PullSourceSampleResponder {
1215 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1216 tx_id: u32,
1217}
1218
1219impl std::ops::Drop for PullSourceSampleResponder {
1223 fn drop(&mut self) {
1224 self.control_handle.shutdown();
1225 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1227 }
1228}
1229
1230impl fidl::endpoints::Responder for PullSourceSampleResponder {
1231 type ControlHandle = PullSourceControlHandle;
1232
1233 fn control_handle(&self) -> &PullSourceControlHandle {
1234 &self.control_handle
1235 }
1236
1237 fn drop_without_shutdown(mut self) {
1238 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1240 std::mem::forget(self);
1242 }
1243}
1244
1245impl PullSourceSampleResponder {
1246 pub fn send(self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1250 let _result = self.send_raw(result);
1251 if _result.is_err() {
1252 self.control_handle.shutdown();
1253 }
1254 self.drop_without_shutdown();
1255 _result
1256 }
1257
1258 pub fn send_no_shutdown_on_err(
1260 self,
1261 mut result: Result<&TimeSample, Error>,
1262 ) -> Result<(), fidl::Error> {
1263 let _result = self.send_raw(result);
1264 self.drop_without_shutdown();
1265 _result
1266 }
1267
1268 fn send_raw(&self, mut result: Result<&TimeSample, Error>) -> Result<(), fidl::Error> {
1269 self.control_handle
1270 .inner
1271 .send::<fidl::encoding::ResultType<PullSourceSampleResponse, Error>>(
1272 result.map(|sample| (sample,)),
1273 self.tx_id,
1274 0x2d29007d8c9cb45a,
1275 fidl::encoding::DynamicFlags::empty(),
1276 )
1277 }
1278}
1279
1280#[must_use = "FIDL methods require a response to be sent"]
1281#[derive(Debug)]
1282pub struct PullSourceNextPossibleSampleTimeResponder {
1283 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1284 tx_id: u32,
1285}
1286
1287impl std::ops::Drop for PullSourceNextPossibleSampleTimeResponder {
1291 fn drop(&mut self) {
1292 self.control_handle.shutdown();
1293 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1295 }
1296}
1297
1298impl fidl::endpoints::Responder for PullSourceNextPossibleSampleTimeResponder {
1299 type ControlHandle = PullSourceControlHandle;
1300
1301 fn control_handle(&self) -> &PullSourceControlHandle {
1302 &self.control_handle
1303 }
1304
1305 fn drop_without_shutdown(mut self) {
1306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1308 std::mem::forget(self);
1310 }
1311}
1312
1313impl PullSourceNextPossibleSampleTimeResponder {
1314 pub fn send(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1318 let _result = self.send_raw(next_possible_time);
1319 if _result.is_err() {
1320 self.control_handle.shutdown();
1321 }
1322 self.drop_without_shutdown();
1323 _result
1324 }
1325
1326 pub fn send_no_shutdown_on_err(self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1328 let _result = self.send_raw(next_possible_time);
1329 self.drop_without_shutdown();
1330 _result
1331 }
1332
1333 fn send_raw(&self, mut next_possible_time: i64) -> Result<(), fidl::Error> {
1334 self.control_handle.inner.send::<PullSourceNextPossibleSampleTimeResponse>(
1335 (next_possible_time,),
1336 self.tx_id,
1337 0x69ca2b1fd63e88a5,
1338 fidl::encoding::DynamicFlags::empty(),
1339 )
1340 }
1341}
1342
1343#[must_use = "FIDL methods require a response to be sent"]
1344#[derive(Debug)]
1345pub struct PullSourceShutdownResponder {
1346 control_handle: std::mem::ManuallyDrop<PullSourceControlHandle>,
1347 tx_id: u32,
1348}
1349
1350impl std::ops::Drop for PullSourceShutdownResponder {
1354 fn drop(&mut self) {
1355 self.control_handle.shutdown();
1356 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358 }
1359}
1360
1361impl fidl::endpoints::Responder for PullSourceShutdownResponder {
1362 type ControlHandle = PullSourceControlHandle;
1363
1364 fn control_handle(&self) -> &PullSourceControlHandle {
1365 &self.control_handle
1366 }
1367
1368 fn drop_without_shutdown(mut self) {
1369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371 std::mem::forget(self);
1373 }
1374}
1375
1376impl PullSourceShutdownResponder {
1377 pub fn send(
1381 self,
1382 mut result: Result<fidl_fuchsia_inspect::EscrowToken, EscrowError>,
1383 ) -> Result<(), fidl::Error> {
1384 let _result = self.send_raw(result);
1385 if _result.is_err() {
1386 self.control_handle.shutdown();
1387 }
1388 self.drop_without_shutdown();
1389 _result
1390 }
1391
1392 pub fn send_no_shutdown_on_err(
1394 self,
1395 mut result: Result<fidl_fuchsia_inspect::EscrowToken, EscrowError>,
1396 ) -> Result<(), fidl::Error> {
1397 let _result = self.send_raw(result);
1398 self.drop_without_shutdown();
1399 _result
1400 }
1401
1402 fn send_raw(
1403 &self,
1404 mut result: Result<fidl_fuchsia_inspect::EscrowToken, EscrowError>,
1405 ) -> Result<(), fidl::Error> {
1406 self.control_handle
1407 .inner
1408 .send::<fidl::encoding::ResultType<PullSourceShutdownResponse, EscrowError>>(
1409 result.as_mut().map_err(|e| *e).map(|escrow_token| (escrow_token,)),
1410 self.tx_id,
1411 0x5af7be0454cfa942,
1412 fidl::encoding::DynamicFlags::empty(),
1413 )
1414 }
1415}
1416
1417#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1418pub struct PushSourceMarker;
1419
1420impl fidl::endpoints::ProtocolMarker for PushSourceMarker {
1421 type Proxy = PushSourceProxy;
1422 type RequestStream = PushSourceRequestStream;
1423 #[cfg(target_os = "fuchsia")]
1424 type SynchronousProxy = PushSourceSynchronousProxy;
1425
1426 const DEBUG_NAME: &'static str = "fuchsia.time.external.PushSource";
1427}
1428impl fidl::endpoints::DiscoverableProtocolMarker for PushSourceMarker {}
1429
1430pub trait PushSourceProxyInterface: Send + Sync {
1431 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
1432 type WatchSampleResponseFut: std::future::Future<Output = Result<TimeSample, fidl::Error>>
1433 + Send;
1434 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut;
1435 type WatchStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
1436 fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
1437}
1438#[derive(Debug)]
1439#[cfg(target_os = "fuchsia")]
1440pub struct PushSourceSynchronousProxy {
1441 client: fidl::client::sync::Client,
1442}
1443
1444#[cfg(target_os = "fuchsia")]
1445impl fidl::endpoints::SynchronousProxy for PushSourceSynchronousProxy {
1446 type Proxy = PushSourceProxy;
1447 type Protocol = PushSourceMarker;
1448
1449 fn from_channel(inner: fidl::Channel) -> Self {
1450 Self::new(inner)
1451 }
1452
1453 fn into_channel(self) -> fidl::Channel {
1454 self.client.into_channel()
1455 }
1456
1457 fn as_channel(&self) -> &fidl::Channel {
1458 self.client.as_channel()
1459 }
1460}
1461
1462#[cfg(target_os = "fuchsia")]
1463impl PushSourceSynchronousProxy {
1464 pub fn new(channel: fidl::Channel) -> Self {
1465 Self { client: fidl::client::sync::Client::new(channel) }
1466 }
1467
1468 pub fn into_channel(self) -> fidl::Channel {
1469 self.client.into_channel()
1470 }
1471
1472 pub fn wait_for_event(
1475 &self,
1476 deadline: zx::MonotonicInstant,
1477 ) -> Result<PushSourceEvent, fidl::Error> {
1478 PushSourceEvent::decode(self.client.wait_for_event::<PushSourceMarker>(deadline)?)
1479 }
1480
1481 pub fn r#update_device_properties(
1484 &self,
1485 mut properties: &Properties,
1486 ) -> Result<(), fidl::Error> {
1487 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1488 (properties,),
1489 0x63704f8bd0962f00,
1490 fidl::encoding::DynamicFlags::empty(),
1491 )
1492 }
1493
1494 pub fn r#watch_sample(
1508 &self,
1509 ___deadline: zx::MonotonicInstant,
1510 ) -> Result<TimeSample, fidl::Error> {
1511 let _response = self.client.send_query::<
1512 fidl::encoding::EmptyPayload,
1513 PushSourceWatchSampleResponse,
1514 PushSourceMarker,
1515 >(
1516 (),
1517 0x44d515a56e8304dc,
1518 fidl::encoding::DynamicFlags::empty(),
1519 ___deadline,
1520 )?;
1521 Ok(_response.sample)
1522 }
1523
1524 pub fn r#watch_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
1533 let _response = self.client.send_query::<
1534 fidl::encoding::EmptyPayload,
1535 PushSourceWatchStatusResponse,
1536 PushSourceMarker,
1537 >(
1538 (),
1539 0x60621a545f488bb1,
1540 fidl::encoding::DynamicFlags::empty(),
1541 ___deadline,
1542 )?;
1543 Ok(_response.status)
1544 }
1545}
1546
1547#[cfg(target_os = "fuchsia")]
1548impl From<PushSourceSynchronousProxy> for zx::NullableHandle {
1549 fn from(value: PushSourceSynchronousProxy) -> Self {
1550 value.into_channel().into()
1551 }
1552}
1553
1554#[cfg(target_os = "fuchsia")]
1555impl From<fidl::Channel> for PushSourceSynchronousProxy {
1556 fn from(value: fidl::Channel) -> Self {
1557 Self::new(value)
1558 }
1559}
1560
1561#[cfg(target_os = "fuchsia")]
1562impl fidl::endpoints::FromClient for PushSourceSynchronousProxy {
1563 type Protocol = PushSourceMarker;
1564
1565 fn from_client(value: fidl::endpoints::ClientEnd<PushSourceMarker>) -> Self {
1566 Self::new(value.into_channel())
1567 }
1568}
1569
1570#[derive(Debug, Clone)]
1571pub struct PushSourceProxy {
1572 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1573}
1574
1575impl fidl::endpoints::Proxy for PushSourceProxy {
1576 type Protocol = PushSourceMarker;
1577
1578 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1579 Self::new(inner)
1580 }
1581
1582 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1583 self.client.into_channel().map_err(|client| Self { client })
1584 }
1585
1586 fn as_channel(&self) -> &::fidl::AsyncChannel {
1587 self.client.as_channel()
1588 }
1589}
1590
1591impl PushSourceProxy {
1592 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1594 let protocol_name = <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1595 Self { client: fidl::client::Client::new(channel, protocol_name) }
1596 }
1597
1598 pub fn take_event_stream(&self) -> PushSourceEventStream {
1604 PushSourceEventStream { event_receiver: self.client.take_event_receiver() }
1605 }
1606
1607 pub fn r#update_device_properties(
1610 &self,
1611 mut properties: &Properties,
1612 ) -> Result<(), fidl::Error> {
1613 PushSourceProxyInterface::r#update_device_properties(self, properties)
1614 }
1615
1616 pub fn r#watch_sample(
1630 &self,
1631 ) -> fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>
1632 {
1633 PushSourceProxyInterface::r#watch_sample(self)
1634 }
1635
1636 pub fn r#watch_status(
1645 &self,
1646 ) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
1647 PushSourceProxyInterface::r#watch_status(self)
1648 }
1649}
1650
1651impl PushSourceProxyInterface for PushSourceProxy {
1652 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
1653 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
1654 (properties,),
1655 0x63704f8bd0962f00,
1656 fidl::encoding::DynamicFlags::empty(),
1657 )
1658 }
1659
1660 type WatchSampleResponseFut =
1661 fidl::client::QueryResponseFut<TimeSample, fidl::encoding::DefaultFuchsiaResourceDialect>;
1662 fn r#watch_sample(&self) -> Self::WatchSampleResponseFut {
1663 fn _decode(
1664 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1665 ) -> Result<TimeSample, fidl::Error> {
1666 let _response = fidl::client::decode_transaction_body::<
1667 PushSourceWatchSampleResponse,
1668 fidl::encoding::DefaultFuchsiaResourceDialect,
1669 0x44d515a56e8304dc,
1670 >(_buf?)?;
1671 Ok(_response.sample)
1672 }
1673 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TimeSample>(
1674 (),
1675 0x44d515a56e8304dc,
1676 fidl::encoding::DynamicFlags::empty(),
1677 _decode,
1678 )
1679 }
1680
1681 type WatchStatusResponseFut =
1682 fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
1683 fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
1684 fn _decode(
1685 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1686 ) -> Result<Status, fidl::Error> {
1687 let _response = fidl::client::decode_transaction_body::<
1688 PushSourceWatchStatusResponse,
1689 fidl::encoding::DefaultFuchsiaResourceDialect,
1690 0x60621a545f488bb1,
1691 >(_buf?)?;
1692 Ok(_response.status)
1693 }
1694 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
1695 (),
1696 0x60621a545f488bb1,
1697 fidl::encoding::DynamicFlags::empty(),
1698 _decode,
1699 )
1700 }
1701}
1702
1703pub struct PushSourceEventStream {
1704 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1705}
1706
1707impl std::marker::Unpin for PushSourceEventStream {}
1708
1709impl futures::stream::FusedStream for PushSourceEventStream {
1710 fn is_terminated(&self) -> bool {
1711 self.event_receiver.is_terminated()
1712 }
1713}
1714
1715impl futures::Stream for PushSourceEventStream {
1716 type Item = Result<PushSourceEvent, fidl::Error>;
1717
1718 fn poll_next(
1719 mut self: std::pin::Pin<&mut Self>,
1720 cx: &mut std::task::Context<'_>,
1721 ) -> std::task::Poll<Option<Self::Item>> {
1722 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1723 &mut self.event_receiver,
1724 cx
1725 )?) {
1726 Some(buf) => std::task::Poll::Ready(Some(PushSourceEvent::decode(buf))),
1727 None => std::task::Poll::Ready(None),
1728 }
1729 }
1730}
1731
1732#[derive(Debug)]
1733pub enum PushSourceEvent {}
1734
1735impl PushSourceEvent {
1736 fn decode(
1738 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1739 ) -> Result<PushSourceEvent, fidl::Error> {
1740 let (bytes, _handles) = buf.split_mut();
1741 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1742 debug_assert_eq!(tx_header.tx_id, 0);
1743 match tx_header.ordinal {
1744 _ => Err(fidl::Error::UnknownOrdinal {
1745 ordinal: tx_header.ordinal,
1746 protocol_name: <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1747 }),
1748 }
1749 }
1750}
1751
1752pub struct PushSourceRequestStream {
1754 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1755 is_terminated: bool,
1756}
1757
1758impl std::marker::Unpin for PushSourceRequestStream {}
1759
1760impl futures::stream::FusedStream for PushSourceRequestStream {
1761 fn is_terminated(&self) -> bool {
1762 self.is_terminated
1763 }
1764}
1765
1766impl fidl::endpoints::RequestStream for PushSourceRequestStream {
1767 type Protocol = PushSourceMarker;
1768 type ControlHandle = PushSourceControlHandle;
1769
1770 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1771 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1772 }
1773
1774 fn control_handle(&self) -> Self::ControlHandle {
1775 PushSourceControlHandle { inner: self.inner.clone() }
1776 }
1777
1778 fn into_inner(
1779 self,
1780 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1781 {
1782 (self.inner, self.is_terminated)
1783 }
1784
1785 fn from_inner(
1786 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1787 is_terminated: bool,
1788 ) -> Self {
1789 Self { inner, is_terminated }
1790 }
1791}
1792
1793impl futures::Stream for PushSourceRequestStream {
1794 type Item = Result<PushSourceRequest, fidl::Error>;
1795
1796 fn poll_next(
1797 mut self: std::pin::Pin<&mut Self>,
1798 cx: &mut std::task::Context<'_>,
1799 ) -> std::task::Poll<Option<Self::Item>> {
1800 let this = &mut *self;
1801 if this.inner.check_shutdown(cx) {
1802 this.is_terminated = true;
1803 return std::task::Poll::Ready(None);
1804 }
1805 if this.is_terminated {
1806 panic!("polled PushSourceRequestStream after completion");
1807 }
1808 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1809 |bytes, handles| {
1810 match this.inner.channel().read_etc(cx, bytes, handles) {
1811 std::task::Poll::Ready(Ok(())) => {}
1812 std::task::Poll::Pending => return std::task::Poll::Pending,
1813 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1814 this.is_terminated = true;
1815 return std::task::Poll::Ready(None);
1816 }
1817 std::task::Poll::Ready(Err(e)) => {
1818 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1819 e.into(),
1820 ))));
1821 }
1822 }
1823
1824 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1826
1827 std::task::Poll::Ready(Some(match header.ordinal {
1828 0x63704f8bd0962f00 => {
1829 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1830 let mut req = fidl::new_empty!(
1831 TimeSourceUpdateDevicePropertiesRequest,
1832 fidl::encoding::DefaultFuchsiaResourceDialect
1833 );
1834 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
1835 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1836 Ok(PushSourceRequest::UpdateDeviceProperties {
1837 properties: req.properties,
1838
1839 control_handle,
1840 })
1841 }
1842 0x44d515a56e8304dc => {
1843 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1844 let mut req = fidl::new_empty!(
1845 fidl::encoding::EmptyPayload,
1846 fidl::encoding::DefaultFuchsiaResourceDialect
1847 );
1848 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1849 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1850 Ok(PushSourceRequest::WatchSample {
1851 responder: PushSourceWatchSampleResponder {
1852 control_handle: std::mem::ManuallyDrop::new(control_handle),
1853 tx_id: header.tx_id,
1854 },
1855 })
1856 }
1857 0x60621a545f488bb1 => {
1858 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1859 let mut req = fidl::new_empty!(
1860 fidl::encoding::EmptyPayload,
1861 fidl::encoding::DefaultFuchsiaResourceDialect
1862 );
1863 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1864 let control_handle = PushSourceControlHandle { inner: this.inner.clone() };
1865 Ok(PushSourceRequest::WatchStatus {
1866 responder: PushSourceWatchStatusResponder {
1867 control_handle: std::mem::ManuallyDrop::new(control_handle),
1868 tx_id: header.tx_id,
1869 },
1870 })
1871 }
1872 _ => Err(fidl::Error::UnknownOrdinal {
1873 ordinal: header.ordinal,
1874 protocol_name:
1875 <PushSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1876 }),
1877 }))
1878 },
1879 )
1880 }
1881}
1882
1883#[derive(Debug)]
1889pub enum PushSourceRequest {
1890 UpdateDeviceProperties { properties: Properties, control_handle: PushSourceControlHandle },
1893 WatchSample { responder: PushSourceWatchSampleResponder },
1907 WatchStatus { responder: PushSourceWatchStatusResponder },
1916}
1917
1918impl PushSourceRequest {
1919 #[allow(irrefutable_let_patterns)]
1920 pub fn into_update_device_properties(self) -> Option<(Properties, PushSourceControlHandle)> {
1921 if let PushSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
1922 Some((properties, control_handle))
1923 } else {
1924 None
1925 }
1926 }
1927
1928 #[allow(irrefutable_let_patterns)]
1929 pub fn into_watch_sample(self) -> Option<(PushSourceWatchSampleResponder)> {
1930 if let PushSourceRequest::WatchSample { responder } = self {
1931 Some((responder))
1932 } else {
1933 None
1934 }
1935 }
1936
1937 #[allow(irrefutable_let_patterns)]
1938 pub fn into_watch_status(self) -> Option<(PushSourceWatchStatusResponder)> {
1939 if let PushSourceRequest::WatchStatus { responder } = self {
1940 Some((responder))
1941 } else {
1942 None
1943 }
1944 }
1945
1946 pub fn method_name(&self) -> &'static str {
1948 match *self {
1949 PushSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
1950 PushSourceRequest::WatchSample { .. } => "watch_sample",
1951 PushSourceRequest::WatchStatus { .. } => "watch_status",
1952 }
1953 }
1954}
1955
1956#[derive(Debug, Clone)]
1957pub struct PushSourceControlHandle {
1958 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1959}
1960
1961impl fidl::endpoints::ControlHandle for PushSourceControlHandle {
1962 fn shutdown(&self) {
1963 self.inner.shutdown()
1964 }
1965
1966 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1967 self.inner.shutdown_with_epitaph(status)
1968 }
1969
1970 fn is_closed(&self) -> bool {
1971 self.inner.channel().is_closed()
1972 }
1973 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1974 self.inner.channel().on_closed()
1975 }
1976
1977 #[cfg(target_os = "fuchsia")]
1978 fn signal_peer(
1979 &self,
1980 clear_mask: zx::Signals,
1981 set_mask: zx::Signals,
1982 ) -> Result<(), zx_status::Status> {
1983 use fidl::Peered;
1984 self.inner.channel().signal_peer(clear_mask, set_mask)
1985 }
1986}
1987
1988impl PushSourceControlHandle {}
1989
1990#[must_use = "FIDL methods require a response to be sent"]
1991#[derive(Debug)]
1992pub struct PushSourceWatchSampleResponder {
1993 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
1994 tx_id: u32,
1995}
1996
1997impl std::ops::Drop for PushSourceWatchSampleResponder {
2001 fn drop(&mut self) {
2002 self.control_handle.shutdown();
2003 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2005 }
2006}
2007
2008impl fidl::endpoints::Responder for PushSourceWatchSampleResponder {
2009 type ControlHandle = PushSourceControlHandle;
2010
2011 fn control_handle(&self) -> &PushSourceControlHandle {
2012 &self.control_handle
2013 }
2014
2015 fn drop_without_shutdown(mut self) {
2016 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2018 std::mem::forget(self);
2020 }
2021}
2022
2023impl PushSourceWatchSampleResponder {
2024 pub fn send(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
2028 let _result = self.send_raw(sample);
2029 if _result.is_err() {
2030 self.control_handle.shutdown();
2031 }
2032 self.drop_without_shutdown();
2033 _result
2034 }
2035
2036 pub fn send_no_shutdown_on_err(self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
2038 let _result = self.send_raw(sample);
2039 self.drop_without_shutdown();
2040 _result
2041 }
2042
2043 fn send_raw(&self, mut sample: &TimeSample) -> Result<(), fidl::Error> {
2044 self.control_handle.inner.send::<PushSourceWatchSampleResponse>(
2045 (sample,),
2046 self.tx_id,
2047 0x44d515a56e8304dc,
2048 fidl::encoding::DynamicFlags::empty(),
2049 )
2050 }
2051}
2052
2053#[must_use = "FIDL methods require a response to be sent"]
2054#[derive(Debug)]
2055pub struct PushSourceWatchStatusResponder {
2056 control_handle: std::mem::ManuallyDrop<PushSourceControlHandle>,
2057 tx_id: u32,
2058}
2059
2060impl std::ops::Drop for PushSourceWatchStatusResponder {
2064 fn drop(&mut self) {
2065 self.control_handle.shutdown();
2066 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2068 }
2069}
2070
2071impl fidl::endpoints::Responder for PushSourceWatchStatusResponder {
2072 type ControlHandle = PushSourceControlHandle;
2073
2074 fn control_handle(&self) -> &PushSourceControlHandle {
2075 &self.control_handle
2076 }
2077
2078 fn drop_without_shutdown(mut self) {
2079 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2081 std::mem::forget(self);
2083 }
2084}
2085
2086impl PushSourceWatchStatusResponder {
2087 pub fn send(self, mut status: Status) -> Result<(), fidl::Error> {
2091 let _result = self.send_raw(status);
2092 if _result.is_err() {
2093 self.control_handle.shutdown();
2094 }
2095 self.drop_without_shutdown();
2096 _result
2097 }
2098
2099 pub fn send_no_shutdown_on_err(self, mut status: Status) -> Result<(), fidl::Error> {
2101 let _result = self.send_raw(status);
2102 self.drop_without_shutdown();
2103 _result
2104 }
2105
2106 fn send_raw(&self, mut status: Status) -> Result<(), fidl::Error> {
2107 self.control_handle.inner.send::<PushSourceWatchStatusResponse>(
2108 (status,),
2109 self.tx_id,
2110 0x60621a545f488bb1,
2111 fidl::encoding::DynamicFlags::empty(),
2112 )
2113 }
2114}
2115
2116#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2117pub struct TimeSourceMarker;
2118
2119impl fidl::endpoints::ProtocolMarker for TimeSourceMarker {
2120 type Proxy = TimeSourceProxy;
2121 type RequestStream = TimeSourceRequestStream;
2122 #[cfg(target_os = "fuchsia")]
2123 type SynchronousProxy = TimeSourceSynchronousProxy;
2124
2125 const DEBUG_NAME: &'static str = "(anonymous) TimeSource";
2126}
2127
2128pub trait TimeSourceProxyInterface: Send + Sync {
2129 fn r#update_device_properties(&self, properties: &Properties) -> Result<(), fidl::Error>;
2130}
2131#[derive(Debug)]
2132#[cfg(target_os = "fuchsia")]
2133pub struct TimeSourceSynchronousProxy {
2134 client: fidl::client::sync::Client,
2135}
2136
2137#[cfg(target_os = "fuchsia")]
2138impl fidl::endpoints::SynchronousProxy for TimeSourceSynchronousProxy {
2139 type Proxy = TimeSourceProxy;
2140 type Protocol = TimeSourceMarker;
2141
2142 fn from_channel(inner: fidl::Channel) -> Self {
2143 Self::new(inner)
2144 }
2145
2146 fn into_channel(self) -> fidl::Channel {
2147 self.client.into_channel()
2148 }
2149
2150 fn as_channel(&self) -> &fidl::Channel {
2151 self.client.as_channel()
2152 }
2153}
2154
2155#[cfg(target_os = "fuchsia")]
2156impl TimeSourceSynchronousProxy {
2157 pub fn new(channel: fidl::Channel) -> Self {
2158 Self { client: fidl::client::sync::Client::new(channel) }
2159 }
2160
2161 pub fn into_channel(self) -> fidl::Channel {
2162 self.client.into_channel()
2163 }
2164
2165 pub fn wait_for_event(
2168 &self,
2169 deadline: zx::MonotonicInstant,
2170 ) -> Result<TimeSourceEvent, fidl::Error> {
2171 TimeSourceEvent::decode(self.client.wait_for_event::<TimeSourceMarker>(deadline)?)
2172 }
2173
2174 pub fn r#update_device_properties(
2177 &self,
2178 mut properties: &Properties,
2179 ) -> Result<(), fidl::Error> {
2180 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2181 (properties,),
2182 0x63704f8bd0962f00,
2183 fidl::encoding::DynamicFlags::empty(),
2184 )
2185 }
2186}
2187
2188#[cfg(target_os = "fuchsia")]
2189impl From<TimeSourceSynchronousProxy> for zx::NullableHandle {
2190 fn from(value: TimeSourceSynchronousProxy) -> Self {
2191 value.into_channel().into()
2192 }
2193}
2194
2195#[cfg(target_os = "fuchsia")]
2196impl From<fidl::Channel> for TimeSourceSynchronousProxy {
2197 fn from(value: fidl::Channel) -> Self {
2198 Self::new(value)
2199 }
2200}
2201
2202#[cfg(target_os = "fuchsia")]
2203impl fidl::endpoints::FromClient for TimeSourceSynchronousProxy {
2204 type Protocol = TimeSourceMarker;
2205
2206 fn from_client(value: fidl::endpoints::ClientEnd<TimeSourceMarker>) -> Self {
2207 Self::new(value.into_channel())
2208 }
2209}
2210
2211#[derive(Debug, Clone)]
2212pub struct TimeSourceProxy {
2213 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2214}
2215
2216impl fidl::endpoints::Proxy for TimeSourceProxy {
2217 type Protocol = TimeSourceMarker;
2218
2219 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2220 Self::new(inner)
2221 }
2222
2223 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2224 self.client.into_channel().map_err(|client| Self { client })
2225 }
2226
2227 fn as_channel(&self) -> &::fidl::AsyncChannel {
2228 self.client.as_channel()
2229 }
2230}
2231
2232impl TimeSourceProxy {
2233 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2235 let protocol_name = <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2236 Self { client: fidl::client::Client::new(channel, protocol_name) }
2237 }
2238
2239 pub fn take_event_stream(&self) -> TimeSourceEventStream {
2245 TimeSourceEventStream { event_receiver: self.client.take_event_receiver() }
2246 }
2247
2248 pub fn r#update_device_properties(
2251 &self,
2252 mut properties: &Properties,
2253 ) -> Result<(), fidl::Error> {
2254 TimeSourceProxyInterface::r#update_device_properties(self, properties)
2255 }
2256}
2257
2258impl TimeSourceProxyInterface for TimeSourceProxy {
2259 fn r#update_device_properties(&self, mut properties: &Properties) -> Result<(), fidl::Error> {
2260 self.client.send::<TimeSourceUpdateDevicePropertiesRequest>(
2261 (properties,),
2262 0x63704f8bd0962f00,
2263 fidl::encoding::DynamicFlags::empty(),
2264 )
2265 }
2266}
2267
2268pub struct TimeSourceEventStream {
2269 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2270}
2271
2272impl std::marker::Unpin for TimeSourceEventStream {}
2273
2274impl futures::stream::FusedStream for TimeSourceEventStream {
2275 fn is_terminated(&self) -> bool {
2276 self.event_receiver.is_terminated()
2277 }
2278}
2279
2280impl futures::Stream for TimeSourceEventStream {
2281 type Item = Result<TimeSourceEvent, fidl::Error>;
2282
2283 fn poll_next(
2284 mut self: std::pin::Pin<&mut Self>,
2285 cx: &mut std::task::Context<'_>,
2286 ) -> std::task::Poll<Option<Self::Item>> {
2287 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2288 &mut self.event_receiver,
2289 cx
2290 )?) {
2291 Some(buf) => std::task::Poll::Ready(Some(TimeSourceEvent::decode(buf))),
2292 None => std::task::Poll::Ready(None),
2293 }
2294 }
2295}
2296
2297#[derive(Debug)]
2298pub enum TimeSourceEvent {}
2299
2300impl TimeSourceEvent {
2301 fn decode(
2303 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2304 ) -> Result<TimeSourceEvent, fidl::Error> {
2305 let (bytes, _handles) = buf.split_mut();
2306 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2307 debug_assert_eq!(tx_header.tx_id, 0);
2308 match tx_header.ordinal {
2309 _ => Err(fidl::Error::UnknownOrdinal {
2310 ordinal: tx_header.ordinal,
2311 protocol_name: <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2312 }),
2313 }
2314 }
2315}
2316
2317pub struct TimeSourceRequestStream {
2319 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2320 is_terminated: bool,
2321}
2322
2323impl std::marker::Unpin for TimeSourceRequestStream {}
2324
2325impl futures::stream::FusedStream for TimeSourceRequestStream {
2326 fn is_terminated(&self) -> bool {
2327 self.is_terminated
2328 }
2329}
2330
2331impl fidl::endpoints::RequestStream for TimeSourceRequestStream {
2332 type Protocol = TimeSourceMarker;
2333 type ControlHandle = TimeSourceControlHandle;
2334
2335 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2336 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2337 }
2338
2339 fn control_handle(&self) -> Self::ControlHandle {
2340 TimeSourceControlHandle { inner: self.inner.clone() }
2341 }
2342
2343 fn into_inner(
2344 self,
2345 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2346 {
2347 (self.inner, self.is_terminated)
2348 }
2349
2350 fn from_inner(
2351 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2352 is_terminated: bool,
2353 ) -> Self {
2354 Self { inner, is_terminated }
2355 }
2356}
2357
2358impl futures::Stream for TimeSourceRequestStream {
2359 type Item = Result<TimeSourceRequest, fidl::Error>;
2360
2361 fn poll_next(
2362 mut self: std::pin::Pin<&mut Self>,
2363 cx: &mut std::task::Context<'_>,
2364 ) -> std::task::Poll<Option<Self::Item>> {
2365 let this = &mut *self;
2366 if this.inner.check_shutdown(cx) {
2367 this.is_terminated = true;
2368 return std::task::Poll::Ready(None);
2369 }
2370 if this.is_terminated {
2371 panic!("polled TimeSourceRequestStream after completion");
2372 }
2373 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2374 |bytes, handles| {
2375 match this.inner.channel().read_etc(cx, bytes, handles) {
2376 std::task::Poll::Ready(Ok(())) => {}
2377 std::task::Poll::Pending => return std::task::Poll::Pending,
2378 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2379 this.is_terminated = true;
2380 return std::task::Poll::Ready(None);
2381 }
2382 std::task::Poll::Ready(Err(e)) => {
2383 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2384 e.into(),
2385 ))));
2386 }
2387 }
2388
2389 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2391
2392 std::task::Poll::Ready(Some(match header.ordinal {
2393 0x63704f8bd0962f00 => {
2394 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2395 let mut req = fidl::new_empty!(
2396 TimeSourceUpdateDevicePropertiesRequest,
2397 fidl::encoding::DefaultFuchsiaResourceDialect
2398 );
2399 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeSourceUpdateDevicePropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
2400 let control_handle = TimeSourceControlHandle { inner: this.inner.clone() };
2401 Ok(TimeSourceRequest::UpdateDeviceProperties {
2402 properties: req.properties,
2403
2404 control_handle,
2405 })
2406 }
2407 _ => Err(fidl::Error::UnknownOrdinal {
2408 ordinal: header.ordinal,
2409 protocol_name:
2410 <TimeSourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2411 }),
2412 }))
2413 },
2414 )
2415 }
2416}
2417
2418#[derive(Debug)]
2421pub enum TimeSourceRequest {
2422 UpdateDeviceProperties { properties: Properties, control_handle: TimeSourceControlHandle },
2425}
2426
2427impl TimeSourceRequest {
2428 #[allow(irrefutable_let_patterns)]
2429 pub fn into_update_device_properties(self) -> Option<(Properties, TimeSourceControlHandle)> {
2430 if let TimeSourceRequest::UpdateDeviceProperties { properties, control_handle } = self {
2431 Some((properties, control_handle))
2432 } else {
2433 None
2434 }
2435 }
2436
2437 pub fn method_name(&self) -> &'static str {
2439 match *self {
2440 TimeSourceRequest::UpdateDeviceProperties { .. } => "update_device_properties",
2441 }
2442 }
2443}
2444
2445#[derive(Debug, Clone)]
2446pub struct TimeSourceControlHandle {
2447 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2448}
2449
2450impl fidl::endpoints::ControlHandle for TimeSourceControlHandle {
2451 fn shutdown(&self) {
2452 self.inner.shutdown()
2453 }
2454
2455 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2456 self.inner.shutdown_with_epitaph(status)
2457 }
2458
2459 fn is_closed(&self) -> bool {
2460 self.inner.channel().is_closed()
2461 }
2462 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2463 self.inner.channel().on_closed()
2464 }
2465
2466 #[cfg(target_os = "fuchsia")]
2467 fn signal_peer(
2468 &self,
2469 clear_mask: zx::Signals,
2470 set_mask: zx::Signals,
2471 ) -> Result<(), zx_status::Status> {
2472 use fidl::Peered;
2473 self.inner.channel().signal_peer(clear_mask, set_mask)
2474 }
2475}
2476
2477impl TimeSourceControlHandle {}
2478
2479mod internal {
2480 use super::*;
2481
2482 impl fidl::encoding::ResourceTypeMarker for PullSourceShutdownResponse {
2483 type Borrowed<'a> = &'a mut Self;
2484 fn take_or_borrow<'a>(
2485 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2486 ) -> Self::Borrowed<'a> {
2487 value
2488 }
2489 }
2490
2491 unsafe impl fidl::encoding::TypeMarker for PullSourceShutdownResponse {
2492 type Owned = Self;
2493
2494 #[inline(always)]
2495 fn inline_align(_context: fidl::encoding::Context) -> usize {
2496 4
2497 }
2498
2499 #[inline(always)]
2500 fn inline_size(_context: fidl::encoding::Context) -> usize {
2501 4
2502 }
2503 }
2504
2505 unsafe impl
2506 fidl::encoding::Encode<
2507 PullSourceShutdownResponse,
2508 fidl::encoding::DefaultFuchsiaResourceDialect,
2509 > for &mut PullSourceShutdownResponse
2510 {
2511 #[inline]
2512 unsafe fn encode(
2513 self,
2514 encoder: &mut fidl::encoding::Encoder<
2515 '_,
2516 fidl::encoding::DefaultFuchsiaResourceDialect,
2517 >,
2518 offset: usize,
2519 _depth: fidl::encoding::Depth,
2520 ) -> fidl::Result<()> {
2521 encoder.debug_check_bounds::<PullSourceShutdownResponse>(offset);
2522 fidl::encoding::Encode::<PullSourceShutdownResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2524 (
2525 <fidl_fuchsia_inspect::EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.escrow_token),
2526 ),
2527 encoder, offset, _depth
2528 )
2529 }
2530 }
2531 unsafe impl<
2532 T0: fidl::encoding::Encode<
2533 fidl_fuchsia_inspect::EscrowToken,
2534 fidl::encoding::DefaultFuchsiaResourceDialect,
2535 >,
2536 >
2537 fidl::encoding::Encode<
2538 PullSourceShutdownResponse,
2539 fidl::encoding::DefaultFuchsiaResourceDialect,
2540 > for (T0,)
2541 {
2542 #[inline]
2543 unsafe fn encode(
2544 self,
2545 encoder: &mut fidl::encoding::Encoder<
2546 '_,
2547 fidl::encoding::DefaultFuchsiaResourceDialect,
2548 >,
2549 offset: usize,
2550 depth: fidl::encoding::Depth,
2551 ) -> fidl::Result<()> {
2552 encoder.debug_check_bounds::<PullSourceShutdownResponse>(offset);
2553 self.0.encode(encoder, offset + 0, depth)?;
2557 Ok(())
2558 }
2559 }
2560
2561 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2562 for PullSourceShutdownResponse
2563 {
2564 #[inline(always)]
2565 fn new_empty() -> Self {
2566 Self {
2567 escrow_token: fidl::new_empty!(
2568 fidl_fuchsia_inspect::EscrowToken,
2569 fidl::encoding::DefaultFuchsiaResourceDialect
2570 ),
2571 }
2572 }
2573
2574 #[inline]
2575 unsafe fn decode(
2576 &mut self,
2577 decoder: &mut fidl::encoding::Decoder<
2578 '_,
2579 fidl::encoding::DefaultFuchsiaResourceDialect,
2580 >,
2581 offset: usize,
2582 _depth: fidl::encoding::Depth,
2583 ) -> fidl::Result<()> {
2584 decoder.debug_check_bounds::<Self>(offset);
2585 fidl::decode!(
2587 fidl_fuchsia_inspect::EscrowToken,
2588 fidl::encoding::DefaultFuchsiaResourceDialect,
2589 &mut self.escrow_token,
2590 decoder,
2591 offset + 0,
2592 _depth
2593 )?;
2594 Ok(())
2595 }
2596 }
2597}