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_sagcontrol_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct StateMarker;
16
17impl fidl::endpoints::ProtocolMarker for StateMarker {
18 type Proxy = StateProxy;
19 type RequestStream = StateRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = StateSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "test.sagcontrol.State";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
26pub type StateSetResult = Result<(), SetSystemActivityGovernorStateError>;
27
28pub trait StateProxyInterface: Send + Sync {
29 type SetResponseFut: std::future::Future<Output = Result<StateSetResult, fidl::Error>> + Send;
30 fn r#set(&self, payload: &SystemActivityGovernorState) -> Self::SetResponseFut;
31 type GetResponseFut: std::future::Future<Output = Result<SystemActivityGovernorState, fidl::Error>>
32 + Send;
33 fn r#get(&self) -> Self::GetResponseFut;
34 type SetBootCompleteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
35 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut;
36 type WatchResponseFut: std::future::Future<Output = Result<SystemActivityGovernorState, fidl::Error>>
37 + Send;
38 fn r#watch(&self) -> Self::WatchResponseFut;
39}
40#[derive(Debug)]
41#[cfg(target_os = "fuchsia")]
42pub struct StateSynchronousProxy {
43 client: fidl::client::sync::Client,
44}
45
46#[cfg(target_os = "fuchsia")]
47impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
48 type Proxy = StateProxy;
49 type Protocol = StateMarker;
50
51 fn from_channel(inner: fidl::Channel) -> Self {
52 Self::new(inner)
53 }
54
55 fn into_channel(self) -> fidl::Channel {
56 self.client.into_channel()
57 }
58
59 fn as_channel(&self) -> &fidl::Channel {
60 self.client.as_channel()
61 }
62}
63
64#[cfg(target_os = "fuchsia")]
65impl StateSynchronousProxy {
66 pub fn new(channel: fidl::Channel) -> Self {
67 Self { client: fidl::client::sync::Client::new(channel) }
68 }
69
70 pub fn into_channel(self) -> fidl::Channel {
71 self.client.into_channel()
72 }
73
74 pub fn wait_for_event(
77 &self,
78 deadline: zx::MonotonicInstant,
79 ) -> Result<StateEvent, fidl::Error> {
80 StateEvent::decode(self.client.wait_for_event::<StateMarker>(deadline)?)
81 }
82
83 pub fn r#set(
90 &self,
91 mut payload: &SystemActivityGovernorState,
92 ___deadline: zx::MonotonicInstant,
93 ) -> Result<StateSetResult, fidl::Error> {
94 let _response =
95 self.client.send_query::<SystemActivityGovernorState, fidl::encoding::ResultType<
96 fidl::encoding::EmptyStruct,
97 SetSystemActivityGovernorStateError,
98 >, StateMarker>(
99 payload,
100 0x212842d46b8459f8,
101 fidl::encoding::DynamicFlags::empty(),
102 ___deadline,
103 )?;
104 Ok(_response.map(|x| x))
105 }
106
107 pub fn r#get(
109 &self,
110 ___deadline: zx::MonotonicInstant,
111 ) -> Result<SystemActivityGovernorState, fidl::Error> {
112 let _response = self
113 .client
114 .send_query::<fidl::encoding::EmptyPayload, SystemActivityGovernorState, StateMarker>(
115 (),
116 0x65b19621b5644fdb,
117 fidl::encoding::DynamicFlags::empty(),
118 ___deadline,
119 )?;
120 Ok(_response)
121 }
122
123 pub fn r#set_boot_complete(
125 &self,
126 ___deadline: zx::MonotonicInstant,
127 ) -> Result<(), fidl::Error> {
128 let _response = self
129 .client
130 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, StateMarker>(
131 (),
132 0x7dded2028ad39365,
133 fidl::encoding::DynamicFlags::empty(),
134 ___deadline,
135 )?;
136 Ok(_response)
137 }
138
139 pub fn r#watch(
153 &self,
154 ___deadline: zx::MonotonicInstant,
155 ) -> Result<SystemActivityGovernorState, fidl::Error> {
156 let _response = self
157 .client
158 .send_query::<fidl::encoding::EmptyPayload, SystemActivityGovernorState, StateMarker>(
159 (),
160 0x434b0aa4bbac7965,
161 fidl::encoding::DynamicFlags::empty(),
162 ___deadline,
163 )?;
164 Ok(_response)
165 }
166}
167
168#[cfg(target_os = "fuchsia")]
169impl From<StateSynchronousProxy> for zx::NullableHandle {
170 fn from(value: StateSynchronousProxy) -> Self {
171 value.into_channel().into()
172 }
173}
174
175#[cfg(target_os = "fuchsia")]
176impl From<fidl::Channel> for StateSynchronousProxy {
177 fn from(value: fidl::Channel) -> Self {
178 Self::new(value)
179 }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl fidl::endpoints::FromClient for StateSynchronousProxy {
184 type Protocol = StateMarker;
185
186 fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
187 Self::new(value.into_channel())
188 }
189}
190
191#[derive(Debug, Clone)]
192pub struct StateProxy {
193 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
194}
195
196impl fidl::endpoints::Proxy for StateProxy {
197 type Protocol = StateMarker;
198
199 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
200 Self::new(inner)
201 }
202
203 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
204 self.client.into_channel().map_err(|client| Self { client })
205 }
206
207 fn as_channel(&self) -> &::fidl::AsyncChannel {
208 self.client.as_channel()
209 }
210}
211
212impl StateProxy {
213 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
215 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
216 Self { client: fidl::client::Client::new(channel, protocol_name) }
217 }
218
219 pub fn take_event_stream(&self) -> StateEventStream {
225 StateEventStream { event_receiver: self.client.take_event_receiver() }
226 }
227
228 pub fn r#set(
235 &self,
236 mut payload: &SystemActivityGovernorState,
237 ) -> fidl::client::QueryResponseFut<StateSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
238 {
239 StateProxyInterface::r#set(self, payload)
240 }
241
242 pub fn r#get(
244 &self,
245 ) -> fidl::client::QueryResponseFut<
246 SystemActivityGovernorState,
247 fidl::encoding::DefaultFuchsiaResourceDialect,
248 > {
249 StateProxyInterface::r#get(self)
250 }
251
252 pub fn r#set_boot_complete(
254 &self,
255 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
256 StateProxyInterface::r#set_boot_complete(self)
257 }
258
259 pub fn r#watch(
273 &self,
274 ) -> fidl::client::QueryResponseFut<
275 SystemActivityGovernorState,
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 > {
278 StateProxyInterface::r#watch(self)
279 }
280}
281
282impl StateProxyInterface for StateProxy {
283 type SetResponseFut = fidl::client::QueryResponseFut<
284 StateSetResult,
285 fidl::encoding::DefaultFuchsiaResourceDialect,
286 >;
287 fn r#set(&self, mut payload: &SystemActivityGovernorState) -> Self::SetResponseFut {
288 fn _decode(
289 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
290 ) -> Result<StateSetResult, fidl::Error> {
291 let _response = fidl::client::decode_transaction_body::<
292 fidl::encoding::ResultType<
293 fidl::encoding::EmptyStruct,
294 SetSystemActivityGovernorStateError,
295 >,
296 fidl::encoding::DefaultFuchsiaResourceDialect,
297 0x212842d46b8459f8,
298 >(_buf?)?;
299 Ok(_response.map(|x| x))
300 }
301 self.client.send_query_and_decode::<SystemActivityGovernorState, StateSetResult>(
302 payload,
303 0x212842d46b8459f8,
304 fidl::encoding::DynamicFlags::empty(),
305 _decode,
306 )
307 }
308
309 type GetResponseFut = fidl::client::QueryResponseFut<
310 SystemActivityGovernorState,
311 fidl::encoding::DefaultFuchsiaResourceDialect,
312 >;
313 fn r#get(&self) -> Self::GetResponseFut {
314 fn _decode(
315 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
316 ) -> Result<SystemActivityGovernorState, fidl::Error> {
317 let _response = fidl::client::decode_transaction_body::<
318 SystemActivityGovernorState,
319 fidl::encoding::DefaultFuchsiaResourceDialect,
320 0x65b19621b5644fdb,
321 >(_buf?)?;
322 Ok(_response)
323 }
324 self.client
325 .send_query_and_decode::<fidl::encoding::EmptyPayload, SystemActivityGovernorState>(
326 (),
327 0x65b19621b5644fdb,
328 fidl::encoding::DynamicFlags::empty(),
329 _decode,
330 )
331 }
332
333 type SetBootCompleteResponseFut =
334 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
335 fn r#set_boot_complete(&self) -> Self::SetBootCompleteResponseFut {
336 fn _decode(
337 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
338 ) -> Result<(), fidl::Error> {
339 let _response = fidl::client::decode_transaction_body::<
340 fidl::encoding::EmptyPayload,
341 fidl::encoding::DefaultFuchsiaResourceDialect,
342 0x7dded2028ad39365,
343 >(_buf?)?;
344 Ok(_response)
345 }
346 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
347 (),
348 0x7dded2028ad39365,
349 fidl::encoding::DynamicFlags::empty(),
350 _decode,
351 )
352 }
353
354 type WatchResponseFut = fidl::client::QueryResponseFut<
355 SystemActivityGovernorState,
356 fidl::encoding::DefaultFuchsiaResourceDialect,
357 >;
358 fn r#watch(&self) -> Self::WatchResponseFut {
359 fn _decode(
360 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
361 ) -> Result<SystemActivityGovernorState, fidl::Error> {
362 let _response = fidl::client::decode_transaction_body::<
363 SystemActivityGovernorState,
364 fidl::encoding::DefaultFuchsiaResourceDialect,
365 0x434b0aa4bbac7965,
366 >(_buf?)?;
367 Ok(_response)
368 }
369 self.client
370 .send_query_and_decode::<fidl::encoding::EmptyPayload, SystemActivityGovernorState>(
371 (),
372 0x434b0aa4bbac7965,
373 fidl::encoding::DynamicFlags::empty(),
374 _decode,
375 )
376 }
377}
378
379pub struct StateEventStream {
380 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
381}
382
383impl std::marker::Unpin for StateEventStream {}
384
385impl futures::stream::FusedStream for StateEventStream {
386 fn is_terminated(&self) -> bool {
387 self.event_receiver.is_terminated()
388 }
389}
390
391impl futures::Stream for StateEventStream {
392 type Item = Result<StateEvent, fidl::Error>;
393
394 fn poll_next(
395 mut self: std::pin::Pin<&mut Self>,
396 cx: &mut std::task::Context<'_>,
397 ) -> std::task::Poll<Option<Self::Item>> {
398 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
399 &mut self.event_receiver,
400 cx
401 )?) {
402 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
403 None => std::task::Poll::Ready(None),
404 }
405 }
406}
407
408#[derive(Debug)]
409pub enum StateEvent {
410 #[non_exhaustive]
411 _UnknownEvent {
412 ordinal: u64,
414 },
415}
416
417impl StateEvent {
418 fn decode(
420 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
421 ) -> Result<StateEvent, fidl::Error> {
422 let (bytes, _handles) = buf.split_mut();
423 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
424 debug_assert_eq!(tx_header.tx_id, 0);
425 match tx_header.ordinal {
426 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
427 Ok(StateEvent::_UnknownEvent { ordinal: tx_header.ordinal })
428 }
429 _ => Err(fidl::Error::UnknownOrdinal {
430 ordinal: tx_header.ordinal,
431 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
432 }),
433 }
434 }
435}
436
437pub struct StateRequestStream {
439 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
440 is_terminated: bool,
441}
442
443impl std::marker::Unpin for StateRequestStream {}
444
445impl futures::stream::FusedStream for StateRequestStream {
446 fn is_terminated(&self) -> bool {
447 self.is_terminated
448 }
449}
450
451impl fidl::endpoints::RequestStream for StateRequestStream {
452 type Protocol = StateMarker;
453 type ControlHandle = StateControlHandle;
454
455 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
456 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
457 }
458
459 fn control_handle(&self) -> Self::ControlHandle {
460 StateControlHandle { inner: self.inner.clone() }
461 }
462
463 fn into_inner(
464 self,
465 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
466 {
467 (self.inner, self.is_terminated)
468 }
469
470 fn from_inner(
471 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
472 is_terminated: bool,
473 ) -> Self {
474 Self { inner, is_terminated }
475 }
476}
477
478impl futures::Stream for StateRequestStream {
479 type Item = Result<StateRequest, fidl::Error>;
480
481 fn poll_next(
482 mut self: std::pin::Pin<&mut Self>,
483 cx: &mut std::task::Context<'_>,
484 ) -> std::task::Poll<Option<Self::Item>> {
485 let this = &mut *self;
486 if this.inner.check_shutdown(cx) {
487 this.is_terminated = true;
488 return std::task::Poll::Ready(None);
489 }
490 if this.is_terminated {
491 panic!("polled StateRequestStream after completion");
492 }
493 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
494 |bytes, handles| {
495 match this.inner.channel().read_etc(cx, bytes, handles) {
496 std::task::Poll::Ready(Ok(())) => {}
497 std::task::Poll::Pending => return std::task::Poll::Pending,
498 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
499 this.is_terminated = true;
500 return std::task::Poll::Ready(None);
501 }
502 std::task::Poll::Ready(Err(e)) => {
503 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
504 e.into(),
505 ))));
506 }
507 }
508
509 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
511
512 std::task::Poll::Ready(Some(match header.ordinal {
513 0x212842d46b8459f8 => {
514 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
515 let mut req = fidl::new_empty!(
516 SystemActivityGovernorState,
517 fidl::encoding::DefaultFuchsiaResourceDialect
518 );
519 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SystemActivityGovernorState>(&header, _body_bytes, handles, &mut req)?;
520 let control_handle = StateControlHandle { inner: this.inner.clone() };
521 Ok(StateRequest::Set {
522 payload: req,
523 responder: StateSetResponder {
524 control_handle: std::mem::ManuallyDrop::new(control_handle),
525 tx_id: header.tx_id,
526 },
527 })
528 }
529 0x65b19621b5644fdb => {
530 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
531 let mut req = fidl::new_empty!(
532 fidl::encoding::EmptyPayload,
533 fidl::encoding::DefaultFuchsiaResourceDialect
534 );
535 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
536 let control_handle = StateControlHandle { inner: this.inner.clone() };
537 Ok(StateRequest::Get {
538 responder: StateGetResponder {
539 control_handle: std::mem::ManuallyDrop::new(control_handle),
540 tx_id: header.tx_id,
541 },
542 })
543 }
544 0x7dded2028ad39365 => {
545 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
546 let mut req = fidl::new_empty!(
547 fidl::encoding::EmptyPayload,
548 fidl::encoding::DefaultFuchsiaResourceDialect
549 );
550 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
551 let control_handle = StateControlHandle { inner: this.inner.clone() };
552 Ok(StateRequest::SetBootComplete {
553 responder: StateSetBootCompleteResponder {
554 control_handle: std::mem::ManuallyDrop::new(control_handle),
555 tx_id: header.tx_id,
556 },
557 })
558 }
559 0x434b0aa4bbac7965 => {
560 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
561 let mut req = fidl::new_empty!(
562 fidl::encoding::EmptyPayload,
563 fidl::encoding::DefaultFuchsiaResourceDialect
564 );
565 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
566 let control_handle = StateControlHandle { inner: this.inner.clone() };
567 Ok(StateRequest::Watch {
568 responder: StateWatchResponder {
569 control_handle: std::mem::ManuallyDrop::new(control_handle),
570 tx_id: header.tx_id,
571 },
572 })
573 }
574 _ if header.tx_id == 0
575 && header
576 .dynamic_flags()
577 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
578 {
579 Ok(StateRequest::_UnknownMethod {
580 ordinal: header.ordinal,
581 control_handle: StateControlHandle { inner: this.inner.clone() },
582 method_type: fidl::MethodType::OneWay,
583 })
584 }
585 _ if header
586 .dynamic_flags()
587 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
588 {
589 this.inner.send_framework_err(
590 fidl::encoding::FrameworkErr::UnknownMethod,
591 header.tx_id,
592 header.ordinal,
593 header.dynamic_flags(),
594 (bytes, handles),
595 )?;
596 Ok(StateRequest::_UnknownMethod {
597 ordinal: header.ordinal,
598 control_handle: StateControlHandle { inner: this.inner.clone() },
599 method_type: fidl::MethodType::TwoWay,
600 })
601 }
602 _ => Err(fidl::Error::UnknownOrdinal {
603 ordinal: header.ordinal,
604 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
605 }),
606 }))
607 },
608 )
609 }
610}
611
612#[derive(Debug)]
613pub enum StateRequest {
614 Set { payload: SystemActivityGovernorState, responder: StateSetResponder },
621 Get { responder: StateGetResponder },
623 SetBootComplete { responder: StateSetBootCompleteResponder },
625 Watch { responder: StateWatchResponder },
639 #[non_exhaustive]
641 _UnknownMethod {
642 ordinal: u64,
644 control_handle: StateControlHandle,
645 method_type: fidl::MethodType,
646 },
647}
648
649impl StateRequest {
650 #[allow(irrefutable_let_patterns)]
651 pub fn into_set(self) -> Option<(SystemActivityGovernorState, StateSetResponder)> {
652 if let StateRequest::Set { payload, responder } = self {
653 Some((payload, responder))
654 } else {
655 None
656 }
657 }
658
659 #[allow(irrefutable_let_patterns)]
660 pub fn into_get(self) -> Option<(StateGetResponder)> {
661 if let StateRequest::Get { responder } = self { Some((responder)) } else { None }
662 }
663
664 #[allow(irrefutable_let_patterns)]
665 pub fn into_set_boot_complete(self) -> Option<(StateSetBootCompleteResponder)> {
666 if let StateRequest::SetBootComplete { responder } = self {
667 Some((responder))
668 } else {
669 None
670 }
671 }
672
673 #[allow(irrefutable_let_patterns)]
674 pub fn into_watch(self) -> Option<(StateWatchResponder)> {
675 if let StateRequest::Watch { responder } = self { Some((responder)) } else { None }
676 }
677
678 pub fn method_name(&self) -> &'static str {
680 match *self {
681 StateRequest::Set { .. } => "set",
682 StateRequest::Get { .. } => "get",
683 StateRequest::SetBootComplete { .. } => "set_boot_complete",
684 StateRequest::Watch { .. } => "watch",
685 StateRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
686 "unknown one-way method"
687 }
688 StateRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
689 "unknown two-way method"
690 }
691 }
692 }
693}
694
695#[derive(Debug, Clone)]
696pub struct StateControlHandle {
697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
698}
699
700impl StateControlHandle {
701 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
702 self.inner.shutdown_with_epitaph(status.into())
703 }
704}
705
706impl fidl::endpoints::ControlHandle for StateControlHandle {
707 fn shutdown(&self) {
708 self.inner.shutdown()
709 }
710
711 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
712 self.inner.shutdown_with_epitaph(status)
713 }
714
715 fn is_closed(&self) -> bool {
716 self.inner.channel().is_closed()
717 }
718 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
719 self.inner.channel().on_closed()
720 }
721
722 #[cfg(target_os = "fuchsia")]
723 fn signal_peer(
724 &self,
725 clear_mask: zx::Signals,
726 set_mask: zx::Signals,
727 ) -> Result<(), zx_status::Status> {
728 use fidl::Peered;
729 self.inner.channel().signal_peer(clear_mask, set_mask)
730 }
731}
732
733impl StateControlHandle {}
734
735#[must_use = "FIDL methods require a response to be sent"]
736#[derive(Debug)]
737pub struct StateSetResponder {
738 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
739 tx_id: u32,
740}
741
742impl std::ops::Drop for StateSetResponder {
746 fn drop(&mut self) {
747 self.control_handle.shutdown();
748 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
750 }
751}
752
753impl fidl::endpoints::Responder for StateSetResponder {
754 type ControlHandle = StateControlHandle;
755
756 fn control_handle(&self) -> &StateControlHandle {
757 &self.control_handle
758 }
759
760 fn drop_without_shutdown(mut self) {
761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
763 std::mem::forget(self);
765 }
766}
767
768impl StateSetResponder {
769 pub fn send(
773 self,
774 mut result: Result<(), SetSystemActivityGovernorStateError>,
775 ) -> Result<(), fidl::Error> {
776 let _result = self.send_raw(result);
777 if _result.is_err() {
778 self.control_handle.shutdown();
779 }
780 self.drop_without_shutdown();
781 _result
782 }
783
784 pub fn send_no_shutdown_on_err(
786 self,
787 mut result: Result<(), SetSystemActivityGovernorStateError>,
788 ) -> Result<(), fidl::Error> {
789 let _result = self.send_raw(result);
790 self.drop_without_shutdown();
791 _result
792 }
793
794 fn send_raw(
795 &self,
796 mut result: Result<(), SetSystemActivityGovernorStateError>,
797 ) -> Result<(), fidl::Error> {
798 self.control_handle.inner.send::<fidl::encoding::ResultType<
799 fidl::encoding::EmptyStruct,
800 SetSystemActivityGovernorStateError,
801 >>(
802 result,
803 self.tx_id,
804 0x212842d46b8459f8,
805 fidl::encoding::DynamicFlags::empty(),
806 )
807 }
808}
809
810#[must_use = "FIDL methods require a response to be sent"]
811#[derive(Debug)]
812pub struct StateGetResponder {
813 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
814 tx_id: u32,
815}
816
817impl std::ops::Drop for StateGetResponder {
821 fn drop(&mut self) {
822 self.control_handle.shutdown();
823 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
825 }
826}
827
828impl fidl::endpoints::Responder for StateGetResponder {
829 type ControlHandle = StateControlHandle;
830
831 fn control_handle(&self) -> &StateControlHandle {
832 &self.control_handle
833 }
834
835 fn drop_without_shutdown(mut self) {
836 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
838 std::mem::forget(self);
840 }
841}
842
843impl StateGetResponder {
844 pub fn send(self, mut payload: &SystemActivityGovernorState) -> Result<(), fidl::Error> {
848 let _result = self.send_raw(payload);
849 if _result.is_err() {
850 self.control_handle.shutdown();
851 }
852 self.drop_without_shutdown();
853 _result
854 }
855
856 pub fn send_no_shutdown_on_err(
858 self,
859 mut payload: &SystemActivityGovernorState,
860 ) -> Result<(), fidl::Error> {
861 let _result = self.send_raw(payload);
862 self.drop_without_shutdown();
863 _result
864 }
865
866 fn send_raw(&self, mut payload: &SystemActivityGovernorState) -> Result<(), fidl::Error> {
867 self.control_handle.inner.send::<SystemActivityGovernorState>(
868 payload,
869 self.tx_id,
870 0x65b19621b5644fdb,
871 fidl::encoding::DynamicFlags::empty(),
872 )
873 }
874}
875
876#[must_use = "FIDL methods require a response to be sent"]
877#[derive(Debug)]
878pub struct StateSetBootCompleteResponder {
879 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
880 tx_id: u32,
881}
882
883impl std::ops::Drop for StateSetBootCompleteResponder {
887 fn drop(&mut self) {
888 self.control_handle.shutdown();
889 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
891 }
892}
893
894impl fidl::endpoints::Responder for StateSetBootCompleteResponder {
895 type ControlHandle = StateControlHandle;
896
897 fn control_handle(&self) -> &StateControlHandle {
898 &self.control_handle
899 }
900
901 fn drop_without_shutdown(mut self) {
902 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
904 std::mem::forget(self);
906 }
907}
908
909impl StateSetBootCompleteResponder {
910 pub fn send(self) -> Result<(), fidl::Error> {
914 let _result = self.send_raw();
915 if _result.is_err() {
916 self.control_handle.shutdown();
917 }
918 self.drop_without_shutdown();
919 _result
920 }
921
922 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
924 let _result = self.send_raw();
925 self.drop_without_shutdown();
926 _result
927 }
928
929 fn send_raw(&self) -> Result<(), fidl::Error> {
930 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
931 (),
932 self.tx_id,
933 0x7dded2028ad39365,
934 fidl::encoding::DynamicFlags::empty(),
935 )
936 }
937}
938
939#[must_use = "FIDL methods require a response to be sent"]
940#[derive(Debug)]
941pub struct StateWatchResponder {
942 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
943 tx_id: u32,
944}
945
946impl std::ops::Drop for StateWatchResponder {
950 fn drop(&mut self) {
951 self.control_handle.shutdown();
952 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
954 }
955}
956
957impl fidl::endpoints::Responder for StateWatchResponder {
958 type ControlHandle = StateControlHandle;
959
960 fn control_handle(&self) -> &StateControlHandle {
961 &self.control_handle
962 }
963
964 fn drop_without_shutdown(mut self) {
965 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
967 std::mem::forget(self);
969 }
970}
971
972impl StateWatchResponder {
973 pub fn send(self, mut payload: &SystemActivityGovernorState) -> Result<(), fidl::Error> {
977 let _result = self.send_raw(payload);
978 if _result.is_err() {
979 self.control_handle.shutdown();
980 }
981 self.drop_without_shutdown();
982 _result
983 }
984
985 pub fn send_no_shutdown_on_err(
987 self,
988 mut payload: &SystemActivityGovernorState,
989 ) -> Result<(), fidl::Error> {
990 let _result = self.send_raw(payload);
991 self.drop_without_shutdown();
992 _result
993 }
994
995 fn send_raw(&self, mut payload: &SystemActivityGovernorState) -> Result<(), fidl::Error> {
996 self.control_handle.inner.send::<SystemActivityGovernorState>(
997 payload,
998 self.tx_id,
999 0x434b0aa4bbac7965,
1000 fidl::encoding::DynamicFlags::empty(),
1001 )
1002 }
1003}
1004
1005mod internal {
1006 use super::*;
1007}