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_hardware_rtc_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.hardware.rtc.Device";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
26pub type DeviceGetResult = Result<Time, i32>;
27pub type DeviceSet2Result = Result<(), i32>;
28
29pub trait DeviceProxyInterface: Send + Sync {
30 type GetResponseFut: std::future::Future<Output = Result<DeviceGetResult, fidl::Error>> + Send;
31 fn r#get(&self) -> Self::GetResponseFut;
32 type SetResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
33 fn r#set(&self, rtc: &Time) -> Self::SetResponseFut;
34 type Set2ResponseFut: std::future::Future<Output = Result<DeviceSet2Result, fidl::Error>> + Send;
35 fn r#set2(&self, rtc: &Time) -> Self::Set2ResponseFut;
36}
37#[derive(Debug)]
38#[cfg(target_os = "fuchsia")]
39pub struct DeviceSynchronousProxy {
40 client: fidl::client::sync::Client,
41}
42
43#[cfg(target_os = "fuchsia")]
44impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
45 type Proxy = DeviceProxy;
46 type Protocol = DeviceMarker;
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 DeviceSynchronousProxy {
63 pub fn new(channel: fidl::Channel) -> Self {
64 let protocol_name = <DeviceMarker 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<DeviceEvent, fidl::Error> {
78 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
79 }
80
81 pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<DeviceGetResult, fidl::Error> {
85 let _response = self.client.send_query::<
86 fidl::encoding::EmptyPayload,
87 fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>,
88 >(
89 (),
90 0x27fdad10b3816ff4,
91 fidl::encoding::DynamicFlags::FLEXIBLE,
92 ___deadline,
93 )?
94 .into_result::<DeviceMarker>("get")?;
95 Ok(_response.map(|x| x.rtc))
96 }
97
98 pub fn r#set(
103 &self,
104 mut rtc: &Time,
105 ___deadline: zx::MonotonicInstant,
106 ) -> Result<i32, fidl::Error> {
107 let _response = self
108 .client
109 .send_query::<DeviceSetRequest, fidl::encoding::FlexibleType<DeviceSetResponse>>(
110 (rtc,),
111 0x5ff1bca8b571d820,
112 fidl::encoding::DynamicFlags::FLEXIBLE,
113 ___deadline,
114 )?
115 .into_result::<DeviceMarker>("set")?;
116 Ok(_response.status)
117 }
118
119 pub fn r#set2(
122 &self,
123 mut rtc: &Time,
124 ___deadline: zx::MonotonicInstant,
125 ) -> Result<DeviceSet2Result, fidl::Error> {
126 let _response = self.client.send_query::<
127 DeviceSet2Request,
128 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
129 >(
130 (rtc,),
131 0x16698df780253ae5,
132 fidl::encoding::DynamicFlags::FLEXIBLE,
133 ___deadline,
134 )?
135 .into_result::<DeviceMarker>("set2")?;
136 Ok(_response.map(|x| x))
137 }
138}
139
140#[derive(Debug, Clone)]
141pub struct DeviceProxy {
142 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
143}
144
145impl fidl::endpoints::Proxy for DeviceProxy {
146 type Protocol = DeviceMarker;
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 DeviceProxy {
162 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
164 let protocol_name = <DeviceMarker 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) -> DeviceEventStream {
174 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
175 }
176
177 pub fn r#get(
181 &self,
182 ) -> fidl::client::QueryResponseFut<
183 DeviceGetResult,
184 fidl::encoding::DefaultFuchsiaResourceDialect,
185 > {
186 DeviceProxyInterface::r#get(self)
187 }
188
189 pub fn r#set(
194 &self,
195 mut rtc: &Time,
196 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
197 DeviceProxyInterface::r#set(self, rtc)
198 }
199
200 pub fn r#set2(
203 &self,
204 mut rtc: &Time,
205 ) -> fidl::client::QueryResponseFut<
206 DeviceSet2Result,
207 fidl::encoding::DefaultFuchsiaResourceDialect,
208 > {
209 DeviceProxyInterface::r#set2(self, rtc)
210 }
211}
212
213impl DeviceProxyInterface for DeviceProxy {
214 type GetResponseFut = fidl::client::QueryResponseFut<
215 DeviceGetResult,
216 fidl::encoding::DefaultFuchsiaResourceDialect,
217 >;
218 fn r#get(&self) -> Self::GetResponseFut {
219 fn _decode(
220 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
221 ) -> Result<DeviceGetResult, fidl::Error> {
222 let _response = fidl::client::decode_transaction_body::<
223 fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>,
224 fidl::encoding::DefaultFuchsiaResourceDialect,
225 0x27fdad10b3816ff4,
226 >(_buf?)?
227 .into_result::<DeviceMarker>("get")?;
228 Ok(_response.map(|x| x.rtc))
229 }
230 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetResult>(
231 (),
232 0x27fdad10b3816ff4,
233 fidl::encoding::DynamicFlags::FLEXIBLE,
234 _decode,
235 )
236 }
237
238 type SetResponseFut =
239 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
240 fn r#set(&self, mut rtc: &Time) -> Self::SetResponseFut {
241 fn _decode(
242 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
243 ) -> Result<i32, fidl::Error> {
244 let _response = fidl::client::decode_transaction_body::<
245 fidl::encoding::FlexibleType<DeviceSetResponse>,
246 fidl::encoding::DefaultFuchsiaResourceDialect,
247 0x5ff1bca8b571d820,
248 >(_buf?)?
249 .into_result::<DeviceMarker>("set")?;
250 Ok(_response.status)
251 }
252 self.client.send_query_and_decode::<DeviceSetRequest, i32>(
253 (rtc,),
254 0x5ff1bca8b571d820,
255 fidl::encoding::DynamicFlags::FLEXIBLE,
256 _decode,
257 )
258 }
259
260 type Set2ResponseFut = fidl::client::QueryResponseFut<
261 DeviceSet2Result,
262 fidl::encoding::DefaultFuchsiaResourceDialect,
263 >;
264 fn r#set2(&self, mut rtc: &Time) -> Self::Set2ResponseFut {
265 fn _decode(
266 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
267 ) -> Result<DeviceSet2Result, fidl::Error> {
268 let _response = fidl::client::decode_transaction_body::<
269 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
270 fidl::encoding::DefaultFuchsiaResourceDialect,
271 0x16698df780253ae5,
272 >(_buf?)?
273 .into_result::<DeviceMarker>("set2")?;
274 Ok(_response.map(|x| x))
275 }
276 self.client.send_query_and_decode::<DeviceSet2Request, DeviceSet2Result>(
277 (rtc,),
278 0x16698df780253ae5,
279 fidl::encoding::DynamicFlags::FLEXIBLE,
280 _decode,
281 )
282 }
283}
284
285pub struct DeviceEventStream {
286 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
287}
288
289impl std::marker::Unpin for DeviceEventStream {}
290
291impl futures::stream::FusedStream for DeviceEventStream {
292 fn is_terminated(&self) -> bool {
293 self.event_receiver.is_terminated()
294 }
295}
296
297impl futures::Stream for DeviceEventStream {
298 type Item = Result<DeviceEvent, fidl::Error>;
299
300 fn poll_next(
301 mut self: std::pin::Pin<&mut Self>,
302 cx: &mut std::task::Context<'_>,
303 ) -> std::task::Poll<Option<Self::Item>> {
304 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
305 &mut self.event_receiver,
306 cx
307 )?) {
308 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
309 None => std::task::Poll::Ready(None),
310 }
311 }
312}
313
314#[derive(Debug)]
315pub enum DeviceEvent {
316 #[non_exhaustive]
317 _UnknownEvent {
318 ordinal: u64,
320 },
321}
322
323impl DeviceEvent {
324 fn decode(
326 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
327 ) -> Result<DeviceEvent, fidl::Error> {
328 let (bytes, _handles) = buf.split_mut();
329 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
330 debug_assert_eq!(tx_header.tx_id, 0);
331 match tx_header.ordinal {
332 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
333 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
334 }
335 _ => Err(fidl::Error::UnknownOrdinal {
336 ordinal: tx_header.ordinal,
337 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
338 }),
339 }
340 }
341}
342
343pub struct DeviceRequestStream {
345 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
346 is_terminated: bool,
347}
348
349impl std::marker::Unpin for DeviceRequestStream {}
350
351impl futures::stream::FusedStream for DeviceRequestStream {
352 fn is_terminated(&self) -> bool {
353 self.is_terminated
354 }
355}
356
357impl fidl::endpoints::RequestStream for DeviceRequestStream {
358 type Protocol = DeviceMarker;
359 type ControlHandle = DeviceControlHandle;
360
361 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
362 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
363 }
364
365 fn control_handle(&self) -> Self::ControlHandle {
366 DeviceControlHandle { inner: self.inner.clone() }
367 }
368
369 fn into_inner(
370 self,
371 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
372 {
373 (self.inner, self.is_terminated)
374 }
375
376 fn from_inner(
377 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
378 is_terminated: bool,
379 ) -> Self {
380 Self { inner, is_terminated }
381 }
382}
383
384impl futures::Stream for DeviceRequestStream {
385 type Item = Result<DeviceRequest, fidl::Error>;
386
387 fn poll_next(
388 mut self: std::pin::Pin<&mut Self>,
389 cx: &mut std::task::Context<'_>,
390 ) -> std::task::Poll<Option<Self::Item>> {
391 let this = &mut *self;
392 if this.inner.check_shutdown(cx) {
393 this.is_terminated = true;
394 return std::task::Poll::Ready(None);
395 }
396 if this.is_terminated {
397 panic!("polled DeviceRequestStream after completion");
398 }
399 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
400 |bytes, handles| {
401 match this.inner.channel().read_etc(cx, bytes, handles) {
402 std::task::Poll::Ready(Ok(())) => {}
403 std::task::Poll::Pending => return std::task::Poll::Pending,
404 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
405 this.is_terminated = true;
406 return std::task::Poll::Ready(None);
407 }
408 std::task::Poll::Ready(Err(e)) => {
409 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
410 e.into(),
411 ))))
412 }
413 }
414
415 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
417
418 std::task::Poll::Ready(Some(match header.ordinal {
419 0x27fdad10b3816ff4 => {
420 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
421 let mut req = fidl::new_empty!(
422 fidl::encoding::EmptyPayload,
423 fidl::encoding::DefaultFuchsiaResourceDialect
424 );
425 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
426 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
427 Ok(DeviceRequest::Get {
428 responder: DeviceGetResponder {
429 control_handle: std::mem::ManuallyDrop::new(control_handle),
430 tx_id: header.tx_id,
431 },
432 })
433 }
434 0x5ff1bca8b571d820 => {
435 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
436 let mut req = fidl::new_empty!(
437 DeviceSetRequest,
438 fidl::encoding::DefaultFuchsiaResourceDialect
439 );
440 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetRequest>(&header, _body_bytes, handles, &mut req)?;
441 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
442 Ok(DeviceRequest::Set {
443 rtc: req.rtc,
444
445 responder: DeviceSetResponder {
446 control_handle: std::mem::ManuallyDrop::new(control_handle),
447 tx_id: header.tx_id,
448 },
449 })
450 }
451 0x16698df780253ae5 => {
452 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
453 let mut req = fidl::new_empty!(
454 DeviceSet2Request,
455 fidl::encoding::DefaultFuchsiaResourceDialect
456 );
457 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSet2Request>(&header, _body_bytes, handles, &mut req)?;
458 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
459 Ok(DeviceRequest::Set2 {
460 rtc: req.rtc,
461
462 responder: DeviceSet2Responder {
463 control_handle: std::mem::ManuallyDrop::new(control_handle),
464 tx_id: header.tx_id,
465 },
466 })
467 }
468 _ if header.tx_id == 0
469 && header
470 .dynamic_flags()
471 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
472 {
473 Ok(DeviceRequest::_UnknownMethod {
474 ordinal: header.ordinal,
475 control_handle: DeviceControlHandle { inner: this.inner.clone() },
476 method_type: fidl::MethodType::OneWay,
477 })
478 }
479 _ if header
480 .dynamic_flags()
481 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
482 {
483 this.inner.send_framework_err(
484 fidl::encoding::FrameworkErr::UnknownMethod,
485 header.tx_id,
486 header.ordinal,
487 header.dynamic_flags(),
488 (bytes, handles),
489 )?;
490 Ok(DeviceRequest::_UnknownMethod {
491 ordinal: header.ordinal,
492 control_handle: DeviceControlHandle { inner: this.inner.clone() },
493 method_type: fidl::MethodType::TwoWay,
494 })
495 }
496 _ => Err(fidl::Error::UnknownOrdinal {
497 ordinal: header.ordinal,
498 protocol_name:
499 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
500 }),
501 }))
502 },
503 )
504 }
505}
506
507#[derive(Debug)]
508pub enum DeviceRequest {
509 Get { responder: DeviceGetResponder },
513 Set { rtc: Time, responder: DeviceSetResponder },
518 Set2 { rtc: Time, responder: DeviceSet2Responder },
521 #[non_exhaustive]
523 _UnknownMethod {
524 ordinal: u64,
526 control_handle: DeviceControlHandle,
527 method_type: fidl::MethodType,
528 },
529}
530
531impl DeviceRequest {
532 #[allow(irrefutable_let_patterns)]
533 pub fn into_get(self) -> Option<(DeviceGetResponder)> {
534 if let DeviceRequest::Get { responder } = self {
535 Some((responder))
536 } else {
537 None
538 }
539 }
540
541 #[allow(irrefutable_let_patterns)]
542 pub fn into_set(self) -> Option<(Time, DeviceSetResponder)> {
543 if let DeviceRequest::Set { rtc, responder } = self {
544 Some((rtc, responder))
545 } else {
546 None
547 }
548 }
549
550 #[allow(irrefutable_let_patterns)]
551 pub fn into_set2(self) -> Option<(Time, DeviceSet2Responder)> {
552 if let DeviceRequest::Set2 { rtc, responder } = self {
553 Some((rtc, responder))
554 } else {
555 None
556 }
557 }
558
559 pub fn method_name(&self) -> &'static str {
561 match *self {
562 DeviceRequest::Get { .. } => "get",
563 DeviceRequest::Set { .. } => "set",
564 DeviceRequest::Set2 { .. } => "set2",
565 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
566 "unknown one-way method"
567 }
568 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
569 "unknown two-way method"
570 }
571 }
572 }
573}
574
575#[derive(Debug, Clone)]
576pub struct DeviceControlHandle {
577 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
578}
579
580impl fidl::endpoints::ControlHandle for DeviceControlHandle {
581 fn shutdown(&self) {
582 self.inner.shutdown()
583 }
584 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
585 self.inner.shutdown_with_epitaph(status)
586 }
587
588 fn is_closed(&self) -> bool {
589 self.inner.channel().is_closed()
590 }
591 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
592 self.inner.channel().on_closed()
593 }
594
595 #[cfg(target_os = "fuchsia")]
596 fn signal_peer(
597 &self,
598 clear_mask: zx::Signals,
599 set_mask: zx::Signals,
600 ) -> Result<(), zx_status::Status> {
601 use fidl::Peered;
602 self.inner.channel().signal_peer(clear_mask, set_mask)
603 }
604}
605
606impl DeviceControlHandle {}
607
608#[must_use = "FIDL methods require a response to be sent"]
609#[derive(Debug)]
610pub struct DeviceGetResponder {
611 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
612 tx_id: u32,
613}
614
615impl std::ops::Drop for DeviceGetResponder {
619 fn drop(&mut self) {
620 self.control_handle.shutdown();
621 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
623 }
624}
625
626impl fidl::endpoints::Responder for DeviceGetResponder {
627 type ControlHandle = DeviceControlHandle;
628
629 fn control_handle(&self) -> &DeviceControlHandle {
630 &self.control_handle
631 }
632
633 fn drop_without_shutdown(mut self) {
634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
636 std::mem::forget(self);
638 }
639}
640
641impl DeviceGetResponder {
642 pub fn send(self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
646 let _result = self.send_raw(result);
647 if _result.is_err() {
648 self.control_handle.shutdown();
649 }
650 self.drop_without_shutdown();
651 _result
652 }
653
654 pub fn send_no_shutdown_on_err(
656 self,
657 mut result: Result<&Time, i32>,
658 ) -> Result<(), fidl::Error> {
659 let _result = self.send_raw(result);
660 self.drop_without_shutdown();
661 _result
662 }
663
664 fn send_raw(&self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
665 self.control_handle
666 .inner
667 .send::<fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>>(
668 fidl::encoding::FlexibleResult::new(result.map(|rtc| (rtc,))),
669 self.tx_id,
670 0x27fdad10b3816ff4,
671 fidl::encoding::DynamicFlags::FLEXIBLE,
672 )
673 }
674}
675
676#[must_use = "FIDL methods require a response to be sent"]
677#[derive(Debug)]
678pub struct DeviceSetResponder {
679 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
680 tx_id: u32,
681}
682
683impl std::ops::Drop for DeviceSetResponder {
687 fn drop(&mut self) {
688 self.control_handle.shutdown();
689 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
691 }
692}
693
694impl fidl::endpoints::Responder for DeviceSetResponder {
695 type ControlHandle = DeviceControlHandle;
696
697 fn control_handle(&self) -> &DeviceControlHandle {
698 &self.control_handle
699 }
700
701 fn drop_without_shutdown(mut self) {
702 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
704 std::mem::forget(self);
706 }
707}
708
709impl DeviceSetResponder {
710 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
714 let _result = self.send_raw(status);
715 if _result.is_err() {
716 self.control_handle.shutdown();
717 }
718 self.drop_without_shutdown();
719 _result
720 }
721
722 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
724 let _result = self.send_raw(status);
725 self.drop_without_shutdown();
726 _result
727 }
728
729 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
730 self.control_handle.inner.send::<fidl::encoding::FlexibleType<DeviceSetResponse>>(
731 fidl::encoding::Flexible::new((status,)),
732 self.tx_id,
733 0x5ff1bca8b571d820,
734 fidl::encoding::DynamicFlags::FLEXIBLE,
735 )
736 }
737}
738
739#[must_use = "FIDL methods require a response to be sent"]
740#[derive(Debug)]
741pub struct DeviceSet2Responder {
742 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
743 tx_id: u32,
744}
745
746impl std::ops::Drop for DeviceSet2Responder {
750 fn drop(&mut self) {
751 self.control_handle.shutdown();
752 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
754 }
755}
756
757impl fidl::endpoints::Responder for DeviceSet2Responder {
758 type ControlHandle = DeviceControlHandle;
759
760 fn control_handle(&self) -> &DeviceControlHandle {
761 &self.control_handle
762 }
763
764 fn drop_without_shutdown(mut self) {
765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
767 std::mem::forget(self);
769 }
770}
771
772impl DeviceSet2Responder {
773 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
777 let _result = self.send_raw(result);
778 if _result.is_err() {
779 self.control_handle.shutdown();
780 }
781 self.drop_without_shutdown();
782 _result
783 }
784
785 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
787 let _result = self.send_raw(result);
788 self.drop_without_shutdown();
789 _result
790 }
791
792 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
793 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
794 fidl::encoding::EmptyStruct,
795 i32,
796 >>(
797 fidl::encoding::FlexibleResult::new(result),
798 self.tx_id,
799 0x16698df780253ae5,
800 fidl::encoding::DynamicFlags::FLEXIBLE,
801 )
802 }
803}
804
805#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
806pub struct ServiceMarker;
807
808#[cfg(target_os = "fuchsia")]
809impl fidl::endpoints::ServiceMarker for ServiceMarker {
810 type Proxy = ServiceProxy;
811 type Request = ServiceRequest;
812 const SERVICE_NAME: &'static str = "fuchsia.hardware.rtc.Service";
813}
814
815#[cfg(target_os = "fuchsia")]
818pub enum ServiceRequest {
819 Device(DeviceRequestStream),
820}
821
822#[cfg(target_os = "fuchsia")]
823impl fidl::endpoints::ServiceRequest for ServiceRequest {
824 type Service = ServiceMarker;
825
826 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
827 match name {
828 "device" => Self::Device(
829 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
830 ),
831 _ => panic!("no such member protocol name for service Service"),
832 }
833 }
834
835 fn member_names() -> &'static [&'static str] {
836 &["device"]
837 }
838}
839#[cfg(target_os = "fuchsia")]
840pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
841
842#[cfg(target_os = "fuchsia")]
843impl fidl::endpoints::ServiceProxy for ServiceProxy {
844 type Service = ServiceMarker;
845
846 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
847 Self(opener)
848 }
849}
850
851#[cfg(target_os = "fuchsia")]
852impl ServiceProxy {
853 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
854 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
855 self.connect_channel_to_device(server_end)?;
856 Ok(proxy)
857 }
858
859 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
862 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
863 self.connect_channel_to_device(server_end)?;
864 Ok(proxy)
865 }
866
867 pub fn connect_channel_to_device(
870 &self,
871 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
872 ) -> Result<(), fidl::Error> {
873 self.0.open_member("device", server_end.into_channel())
874 }
875
876 pub fn instance_name(&self) -> &str {
877 self.0.instance_name()
878 }
879}
880
881mod internal {
882 use super::*;
883}