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_test_suspendcontrol_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 = "test.suspendcontrol.Device";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
26pub type DeviceSetSuspendStatesResult = Result<(), i32>;
27pub type DeviceAwaitSuspendResult = Result<DeviceAwaitSuspendResponse, i32>;
28pub type DeviceResumeResult = Result<(), i32>;
29
30pub trait DeviceProxyInterface: Send + Sync {
31 type SetSuspendStatesResponseFut: std::future::Future<Output = Result<DeviceSetSuspendStatesResult, fidl::Error>>
32 + Send;
33 fn r#set_suspend_states(
34 &self,
35 payload: &DeviceSetSuspendStatesRequest,
36 ) -> Self::SetSuspendStatesResponseFut;
37 type AwaitSuspendResponseFut: std::future::Future<Output = Result<DeviceAwaitSuspendResult, fidl::Error>>
38 + Send;
39 fn r#await_suspend(&self) -> Self::AwaitSuspendResponseFut;
40 type ResumeResponseFut: std::future::Future<Output = Result<DeviceResumeResult, fidl::Error>>
41 + Send;
42 fn r#resume(&self, payload: &DeviceResumeRequest) -> Self::ResumeResponseFut;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct DeviceSynchronousProxy {
47 client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
52 type Proxy = DeviceProxy;
53 type Protocol = DeviceMarker;
54
55 fn from_channel(inner: fidl::Channel) -> Self {
56 Self::new(inner)
57 }
58
59 fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 fn as_channel(&self) -> &fidl::Channel {
64 self.client.as_channel()
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl DeviceSynchronousProxy {
70 pub fn new(channel: fidl::Channel) -> Self {
71 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
72 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
73 }
74
75 pub fn into_channel(self) -> fidl::Channel {
76 self.client.into_channel()
77 }
78
79 pub fn wait_for_event(
82 &self,
83 deadline: zx::MonotonicInstant,
84 ) -> Result<DeviceEvent, fidl::Error> {
85 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
86 }
87
88 pub fn r#set_suspend_states(
89 &self,
90 mut payload: &DeviceSetSuspendStatesRequest,
91 ___deadline: zx::MonotonicInstant,
92 ) -> Result<DeviceSetSuspendStatesResult, fidl::Error> {
93 let _response = self.client.send_query::<
94 DeviceSetSuspendStatesRequest,
95 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
96 >(
97 payload,
98 0x3d37a51c2955e852,
99 fidl::encoding::DynamicFlags::empty(),
100 ___deadline,
101 )?;
102 Ok(_response.map(|x| x))
103 }
104
105 pub fn r#await_suspend(
106 &self,
107 ___deadline: zx::MonotonicInstant,
108 ) -> Result<DeviceAwaitSuspendResult, fidl::Error> {
109 let _response = self.client.send_query::<
110 fidl::encoding::EmptyPayload,
111 fidl::encoding::ResultType<DeviceAwaitSuspendResponse, i32>,
112 >(
113 (),
114 0x7eb0d662063b347e,
115 fidl::encoding::DynamicFlags::empty(),
116 ___deadline,
117 )?;
118 Ok(_response.map(|x| x))
119 }
120
121 pub fn r#resume(
122 &self,
123 mut payload: &DeviceResumeRequest,
124 ___deadline: zx::MonotonicInstant,
125 ) -> Result<DeviceResumeResult, fidl::Error> {
126 let _response = self.client.send_query::<
127 DeviceResumeRequest,
128 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
129 >(
130 payload,
131 0x2deb813cfe9b881e,
132 fidl::encoding::DynamicFlags::empty(),
133 ___deadline,
134 )?;
135 Ok(_response.map(|x| x))
136 }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<DeviceSynchronousProxy> for zx::Handle {
141 fn from(value: DeviceSynchronousProxy) -> Self {
142 value.into_channel().into()
143 }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<fidl::Channel> for DeviceSynchronousProxy {
148 fn from(value: fidl::Channel) -> Self {
149 Self::new(value)
150 }
151}
152
153#[derive(Debug, Clone)]
154pub struct DeviceProxy {
155 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
156}
157
158impl fidl::endpoints::Proxy for DeviceProxy {
159 type Protocol = DeviceMarker;
160
161 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
162 Self::new(inner)
163 }
164
165 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
166 self.client.into_channel().map_err(|client| Self { client })
167 }
168
169 fn as_channel(&self) -> &::fidl::AsyncChannel {
170 self.client.as_channel()
171 }
172}
173
174impl DeviceProxy {
175 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
177 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
178 Self { client: fidl::client::Client::new(channel, protocol_name) }
179 }
180
181 pub fn take_event_stream(&self) -> DeviceEventStream {
187 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
188 }
189
190 pub fn r#set_suspend_states(
191 &self,
192 mut payload: &DeviceSetSuspendStatesRequest,
193 ) -> fidl::client::QueryResponseFut<
194 DeviceSetSuspendStatesResult,
195 fidl::encoding::DefaultFuchsiaResourceDialect,
196 > {
197 DeviceProxyInterface::r#set_suspend_states(self, payload)
198 }
199
200 pub fn r#await_suspend(
201 &self,
202 ) -> fidl::client::QueryResponseFut<
203 DeviceAwaitSuspendResult,
204 fidl::encoding::DefaultFuchsiaResourceDialect,
205 > {
206 DeviceProxyInterface::r#await_suspend(self)
207 }
208
209 pub fn r#resume(
210 &self,
211 mut payload: &DeviceResumeRequest,
212 ) -> fidl::client::QueryResponseFut<
213 DeviceResumeResult,
214 fidl::encoding::DefaultFuchsiaResourceDialect,
215 > {
216 DeviceProxyInterface::r#resume(self, payload)
217 }
218}
219
220impl DeviceProxyInterface for DeviceProxy {
221 type SetSuspendStatesResponseFut = fidl::client::QueryResponseFut<
222 DeviceSetSuspendStatesResult,
223 fidl::encoding::DefaultFuchsiaResourceDialect,
224 >;
225 fn r#set_suspend_states(
226 &self,
227 mut payload: &DeviceSetSuspendStatesRequest,
228 ) -> Self::SetSuspendStatesResponseFut {
229 fn _decode(
230 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
231 ) -> Result<DeviceSetSuspendStatesResult, fidl::Error> {
232 let _response = fidl::client::decode_transaction_body::<
233 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
234 fidl::encoding::DefaultFuchsiaResourceDialect,
235 0x3d37a51c2955e852,
236 >(_buf?)?;
237 Ok(_response.map(|x| x))
238 }
239 self.client
240 .send_query_and_decode::<DeviceSetSuspendStatesRequest, DeviceSetSuspendStatesResult>(
241 payload,
242 0x3d37a51c2955e852,
243 fidl::encoding::DynamicFlags::empty(),
244 _decode,
245 )
246 }
247
248 type AwaitSuspendResponseFut = fidl::client::QueryResponseFut<
249 DeviceAwaitSuspendResult,
250 fidl::encoding::DefaultFuchsiaResourceDialect,
251 >;
252 fn r#await_suspend(&self) -> Self::AwaitSuspendResponseFut {
253 fn _decode(
254 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
255 ) -> Result<DeviceAwaitSuspendResult, fidl::Error> {
256 let _response = fidl::client::decode_transaction_body::<
257 fidl::encoding::ResultType<DeviceAwaitSuspendResponse, i32>,
258 fidl::encoding::DefaultFuchsiaResourceDialect,
259 0x7eb0d662063b347e,
260 >(_buf?)?;
261 Ok(_response.map(|x| x))
262 }
263 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceAwaitSuspendResult>(
264 (),
265 0x7eb0d662063b347e,
266 fidl::encoding::DynamicFlags::empty(),
267 _decode,
268 )
269 }
270
271 type ResumeResponseFut = fidl::client::QueryResponseFut<
272 DeviceResumeResult,
273 fidl::encoding::DefaultFuchsiaResourceDialect,
274 >;
275 fn r#resume(&self, mut payload: &DeviceResumeRequest) -> Self::ResumeResponseFut {
276 fn _decode(
277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
278 ) -> Result<DeviceResumeResult, fidl::Error> {
279 let _response = fidl::client::decode_transaction_body::<
280 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
281 fidl::encoding::DefaultFuchsiaResourceDialect,
282 0x2deb813cfe9b881e,
283 >(_buf?)?;
284 Ok(_response.map(|x| x))
285 }
286 self.client.send_query_and_decode::<DeviceResumeRequest, DeviceResumeResult>(
287 payload,
288 0x2deb813cfe9b881e,
289 fidl::encoding::DynamicFlags::empty(),
290 _decode,
291 )
292 }
293}
294
295pub struct DeviceEventStream {
296 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
297}
298
299impl std::marker::Unpin for DeviceEventStream {}
300
301impl futures::stream::FusedStream for DeviceEventStream {
302 fn is_terminated(&self) -> bool {
303 self.event_receiver.is_terminated()
304 }
305}
306
307impl futures::Stream for DeviceEventStream {
308 type Item = Result<DeviceEvent, fidl::Error>;
309
310 fn poll_next(
311 mut self: std::pin::Pin<&mut Self>,
312 cx: &mut std::task::Context<'_>,
313 ) -> std::task::Poll<Option<Self::Item>> {
314 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
315 &mut self.event_receiver,
316 cx
317 )?) {
318 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
319 None => std::task::Poll::Ready(None),
320 }
321 }
322}
323
324#[derive(Debug)]
325pub enum DeviceEvent {}
326
327impl DeviceEvent {
328 fn decode(
330 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
331 ) -> Result<DeviceEvent, fidl::Error> {
332 let (bytes, _handles) = buf.split_mut();
333 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
334 debug_assert_eq!(tx_header.tx_id, 0);
335 match tx_header.ordinal {
336 _ => Err(fidl::Error::UnknownOrdinal {
337 ordinal: tx_header.ordinal,
338 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
339 }),
340 }
341 }
342}
343
344pub struct DeviceRequestStream {
346 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
347 is_terminated: bool,
348}
349
350impl std::marker::Unpin for DeviceRequestStream {}
351
352impl futures::stream::FusedStream for DeviceRequestStream {
353 fn is_terminated(&self) -> bool {
354 self.is_terminated
355 }
356}
357
358impl fidl::endpoints::RequestStream for DeviceRequestStream {
359 type Protocol = DeviceMarker;
360 type ControlHandle = DeviceControlHandle;
361
362 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
363 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
364 }
365
366 fn control_handle(&self) -> Self::ControlHandle {
367 DeviceControlHandle { inner: self.inner.clone() }
368 }
369
370 fn into_inner(
371 self,
372 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
373 {
374 (self.inner, self.is_terminated)
375 }
376
377 fn from_inner(
378 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
379 is_terminated: bool,
380 ) -> Self {
381 Self { inner, is_terminated }
382 }
383}
384
385impl futures::Stream for DeviceRequestStream {
386 type Item = Result<DeviceRequest, fidl::Error>;
387
388 fn poll_next(
389 mut self: std::pin::Pin<&mut Self>,
390 cx: &mut std::task::Context<'_>,
391 ) -> std::task::Poll<Option<Self::Item>> {
392 let this = &mut *self;
393 if this.inner.check_shutdown(cx) {
394 this.is_terminated = true;
395 return std::task::Poll::Ready(None);
396 }
397 if this.is_terminated {
398 panic!("polled DeviceRequestStream after completion");
399 }
400 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
401 |bytes, handles| {
402 match this.inner.channel().read_etc(cx, bytes, handles) {
403 std::task::Poll::Ready(Ok(())) => {}
404 std::task::Poll::Pending => return std::task::Poll::Pending,
405 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
406 this.is_terminated = true;
407 return std::task::Poll::Ready(None);
408 }
409 std::task::Poll::Ready(Err(e)) => {
410 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
411 e.into(),
412 ))))
413 }
414 }
415
416 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
418
419 std::task::Poll::Ready(Some(match header.ordinal {
420 0x3d37a51c2955e852 => {
421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
422 let mut req = fidl::new_empty!(
423 DeviceSetSuspendStatesRequest,
424 fidl::encoding::DefaultFuchsiaResourceDialect
425 );
426 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetSuspendStatesRequest>(&header, _body_bytes, handles, &mut req)?;
427 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
428 Ok(DeviceRequest::SetSuspendStates {
429 payload: req,
430 responder: DeviceSetSuspendStatesResponder {
431 control_handle: std::mem::ManuallyDrop::new(control_handle),
432 tx_id: header.tx_id,
433 },
434 })
435 }
436 0x7eb0d662063b347e => {
437 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
438 let mut req = fidl::new_empty!(
439 fidl::encoding::EmptyPayload,
440 fidl::encoding::DefaultFuchsiaResourceDialect
441 );
442 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
443 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
444 Ok(DeviceRequest::AwaitSuspend {
445 responder: DeviceAwaitSuspendResponder {
446 control_handle: std::mem::ManuallyDrop::new(control_handle),
447 tx_id: header.tx_id,
448 },
449 })
450 }
451 0x2deb813cfe9b881e => {
452 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
453 let mut req = fidl::new_empty!(
454 DeviceResumeRequest,
455 fidl::encoding::DefaultFuchsiaResourceDialect
456 );
457 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceResumeRequest>(&header, _body_bytes, handles, &mut req)?;
458 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
459 Ok(DeviceRequest::Resume {
460 payload: req,
461 responder: DeviceResumeResponder {
462 control_handle: std::mem::ManuallyDrop::new(control_handle),
463 tx_id: header.tx_id,
464 },
465 })
466 }
467 _ => Err(fidl::Error::UnknownOrdinal {
468 ordinal: header.ordinal,
469 protocol_name:
470 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
471 }),
472 }))
473 },
474 )
475 }
476}
477
478#[derive(Debug)]
479pub enum DeviceRequest {
480 SetSuspendStates {
481 payload: DeviceSetSuspendStatesRequest,
482 responder: DeviceSetSuspendStatesResponder,
483 },
484 AwaitSuspend {
485 responder: DeviceAwaitSuspendResponder,
486 },
487 Resume {
488 payload: DeviceResumeRequest,
489 responder: DeviceResumeResponder,
490 },
491}
492
493impl DeviceRequest {
494 #[allow(irrefutable_let_patterns)]
495 pub fn into_set_suspend_states(
496 self,
497 ) -> Option<(DeviceSetSuspendStatesRequest, DeviceSetSuspendStatesResponder)> {
498 if let DeviceRequest::SetSuspendStates { payload, responder } = self {
499 Some((payload, responder))
500 } else {
501 None
502 }
503 }
504
505 #[allow(irrefutable_let_patterns)]
506 pub fn into_await_suspend(self) -> Option<(DeviceAwaitSuspendResponder)> {
507 if let DeviceRequest::AwaitSuspend { responder } = self {
508 Some((responder))
509 } else {
510 None
511 }
512 }
513
514 #[allow(irrefutable_let_patterns)]
515 pub fn into_resume(self) -> Option<(DeviceResumeRequest, DeviceResumeResponder)> {
516 if let DeviceRequest::Resume { payload, responder } = self {
517 Some((payload, responder))
518 } else {
519 None
520 }
521 }
522
523 pub fn method_name(&self) -> &'static str {
525 match *self {
526 DeviceRequest::SetSuspendStates { .. } => "set_suspend_states",
527 DeviceRequest::AwaitSuspend { .. } => "await_suspend",
528 DeviceRequest::Resume { .. } => "resume",
529 }
530 }
531}
532
533#[derive(Debug, Clone)]
534pub struct DeviceControlHandle {
535 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
536}
537
538impl fidl::endpoints::ControlHandle for DeviceControlHandle {
539 fn shutdown(&self) {
540 self.inner.shutdown()
541 }
542 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
543 self.inner.shutdown_with_epitaph(status)
544 }
545
546 fn is_closed(&self) -> bool {
547 self.inner.channel().is_closed()
548 }
549 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
550 self.inner.channel().on_closed()
551 }
552
553 #[cfg(target_os = "fuchsia")]
554 fn signal_peer(
555 &self,
556 clear_mask: zx::Signals,
557 set_mask: zx::Signals,
558 ) -> Result<(), zx_status::Status> {
559 use fidl::Peered;
560 self.inner.channel().signal_peer(clear_mask, set_mask)
561 }
562}
563
564impl DeviceControlHandle {}
565
566#[must_use = "FIDL methods require a response to be sent"]
567#[derive(Debug)]
568pub struct DeviceSetSuspendStatesResponder {
569 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
570 tx_id: u32,
571}
572
573impl std::ops::Drop for DeviceSetSuspendStatesResponder {
577 fn drop(&mut self) {
578 self.control_handle.shutdown();
579 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
581 }
582}
583
584impl fidl::endpoints::Responder for DeviceSetSuspendStatesResponder {
585 type ControlHandle = DeviceControlHandle;
586
587 fn control_handle(&self) -> &DeviceControlHandle {
588 &self.control_handle
589 }
590
591 fn drop_without_shutdown(mut self) {
592 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
594 std::mem::forget(self);
596 }
597}
598
599impl DeviceSetSuspendStatesResponder {
600 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
604 let _result = self.send_raw(result);
605 if _result.is_err() {
606 self.control_handle.shutdown();
607 }
608 self.drop_without_shutdown();
609 _result
610 }
611
612 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
614 let _result = self.send_raw(result);
615 self.drop_without_shutdown();
616 _result
617 }
618
619 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
620 self.control_handle
621 .inner
622 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
623 result,
624 self.tx_id,
625 0x3d37a51c2955e852,
626 fidl::encoding::DynamicFlags::empty(),
627 )
628 }
629}
630
631#[must_use = "FIDL methods require a response to be sent"]
632#[derive(Debug)]
633pub struct DeviceAwaitSuspendResponder {
634 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
635 tx_id: u32,
636}
637
638impl std::ops::Drop for DeviceAwaitSuspendResponder {
642 fn drop(&mut self) {
643 self.control_handle.shutdown();
644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
646 }
647}
648
649impl fidl::endpoints::Responder for DeviceAwaitSuspendResponder {
650 type ControlHandle = DeviceControlHandle;
651
652 fn control_handle(&self) -> &DeviceControlHandle {
653 &self.control_handle
654 }
655
656 fn drop_without_shutdown(mut self) {
657 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
659 std::mem::forget(self);
661 }
662}
663
664impl DeviceAwaitSuspendResponder {
665 pub fn send(
669 self,
670 mut result: Result<&DeviceAwaitSuspendResponse, i32>,
671 ) -> Result<(), fidl::Error> {
672 let _result = self.send_raw(result);
673 if _result.is_err() {
674 self.control_handle.shutdown();
675 }
676 self.drop_without_shutdown();
677 _result
678 }
679
680 pub fn send_no_shutdown_on_err(
682 self,
683 mut result: Result<&DeviceAwaitSuspendResponse, i32>,
684 ) -> Result<(), fidl::Error> {
685 let _result = self.send_raw(result);
686 self.drop_without_shutdown();
687 _result
688 }
689
690 fn send_raw(
691 &self,
692 mut result: Result<&DeviceAwaitSuspendResponse, i32>,
693 ) -> Result<(), fidl::Error> {
694 self.control_handle
695 .inner
696 .send::<fidl::encoding::ResultType<DeviceAwaitSuspendResponse, i32>>(
697 result,
698 self.tx_id,
699 0x7eb0d662063b347e,
700 fidl::encoding::DynamicFlags::empty(),
701 )
702 }
703}
704
705#[must_use = "FIDL methods require a response to be sent"]
706#[derive(Debug)]
707pub struct DeviceResumeResponder {
708 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
709 tx_id: u32,
710}
711
712impl std::ops::Drop for DeviceResumeResponder {
716 fn drop(&mut self) {
717 self.control_handle.shutdown();
718 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
720 }
721}
722
723impl fidl::endpoints::Responder for DeviceResumeResponder {
724 type ControlHandle = DeviceControlHandle;
725
726 fn control_handle(&self) -> &DeviceControlHandle {
727 &self.control_handle
728 }
729
730 fn drop_without_shutdown(mut self) {
731 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
733 std::mem::forget(self);
735 }
736}
737
738impl DeviceResumeResponder {
739 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
743 let _result = self.send_raw(result);
744 if _result.is_err() {
745 self.control_handle.shutdown();
746 }
747 self.drop_without_shutdown();
748 _result
749 }
750
751 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
753 let _result = self.send_raw(result);
754 self.drop_without_shutdown();
755 _result
756 }
757
758 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
759 self.control_handle
760 .inner
761 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
762 result,
763 self.tx_id,
764 0x2deb813cfe9b881e,
765 fidl::encoding::DynamicFlags::empty(),
766 )
767 }
768}
769
770mod internal {
771 use super::*;
772}