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_suspend_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct SuspenderMarker;
16
17impl fidl::endpoints::ProtocolMarker for SuspenderMarker {
18 type Proxy = SuspenderProxy;
19 type RequestStream = SuspenderRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = SuspenderSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) Suspender";
24}
25pub type SuspenderGetSuspendStatesResult = Result<SuspenderGetSuspendStatesResponse, i32>;
26pub type SuspenderSuspendResult = Result<SuspenderSuspendResponse, i32>;
27
28pub trait SuspenderProxyInterface: Send + Sync {
29 type GetSuspendStatesResponseFut: std::future::Future<Output = Result<SuspenderGetSuspendStatesResult, fidl::Error>>
30 + Send;
31 fn r#get_suspend_states(&self) -> Self::GetSuspendStatesResponseFut;
32 type SuspendResponseFut: std::future::Future<Output = Result<SuspenderSuspendResult, fidl::Error>>
33 + Send;
34 fn r#suspend(&self, payload: &SuspenderSuspendRequest) -> Self::SuspendResponseFut;
35}
36#[derive(Debug)]
37#[cfg(target_os = "fuchsia")]
38pub struct SuspenderSynchronousProxy {
39 client: fidl::client::sync::Client,
40}
41
42#[cfg(target_os = "fuchsia")]
43impl fidl::endpoints::SynchronousProxy for SuspenderSynchronousProxy {
44 type Proxy = SuspenderProxy;
45 type Protocol = SuspenderMarker;
46
47 fn from_channel(inner: fidl::Channel) -> Self {
48 Self::new(inner)
49 }
50
51 fn into_channel(self) -> fidl::Channel {
52 self.client.into_channel()
53 }
54
55 fn as_channel(&self) -> &fidl::Channel {
56 self.client.as_channel()
57 }
58}
59
60#[cfg(target_os = "fuchsia")]
61impl SuspenderSynchronousProxy {
62 pub fn new(channel: fidl::Channel) -> Self {
63 let protocol_name = <SuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
64 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
65 }
66
67 pub fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 pub fn wait_for_event(
74 &self,
75 deadline: zx::MonotonicInstant,
76 ) -> Result<SuspenderEvent, fidl::Error> {
77 SuspenderEvent::decode(self.client.wait_for_event(deadline)?)
78 }
79
80 pub fn r#get_suspend_states(
89 &self,
90 ___deadline: zx::MonotonicInstant,
91 ) -> Result<SuspenderGetSuspendStatesResult, fidl::Error> {
92 let _response = self.client.send_query::<
93 fidl::encoding::EmptyPayload,
94 fidl::encoding::FlexibleResultType<SuspenderGetSuspendStatesResponse, i32>,
95 >(
96 (),
97 0x13651a60bd368170,
98 fidl::encoding::DynamicFlags::FLEXIBLE,
99 ___deadline,
100 )?
101 .into_result::<SuspenderMarker>("get_suspend_states")?;
102 Ok(_response.map(|x| x))
103 }
104
105 pub fn r#suspend(
112 &self,
113 mut payload: &SuspenderSuspendRequest,
114 ___deadline: zx::MonotonicInstant,
115 ) -> Result<SuspenderSuspendResult, fidl::Error> {
116 let _response = self.client.send_query::<
117 SuspenderSuspendRequest,
118 fidl::encoding::FlexibleResultType<SuspenderSuspendResponse, i32>,
119 >(
120 payload,
121 0x657d4d76beacad40,
122 fidl::encoding::DynamicFlags::FLEXIBLE,
123 ___deadline,
124 )?
125 .into_result::<SuspenderMarker>("suspend")?;
126 Ok(_response.map(|x| x))
127 }
128}
129
130#[cfg(target_os = "fuchsia")]
131impl From<SuspenderSynchronousProxy> for zx::Handle {
132 fn from(value: SuspenderSynchronousProxy) -> Self {
133 value.into_channel().into()
134 }
135}
136
137#[cfg(target_os = "fuchsia")]
138impl From<fidl::Channel> for SuspenderSynchronousProxy {
139 fn from(value: fidl::Channel) -> Self {
140 Self::new(value)
141 }
142}
143
144#[derive(Debug, Clone)]
145pub struct SuspenderProxy {
146 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
147}
148
149impl fidl::endpoints::Proxy for SuspenderProxy {
150 type Protocol = SuspenderMarker;
151
152 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
153 Self::new(inner)
154 }
155
156 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
157 self.client.into_channel().map_err(|client| Self { client })
158 }
159
160 fn as_channel(&self) -> &::fidl::AsyncChannel {
161 self.client.as_channel()
162 }
163}
164
165impl SuspenderProxy {
166 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
168 let protocol_name = <SuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169 Self { client: fidl::client::Client::new(channel, protocol_name) }
170 }
171
172 pub fn take_event_stream(&self) -> SuspenderEventStream {
178 SuspenderEventStream { event_receiver: self.client.take_event_receiver() }
179 }
180
181 pub fn r#get_suspend_states(
190 &self,
191 ) -> fidl::client::QueryResponseFut<
192 SuspenderGetSuspendStatesResult,
193 fidl::encoding::DefaultFuchsiaResourceDialect,
194 > {
195 SuspenderProxyInterface::r#get_suspend_states(self)
196 }
197
198 pub fn r#suspend(
205 &self,
206 mut payload: &SuspenderSuspendRequest,
207 ) -> fidl::client::QueryResponseFut<
208 SuspenderSuspendResult,
209 fidl::encoding::DefaultFuchsiaResourceDialect,
210 > {
211 SuspenderProxyInterface::r#suspend(self, payload)
212 }
213}
214
215impl SuspenderProxyInterface for SuspenderProxy {
216 type GetSuspendStatesResponseFut = fidl::client::QueryResponseFut<
217 SuspenderGetSuspendStatesResult,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 >;
220 fn r#get_suspend_states(&self) -> Self::GetSuspendStatesResponseFut {
221 fn _decode(
222 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
223 ) -> Result<SuspenderGetSuspendStatesResult, fidl::Error> {
224 let _response = fidl::client::decode_transaction_body::<
225 fidl::encoding::FlexibleResultType<SuspenderGetSuspendStatesResponse, i32>,
226 fidl::encoding::DefaultFuchsiaResourceDialect,
227 0x13651a60bd368170,
228 >(_buf?)?
229 .into_result::<SuspenderMarker>("get_suspend_states")?;
230 Ok(_response.map(|x| x))
231 }
232 self.client
233 .send_query_and_decode::<fidl::encoding::EmptyPayload, SuspenderGetSuspendStatesResult>(
234 (),
235 0x13651a60bd368170,
236 fidl::encoding::DynamicFlags::FLEXIBLE,
237 _decode,
238 )
239 }
240
241 type SuspendResponseFut = fidl::client::QueryResponseFut<
242 SuspenderSuspendResult,
243 fidl::encoding::DefaultFuchsiaResourceDialect,
244 >;
245 fn r#suspend(&self, mut payload: &SuspenderSuspendRequest) -> Self::SuspendResponseFut {
246 fn _decode(
247 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
248 ) -> Result<SuspenderSuspendResult, fidl::Error> {
249 let _response = fidl::client::decode_transaction_body::<
250 fidl::encoding::FlexibleResultType<SuspenderSuspendResponse, i32>,
251 fidl::encoding::DefaultFuchsiaResourceDialect,
252 0x657d4d76beacad40,
253 >(_buf?)?
254 .into_result::<SuspenderMarker>("suspend")?;
255 Ok(_response.map(|x| x))
256 }
257 self.client.send_query_and_decode::<SuspenderSuspendRequest, SuspenderSuspendResult>(
258 payload,
259 0x657d4d76beacad40,
260 fidl::encoding::DynamicFlags::FLEXIBLE,
261 _decode,
262 )
263 }
264}
265
266pub struct SuspenderEventStream {
267 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
268}
269
270impl std::marker::Unpin for SuspenderEventStream {}
271
272impl futures::stream::FusedStream for SuspenderEventStream {
273 fn is_terminated(&self) -> bool {
274 self.event_receiver.is_terminated()
275 }
276}
277
278impl futures::Stream for SuspenderEventStream {
279 type Item = Result<SuspenderEvent, fidl::Error>;
280
281 fn poll_next(
282 mut self: std::pin::Pin<&mut Self>,
283 cx: &mut std::task::Context<'_>,
284 ) -> std::task::Poll<Option<Self::Item>> {
285 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
286 &mut self.event_receiver,
287 cx
288 )?) {
289 Some(buf) => std::task::Poll::Ready(Some(SuspenderEvent::decode(buf))),
290 None => std::task::Poll::Ready(None),
291 }
292 }
293}
294
295#[derive(Debug)]
296pub enum SuspenderEvent {
297 #[non_exhaustive]
298 _UnknownEvent {
299 ordinal: u64,
301 },
302}
303
304impl SuspenderEvent {
305 fn decode(
307 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
308 ) -> Result<SuspenderEvent, fidl::Error> {
309 let (bytes, _handles) = buf.split_mut();
310 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
311 debug_assert_eq!(tx_header.tx_id, 0);
312 match tx_header.ordinal {
313 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
314 Ok(SuspenderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
315 }
316 _ => Err(fidl::Error::UnknownOrdinal {
317 ordinal: tx_header.ordinal,
318 protocol_name: <SuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
319 }),
320 }
321 }
322}
323
324pub struct SuspenderRequestStream {
326 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
327 is_terminated: bool,
328}
329
330impl std::marker::Unpin for SuspenderRequestStream {}
331
332impl futures::stream::FusedStream for SuspenderRequestStream {
333 fn is_terminated(&self) -> bool {
334 self.is_terminated
335 }
336}
337
338impl fidl::endpoints::RequestStream for SuspenderRequestStream {
339 type Protocol = SuspenderMarker;
340 type ControlHandle = SuspenderControlHandle;
341
342 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
343 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
344 }
345
346 fn control_handle(&self) -> Self::ControlHandle {
347 SuspenderControlHandle { inner: self.inner.clone() }
348 }
349
350 fn into_inner(
351 self,
352 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
353 {
354 (self.inner, self.is_terminated)
355 }
356
357 fn from_inner(
358 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
359 is_terminated: bool,
360 ) -> Self {
361 Self { inner, is_terminated }
362 }
363}
364
365impl futures::Stream for SuspenderRequestStream {
366 type Item = Result<SuspenderRequest, fidl::Error>;
367
368 fn poll_next(
369 mut self: std::pin::Pin<&mut Self>,
370 cx: &mut std::task::Context<'_>,
371 ) -> std::task::Poll<Option<Self::Item>> {
372 let this = &mut *self;
373 if this.inner.check_shutdown(cx) {
374 this.is_terminated = true;
375 return std::task::Poll::Ready(None);
376 }
377 if this.is_terminated {
378 panic!("polled SuspenderRequestStream after completion");
379 }
380 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
381 |bytes, handles| {
382 match this.inner.channel().read_etc(cx, bytes, handles) {
383 std::task::Poll::Ready(Ok(())) => {}
384 std::task::Poll::Pending => return std::task::Poll::Pending,
385 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
386 this.is_terminated = true;
387 return std::task::Poll::Ready(None);
388 }
389 std::task::Poll::Ready(Err(e)) => {
390 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
391 e.into(),
392 ))))
393 }
394 }
395
396 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
398
399 std::task::Poll::Ready(Some(match header.ordinal {
400 0x13651a60bd368170 => {
401 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
402 let mut req = fidl::new_empty!(
403 fidl::encoding::EmptyPayload,
404 fidl::encoding::DefaultFuchsiaResourceDialect
405 );
406 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
407 let control_handle = SuspenderControlHandle { inner: this.inner.clone() };
408 Ok(SuspenderRequest::GetSuspendStates {
409 responder: SuspenderGetSuspendStatesResponder {
410 control_handle: std::mem::ManuallyDrop::new(control_handle),
411 tx_id: header.tx_id,
412 },
413 })
414 }
415 0x657d4d76beacad40 => {
416 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
417 let mut req = fidl::new_empty!(
418 SuspenderSuspendRequest,
419 fidl::encoding::DefaultFuchsiaResourceDialect
420 );
421 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SuspenderSuspendRequest>(&header, _body_bytes, handles, &mut req)?;
422 let control_handle = SuspenderControlHandle { inner: this.inner.clone() };
423 Ok(SuspenderRequest::Suspend {
424 payload: req,
425 responder: SuspenderSuspendResponder {
426 control_handle: std::mem::ManuallyDrop::new(control_handle),
427 tx_id: header.tx_id,
428 },
429 })
430 }
431 _ if header.tx_id == 0
432 && header
433 .dynamic_flags()
434 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
435 {
436 Ok(SuspenderRequest::_UnknownMethod {
437 ordinal: header.ordinal,
438 control_handle: SuspenderControlHandle { inner: this.inner.clone() },
439 method_type: fidl::MethodType::OneWay,
440 })
441 }
442 _ if header
443 .dynamic_flags()
444 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
445 {
446 this.inner.send_framework_err(
447 fidl::encoding::FrameworkErr::UnknownMethod,
448 header.tx_id,
449 header.ordinal,
450 header.dynamic_flags(),
451 (bytes, handles),
452 )?;
453 Ok(SuspenderRequest::_UnknownMethod {
454 ordinal: header.ordinal,
455 control_handle: SuspenderControlHandle { inner: this.inner.clone() },
456 method_type: fidl::MethodType::TwoWay,
457 })
458 }
459 _ => Err(fidl::Error::UnknownOrdinal {
460 ordinal: header.ordinal,
461 protocol_name:
462 <SuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
463 }),
464 }))
465 },
466 )
467 }
468}
469
470#[derive(Debug)]
471pub enum SuspenderRequest {
472 GetSuspendStates { responder: SuspenderGetSuspendStatesResponder },
481 Suspend { payload: SuspenderSuspendRequest, responder: SuspenderSuspendResponder },
488 #[non_exhaustive]
490 _UnknownMethod {
491 ordinal: u64,
493 control_handle: SuspenderControlHandle,
494 method_type: fidl::MethodType,
495 },
496}
497
498impl SuspenderRequest {
499 #[allow(irrefutable_let_patterns)]
500 pub fn into_get_suspend_states(self) -> Option<(SuspenderGetSuspendStatesResponder)> {
501 if let SuspenderRequest::GetSuspendStates { responder } = self {
502 Some((responder))
503 } else {
504 None
505 }
506 }
507
508 #[allow(irrefutable_let_patterns)]
509 pub fn into_suspend(self) -> Option<(SuspenderSuspendRequest, SuspenderSuspendResponder)> {
510 if let SuspenderRequest::Suspend { payload, responder } = self {
511 Some((payload, responder))
512 } else {
513 None
514 }
515 }
516
517 pub fn method_name(&self) -> &'static str {
519 match *self {
520 SuspenderRequest::GetSuspendStates { .. } => "get_suspend_states",
521 SuspenderRequest::Suspend { .. } => "suspend",
522 SuspenderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
523 "unknown one-way method"
524 }
525 SuspenderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
526 "unknown two-way method"
527 }
528 }
529 }
530}
531
532#[derive(Debug, Clone)]
533pub struct SuspenderControlHandle {
534 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
535}
536
537impl fidl::endpoints::ControlHandle for SuspenderControlHandle {
538 fn shutdown(&self) {
539 self.inner.shutdown()
540 }
541 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
542 self.inner.shutdown_with_epitaph(status)
543 }
544
545 fn is_closed(&self) -> bool {
546 self.inner.channel().is_closed()
547 }
548 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
549 self.inner.channel().on_closed()
550 }
551
552 #[cfg(target_os = "fuchsia")]
553 fn signal_peer(
554 &self,
555 clear_mask: zx::Signals,
556 set_mask: zx::Signals,
557 ) -> Result<(), zx_status::Status> {
558 use fidl::Peered;
559 self.inner.channel().signal_peer(clear_mask, set_mask)
560 }
561}
562
563impl SuspenderControlHandle {}
564
565#[must_use = "FIDL methods require a response to be sent"]
566#[derive(Debug)]
567pub struct SuspenderGetSuspendStatesResponder {
568 control_handle: std::mem::ManuallyDrop<SuspenderControlHandle>,
569 tx_id: u32,
570}
571
572impl std::ops::Drop for SuspenderGetSuspendStatesResponder {
576 fn drop(&mut self) {
577 self.control_handle.shutdown();
578 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
580 }
581}
582
583impl fidl::endpoints::Responder for SuspenderGetSuspendStatesResponder {
584 type ControlHandle = SuspenderControlHandle;
585
586 fn control_handle(&self) -> &SuspenderControlHandle {
587 &self.control_handle
588 }
589
590 fn drop_without_shutdown(mut self) {
591 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
593 std::mem::forget(self);
595 }
596}
597
598impl SuspenderGetSuspendStatesResponder {
599 pub fn send(
603 self,
604 mut result: Result<&SuspenderGetSuspendStatesResponse, i32>,
605 ) -> Result<(), fidl::Error> {
606 let _result = self.send_raw(result);
607 if _result.is_err() {
608 self.control_handle.shutdown();
609 }
610 self.drop_without_shutdown();
611 _result
612 }
613
614 pub fn send_no_shutdown_on_err(
616 self,
617 mut result: Result<&SuspenderGetSuspendStatesResponse, i32>,
618 ) -> Result<(), fidl::Error> {
619 let _result = self.send_raw(result);
620 self.drop_without_shutdown();
621 _result
622 }
623
624 fn send_raw(
625 &self,
626 mut result: Result<&SuspenderGetSuspendStatesResponse, i32>,
627 ) -> Result<(), fidl::Error> {
628 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
629 SuspenderGetSuspendStatesResponse,
630 i32,
631 >>(
632 fidl::encoding::FlexibleResult::new(result),
633 self.tx_id,
634 0x13651a60bd368170,
635 fidl::encoding::DynamicFlags::FLEXIBLE,
636 )
637 }
638}
639
640#[must_use = "FIDL methods require a response to be sent"]
641#[derive(Debug)]
642pub struct SuspenderSuspendResponder {
643 control_handle: std::mem::ManuallyDrop<SuspenderControlHandle>,
644 tx_id: u32,
645}
646
647impl std::ops::Drop for SuspenderSuspendResponder {
651 fn drop(&mut self) {
652 self.control_handle.shutdown();
653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
655 }
656}
657
658impl fidl::endpoints::Responder for SuspenderSuspendResponder {
659 type ControlHandle = SuspenderControlHandle;
660
661 fn control_handle(&self) -> &SuspenderControlHandle {
662 &self.control_handle
663 }
664
665 fn drop_without_shutdown(mut self) {
666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
668 std::mem::forget(self);
670 }
671}
672
673impl SuspenderSuspendResponder {
674 pub fn send(
678 self,
679 mut result: Result<&SuspenderSuspendResponse, i32>,
680 ) -> Result<(), fidl::Error> {
681 let _result = self.send_raw(result);
682 if _result.is_err() {
683 self.control_handle.shutdown();
684 }
685 self.drop_without_shutdown();
686 _result
687 }
688
689 pub fn send_no_shutdown_on_err(
691 self,
692 mut result: Result<&SuspenderSuspendResponse, i32>,
693 ) -> Result<(), fidl::Error> {
694 let _result = self.send_raw(result);
695 self.drop_without_shutdown();
696 _result
697 }
698
699 fn send_raw(
700 &self,
701 mut result: Result<&SuspenderSuspendResponse, i32>,
702 ) -> Result<(), fidl::Error> {
703 self.control_handle
704 .inner
705 .send::<fidl::encoding::FlexibleResultType<SuspenderSuspendResponse, i32>>(
706 fidl::encoding::FlexibleResult::new(result),
707 self.tx_id,
708 0x657d4d76beacad40,
709 fidl::encoding::DynamicFlags::FLEXIBLE,
710 )
711 }
712}
713
714#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
715pub struct SuspendServiceMarker;
716
717#[cfg(target_os = "fuchsia")]
718impl fidl::endpoints::ServiceMarker for SuspendServiceMarker {
719 type Proxy = SuspendServiceProxy;
720 type Request = SuspendServiceRequest;
721 const SERVICE_NAME: &'static str = "fuchsia.hardware.suspend.SuspendService";
722}
723
724#[cfg(target_os = "fuchsia")]
727pub enum SuspendServiceRequest {
728 Suspender(SuspenderRequestStream),
729}
730
731#[cfg(target_os = "fuchsia")]
732impl fidl::endpoints::ServiceRequest for SuspendServiceRequest {
733 type Service = SuspendServiceMarker;
734
735 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
736 match name {
737 "suspender" => Self::Suspender(
738 <SuspenderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
739 ),
740 _ => panic!("no such member protocol name for service SuspendService"),
741 }
742 }
743
744 fn member_names() -> &'static [&'static str] {
745 &["suspender"]
746 }
747}
748#[cfg(target_os = "fuchsia")]
749pub struct SuspendServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
750
751#[cfg(target_os = "fuchsia")]
752impl fidl::endpoints::ServiceProxy for SuspendServiceProxy {
753 type Service = SuspendServiceMarker;
754
755 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
756 Self(opener)
757 }
758}
759
760#[cfg(target_os = "fuchsia")]
761impl SuspendServiceProxy {
762 pub fn connect_to_suspender(&self) -> Result<SuspenderProxy, fidl::Error> {
763 let (proxy, server_end) = fidl::endpoints::create_proxy::<SuspenderMarker>();
764 self.connect_channel_to_suspender(server_end)?;
765 Ok(proxy)
766 }
767
768 pub fn connect_to_suspender_sync(&self) -> Result<SuspenderSynchronousProxy, fidl::Error> {
771 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<SuspenderMarker>();
772 self.connect_channel_to_suspender(server_end)?;
773 Ok(proxy)
774 }
775
776 pub fn connect_channel_to_suspender(
779 &self,
780 server_end: fidl::endpoints::ServerEnd<SuspenderMarker>,
781 ) -> Result<(), fidl::Error> {
782 self.0.open_member("suspender", server_end.into_channel())
783 }
784
785 pub fn instance_name(&self) -> &str {
786 self.0.instance_name()
787 }
788}
789
790mod internal {
791 use super::*;
792}