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#[cfg(target_os = "fuchsia")]
141impl From<DeviceSynchronousProxy> for zx::Handle {
142 fn from(value: DeviceSynchronousProxy) -> Self {
143 value.into_channel().into()
144 }
145}
146
147#[cfg(target_os = "fuchsia")]
148impl From<fidl::Channel> for DeviceSynchronousProxy {
149 fn from(value: fidl::Channel) -> Self {
150 Self::new(value)
151 }
152}
153
154#[derive(Debug, Clone)]
155pub struct DeviceProxy {
156 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
157}
158
159impl fidl::endpoints::Proxy for DeviceProxy {
160 type Protocol = DeviceMarker;
161
162 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
163 Self::new(inner)
164 }
165
166 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
167 self.client.into_channel().map_err(|client| Self { client })
168 }
169
170 fn as_channel(&self) -> &::fidl::AsyncChannel {
171 self.client.as_channel()
172 }
173}
174
175impl DeviceProxy {
176 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
178 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
179 Self { client: fidl::client::Client::new(channel, protocol_name) }
180 }
181
182 pub fn take_event_stream(&self) -> DeviceEventStream {
188 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
189 }
190
191 pub fn r#get(
195 &self,
196 ) -> fidl::client::QueryResponseFut<
197 DeviceGetResult,
198 fidl::encoding::DefaultFuchsiaResourceDialect,
199 > {
200 DeviceProxyInterface::r#get(self)
201 }
202
203 pub fn r#set(
208 &self,
209 mut rtc: &Time,
210 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
211 DeviceProxyInterface::r#set(self, rtc)
212 }
213
214 pub fn r#set2(
217 &self,
218 mut rtc: &Time,
219 ) -> fidl::client::QueryResponseFut<
220 DeviceSet2Result,
221 fidl::encoding::DefaultFuchsiaResourceDialect,
222 > {
223 DeviceProxyInterface::r#set2(self, rtc)
224 }
225}
226
227impl DeviceProxyInterface for DeviceProxy {
228 type GetResponseFut = fidl::client::QueryResponseFut<
229 DeviceGetResult,
230 fidl::encoding::DefaultFuchsiaResourceDialect,
231 >;
232 fn r#get(&self) -> Self::GetResponseFut {
233 fn _decode(
234 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
235 ) -> Result<DeviceGetResult, fidl::Error> {
236 let _response = fidl::client::decode_transaction_body::<
237 fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>,
238 fidl::encoding::DefaultFuchsiaResourceDialect,
239 0x27fdad10b3816ff4,
240 >(_buf?)?
241 .into_result::<DeviceMarker>("get")?;
242 Ok(_response.map(|x| x.rtc))
243 }
244 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetResult>(
245 (),
246 0x27fdad10b3816ff4,
247 fidl::encoding::DynamicFlags::FLEXIBLE,
248 _decode,
249 )
250 }
251
252 type SetResponseFut =
253 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
254 fn r#set(&self, mut rtc: &Time) -> Self::SetResponseFut {
255 fn _decode(
256 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
257 ) -> Result<i32, fidl::Error> {
258 let _response = fidl::client::decode_transaction_body::<
259 fidl::encoding::FlexibleType<DeviceSetResponse>,
260 fidl::encoding::DefaultFuchsiaResourceDialect,
261 0x5ff1bca8b571d820,
262 >(_buf?)?
263 .into_result::<DeviceMarker>("set")?;
264 Ok(_response.status)
265 }
266 self.client.send_query_and_decode::<DeviceSetRequest, i32>(
267 (rtc,),
268 0x5ff1bca8b571d820,
269 fidl::encoding::DynamicFlags::FLEXIBLE,
270 _decode,
271 )
272 }
273
274 type Set2ResponseFut = fidl::client::QueryResponseFut<
275 DeviceSet2Result,
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 >;
278 fn r#set2(&self, mut rtc: &Time) -> Self::Set2ResponseFut {
279 fn _decode(
280 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
281 ) -> Result<DeviceSet2Result, fidl::Error> {
282 let _response = fidl::client::decode_transaction_body::<
283 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
284 fidl::encoding::DefaultFuchsiaResourceDialect,
285 0x16698df780253ae5,
286 >(_buf?)?
287 .into_result::<DeviceMarker>("set2")?;
288 Ok(_response.map(|x| x))
289 }
290 self.client.send_query_and_decode::<DeviceSet2Request, DeviceSet2Result>(
291 (rtc,),
292 0x16698df780253ae5,
293 fidl::encoding::DynamicFlags::FLEXIBLE,
294 _decode,
295 )
296 }
297}
298
299pub struct DeviceEventStream {
300 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
301}
302
303impl std::marker::Unpin for DeviceEventStream {}
304
305impl futures::stream::FusedStream for DeviceEventStream {
306 fn is_terminated(&self) -> bool {
307 self.event_receiver.is_terminated()
308 }
309}
310
311impl futures::Stream for DeviceEventStream {
312 type Item = Result<DeviceEvent, fidl::Error>;
313
314 fn poll_next(
315 mut self: std::pin::Pin<&mut Self>,
316 cx: &mut std::task::Context<'_>,
317 ) -> std::task::Poll<Option<Self::Item>> {
318 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
319 &mut self.event_receiver,
320 cx
321 )?) {
322 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
323 None => std::task::Poll::Ready(None),
324 }
325 }
326}
327
328#[derive(Debug)]
329pub enum DeviceEvent {
330 #[non_exhaustive]
331 _UnknownEvent {
332 ordinal: u64,
334 },
335}
336
337impl DeviceEvent {
338 fn decode(
340 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
341 ) -> Result<DeviceEvent, fidl::Error> {
342 let (bytes, _handles) = buf.split_mut();
343 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
344 debug_assert_eq!(tx_header.tx_id, 0);
345 match tx_header.ordinal {
346 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
347 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
348 }
349 _ => Err(fidl::Error::UnknownOrdinal {
350 ordinal: tx_header.ordinal,
351 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
352 }),
353 }
354 }
355}
356
357pub struct DeviceRequestStream {
359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
360 is_terminated: bool,
361}
362
363impl std::marker::Unpin for DeviceRequestStream {}
364
365impl futures::stream::FusedStream for DeviceRequestStream {
366 fn is_terminated(&self) -> bool {
367 self.is_terminated
368 }
369}
370
371impl fidl::endpoints::RequestStream for DeviceRequestStream {
372 type Protocol = DeviceMarker;
373 type ControlHandle = DeviceControlHandle;
374
375 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
376 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
377 }
378
379 fn control_handle(&self) -> Self::ControlHandle {
380 DeviceControlHandle { inner: self.inner.clone() }
381 }
382
383 fn into_inner(
384 self,
385 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
386 {
387 (self.inner, self.is_terminated)
388 }
389
390 fn from_inner(
391 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
392 is_terminated: bool,
393 ) -> Self {
394 Self { inner, is_terminated }
395 }
396}
397
398impl futures::Stream for DeviceRequestStream {
399 type Item = Result<DeviceRequest, fidl::Error>;
400
401 fn poll_next(
402 mut self: std::pin::Pin<&mut Self>,
403 cx: &mut std::task::Context<'_>,
404 ) -> std::task::Poll<Option<Self::Item>> {
405 let this = &mut *self;
406 if this.inner.check_shutdown(cx) {
407 this.is_terminated = true;
408 return std::task::Poll::Ready(None);
409 }
410 if this.is_terminated {
411 panic!("polled DeviceRequestStream after completion");
412 }
413 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
414 |bytes, handles| {
415 match this.inner.channel().read_etc(cx, bytes, handles) {
416 std::task::Poll::Ready(Ok(())) => {}
417 std::task::Poll::Pending => return std::task::Poll::Pending,
418 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
419 this.is_terminated = true;
420 return std::task::Poll::Ready(None);
421 }
422 std::task::Poll::Ready(Err(e)) => {
423 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
424 e.into(),
425 ))))
426 }
427 }
428
429 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
431
432 std::task::Poll::Ready(Some(match header.ordinal {
433 0x27fdad10b3816ff4 => {
434 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
435 let mut req = fidl::new_empty!(
436 fidl::encoding::EmptyPayload,
437 fidl::encoding::DefaultFuchsiaResourceDialect
438 );
439 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
440 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
441 Ok(DeviceRequest::Get {
442 responder: DeviceGetResponder {
443 control_handle: std::mem::ManuallyDrop::new(control_handle),
444 tx_id: header.tx_id,
445 },
446 })
447 }
448 0x5ff1bca8b571d820 => {
449 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
450 let mut req = fidl::new_empty!(
451 DeviceSetRequest,
452 fidl::encoding::DefaultFuchsiaResourceDialect
453 );
454 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetRequest>(&header, _body_bytes, handles, &mut req)?;
455 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
456 Ok(DeviceRequest::Set {
457 rtc: req.rtc,
458
459 responder: DeviceSetResponder {
460 control_handle: std::mem::ManuallyDrop::new(control_handle),
461 tx_id: header.tx_id,
462 },
463 })
464 }
465 0x16698df780253ae5 => {
466 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
467 let mut req = fidl::new_empty!(
468 DeviceSet2Request,
469 fidl::encoding::DefaultFuchsiaResourceDialect
470 );
471 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSet2Request>(&header, _body_bytes, handles, &mut req)?;
472 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
473 Ok(DeviceRequest::Set2 {
474 rtc: req.rtc,
475
476 responder: DeviceSet2Responder {
477 control_handle: std::mem::ManuallyDrop::new(control_handle),
478 tx_id: header.tx_id,
479 },
480 })
481 }
482 _ if header.tx_id == 0
483 && header
484 .dynamic_flags()
485 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
486 {
487 Ok(DeviceRequest::_UnknownMethod {
488 ordinal: header.ordinal,
489 control_handle: DeviceControlHandle { inner: this.inner.clone() },
490 method_type: fidl::MethodType::OneWay,
491 })
492 }
493 _ if header
494 .dynamic_flags()
495 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
496 {
497 this.inner.send_framework_err(
498 fidl::encoding::FrameworkErr::UnknownMethod,
499 header.tx_id,
500 header.ordinal,
501 header.dynamic_flags(),
502 (bytes, handles),
503 )?;
504 Ok(DeviceRequest::_UnknownMethod {
505 ordinal: header.ordinal,
506 control_handle: DeviceControlHandle { inner: this.inner.clone() },
507 method_type: fidl::MethodType::TwoWay,
508 })
509 }
510 _ => Err(fidl::Error::UnknownOrdinal {
511 ordinal: header.ordinal,
512 protocol_name:
513 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
514 }),
515 }))
516 },
517 )
518 }
519}
520
521#[derive(Debug)]
522pub enum DeviceRequest {
523 Get { responder: DeviceGetResponder },
527 Set { rtc: Time, responder: DeviceSetResponder },
532 Set2 { rtc: Time, responder: DeviceSet2Responder },
535 #[non_exhaustive]
537 _UnknownMethod {
538 ordinal: u64,
540 control_handle: DeviceControlHandle,
541 method_type: fidl::MethodType,
542 },
543}
544
545impl DeviceRequest {
546 #[allow(irrefutable_let_patterns)]
547 pub fn into_get(self) -> Option<(DeviceGetResponder)> {
548 if let DeviceRequest::Get { responder } = self {
549 Some((responder))
550 } else {
551 None
552 }
553 }
554
555 #[allow(irrefutable_let_patterns)]
556 pub fn into_set(self) -> Option<(Time, DeviceSetResponder)> {
557 if let DeviceRequest::Set { rtc, responder } = self {
558 Some((rtc, responder))
559 } else {
560 None
561 }
562 }
563
564 #[allow(irrefutable_let_patterns)]
565 pub fn into_set2(self) -> Option<(Time, DeviceSet2Responder)> {
566 if let DeviceRequest::Set2 { rtc, responder } = self {
567 Some((rtc, responder))
568 } else {
569 None
570 }
571 }
572
573 pub fn method_name(&self) -> &'static str {
575 match *self {
576 DeviceRequest::Get { .. } => "get",
577 DeviceRequest::Set { .. } => "set",
578 DeviceRequest::Set2 { .. } => "set2",
579 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
580 "unknown one-way method"
581 }
582 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
583 "unknown two-way method"
584 }
585 }
586 }
587}
588
589#[derive(Debug, Clone)]
590pub struct DeviceControlHandle {
591 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592}
593
594impl fidl::endpoints::ControlHandle for DeviceControlHandle {
595 fn shutdown(&self) {
596 self.inner.shutdown()
597 }
598 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
599 self.inner.shutdown_with_epitaph(status)
600 }
601
602 fn is_closed(&self) -> bool {
603 self.inner.channel().is_closed()
604 }
605 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
606 self.inner.channel().on_closed()
607 }
608
609 #[cfg(target_os = "fuchsia")]
610 fn signal_peer(
611 &self,
612 clear_mask: zx::Signals,
613 set_mask: zx::Signals,
614 ) -> Result<(), zx_status::Status> {
615 use fidl::Peered;
616 self.inner.channel().signal_peer(clear_mask, set_mask)
617 }
618}
619
620impl DeviceControlHandle {}
621
622#[must_use = "FIDL methods require a response to be sent"]
623#[derive(Debug)]
624pub struct DeviceGetResponder {
625 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
626 tx_id: u32,
627}
628
629impl std::ops::Drop for DeviceGetResponder {
633 fn drop(&mut self) {
634 self.control_handle.shutdown();
635 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
637 }
638}
639
640impl fidl::endpoints::Responder for DeviceGetResponder {
641 type ControlHandle = DeviceControlHandle;
642
643 fn control_handle(&self) -> &DeviceControlHandle {
644 &self.control_handle
645 }
646
647 fn drop_without_shutdown(mut self) {
648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
650 std::mem::forget(self);
652 }
653}
654
655impl DeviceGetResponder {
656 pub fn send(self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
660 let _result = self.send_raw(result);
661 if _result.is_err() {
662 self.control_handle.shutdown();
663 }
664 self.drop_without_shutdown();
665 _result
666 }
667
668 pub fn send_no_shutdown_on_err(
670 self,
671 mut result: Result<&Time, i32>,
672 ) -> Result<(), fidl::Error> {
673 let _result = self.send_raw(result);
674 self.drop_without_shutdown();
675 _result
676 }
677
678 fn send_raw(&self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
679 self.control_handle
680 .inner
681 .send::<fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>>(
682 fidl::encoding::FlexibleResult::new(result.map(|rtc| (rtc,))),
683 self.tx_id,
684 0x27fdad10b3816ff4,
685 fidl::encoding::DynamicFlags::FLEXIBLE,
686 )
687 }
688}
689
690#[must_use = "FIDL methods require a response to be sent"]
691#[derive(Debug)]
692pub struct DeviceSetResponder {
693 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
694 tx_id: u32,
695}
696
697impl std::ops::Drop for DeviceSetResponder {
701 fn drop(&mut self) {
702 self.control_handle.shutdown();
703 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
705 }
706}
707
708impl fidl::endpoints::Responder for DeviceSetResponder {
709 type ControlHandle = DeviceControlHandle;
710
711 fn control_handle(&self) -> &DeviceControlHandle {
712 &self.control_handle
713 }
714
715 fn drop_without_shutdown(mut self) {
716 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
718 std::mem::forget(self);
720 }
721}
722
723impl DeviceSetResponder {
724 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
728 let _result = self.send_raw(status);
729 if _result.is_err() {
730 self.control_handle.shutdown();
731 }
732 self.drop_without_shutdown();
733 _result
734 }
735
736 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
738 let _result = self.send_raw(status);
739 self.drop_without_shutdown();
740 _result
741 }
742
743 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
744 self.control_handle.inner.send::<fidl::encoding::FlexibleType<DeviceSetResponse>>(
745 fidl::encoding::Flexible::new((status,)),
746 self.tx_id,
747 0x5ff1bca8b571d820,
748 fidl::encoding::DynamicFlags::FLEXIBLE,
749 )
750 }
751}
752
753#[must_use = "FIDL methods require a response to be sent"]
754#[derive(Debug)]
755pub struct DeviceSet2Responder {
756 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
757 tx_id: u32,
758}
759
760impl std::ops::Drop for DeviceSet2Responder {
764 fn drop(&mut self) {
765 self.control_handle.shutdown();
766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
768 }
769}
770
771impl fidl::endpoints::Responder for DeviceSet2Responder {
772 type ControlHandle = DeviceControlHandle;
773
774 fn control_handle(&self) -> &DeviceControlHandle {
775 &self.control_handle
776 }
777
778 fn drop_without_shutdown(mut self) {
779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
781 std::mem::forget(self);
783 }
784}
785
786impl DeviceSet2Responder {
787 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
791 let _result = self.send_raw(result);
792 if _result.is_err() {
793 self.control_handle.shutdown();
794 }
795 self.drop_without_shutdown();
796 _result
797 }
798
799 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
801 let _result = self.send_raw(result);
802 self.drop_without_shutdown();
803 _result
804 }
805
806 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
807 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
808 fidl::encoding::EmptyStruct,
809 i32,
810 >>(
811 fidl::encoding::FlexibleResult::new(result),
812 self.tx_id,
813 0x16698df780253ae5,
814 fidl::encoding::DynamicFlags::FLEXIBLE,
815 )
816 }
817}
818
819#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
820pub struct ServiceMarker;
821
822#[cfg(target_os = "fuchsia")]
823impl fidl::endpoints::ServiceMarker for ServiceMarker {
824 type Proxy = ServiceProxy;
825 type Request = ServiceRequest;
826 const SERVICE_NAME: &'static str = "fuchsia.hardware.rtc.Service";
827}
828
829#[cfg(target_os = "fuchsia")]
832pub enum ServiceRequest {
833 Device(DeviceRequestStream),
834}
835
836#[cfg(target_os = "fuchsia")]
837impl fidl::endpoints::ServiceRequest for ServiceRequest {
838 type Service = ServiceMarker;
839
840 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
841 match name {
842 "device" => Self::Device(
843 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
844 ),
845 _ => panic!("no such member protocol name for service Service"),
846 }
847 }
848
849 fn member_names() -> &'static [&'static str] {
850 &["device"]
851 }
852}
853#[cfg(target_os = "fuchsia")]
854pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
855
856#[cfg(target_os = "fuchsia")]
857impl fidl::endpoints::ServiceProxy for ServiceProxy {
858 type Service = ServiceMarker;
859
860 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
861 Self(opener)
862 }
863}
864
865#[cfg(target_os = "fuchsia")]
866impl ServiceProxy {
867 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
868 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
869 self.connect_channel_to_device(server_end)?;
870 Ok(proxy)
871 }
872
873 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
876 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
877 self.connect_channel_to_device(server_end)?;
878 Ok(proxy)
879 }
880
881 pub fn connect_channel_to_device(
884 &self,
885 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
886 ) -> Result<(), fidl::Error> {
887 self.0.open_member("device", server_end.into_channel())
888 }
889
890 pub fn instance_name(&self) -> &str {
891 self.0.instance_name()
892 }
893}
894
895mod internal {
896 use super::*;
897}