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