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_power_topology_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct TopologyControlOpenStatusChannelRequest {
16 pub element_name: String,
17 pub status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for TopologyControlOpenStatusChannelRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct SystemActivityControlMarker;
27
28impl fidl::endpoints::ProtocolMarker for SystemActivityControlMarker {
29 type Proxy = SystemActivityControlProxy;
30 type RequestStream = SystemActivityControlRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = SystemActivityControlSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "fuchsia.power.topology.test.SystemActivityControl";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for SystemActivityControlMarker {}
37pub type SystemActivityControlStartApplicationActivityResult =
38 Result<(), SystemActivityControlError>;
39pub type SystemActivityControlStopApplicationActivityResult =
40 Result<(), SystemActivityControlError>;
41pub type SystemActivityControlRestartApplicationActivityResult =
42 Result<(), SystemActivityControlError>;
43
44pub trait SystemActivityControlProxyInterface: Send + Sync {
45 type StartApplicationActivityResponseFut: std::future::Future<
46 Output = Result<SystemActivityControlStartApplicationActivityResult, fidl::Error>,
47 > + Send;
48 fn r#start_application_activity(&self) -> Self::StartApplicationActivityResponseFut;
49 type StopApplicationActivityResponseFut: std::future::Future<
50 Output = Result<SystemActivityControlStopApplicationActivityResult, fidl::Error>,
51 > + Send;
52 fn r#stop_application_activity(&self) -> Self::StopApplicationActivityResponseFut;
53 type RestartApplicationActivityResponseFut: std::future::Future<
54 Output = Result<SystemActivityControlRestartApplicationActivityResult, fidl::Error>,
55 > + Send;
56 fn r#restart_application_activity(
57 &self,
58 wait_time_ns: u64,
59 ) -> Self::RestartApplicationActivityResponseFut;
60}
61#[derive(Debug)]
62#[cfg(target_os = "fuchsia")]
63pub struct SystemActivityControlSynchronousProxy {
64 client: fidl::client::sync::Client,
65}
66
67#[cfg(target_os = "fuchsia")]
68impl fidl::endpoints::SynchronousProxy for SystemActivityControlSynchronousProxy {
69 type Proxy = SystemActivityControlProxy;
70 type Protocol = SystemActivityControlMarker;
71
72 fn from_channel(inner: fidl::Channel) -> Self {
73 Self::new(inner)
74 }
75
76 fn into_channel(self) -> fidl::Channel {
77 self.client.into_channel()
78 }
79
80 fn as_channel(&self) -> &fidl::Channel {
81 self.client.as_channel()
82 }
83}
84
85#[cfg(target_os = "fuchsia")]
86impl SystemActivityControlSynchronousProxy {
87 pub fn new(channel: fidl::Channel) -> Self {
88 let protocol_name =
89 <SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
90 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
91 }
92
93 pub fn into_channel(self) -> fidl::Channel {
94 self.client.into_channel()
95 }
96
97 pub fn wait_for_event(
100 &self,
101 deadline: zx::MonotonicInstant,
102 ) -> Result<SystemActivityControlEvent, fidl::Error> {
103 SystemActivityControlEvent::decode(self.client.wait_for_event(deadline)?)
104 }
105
106 pub fn r#start_application_activity(
108 &self,
109 ___deadline: zx::MonotonicInstant,
110 ) -> Result<SystemActivityControlStartApplicationActivityResult, fidl::Error> {
111 let _response =
112 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
113 fidl::encoding::EmptyStruct,
114 SystemActivityControlError,
115 >>(
116 (),
117 0x61de6f5d5285a4e3,
118 fidl::encoding::DynamicFlags::empty(),
119 ___deadline,
120 )?;
121 Ok(_response.map(|x| x))
122 }
123
124 pub fn r#stop_application_activity(
126 &self,
127 ___deadline: zx::MonotonicInstant,
128 ) -> Result<SystemActivityControlStopApplicationActivityResult, fidl::Error> {
129 let _response =
130 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
131 fidl::encoding::EmptyStruct,
132 SystemActivityControlError,
133 >>(
134 (),
135 0x294ea5c8d0e2e0c0,
136 fidl::encoding::DynamicFlags::empty(),
137 ___deadline,
138 )?;
139 Ok(_response.map(|x| x))
140 }
141
142 pub fn r#restart_application_activity(
144 &self,
145 mut wait_time_ns: u64,
146 ___deadline: zx::MonotonicInstant,
147 ) -> Result<SystemActivityControlRestartApplicationActivityResult, fidl::Error> {
148 let _response = self.client.send_query::<
149 SystemActivityControlRestartApplicationActivityRequest,
150 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
151 >(
152 (wait_time_ns,),
153 0x2881d47bba86f3d4,
154 fidl::encoding::DynamicFlags::empty(),
155 ___deadline,
156 )?;
157 Ok(_response.map(|x| x))
158 }
159}
160
161#[cfg(target_os = "fuchsia")]
162impl From<SystemActivityControlSynchronousProxy> for zx::NullableHandle {
163 fn from(value: SystemActivityControlSynchronousProxy) -> Self {
164 value.into_channel().into()
165 }
166}
167
168#[cfg(target_os = "fuchsia")]
169impl From<fidl::Channel> for SystemActivityControlSynchronousProxy {
170 fn from(value: fidl::Channel) -> Self {
171 Self::new(value)
172 }
173}
174
175#[cfg(target_os = "fuchsia")]
176impl fidl::endpoints::FromClient for SystemActivityControlSynchronousProxy {
177 type Protocol = SystemActivityControlMarker;
178
179 fn from_client(value: fidl::endpoints::ClientEnd<SystemActivityControlMarker>) -> Self {
180 Self::new(value.into_channel())
181 }
182}
183
184#[derive(Debug, Clone)]
185pub struct SystemActivityControlProxy {
186 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
187}
188
189impl fidl::endpoints::Proxy for SystemActivityControlProxy {
190 type Protocol = SystemActivityControlMarker;
191
192 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
193 Self::new(inner)
194 }
195
196 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
197 self.client.into_channel().map_err(|client| Self { client })
198 }
199
200 fn as_channel(&self) -> &::fidl::AsyncChannel {
201 self.client.as_channel()
202 }
203}
204
205impl SystemActivityControlProxy {
206 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
208 let protocol_name =
209 <SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
210 Self { client: fidl::client::Client::new(channel, protocol_name) }
211 }
212
213 pub fn take_event_stream(&self) -> SystemActivityControlEventStream {
219 SystemActivityControlEventStream { event_receiver: self.client.take_event_receiver() }
220 }
221
222 pub fn r#start_application_activity(
224 &self,
225 ) -> fidl::client::QueryResponseFut<
226 SystemActivityControlStartApplicationActivityResult,
227 fidl::encoding::DefaultFuchsiaResourceDialect,
228 > {
229 SystemActivityControlProxyInterface::r#start_application_activity(self)
230 }
231
232 pub fn r#stop_application_activity(
234 &self,
235 ) -> fidl::client::QueryResponseFut<
236 SystemActivityControlStopApplicationActivityResult,
237 fidl::encoding::DefaultFuchsiaResourceDialect,
238 > {
239 SystemActivityControlProxyInterface::r#stop_application_activity(self)
240 }
241
242 pub fn r#restart_application_activity(
244 &self,
245 mut wait_time_ns: u64,
246 ) -> fidl::client::QueryResponseFut<
247 SystemActivityControlRestartApplicationActivityResult,
248 fidl::encoding::DefaultFuchsiaResourceDialect,
249 > {
250 SystemActivityControlProxyInterface::r#restart_application_activity(self, wait_time_ns)
251 }
252}
253
254impl SystemActivityControlProxyInterface for SystemActivityControlProxy {
255 type StartApplicationActivityResponseFut = fidl::client::QueryResponseFut<
256 SystemActivityControlStartApplicationActivityResult,
257 fidl::encoding::DefaultFuchsiaResourceDialect,
258 >;
259 fn r#start_application_activity(&self) -> Self::StartApplicationActivityResponseFut {
260 fn _decode(
261 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
262 ) -> Result<SystemActivityControlStartApplicationActivityResult, fidl::Error> {
263 let _response = fidl::client::decode_transaction_body::<
264 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
265 fidl::encoding::DefaultFuchsiaResourceDialect,
266 0x61de6f5d5285a4e3,
267 >(_buf?)?;
268 Ok(_response.map(|x| x))
269 }
270 self.client.send_query_and_decode::<
271 fidl::encoding::EmptyPayload,
272 SystemActivityControlStartApplicationActivityResult,
273 >(
274 (),
275 0x61de6f5d5285a4e3,
276 fidl::encoding::DynamicFlags::empty(),
277 _decode,
278 )
279 }
280
281 type StopApplicationActivityResponseFut = fidl::client::QueryResponseFut<
282 SystemActivityControlStopApplicationActivityResult,
283 fidl::encoding::DefaultFuchsiaResourceDialect,
284 >;
285 fn r#stop_application_activity(&self) -> Self::StopApplicationActivityResponseFut {
286 fn _decode(
287 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
288 ) -> Result<SystemActivityControlStopApplicationActivityResult, fidl::Error> {
289 let _response = fidl::client::decode_transaction_body::<
290 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
291 fidl::encoding::DefaultFuchsiaResourceDialect,
292 0x294ea5c8d0e2e0c0,
293 >(_buf?)?;
294 Ok(_response.map(|x| x))
295 }
296 self.client.send_query_and_decode::<
297 fidl::encoding::EmptyPayload,
298 SystemActivityControlStopApplicationActivityResult,
299 >(
300 (),
301 0x294ea5c8d0e2e0c0,
302 fidl::encoding::DynamicFlags::empty(),
303 _decode,
304 )
305 }
306
307 type RestartApplicationActivityResponseFut = fidl::client::QueryResponseFut<
308 SystemActivityControlRestartApplicationActivityResult,
309 fidl::encoding::DefaultFuchsiaResourceDialect,
310 >;
311 fn r#restart_application_activity(
312 &self,
313 mut wait_time_ns: u64,
314 ) -> Self::RestartApplicationActivityResponseFut {
315 fn _decode(
316 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
317 ) -> Result<SystemActivityControlRestartApplicationActivityResult, fidl::Error> {
318 let _response = fidl::client::decode_transaction_body::<
319 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
320 fidl::encoding::DefaultFuchsiaResourceDialect,
321 0x2881d47bba86f3d4,
322 >(_buf?)?;
323 Ok(_response.map(|x| x))
324 }
325 self.client.send_query_and_decode::<
326 SystemActivityControlRestartApplicationActivityRequest,
327 SystemActivityControlRestartApplicationActivityResult,
328 >(
329 (wait_time_ns,),
330 0x2881d47bba86f3d4,
331 fidl::encoding::DynamicFlags::empty(),
332 _decode,
333 )
334 }
335}
336
337pub struct SystemActivityControlEventStream {
338 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
339}
340
341impl std::marker::Unpin for SystemActivityControlEventStream {}
342
343impl futures::stream::FusedStream for SystemActivityControlEventStream {
344 fn is_terminated(&self) -> bool {
345 self.event_receiver.is_terminated()
346 }
347}
348
349impl futures::Stream for SystemActivityControlEventStream {
350 type Item = Result<SystemActivityControlEvent, fidl::Error>;
351
352 fn poll_next(
353 mut self: std::pin::Pin<&mut Self>,
354 cx: &mut std::task::Context<'_>,
355 ) -> std::task::Poll<Option<Self::Item>> {
356 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
357 &mut self.event_receiver,
358 cx
359 )?) {
360 Some(buf) => std::task::Poll::Ready(Some(SystemActivityControlEvent::decode(buf))),
361 None => std::task::Poll::Ready(None),
362 }
363 }
364}
365
366#[derive(Debug)]
367pub enum SystemActivityControlEvent {
368 #[non_exhaustive]
369 _UnknownEvent {
370 ordinal: u64,
372 },
373}
374
375impl SystemActivityControlEvent {
376 fn decode(
378 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
379 ) -> Result<SystemActivityControlEvent, fidl::Error> {
380 let (bytes, _handles) = buf.split_mut();
381 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
382 debug_assert_eq!(tx_header.tx_id, 0);
383 match tx_header.ordinal {
384 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
385 Ok(SystemActivityControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
386 }
387 _ => Err(fidl::Error::UnknownOrdinal {
388 ordinal: tx_header.ordinal,
389 protocol_name:
390 <SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
391 }),
392 }
393 }
394}
395
396pub struct SystemActivityControlRequestStream {
398 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
399 is_terminated: bool,
400}
401
402impl std::marker::Unpin for SystemActivityControlRequestStream {}
403
404impl futures::stream::FusedStream for SystemActivityControlRequestStream {
405 fn is_terminated(&self) -> bool {
406 self.is_terminated
407 }
408}
409
410impl fidl::endpoints::RequestStream for SystemActivityControlRequestStream {
411 type Protocol = SystemActivityControlMarker;
412 type ControlHandle = SystemActivityControlControlHandle;
413
414 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
415 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
416 }
417
418 fn control_handle(&self) -> Self::ControlHandle {
419 SystemActivityControlControlHandle { inner: self.inner.clone() }
420 }
421
422 fn into_inner(
423 self,
424 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
425 {
426 (self.inner, self.is_terminated)
427 }
428
429 fn from_inner(
430 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
431 is_terminated: bool,
432 ) -> Self {
433 Self { inner, is_terminated }
434 }
435}
436
437impl futures::Stream for SystemActivityControlRequestStream {
438 type Item = Result<SystemActivityControlRequest, fidl::Error>;
439
440 fn poll_next(
441 mut self: std::pin::Pin<&mut Self>,
442 cx: &mut std::task::Context<'_>,
443 ) -> std::task::Poll<Option<Self::Item>> {
444 let this = &mut *self;
445 if this.inner.check_shutdown(cx) {
446 this.is_terminated = true;
447 return std::task::Poll::Ready(None);
448 }
449 if this.is_terminated {
450 panic!("polled SystemActivityControlRequestStream after completion");
451 }
452 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
453 |bytes, handles| {
454 match this.inner.channel().read_etc(cx, bytes, handles) {
455 std::task::Poll::Ready(Ok(())) => {}
456 std::task::Poll::Pending => return std::task::Poll::Pending,
457 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
458 this.is_terminated = true;
459 return std::task::Poll::Ready(None);
460 }
461 std::task::Poll::Ready(Err(e)) => {
462 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
463 e.into(),
464 ))));
465 }
466 }
467
468 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
470
471 std::task::Poll::Ready(Some(match header.ordinal {
472 0x61de6f5d5285a4e3 => {
473 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
474 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
475 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
476 let control_handle = SystemActivityControlControlHandle {
477 inner: this.inner.clone(),
478 };
479 Ok(SystemActivityControlRequest::StartApplicationActivity {
480 responder: SystemActivityControlStartApplicationActivityResponder {
481 control_handle: std::mem::ManuallyDrop::new(control_handle),
482 tx_id: header.tx_id,
483 },
484 })
485 }
486 0x294ea5c8d0e2e0c0 => {
487 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
488 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
489 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
490 let control_handle = SystemActivityControlControlHandle {
491 inner: this.inner.clone(),
492 };
493 Ok(SystemActivityControlRequest::StopApplicationActivity {
494 responder: SystemActivityControlStopApplicationActivityResponder {
495 control_handle: std::mem::ManuallyDrop::new(control_handle),
496 tx_id: header.tx_id,
497 },
498 })
499 }
500 0x2881d47bba86f3d4 => {
501 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
502 let mut req = fidl::new_empty!(SystemActivityControlRestartApplicationActivityRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SystemActivityControlRestartApplicationActivityRequest>(&header, _body_bytes, handles, &mut req)?;
504 let control_handle = SystemActivityControlControlHandle {
505 inner: this.inner.clone(),
506 };
507 Ok(SystemActivityControlRequest::RestartApplicationActivity {wait_time_ns: req.wait_time_ns,
508
509 responder: SystemActivityControlRestartApplicationActivityResponder {
510 control_handle: std::mem::ManuallyDrop::new(control_handle),
511 tx_id: header.tx_id,
512 },
513 })
514 }
515 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
516 Ok(SystemActivityControlRequest::_UnknownMethod {
517 ordinal: header.ordinal,
518 control_handle: SystemActivityControlControlHandle { inner: this.inner.clone() },
519 method_type: fidl::MethodType::OneWay,
520 })
521 }
522 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
523 this.inner.send_framework_err(
524 fidl::encoding::FrameworkErr::UnknownMethod,
525 header.tx_id,
526 header.ordinal,
527 header.dynamic_flags(),
528 (bytes, handles),
529 )?;
530 Ok(SystemActivityControlRequest::_UnknownMethod {
531 ordinal: header.ordinal,
532 control_handle: SystemActivityControlControlHandle { inner: this.inner.clone() },
533 method_type: fidl::MethodType::TwoWay,
534 })
535 }
536 _ => Err(fidl::Error::UnknownOrdinal {
537 ordinal: header.ordinal,
538 protocol_name: <SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
539 }),
540 }))
541 },
542 )
543 }
544}
545
546#[derive(Debug)]
548pub enum SystemActivityControlRequest {
549 StartApplicationActivity { responder: SystemActivityControlStartApplicationActivityResponder },
551 StopApplicationActivity { responder: SystemActivityControlStopApplicationActivityResponder },
553 RestartApplicationActivity {
555 wait_time_ns: u64,
556 responder: SystemActivityControlRestartApplicationActivityResponder,
557 },
558 #[non_exhaustive]
560 _UnknownMethod {
561 ordinal: u64,
563 control_handle: SystemActivityControlControlHandle,
564 method_type: fidl::MethodType,
565 },
566}
567
568impl SystemActivityControlRequest {
569 #[allow(irrefutable_let_patterns)]
570 pub fn into_start_application_activity(
571 self,
572 ) -> Option<(SystemActivityControlStartApplicationActivityResponder)> {
573 if let SystemActivityControlRequest::StartApplicationActivity { responder } = self {
574 Some((responder))
575 } else {
576 None
577 }
578 }
579
580 #[allow(irrefutable_let_patterns)]
581 pub fn into_stop_application_activity(
582 self,
583 ) -> Option<(SystemActivityControlStopApplicationActivityResponder)> {
584 if let SystemActivityControlRequest::StopApplicationActivity { responder } = self {
585 Some((responder))
586 } else {
587 None
588 }
589 }
590
591 #[allow(irrefutable_let_patterns)]
592 pub fn into_restart_application_activity(
593 self,
594 ) -> Option<(u64, SystemActivityControlRestartApplicationActivityResponder)> {
595 if let SystemActivityControlRequest::RestartApplicationActivity {
596 wait_time_ns,
597 responder,
598 } = self
599 {
600 Some((wait_time_ns, responder))
601 } else {
602 None
603 }
604 }
605
606 pub fn method_name(&self) -> &'static str {
608 match *self {
609 SystemActivityControlRequest::StartApplicationActivity { .. } => {
610 "start_application_activity"
611 }
612 SystemActivityControlRequest::StopApplicationActivity { .. } => {
613 "stop_application_activity"
614 }
615 SystemActivityControlRequest::RestartApplicationActivity { .. } => {
616 "restart_application_activity"
617 }
618 SystemActivityControlRequest::_UnknownMethod {
619 method_type: fidl::MethodType::OneWay,
620 ..
621 } => "unknown one-way method",
622 SystemActivityControlRequest::_UnknownMethod {
623 method_type: fidl::MethodType::TwoWay,
624 ..
625 } => "unknown two-way method",
626 }
627 }
628}
629
630#[derive(Debug, Clone)]
631pub struct SystemActivityControlControlHandle {
632 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
633}
634
635impl fidl::endpoints::ControlHandle for SystemActivityControlControlHandle {
636 fn shutdown(&self) {
637 self.inner.shutdown()
638 }
639
640 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
641 self.inner.shutdown_with_epitaph(status)
642 }
643
644 fn is_closed(&self) -> bool {
645 self.inner.channel().is_closed()
646 }
647 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
648 self.inner.channel().on_closed()
649 }
650
651 #[cfg(target_os = "fuchsia")]
652 fn signal_peer(
653 &self,
654 clear_mask: zx::Signals,
655 set_mask: zx::Signals,
656 ) -> Result<(), zx_status::Status> {
657 use fidl::Peered;
658 self.inner.channel().signal_peer(clear_mask, set_mask)
659 }
660}
661
662impl SystemActivityControlControlHandle {}
663
664#[must_use = "FIDL methods require a response to be sent"]
665#[derive(Debug)]
666pub struct SystemActivityControlStartApplicationActivityResponder {
667 control_handle: std::mem::ManuallyDrop<SystemActivityControlControlHandle>,
668 tx_id: u32,
669}
670
671impl std::ops::Drop for SystemActivityControlStartApplicationActivityResponder {
675 fn drop(&mut self) {
676 self.control_handle.shutdown();
677 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
679 }
680}
681
682impl fidl::endpoints::Responder for SystemActivityControlStartApplicationActivityResponder {
683 type ControlHandle = SystemActivityControlControlHandle;
684
685 fn control_handle(&self) -> &SystemActivityControlControlHandle {
686 &self.control_handle
687 }
688
689 fn drop_without_shutdown(mut self) {
690 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
692 std::mem::forget(self);
694 }
695}
696
697impl SystemActivityControlStartApplicationActivityResponder {
698 pub fn send(
702 self,
703 mut result: Result<(), SystemActivityControlError>,
704 ) -> Result<(), fidl::Error> {
705 let _result = self.send_raw(result);
706 if _result.is_err() {
707 self.control_handle.shutdown();
708 }
709 self.drop_without_shutdown();
710 _result
711 }
712
713 pub fn send_no_shutdown_on_err(
715 self,
716 mut result: Result<(), SystemActivityControlError>,
717 ) -> Result<(), fidl::Error> {
718 let _result = self.send_raw(result);
719 self.drop_without_shutdown();
720 _result
721 }
722
723 fn send_raw(
724 &self,
725 mut result: Result<(), SystemActivityControlError>,
726 ) -> Result<(), fidl::Error> {
727 self.control_handle.inner.send::<fidl::encoding::ResultType<
728 fidl::encoding::EmptyStruct,
729 SystemActivityControlError,
730 >>(
731 result,
732 self.tx_id,
733 0x61de6f5d5285a4e3,
734 fidl::encoding::DynamicFlags::empty(),
735 )
736 }
737}
738
739#[must_use = "FIDL methods require a response to be sent"]
740#[derive(Debug)]
741pub struct SystemActivityControlStopApplicationActivityResponder {
742 control_handle: std::mem::ManuallyDrop<SystemActivityControlControlHandle>,
743 tx_id: u32,
744}
745
746impl std::ops::Drop for SystemActivityControlStopApplicationActivityResponder {
750 fn drop(&mut self) {
751 self.control_handle.shutdown();
752 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
754 }
755}
756
757impl fidl::endpoints::Responder for SystemActivityControlStopApplicationActivityResponder {
758 type ControlHandle = SystemActivityControlControlHandle;
759
760 fn control_handle(&self) -> &SystemActivityControlControlHandle {
761 &self.control_handle
762 }
763
764 fn drop_without_shutdown(mut self) {
765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
767 std::mem::forget(self);
769 }
770}
771
772impl SystemActivityControlStopApplicationActivityResponder {
773 pub fn send(
777 self,
778 mut result: Result<(), SystemActivityControlError>,
779 ) -> Result<(), fidl::Error> {
780 let _result = self.send_raw(result);
781 if _result.is_err() {
782 self.control_handle.shutdown();
783 }
784 self.drop_without_shutdown();
785 _result
786 }
787
788 pub fn send_no_shutdown_on_err(
790 self,
791 mut result: Result<(), SystemActivityControlError>,
792 ) -> Result<(), fidl::Error> {
793 let _result = self.send_raw(result);
794 self.drop_without_shutdown();
795 _result
796 }
797
798 fn send_raw(
799 &self,
800 mut result: Result<(), SystemActivityControlError>,
801 ) -> Result<(), fidl::Error> {
802 self.control_handle.inner.send::<fidl::encoding::ResultType<
803 fidl::encoding::EmptyStruct,
804 SystemActivityControlError,
805 >>(
806 result,
807 self.tx_id,
808 0x294ea5c8d0e2e0c0,
809 fidl::encoding::DynamicFlags::empty(),
810 )
811 }
812}
813
814#[must_use = "FIDL methods require a response to be sent"]
815#[derive(Debug)]
816pub struct SystemActivityControlRestartApplicationActivityResponder {
817 control_handle: std::mem::ManuallyDrop<SystemActivityControlControlHandle>,
818 tx_id: u32,
819}
820
821impl std::ops::Drop for SystemActivityControlRestartApplicationActivityResponder {
825 fn drop(&mut self) {
826 self.control_handle.shutdown();
827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
829 }
830}
831
832impl fidl::endpoints::Responder for SystemActivityControlRestartApplicationActivityResponder {
833 type ControlHandle = SystemActivityControlControlHandle;
834
835 fn control_handle(&self) -> &SystemActivityControlControlHandle {
836 &self.control_handle
837 }
838
839 fn drop_without_shutdown(mut self) {
840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
842 std::mem::forget(self);
844 }
845}
846
847impl SystemActivityControlRestartApplicationActivityResponder {
848 pub fn send(
852 self,
853 mut result: Result<(), SystemActivityControlError>,
854 ) -> Result<(), fidl::Error> {
855 let _result = self.send_raw(result);
856 if _result.is_err() {
857 self.control_handle.shutdown();
858 }
859 self.drop_without_shutdown();
860 _result
861 }
862
863 pub fn send_no_shutdown_on_err(
865 self,
866 mut result: Result<(), SystemActivityControlError>,
867 ) -> Result<(), fidl::Error> {
868 let _result = self.send_raw(result);
869 self.drop_without_shutdown();
870 _result
871 }
872
873 fn send_raw(
874 &self,
875 mut result: Result<(), SystemActivityControlError>,
876 ) -> Result<(), fidl::Error> {
877 self.control_handle.inner.send::<fidl::encoding::ResultType<
878 fidl::encoding::EmptyStruct,
879 SystemActivityControlError,
880 >>(
881 result,
882 self.tx_id,
883 0x2881d47bba86f3d4,
884 fidl::encoding::DynamicFlags::empty(),
885 )
886 }
887}
888
889#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
890pub struct TopologyControlMarker;
891
892impl fidl::endpoints::ProtocolMarker for TopologyControlMarker {
893 type Proxy = TopologyControlProxy;
894 type RequestStream = TopologyControlRequestStream;
895 #[cfg(target_os = "fuchsia")]
896 type SynchronousProxy = TopologyControlSynchronousProxy;
897
898 const DEBUG_NAME: &'static str = "fuchsia.power.topology.test.TopologyControl";
899}
900impl fidl::endpoints::DiscoverableProtocolMarker for TopologyControlMarker {}
901pub type TopologyControlCreateResult = Result<(), CreateTopologyGraphError>;
902pub type TopologyControlAcquireLeaseResult = Result<(), LeaseControlError>;
903pub type TopologyControlDropLeaseResult = Result<(), LeaseControlError>;
904pub type TopologyControlOpenStatusChannelResult = Result<(), OpenStatusChannelError>;
905
906pub trait TopologyControlProxyInterface: Send + Sync {
907 type CreateResponseFut: std::future::Future<Output = Result<TopologyControlCreateResult, fidl::Error>>
908 + Send;
909 fn r#create(&self, elements: &[Element]) -> Self::CreateResponseFut;
910 type AcquireLeaseResponseFut: std::future::Future<Output = Result<TopologyControlAcquireLeaseResult, fidl::Error>>
911 + Send;
912 fn r#acquire_lease(&self, element_name: &str, level: u8) -> Self::AcquireLeaseResponseFut;
913 type DropLeaseResponseFut: std::future::Future<Output = Result<TopologyControlDropLeaseResult, fidl::Error>>
914 + Send;
915 fn r#drop_lease(&self, element_name: &str) -> Self::DropLeaseResponseFut;
916 type OpenStatusChannelResponseFut: std::future::Future<Output = Result<TopologyControlOpenStatusChannelResult, fidl::Error>>
917 + Send;
918 fn r#open_status_channel(
919 &self,
920 element_name: &str,
921 status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
922 ) -> Self::OpenStatusChannelResponseFut;
923}
924#[derive(Debug)]
925#[cfg(target_os = "fuchsia")]
926pub struct TopologyControlSynchronousProxy {
927 client: fidl::client::sync::Client,
928}
929
930#[cfg(target_os = "fuchsia")]
931impl fidl::endpoints::SynchronousProxy for TopologyControlSynchronousProxy {
932 type Proxy = TopologyControlProxy;
933 type Protocol = TopologyControlMarker;
934
935 fn from_channel(inner: fidl::Channel) -> Self {
936 Self::new(inner)
937 }
938
939 fn into_channel(self) -> fidl::Channel {
940 self.client.into_channel()
941 }
942
943 fn as_channel(&self) -> &fidl::Channel {
944 self.client.as_channel()
945 }
946}
947
948#[cfg(target_os = "fuchsia")]
949impl TopologyControlSynchronousProxy {
950 pub fn new(channel: fidl::Channel) -> Self {
951 let protocol_name = <TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
952 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
953 }
954
955 pub fn into_channel(self) -> fidl::Channel {
956 self.client.into_channel()
957 }
958
959 pub fn wait_for_event(
962 &self,
963 deadline: zx::MonotonicInstant,
964 ) -> Result<TopologyControlEvent, fidl::Error> {
965 TopologyControlEvent::decode(self.client.wait_for_event(deadline)?)
966 }
967
968 pub fn r#create(
969 &self,
970 mut elements: &[Element],
971 ___deadline: zx::MonotonicInstant,
972 ) -> Result<TopologyControlCreateResult, fidl::Error> {
973 let _response =
974 self.client.send_query::<TopologyControlCreateRequest, fidl::encoding::ResultType<
975 fidl::encoding::EmptyStruct,
976 CreateTopologyGraphError,
977 >>(
978 (elements,),
979 0x12033976b88716fa,
980 fidl::encoding::DynamicFlags::empty(),
981 ___deadline,
982 )?;
983 Ok(_response.map(|x| x))
984 }
985
986 pub fn r#acquire_lease(
987 &self,
988 mut element_name: &str,
989 mut level: u8,
990 ___deadline: zx::MonotonicInstant,
991 ) -> Result<TopologyControlAcquireLeaseResult, fidl::Error> {
992 let _response = self.client.send_query::<
993 TopologyControlAcquireLeaseRequest,
994 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
995 >(
996 (element_name, level,),
997 0x1bedc35d9b68bac8,
998 fidl::encoding::DynamicFlags::empty(),
999 ___deadline,
1000 )?;
1001 Ok(_response.map(|x| x))
1002 }
1003
1004 pub fn r#drop_lease(
1005 &self,
1006 mut element_name: &str,
1007 ___deadline: zx::MonotonicInstant,
1008 ) -> Result<TopologyControlDropLeaseResult, fidl::Error> {
1009 let _response =
1010 self.client.send_query::<TopologyControlDropLeaseRequest, fidl::encoding::ResultType<
1011 fidl::encoding::EmptyStruct,
1012 LeaseControlError,
1013 >>(
1014 (element_name,),
1015 0x7107f8f1080faddc,
1016 fidl::encoding::DynamicFlags::empty(),
1017 ___deadline,
1018 )?;
1019 Ok(_response.map(|x| x))
1020 }
1021
1022 pub fn r#open_status_channel(
1025 &self,
1026 mut element_name: &str,
1027 mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1028 ___deadline: zx::MonotonicInstant,
1029 ) -> Result<TopologyControlOpenStatusChannelResult, fidl::Error> {
1030 let _response = self.client.send_query::<
1031 TopologyControlOpenStatusChannelRequest,
1032 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenStatusChannelError>,
1033 >(
1034 (element_name, status_channel,),
1035 0x69fba616c3ee2e90,
1036 fidl::encoding::DynamicFlags::empty(),
1037 ___deadline,
1038 )?;
1039 Ok(_response.map(|x| x))
1040 }
1041}
1042
1043#[cfg(target_os = "fuchsia")]
1044impl From<TopologyControlSynchronousProxy> for zx::NullableHandle {
1045 fn from(value: TopologyControlSynchronousProxy) -> Self {
1046 value.into_channel().into()
1047 }
1048}
1049
1050#[cfg(target_os = "fuchsia")]
1051impl From<fidl::Channel> for TopologyControlSynchronousProxy {
1052 fn from(value: fidl::Channel) -> Self {
1053 Self::new(value)
1054 }
1055}
1056
1057#[cfg(target_os = "fuchsia")]
1058impl fidl::endpoints::FromClient for TopologyControlSynchronousProxy {
1059 type Protocol = TopologyControlMarker;
1060
1061 fn from_client(value: fidl::endpoints::ClientEnd<TopologyControlMarker>) -> Self {
1062 Self::new(value.into_channel())
1063 }
1064}
1065
1066#[derive(Debug, Clone)]
1067pub struct TopologyControlProxy {
1068 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1069}
1070
1071impl fidl::endpoints::Proxy for TopologyControlProxy {
1072 type Protocol = TopologyControlMarker;
1073
1074 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1075 Self::new(inner)
1076 }
1077
1078 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1079 self.client.into_channel().map_err(|client| Self { client })
1080 }
1081
1082 fn as_channel(&self) -> &::fidl::AsyncChannel {
1083 self.client.as_channel()
1084 }
1085}
1086
1087impl TopologyControlProxy {
1088 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1090 let protocol_name = <TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1091 Self { client: fidl::client::Client::new(channel, protocol_name) }
1092 }
1093
1094 pub fn take_event_stream(&self) -> TopologyControlEventStream {
1100 TopologyControlEventStream { event_receiver: self.client.take_event_receiver() }
1101 }
1102
1103 pub fn r#create(
1104 &self,
1105 mut elements: &[Element],
1106 ) -> fidl::client::QueryResponseFut<
1107 TopologyControlCreateResult,
1108 fidl::encoding::DefaultFuchsiaResourceDialect,
1109 > {
1110 TopologyControlProxyInterface::r#create(self, elements)
1111 }
1112
1113 pub fn r#acquire_lease(
1114 &self,
1115 mut element_name: &str,
1116 mut level: u8,
1117 ) -> fidl::client::QueryResponseFut<
1118 TopologyControlAcquireLeaseResult,
1119 fidl::encoding::DefaultFuchsiaResourceDialect,
1120 > {
1121 TopologyControlProxyInterface::r#acquire_lease(self, element_name, level)
1122 }
1123
1124 pub fn r#drop_lease(
1125 &self,
1126 mut element_name: &str,
1127 ) -> fidl::client::QueryResponseFut<
1128 TopologyControlDropLeaseResult,
1129 fidl::encoding::DefaultFuchsiaResourceDialect,
1130 > {
1131 TopologyControlProxyInterface::r#drop_lease(self, element_name)
1132 }
1133
1134 pub fn r#open_status_channel(
1137 &self,
1138 mut element_name: &str,
1139 mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1140 ) -> fidl::client::QueryResponseFut<
1141 TopologyControlOpenStatusChannelResult,
1142 fidl::encoding::DefaultFuchsiaResourceDialect,
1143 > {
1144 TopologyControlProxyInterface::r#open_status_channel(self, element_name, status_channel)
1145 }
1146}
1147
1148impl TopologyControlProxyInterface for TopologyControlProxy {
1149 type CreateResponseFut = fidl::client::QueryResponseFut<
1150 TopologyControlCreateResult,
1151 fidl::encoding::DefaultFuchsiaResourceDialect,
1152 >;
1153 fn r#create(&self, mut elements: &[Element]) -> Self::CreateResponseFut {
1154 fn _decode(
1155 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1156 ) -> Result<TopologyControlCreateResult, fidl::Error> {
1157 let _response = fidl::client::decode_transaction_body::<
1158 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CreateTopologyGraphError>,
1159 fidl::encoding::DefaultFuchsiaResourceDialect,
1160 0x12033976b88716fa,
1161 >(_buf?)?;
1162 Ok(_response.map(|x| x))
1163 }
1164 self.client
1165 .send_query_and_decode::<TopologyControlCreateRequest, TopologyControlCreateResult>(
1166 (elements,),
1167 0x12033976b88716fa,
1168 fidl::encoding::DynamicFlags::empty(),
1169 _decode,
1170 )
1171 }
1172
1173 type AcquireLeaseResponseFut = fidl::client::QueryResponseFut<
1174 TopologyControlAcquireLeaseResult,
1175 fidl::encoding::DefaultFuchsiaResourceDialect,
1176 >;
1177 fn r#acquire_lease(
1178 &self,
1179 mut element_name: &str,
1180 mut level: u8,
1181 ) -> Self::AcquireLeaseResponseFut {
1182 fn _decode(
1183 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1184 ) -> Result<TopologyControlAcquireLeaseResult, fidl::Error> {
1185 let _response = fidl::client::decode_transaction_body::<
1186 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
1187 fidl::encoding::DefaultFuchsiaResourceDialect,
1188 0x1bedc35d9b68bac8,
1189 >(_buf?)?;
1190 Ok(_response.map(|x| x))
1191 }
1192 self.client.send_query_and_decode::<
1193 TopologyControlAcquireLeaseRequest,
1194 TopologyControlAcquireLeaseResult,
1195 >(
1196 (element_name, level,),
1197 0x1bedc35d9b68bac8,
1198 fidl::encoding::DynamicFlags::empty(),
1199 _decode,
1200 )
1201 }
1202
1203 type DropLeaseResponseFut = fidl::client::QueryResponseFut<
1204 TopologyControlDropLeaseResult,
1205 fidl::encoding::DefaultFuchsiaResourceDialect,
1206 >;
1207 fn r#drop_lease(&self, mut element_name: &str) -> Self::DropLeaseResponseFut {
1208 fn _decode(
1209 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1210 ) -> Result<TopologyControlDropLeaseResult, fidl::Error> {
1211 let _response = fidl::client::decode_transaction_body::<
1212 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
1213 fidl::encoding::DefaultFuchsiaResourceDialect,
1214 0x7107f8f1080faddc,
1215 >(_buf?)?;
1216 Ok(_response.map(|x| x))
1217 }
1218 self.client.send_query_and_decode::<
1219 TopologyControlDropLeaseRequest,
1220 TopologyControlDropLeaseResult,
1221 >(
1222 (element_name,),
1223 0x7107f8f1080faddc,
1224 fidl::encoding::DynamicFlags::empty(),
1225 _decode,
1226 )
1227 }
1228
1229 type OpenStatusChannelResponseFut = fidl::client::QueryResponseFut<
1230 TopologyControlOpenStatusChannelResult,
1231 fidl::encoding::DefaultFuchsiaResourceDialect,
1232 >;
1233 fn r#open_status_channel(
1234 &self,
1235 mut element_name: &str,
1236 mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1237 ) -> Self::OpenStatusChannelResponseFut {
1238 fn _decode(
1239 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1240 ) -> Result<TopologyControlOpenStatusChannelResult, fidl::Error> {
1241 let _response = fidl::client::decode_transaction_body::<
1242 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenStatusChannelError>,
1243 fidl::encoding::DefaultFuchsiaResourceDialect,
1244 0x69fba616c3ee2e90,
1245 >(_buf?)?;
1246 Ok(_response.map(|x| x))
1247 }
1248 self.client.send_query_and_decode::<
1249 TopologyControlOpenStatusChannelRequest,
1250 TopologyControlOpenStatusChannelResult,
1251 >(
1252 (element_name, status_channel,),
1253 0x69fba616c3ee2e90,
1254 fidl::encoding::DynamicFlags::empty(),
1255 _decode,
1256 )
1257 }
1258}
1259
1260pub struct TopologyControlEventStream {
1261 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1262}
1263
1264impl std::marker::Unpin for TopologyControlEventStream {}
1265
1266impl futures::stream::FusedStream for TopologyControlEventStream {
1267 fn is_terminated(&self) -> bool {
1268 self.event_receiver.is_terminated()
1269 }
1270}
1271
1272impl futures::Stream for TopologyControlEventStream {
1273 type Item = Result<TopologyControlEvent, fidl::Error>;
1274
1275 fn poll_next(
1276 mut self: std::pin::Pin<&mut Self>,
1277 cx: &mut std::task::Context<'_>,
1278 ) -> std::task::Poll<Option<Self::Item>> {
1279 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1280 &mut self.event_receiver,
1281 cx
1282 )?) {
1283 Some(buf) => std::task::Poll::Ready(Some(TopologyControlEvent::decode(buf))),
1284 None => std::task::Poll::Ready(None),
1285 }
1286 }
1287}
1288
1289#[derive(Debug)]
1290pub enum TopologyControlEvent {
1291 #[non_exhaustive]
1292 _UnknownEvent {
1293 ordinal: u64,
1295 },
1296}
1297
1298impl TopologyControlEvent {
1299 fn decode(
1301 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1302 ) -> Result<TopologyControlEvent, fidl::Error> {
1303 let (bytes, _handles) = buf.split_mut();
1304 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1305 debug_assert_eq!(tx_header.tx_id, 0);
1306 match tx_header.ordinal {
1307 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1308 Ok(TopologyControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1309 }
1310 _ => Err(fidl::Error::UnknownOrdinal {
1311 ordinal: tx_header.ordinal,
1312 protocol_name:
1313 <TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1314 }),
1315 }
1316 }
1317}
1318
1319pub struct TopologyControlRequestStream {
1321 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1322 is_terminated: bool,
1323}
1324
1325impl std::marker::Unpin for TopologyControlRequestStream {}
1326
1327impl futures::stream::FusedStream for TopologyControlRequestStream {
1328 fn is_terminated(&self) -> bool {
1329 self.is_terminated
1330 }
1331}
1332
1333impl fidl::endpoints::RequestStream for TopologyControlRequestStream {
1334 type Protocol = TopologyControlMarker;
1335 type ControlHandle = TopologyControlControlHandle;
1336
1337 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1338 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1339 }
1340
1341 fn control_handle(&self) -> Self::ControlHandle {
1342 TopologyControlControlHandle { inner: self.inner.clone() }
1343 }
1344
1345 fn into_inner(
1346 self,
1347 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1348 {
1349 (self.inner, self.is_terminated)
1350 }
1351
1352 fn from_inner(
1353 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1354 is_terminated: bool,
1355 ) -> Self {
1356 Self { inner, is_terminated }
1357 }
1358}
1359
1360impl futures::Stream for TopologyControlRequestStream {
1361 type Item = Result<TopologyControlRequest, fidl::Error>;
1362
1363 fn poll_next(
1364 mut self: std::pin::Pin<&mut Self>,
1365 cx: &mut std::task::Context<'_>,
1366 ) -> std::task::Poll<Option<Self::Item>> {
1367 let this = &mut *self;
1368 if this.inner.check_shutdown(cx) {
1369 this.is_terminated = true;
1370 return std::task::Poll::Ready(None);
1371 }
1372 if this.is_terminated {
1373 panic!("polled TopologyControlRequestStream after completion");
1374 }
1375 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1376 |bytes, handles| {
1377 match this.inner.channel().read_etc(cx, bytes, handles) {
1378 std::task::Poll::Ready(Ok(())) => {}
1379 std::task::Poll::Pending => return std::task::Poll::Pending,
1380 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1381 this.is_terminated = true;
1382 return std::task::Poll::Ready(None);
1383 }
1384 std::task::Poll::Ready(Err(e)) => {
1385 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1386 e.into(),
1387 ))));
1388 }
1389 }
1390
1391 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1393
1394 std::task::Poll::Ready(Some(match header.ordinal {
1395 0x12033976b88716fa => {
1396 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1397 let mut req = fidl::new_empty!(
1398 TopologyControlCreateRequest,
1399 fidl::encoding::DefaultFuchsiaResourceDialect
1400 );
1401 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1402 let control_handle =
1403 TopologyControlControlHandle { inner: this.inner.clone() };
1404 Ok(TopologyControlRequest::Create {
1405 elements: req.elements,
1406
1407 responder: TopologyControlCreateResponder {
1408 control_handle: std::mem::ManuallyDrop::new(control_handle),
1409 tx_id: header.tx_id,
1410 },
1411 })
1412 }
1413 0x1bedc35d9b68bac8 => {
1414 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1415 let mut req = fidl::new_empty!(
1416 TopologyControlAcquireLeaseRequest,
1417 fidl::encoding::DefaultFuchsiaResourceDialect
1418 );
1419 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlAcquireLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1420 let control_handle =
1421 TopologyControlControlHandle { inner: this.inner.clone() };
1422 Ok(TopologyControlRequest::AcquireLease {
1423 element_name: req.element_name,
1424 level: req.level,
1425
1426 responder: TopologyControlAcquireLeaseResponder {
1427 control_handle: std::mem::ManuallyDrop::new(control_handle),
1428 tx_id: header.tx_id,
1429 },
1430 })
1431 }
1432 0x7107f8f1080faddc => {
1433 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1434 let mut req = fidl::new_empty!(
1435 TopologyControlDropLeaseRequest,
1436 fidl::encoding::DefaultFuchsiaResourceDialect
1437 );
1438 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlDropLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
1439 let control_handle =
1440 TopologyControlControlHandle { inner: this.inner.clone() };
1441 Ok(TopologyControlRequest::DropLease {
1442 element_name: req.element_name,
1443
1444 responder: TopologyControlDropLeaseResponder {
1445 control_handle: std::mem::ManuallyDrop::new(control_handle),
1446 tx_id: header.tx_id,
1447 },
1448 })
1449 }
1450 0x69fba616c3ee2e90 => {
1451 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1452 let mut req = fidl::new_empty!(
1453 TopologyControlOpenStatusChannelRequest,
1454 fidl::encoding::DefaultFuchsiaResourceDialect
1455 );
1456 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlOpenStatusChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1457 let control_handle =
1458 TopologyControlControlHandle { inner: this.inner.clone() };
1459 Ok(TopologyControlRequest::OpenStatusChannel {
1460 element_name: req.element_name,
1461 status_channel: req.status_channel,
1462
1463 responder: TopologyControlOpenStatusChannelResponder {
1464 control_handle: std::mem::ManuallyDrop::new(control_handle),
1465 tx_id: header.tx_id,
1466 },
1467 })
1468 }
1469 _ if header.tx_id == 0
1470 && header
1471 .dynamic_flags()
1472 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1473 {
1474 Ok(TopologyControlRequest::_UnknownMethod {
1475 ordinal: header.ordinal,
1476 control_handle: TopologyControlControlHandle {
1477 inner: this.inner.clone(),
1478 },
1479 method_type: fidl::MethodType::OneWay,
1480 })
1481 }
1482 _ if header
1483 .dynamic_flags()
1484 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1485 {
1486 this.inner.send_framework_err(
1487 fidl::encoding::FrameworkErr::UnknownMethod,
1488 header.tx_id,
1489 header.ordinal,
1490 header.dynamic_flags(),
1491 (bytes, handles),
1492 )?;
1493 Ok(TopologyControlRequest::_UnknownMethod {
1494 ordinal: header.ordinal,
1495 control_handle: TopologyControlControlHandle {
1496 inner: this.inner.clone(),
1497 },
1498 method_type: fidl::MethodType::TwoWay,
1499 })
1500 }
1501 _ => Err(fidl::Error::UnknownOrdinal {
1502 ordinal: header.ordinal,
1503 protocol_name:
1504 <TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1505 }),
1506 }))
1507 },
1508 )
1509 }
1510}
1511
1512#[derive(Debug)]
1516pub enum TopologyControlRequest {
1517 Create {
1518 elements: Vec<Element>,
1519 responder: TopologyControlCreateResponder,
1520 },
1521 AcquireLease {
1522 element_name: String,
1523 level: u8,
1524 responder: TopologyControlAcquireLeaseResponder,
1525 },
1526 DropLease {
1527 element_name: String,
1528 responder: TopologyControlDropLeaseResponder,
1529 },
1530 OpenStatusChannel {
1533 element_name: String,
1534 status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1535 responder: TopologyControlOpenStatusChannelResponder,
1536 },
1537 #[non_exhaustive]
1539 _UnknownMethod {
1540 ordinal: u64,
1542 control_handle: TopologyControlControlHandle,
1543 method_type: fidl::MethodType,
1544 },
1545}
1546
1547impl TopologyControlRequest {
1548 #[allow(irrefutable_let_patterns)]
1549 pub fn into_create(self) -> Option<(Vec<Element>, TopologyControlCreateResponder)> {
1550 if let TopologyControlRequest::Create { elements, responder } = self {
1551 Some((elements, responder))
1552 } else {
1553 None
1554 }
1555 }
1556
1557 #[allow(irrefutable_let_patterns)]
1558 pub fn into_acquire_lease(self) -> Option<(String, u8, TopologyControlAcquireLeaseResponder)> {
1559 if let TopologyControlRequest::AcquireLease { element_name, level, responder } = self {
1560 Some((element_name, level, responder))
1561 } else {
1562 None
1563 }
1564 }
1565
1566 #[allow(irrefutable_let_patterns)]
1567 pub fn into_drop_lease(self) -> Option<(String, TopologyControlDropLeaseResponder)> {
1568 if let TopologyControlRequest::DropLease { element_name, responder } = self {
1569 Some((element_name, responder))
1570 } else {
1571 None
1572 }
1573 }
1574
1575 #[allow(irrefutable_let_patterns)]
1576 pub fn into_open_status_channel(
1577 self,
1578 ) -> Option<(
1579 String,
1580 fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1581 TopologyControlOpenStatusChannelResponder,
1582 )> {
1583 if let TopologyControlRequest::OpenStatusChannel {
1584 element_name,
1585 status_channel,
1586 responder,
1587 } = self
1588 {
1589 Some((element_name, status_channel, responder))
1590 } else {
1591 None
1592 }
1593 }
1594
1595 pub fn method_name(&self) -> &'static str {
1597 match *self {
1598 TopologyControlRequest::Create { .. } => "create",
1599 TopologyControlRequest::AcquireLease { .. } => "acquire_lease",
1600 TopologyControlRequest::DropLease { .. } => "drop_lease",
1601 TopologyControlRequest::OpenStatusChannel { .. } => "open_status_channel",
1602 TopologyControlRequest::_UnknownMethod {
1603 method_type: fidl::MethodType::OneWay,
1604 ..
1605 } => "unknown one-way method",
1606 TopologyControlRequest::_UnknownMethod {
1607 method_type: fidl::MethodType::TwoWay,
1608 ..
1609 } => "unknown two-way method",
1610 }
1611 }
1612}
1613
1614#[derive(Debug, Clone)]
1615pub struct TopologyControlControlHandle {
1616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1617}
1618
1619impl fidl::endpoints::ControlHandle for TopologyControlControlHandle {
1620 fn shutdown(&self) {
1621 self.inner.shutdown()
1622 }
1623
1624 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1625 self.inner.shutdown_with_epitaph(status)
1626 }
1627
1628 fn is_closed(&self) -> bool {
1629 self.inner.channel().is_closed()
1630 }
1631 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1632 self.inner.channel().on_closed()
1633 }
1634
1635 #[cfg(target_os = "fuchsia")]
1636 fn signal_peer(
1637 &self,
1638 clear_mask: zx::Signals,
1639 set_mask: zx::Signals,
1640 ) -> Result<(), zx_status::Status> {
1641 use fidl::Peered;
1642 self.inner.channel().signal_peer(clear_mask, set_mask)
1643 }
1644}
1645
1646impl TopologyControlControlHandle {}
1647
1648#[must_use = "FIDL methods require a response to be sent"]
1649#[derive(Debug)]
1650pub struct TopologyControlCreateResponder {
1651 control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
1652 tx_id: u32,
1653}
1654
1655impl std::ops::Drop for TopologyControlCreateResponder {
1659 fn drop(&mut self) {
1660 self.control_handle.shutdown();
1661 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1663 }
1664}
1665
1666impl fidl::endpoints::Responder for TopologyControlCreateResponder {
1667 type ControlHandle = TopologyControlControlHandle;
1668
1669 fn control_handle(&self) -> &TopologyControlControlHandle {
1670 &self.control_handle
1671 }
1672
1673 fn drop_without_shutdown(mut self) {
1674 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1676 std::mem::forget(self);
1678 }
1679}
1680
1681impl TopologyControlCreateResponder {
1682 pub fn send(self, mut result: Result<(), CreateTopologyGraphError>) -> Result<(), fidl::Error> {
1686 let _result = self.send_raw(result);
1687 if _result.is_err() {
1688 self.control_handle.shutdown();
1689 }
1690 self.drop_without_shutdown();
1691 _result
1692 }
1693
1694 pub fn send_no_shutdown_on_err(
1696 self,
1697 mut result: Result<(), CreateTopologyGraphError>,
1698 ) -> Result<(), fidl::Error> {
1699 let _result = self.send_raw(result);
1700 self.drop_without_shutdown();
1701 _result
1702 }
1703
1704 fn send_raw(
1705 &self,
1706 mut result: Result<(), CreateTopologyGraphError>,
1707 ) -> Result<(), fidl::Error> {
1708 self.control_handle.inner.send::<fidl::encoding::ResultType<
1709 fidl::encoding::EmptyStruct,
1710 CreateTopologyGraphError,
1711 >>(
1712 result,
1713 self.tx_id,
1714 0x12033976b88716fa,
1715 fidl::encoding::DynamicFlags::empty(),
1716 )
1717 }
1718}
1719
1720#[must_use = "FIDL methods require a response to be sent"]
1721#[derive(Debug)]
1722pub struct TopologyControlAcquireLeaseResponder {
1723 control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
1724 tx_id: u32,
1725}
1726
1727impl std::ops::Drop for TopologyControlAcquireLeaseResponder {
1731 fn drop(&mut self) {
1732 self.control_handle.shutdown();
1733 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1735 }
1736}
1737
1738impl fidl::endpoints::Responder for TopologyControlAcquireLeaseResponder {
1739 type ControlHandle = TopologyControlControlHandle;
1740
1741 fn control_handle(&self) -> &TopologyControlControlHandle {
1742 &self.control_handle
1743 }
1744
1745 fn drop_without_shutdown(mut self) {
1746 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1748 std::mem::forget(self);
1750 }
1751}
1752
1753impl TopologyControlAcquireLeaseResponder {
1754 pub fn send(self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
1758 let _result = self.send_raw(result);
1759 if _result.is_err() {
1760 self.control_handle.shutdown();
1761 }
1762 self.drop_without_shutdown();
1763 _result
1764 }
1765
1766 pub fn send_no_shutdown_on_err(
1768 self,
1769 mut result: Result<(), LeaseControlError>,
1770 ) -> Result<(), fidl::Error> {
1771 let _result = self.send_raw(result);
1772 self.drop_without_shutdown();
1773 _result
1774 }
1775
1776 fn send_raw(&self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
1777 self.control_handle.inner.send::<fidl::encoding::ResultType<
1778 fidl::encoding::EmptyStruct,
1779 LeaseControlError,
1780 >>(
1781 result,
1782 self.tx_id,
1783 0x1bedc35d9b68bac8,
1784 fidl::encoding::DynamicFlags::empty(),
1785 )
1786 }
1787}
1788
1789#[must_use = "FIDL methods require a response to be sent"]
1790#[derive(Debug)]
1791pub struct TopologyControlDropLeaseResponder {
1792 control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
1793 tx_id: u32,
1794}
1795
1796impl std::ops::Drop for TopologyControlDropLeaseResponder {
1800 fn drop(&mut self) {
1801 self.control_handle.shutdown();
1802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1804 }
1805}
1806
1807impl fidl::endpoints::Responder for TopologyControlDropLeaseResponder {
1808 type ControlHandle = TopologyControlControlHandle;
1809
1810 fn control_handle(&self) -> &TopologyControlControlHandle {
1811 &self.control_handle
1812 }
1813
1814 fn drop_without_shutdown(mut self) {
1815 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1817 std::mem::forget(self);
1819 }
1820}
1821
1822impl TopologyControlDropLeaseResponder {
1823 pub fn send(self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
1827 let _result = self.send_raw(result);
1828 if _result.is_err() {
1829 self.control_handle.shutdown();
1830 }
1831 self.drop_without_shutdown();
1832 _result
1833 }
1834
1835 pub fn send_no_shutdown_on_err(
1837 self,
1838 mut result: Result<(), LeaseControlError>,
1839 ) -> Result<(), fidl::Error> {
1840 let _result = self.send_raw(result);
1841 self.drop_without_shutdown();
1842 _result
1843 }
1844
1845 fn send_raw(&self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
1846 self.control_handle.inner.send::<fidl::encoding::ResultType<
1847 fidl::encoding::EmptyStruct,
1848 LeaseControlError,
1849 >>(
1850 result,
1851 self.tx_id,
1852 0x7107f8f1080faddc,
1853 fidl::encoding::DynamicFlags::empty(),
1854 )
1855 }
1856}
1857
1858#[must_use = "FIDL methods require a response to be sent"]
1859#[derive(Debug)]
1860pub struct TopologyControlOpenStatusChannelResponder {
1861 control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
1862 tx_id: u32,
1863}
1864
1865impl std::ops::Drop for TopologyControlOpenStatusChannelResponder {
1869 fn drop(&mut self) {
1870 self.control_handle.shutdown();
1871 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1873 }
1874}
1875
1876impl fidl::endpoints::Responder for TopologyControlOpenStatusChannelResponder {
1877 type ControlHandle = TopologyControlControlHandle;
1878
1879 fn control_handle(&self) -> &TopologyControlControlHandle {
1880 &self.control_handle
1881 }
1882
1883 fn drop_without_shutdown(mut self) {
1884 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1886 std::mem::forget(self);
1888 }
1889}
1890
1891impl TopologyControlOpenStatusChannelResponder {
1892 pub fn send(self, mut result: Result<(), OpenStatusChannelError>) -> Result<(), fidl::Error> {
1896 let _result = self.send_raw(result);
1897 if _result.is_err() {
1898 self.control_handle.shutdown();
1899 }
1900 self.drop_without_shutdown();
1901 _result
1902 }
1903
1904 pub fn send_no_shutdown_on_err(
1906 self,
1907 mut result: Result<(), OpenStatusChannelError>,
1908 ) -> Result<(), fidl::Error> {
1909 let _result = self.send_raw(result);
1910 self.drop_without_shutdown();
1911 _result
1912 }
1913
1914 fn send_raw(&self, mut result: Result<(), OpenStatusChannelError>) -> Result<(), fidl::Error> {
1915 self.control_handle.inner.send::<fidl::encoding::ResultType<
1916 fidl::encoding::EmptyStruct,
1917 OpenStatusChannelError,
1918 >>(
1919 result,
1920 self.tx_id,
1921 0x69fba616c3ee2e90,
1922 fidl::encoding::DynamicFlags::empty(),
1923 )
1924 }
1925}
1926
1927mod internal {
1928 use super::*;
1929
1930 impl fidl::encoding::ResourceTypeMarker for TopologyControlOpenStatusChannelRequest {
1931 type Borrowed<'a> = &'a mut Self;
1932 fn take_or_borrow<'a>(
1933 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1934 ) -> Self::Borrowed<'a> {
1935 value
1936 }
1937 }
1938
1939 unsafe impl fidl::encoding::TypeMarker for TopologyControlOpenStatusChannelRequest {
1940 type Owned = Self;
1941
1942 #[inline(always)]
1943 fn inline_align(_context: fidl::encoding::Context) -> usize {
1944 8
1945 }
1946
1947 #[inline(always)]
1948 fn inline_size(_context: fidl::encoding::Context) -> usize {
1949 24
1950 }
1951 }
1952
1953 unsafe impl
1954 fidl::encoding::Encode<
1955 TopologyControlOpenStatusChannelRequest,
1956 fidl::encoding::DefaultFuchsiaResourceDialect,
1957 > for &mut TopologyControlOpenStatusChannelRequest
1958 {
1959 #[inline]
1960 unsafe fn encode(
1961 self,
1962 encoder: &mut fidl::encoding::Encoder<
1963 '_,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 >,
1966 offset: usize,
1967 _depth: fidl::encoding::Depth,
1968 ) -> fidl::Result<()> {
1969 encoder.debug_check_bounds::<TopologyControlOpenStatusChannelRequest>(offset);
1970 fidl::encoding::Encode::<
1972 TopologyControlOpenStatusChannelRequest,
1973 fidl::encoding::DefaultFuchsiaResourceDialect,
1974 >::encode(
1975 (
1976 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1977 &self.element_name,
1978 ),
1979 <fidl::encoding::Endpoint<
1980 fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1981 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1982 &mut self.status_channel,
1983 ),
1984 ),
1985 encoder,
1986 offset,
1987 _depth,
1988 )
1989 }
1990 }
1991 unsafe impl<
1992 T0: fidl::encoding::Encode<
1993 fidl::encoding::BoundedString<64>,
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 >,
1996 T1: fidl::encoding::Encode<
1997 fidl::encoding::Endpoint<
1998 fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
1999 >,
2000 fidl::encoding::DefaultFuchsiaResourceDialect,
2001 >,
2002 >
2003 fidl::encoding::Encode<
2004 TopologyControlOpenStatusChannelRequest,
2005 fidl::encoding::DefaultFuchsiaResourceDialect,
2006 > for (T0, T1)
2007 {
2008 #[inline]
2009 unsafe fn encode(
2010 self,
2011 encoder: &mut fidl::encoding::Encoder<
2012 '_,
2013 fidl::encoding::DefaultFuchsiaResourceDialect,
2014 >,
2015 offset: usize,
2016 depth: fidl::encoding::Depth,
2017 ) -> fidl::Result<()> {
2018 encoder.debug_check_bounds::<TopologyControlOpenStatusChannelRequest>(offset);
2019 unsafe {
2022 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2023 (ptr as *mut u64).write_unaligned(0);
2024 }
2025 self.0.encode(encoder, offset + 0, depth)?;
2027 self.1.encode(encoder, offset + 16, depth)?;
2028 Ok(())
2029 }
2030 }
2031
2032 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2033 for TopologyControlOpenStatusChannelRequest
2034 {
2035 #[inline(always)]
2036 fn new_empty() -> Self {
2037 Self {
2038 element_name: fidl::new_empty!(
2039 fidl::encoding::BoundedString<64>,
2040 fidl::encoding::DefaultFuchsiaResourceDialect
2041 ),
2042 status_channel: fidl::new_empty!(
2043 fidl::encoding::Endpoint<
2044 fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
2045 >,
2046 fidl::encoding::DefaultFuchsiaResourceDialect
2047 ),
2048 }
2049 }
2050
2051 #[inline]
2052 unsafe fn decode(
2053 &mut self,
2054 decoder: &mut fidl::encoding::Decoder<
2055 '_,
2056 fidl::encoding::DefaultFuchsiaResourceDialect,
2057 >,
2058 offset: usize,
2059 _depth: fidl::encoding::Depth,
2060 ) -> fidl::Result<()> {
2061 decoder.debug_check_bounds::<Self>(offset);
2062 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2064 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2065 let mask = 0xffffffff00000000u64;
2066 let maskedval = padval & mask;
2067 if maskedval != 0 {
2068 return Err(fidl::Error::NonZeroPadding {
2069 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2070 });
2071 }
2072 fidl::decode!(
2073 fidl::encoding::BoundedString<64>,
2074 fidl::encoding::DefaultFuchsiaResourceDialect,
2075 &mut self.element_name,
2076 decoder,
2077 offset + 0,
2078 _depth
2079 )?;
2080 fidl::decode!(
2081 fidl::encoding::Endpoint<
2082 fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
2083 >,
2084 fidl::encoding::DefaultFuchsiaResourceDialect,
2085 &mut self.status_channel,
2086 decoder,
2087 offset + 16,
2088 _depth
2089 )?;
2090 Ok(())
2091 }
2092 }
2093}