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#[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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
600 self.inner.shutdown_with_epitaph(status)
601 }
602
603 fn is_closed(&self) -> bool {
604 self.inner.channel().is_closed()
605 }
606 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
607 self.inner.channel().on_closed()
608 }
609
610 #[cfg(target_os = "fuchsia")]
611 fn signal_peer(
612 &self,
613 clear_mask: zx::Signals,
614 set_mask: zx::Signals,
615 ) -> Result<(), zx_status::Status> {
616 use fidl::Peered;
617 self.inner.channel().signal_peer(clear_mask, set_mask)
618 }
619}
620
621impl DeviceControlHandle {}
622
623#[must_use = "FIDL methods require a response to be sent"]
624#[derive(Debug)]
625pub struct DeviceGetResponder {
626 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
627 tx_id: u32,
628}
629
630impl std::ops::Drop for DeviceGetResponder {
634 fn drop(&mut self) {
635 self.control_handle.shutdown();
636 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
638 }
639}
640
641impl fidl::endpoints::Responder for DeviceGetResponder {
642 type ControlHandle = DeviceControlHandle;
643
644 fn control_handle(&self) -> &DeviceControlHandle {
645 &self.control_handle
646 }
647
648 fn drop_without_shutdown(mut self) {
649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
651 std::mem::forget(self);
653 }
654}
655
656impl DeviceGetResponder {
657 pub fn send(self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
661 let _result = self.send_raw(result);
662 if _result.is_err() {
663 self.control_handle.shutdown();
664 }
665 self.drop_without_shutdown();
666 _result
667 }
668
669 pub fn send_no_shutdown_on_err(
671 self,
672 mut result: Result<&Time, i32>,
673 ) -> Result<(), fidl::Error> {
674 let _result = self.send_raw(result);
675 self.drop_without_shutdown();
676 _result
677 }
678
679 fn send_raw(&self, mut result: Result<&Time, i32>) -> Result<(), fidl::Error> {
680 self.control_handle
681 .inner
682 .send::<fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>>(
683 fidl::encoding::FlexibleResult::new(result.map(|rtc| (rtc,))),
684 self.tx_id,
685 0x27fdad10b3816ff4,
686 fidl::encoding::DynamicFlags::FLEXIBLE,
687 )
688 }
689}
690
691#[must_use = "FIDL methods require a response to be sent"]
692#[derive(Debug)]
693pub struct DeviceSetResponder {
694 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
695 tx_id: u32,
696}
697
698impl std::ops::Drop for DeviceSetResponder {
702 fn drop(&mut self) {
703 self.control_handle.shutdown();
704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
706 }
707}
708
709impl fidl::endpoints::Responder for DeviceSetResponder {
710 type ControlHandle = DeviceControlHandle;
711
712 fn control_handle(&self) -> &DeviceControlHandle {
713 &self.control_handle
714 }
715
716 fn drop_without_shutdown(mut self) {
717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
719 std::mem::forget(self);
721 }
722}
723
724impl DeviceSetResponder {
725 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
729 let _result = self.send_raw(status);
730 if _result.is_err() {
731 self.control_handle.shutdown();
732 }
733 self.drop_without_shutdown();
734 _result
735 }
736
737 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
739 let _result = self.send_raw(status);
740 self.drop_without_shutdown();
741 _result
742 }
743
744 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
745 self.control_handle.inner.send::<fidl::encoding::FlexibleType<DeviceSetResponse>>(
746 fidl::encoding::Flexible::new((status,)),
747 self.tx_id,
748 0x5ff1bca8b571d820,
749 fidl::encoding::DynamicFlags::FLEXIBLE,
750 )
751 }
752}
753
754#[must_use = "FIDL methods require a response to be sent"]
755#[derive(Debug)]
756pub struct DeviceSet2Responder {
757 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
758 tx_id: u32,
759}
760
761impl std::ops::Drop for DeviceSet2Responder {
765 fn drop(&mut self) {
766 self.control_handle.shutdown();
767 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
769 }
770}
771
772impl fidl::endpoints::Responder for DeviceSet2Responder {
773 type ControlHandle = DeviceControlHandle;
774
775 fn control_handle(&self) -> &DeviceControlHandle {
776 &self.control_handle
777 }
778
779 fn drop_without_shutdown(mut self) {
780 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
782 std::mem::forget(self);
784 }
785}
786
787impl DeviceSet2Responder {
788 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
792 let _result = self.send_raw(result);
793 if _result.is_err() {
794 self.control_handle.shutdown();
795 }
796 self.drop_without_shutdown();
797 _result
798 }
799
800 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
802 let _result = self.send_raw(result);
803 self.drop_without_shutdown();
804 _result
805 }
806
807 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
808 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
809 fidl::encoding::EmptyStruct,
810 i32,
811 >>(
812 fidl::encoding::FlexibleResult::new(result),
813 self.tx_id,
814 0x16698df780253ae5,
815 fidl::encoding::DynamicFlags::FLEXIBLE,
816 )
817 }
818}
819
820#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
821pub struct ServiceMarker;
822
823#[cfg(target_os = "fuchsia")]
824impl fidl::endpoints::ServiceMarker for ServiceMarker {
825 type Proxy = ServiceProxy;
826 type Request = ServiceRequest;
827 const SERVICE_NAME: &'static str = "fuchsia.hardware.rtc.Service";
828}
829
830#[cfg(target_os = "fuchsia")]
833pub enum ServiceRequest {
834 Device(DeviceRequestStream),
835}
836
837#[cfg(target_os = "fuchsia")]
838impl fidl::endpoints::ServiceRequest for ServiceRequest {
839 type Service = ServiceMarker;
840
841 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
842 match name {
843 "device" => Self::Device(
844 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
845 ),
846 _ => panic!("no such member protocol name for service Service"),
847 }
848 }
849
850 fn member_names() -> &'static [&'static str] {
851 &["device"]
852 }
853}
854#[cfg(target_os = "fuchsia")]
855pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
856
857#[cfg(target_os = "fuchsia")]
858impl fidl::endpoints::ServiceProxy for ServiceProxy {
859 type Service = ServiceMarker;
860
861 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
862 Self(opener)
863 }
864}
865
866#[cfg(target_os = "fuchsia")]
867impl ServiceProxy {
868 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
869 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
870 self.connect_channel_to_device(server_end)?;
871 Ok(proxy)
872 }
873
874 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
877 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
878 self.connect_channel_to_device(server_end)?;
879 Ok(proxy)
880 }
881
882 pub fn connect_channel_to_device(
885 &self,
886 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
887 ) -> Result<(), fidl::Error> {
888 self.0.open_member("device", server_end.into_channel())
889 }
890
891 pub fn instance_name(&self) -> &str {
892 self.0.instance_name()
893 }
894}
895
896mod internal {
897 use super::*;
898}