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_broker__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14pub type DependencyToken = fidl::Event;
18
19#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct ElementControlOpenStatusChannelRequest {
21 pub status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
22}
23
24impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
25 for ElementControlOpenStatusChannelRequest
26{
27}
28
29#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
30pub struct ElementControlRegisterDependencyTokenRequest {
31 pub token: fidl::Event,
32 pub dependency_type: DependencyType,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
36 for ElementControlRegisterDependencyTokenRequest
37{
38}
39
40#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
41pub struct ElementControlUnregisterDependencyTokenRequest {
42 pub token: fidl::Event,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46 for ElementControlUnregisterDependencyTokenRequest
47{
48}
49
50#[derive(Debug, PartialEq)]
51pub struct ElementInfoProviderGetElementPowerLevelNamesResponse {
52 pub level_names: Vec<ElementPowerLevelNames>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56 for ElementInfoProviderGetElementPowerLevelNamesResponse
57{
58}
59
60#[derive(Debug, PartialEq)]
61pub struct ElementInfoProviderGetStatusEndpointsResponse {
62 pub endpoints: Vec<ElementStatusEndpoint>,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66 for ElementInfoProviderGetStatusEndpointsResponse
67{
68}
69
70#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71#[repr(C)]
72pub struct LessorLeaseRequest {
73 pub level: u8,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LessorLeaseRequest {}
78
79#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80pub struct LessorLeaseResponse {
81 pub lease_control: fidl::endpoints::ClientEnd<LeaseControlMarker>,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LessorLeaseResponse {}
87
88#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct LevelDependency {
106 pub dependency_type: DependencyType,
110 pub dependent_level: u8,
114 pub requires_token: fidl::Event,
117 pub requires_level_by_preference: Vec<u8>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LevelDependency {}
129
130#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131#[repr(C)]
132pub struct StatusWatchPowerLevelResponse {
133 pub current_level: u8,
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
137 for StatusWatchPowerLevelResponse
138{
139}
140
141#[derive(Debug, Default, PartialEq)]
143pub struct ElementSchema {
144 pub element_name: Option<String>,
146 pub initial_current_level: Option<u8>,
148 pub valid_levels: Option<Vec<u8>>,
156 pub dependencies: Option<Vec<LevelDependency>>,
159 pub lessor_channel: Option<fidl::endpoints::ServerEnd<LessorMarker>>,
164 pub element_control: Option<fidl::endpoints::ServerEnd<ElementControlMarker>>,
170 pub element_runner: Option<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
174 #[doc(hidden)]
175 pub __source_breaking: fidl::marker::SourceBreaking,
176}
177
178impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ElementSchema {}
179
180#[derive(Debug, Default, PartialEq)]
184pub struct ElementStatusEndpoint {
185 pub identifier: Option<String>,
186 pub status: Option<fidl::endpoints::ClientEnd<StatusMarker>>,
187 #[doc(hidden)]
188 pub __source_breaking: fidl::marker::SourceBreaking,
189}
190
191impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ElementStatusEndpoint {}
192
193#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
194pub struct ElementControlMarker;
195
196impl fidl::endpoints::ProtocolMarker for ElementControlMarker {
197 type Proxy = ElementControlProxy;
198 type RequestStream = ElementControlRequestStream;
199 #[cfg(target_os = "fuchsia")]
200 type SynchronousProxy = ElementControlSynchronousProxy;
201
202 const DEBUG_NAME: &'static str = "(anonymous) ElementControl";
203}
204pub type ElementControlRegisterDependencyTokenResult = Result<(), RegisterDependencyTokenError>;
205pub type ElementControlUnregisterDependencyTokenResult = Result<(), UnregisterDependencyTokenError>;
206
207pub trait ElementControlProxyInterface: Send + Sync {
208 fn r#open_status_channel(
209 &self,
210 status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
211 ) -> Result<(), fidl::Error>;
212 type RegisterDependencyTokenResponseFut: std::future::Future<
213 Output = Result<ElementControlRegisterDependencyTokenResult, fidl::Error>,
214 > + Send;
215 fn r#register_dependency_token(
216 &self,
217 token: fidl::Event,
218 dependency_type: DependencyType,
219 ) -> Self::RegisterDependencyTokenResponseFut;
220 type UnregisterDependencyTokenResponseFut: std::future::Future<
221 Output = Result<ElementControlUnregisterDependencyTokenResult, fidl::Error>,
222 > + Send;
223 fn r#unregister_dependency_token(
224 &self,
225 token: fidl::Event,
226 ) -> Self::UnregisterDependencyTokenResponseFut;
227}
228#[derive(Debug)]
229#[cfg(target_os = "fuchsia")]
230pub struct ElementControlSynchronousProxy {
231 client: fidl::client::sync::Client,
232}
233
234#[cfg(target_os = "fuchsia")]
235impl fidl::endpoints::SynchronousProxy for ElementControlSynchronousProxy {
236 type Proxy = ElementControlProxy;
237 type Protocol = ElementControlMarker;
238
239 fn from_channel(inner: fidl::Channel) -> Self {
240 Self::new(inner)
241 }
242
243 fn into_channel(self) -> fidl::Channel {
244 self.client.into_channel()
245 }
246
247 fn as_channel(&self) -> &fidl::Channel {
248 self.client.as_channel()
249 }
250}
251
252#[cfg(target_os = "fuchsia")]
253impl ElementControlSynchronousProxy {
254 pub fn new(channel: fidl::Channel) -> Self {
255 let protocol_name = <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
256 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
257 }
258
259 pub fn into_channel(self) -> fidl::Channel {
260 self.client.into_channel()
261 }
262
263 pub fn wait_for_event(
266 &self,
267 deadline: zx::MonotonicInstant,
268 ) -> Result<ElementControlEvent, fidl::Error> {
269 ElementControlEvent::decode(self.client.wait_for_event(deadline)?)
270 }
271
272 pub fn r#open_status_channel(
278 &self,
279 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
280 ) -> Result<(), fidl::Error> {
281 self.client.send::<ElementControlOpenStatusChannelRequest>(
282 (status_channel,),
283 0x4d7772e93dba6300,
284 fidl::encoding::DynamicFlags::FLEXIBLE,
285 )
286 }
287
288 pub fn r#register_dependency_token(
292 &self,
293 mut token: fidl::Event,
294 mut dependency_type: DependencyType,
295 ___deadline: zx::MonotonicInstant,
296 ) -> Result<ElementControlRegisterDependencyTokenResult, fidl::Error> {
297 let _response = self.client.send_query::<
298 ElementControlRegisterDependencyTokenRequest,
299 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, RegisterDependencyTokenError>,
300 >(
301 (token, dependency_type,),
302 0x3a5016663d198d61,
303 fidl::encoding::DynamicFlags::FLEXIBLE,
304 ___deadline,
305 )?
306 .into_result::<ElementControlMarker>("register_dependency_token")?;
307 Ok(_response.map(|x| x))
308 }
309
310 pub fn r#unregister_dependency_token(
312 &self,
313 mut token: fidl::Event,
314 ___deadline: zx::MonotonicInstant,
315 ) -> Result<ElementControlUnregisterDependencyTokenResult, fidl::Error> {
316 let _response = self.client.send_query::<
317 ElementControlUnregisterDependencyTokenRequest,
318 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, UnregisterDependencyTokenError>,
319 >(
320 (token,),
321 0x65a31a3661499529,
322 fidl::encoding::DynamicFlags::FLEXIBLE,
323 ___deadline,
324 )?
325 .into_result::<ElementControlMarker>("unregister_dependency_token")?;
326 Ok(_response.map(|x| x))
327 }
328}
329
330#[cfg(target_os = "fuchsia")]
331impl From<ElementControlSynchronousProxy> for zx::Handle {
332 fn from(value: ElementControlSynchronousProxy) -> Self {
333 value.into_channel().into()
334 }
335}
336
337#[cfg(target_os = "fuchsia")]
338impl From<fidl::Channel> for ElementControlSynchronousProxy {
339 fn from(value: fidl::Channel) -> Self {
340 Self::new(value)
341 }
342}
343
344#[cfg(target_os = "fuchsia")]
345impl fidl::endpoints::FromClient for ElementControlSynchronousProxy {
346 type Protocol = ElementControlMarker;
347
348 fn from_client(value: fidl::endpoints::ClientEnd<ElementControlMarker>) -> Self {
349 Self::new(value.into_channel())
350 }
351}
352
353#[derive(Debug, Clone)]
354pub struct ElementControlProxy {
355 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
356}
357
358impl fidl::endpoints::Proxy for ElementControlProxy {
359 type Protocol = ElementControlMarker;
360
361 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
362 Self::new(inner)
363 }
364
365 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
366 self.client.into_channel().map_err(|client| Self { client })
367 }
368
369 fn as_channel(&self) -> &::fidl::AsyncChannel {
370 self.client.as_channel()
371 }
372}
373
374impl ElementControlProxy {
375 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
377 let protocol_name = <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
378 Self { client: fidl::client::Client::new(channel, protocol_name) }
379 }
380
381 pub fn take_event_stream(&self) -> ElementControlEventStream {
387 ElementControlEventStream { event_receiver: self.client.take_event_receiver() }
388 }
389
390 pub fn r#open_status_channel(
396 &self,
397 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
398 ) -> Result<(), fidl::Error> {
399 ElementControlProxyInterface::r#open_status_channel(self, status_channel)
400 }
401
402 pub fn r#register_dependency_token(
406 &self,
407 mut token: fidl::Event,
408 mut dependency_type: DependencyType,
409 ) -> fidl::client::QueryResponseFut<
410 ElementControlRegisterDependencyTokenResult,
411 fidl::encoding::DefaultFuchsiaResourceDialect,
412 > {
413 ElementControlProxyInterface::r#register_dependency_token(self, token, dependency_type)
414 }
415
416 pub fn r#unregister_dependency_token(
418 &self,
419 mut token: fidl::Event,
420 ) -> fidl::client::QueryResponseFut<
421 ElementControlUnregisterDependencyTokenResult,
422 fidl::encoding::DefaultFuchsiaResourceDialect,
423 > {
424 ElementControlProxyInterface::r#unregister_dependency_token(self, token)
425 }
426}
427
428impl ElementControlProxyInterface for ElementControlProxy {
429 fn r#open_status_channel(
430 &self,
431 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
432 ) -> Result<(), fidl::Error> {
433 self.client.send::<ElementControlOpenStatusChannelRequest>(
434 (status_channel,),
435 0x4d7772e93dba6300,
436 fidl::encoding::DynamicFlags::FLEXIBLE,
437 )
438 }
439
440 type RegisterDependencyTokenResponseFut = fidl::client::QueryResponseFut<
441 ElementControlRegisterDependencyTokenResult,
442 fidl::encoding::DefaultFuchsiaResourceDialect,
443 >;
444 fn r#register_dependency_token(
445 &self,
446 mut token: fidl::Event,
447 mut dependency_type: DependencyType,
448 ) -> Self::RegisterDependencyTokenResponseFut {
449 fn _decode(
450 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
451 ) -> Result<ElementControlRegisterDependencyTokenResult, fidl::Error> {
452 let _response = fidl::client::decode_transaction_body::<
453 fidl::encoding::FlexibleResultType<
454 fidl::encoding::EmptyStruct,
455 RegisterDependencyTokenError,
456 >,
457 fidl::encoding::DefaultFuchsiaResourceDialect,
458 0x3a5016663d198d61,
459 >(_buf?)?
460 .into_result::<ElementControlMarker>("register_dependency_token")?;
461 Ok(_response.map(|x| x))
462 }
463 self.client.send_query_and_decode::<
464 ElementControlRegisterDependencyTokenRequest,
465 ElementControlRegisterDependencyTokenResult,
466 >(
467 (token, dependency_type,),
468 0x3a5016663d198d61,
469 fidl::encoding::DynamicFlags::FLEXIBLE,
470 _decode,
471 )
472 }
473
474 type UnregisterDependencyTokenResponseFut = fidl::client::QueryResponseFut<
475 ElementControlUnregisterDependencyTokenResult,
476 fidl::encoding::DefaultFuchsiaResourceDialect,
477 >;
478 fn r#unregister_dependency_token(
479 &self,
480 mut token: fidl::Event,
481 ) -> Self::UnregisterDependencyTokenResponseFut {
482 fn _decode(
483 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
484 ) -> Result<ElementControlUnregisterDependencyTokenResult, fidl::Error> {
485 let _response = fidl::client::decode_transaction_body::<
486 fidl::encoding::FlexibleResultType<
487 fidl::encoding::EmptyStruct,
488 UnregisterDependencyTokenError,
489 >,
490 fidl::encoding::DefaultFuchsiaResourceDialect,
491 0x65a31a3661499529,
492 >(_buf?)?
493 .into_result::<ElementControlMarker>("unregister_dependency_token")?;
494 Ok(_response.map(|x| x))
495 }
496 self.client.send_query_and_decode::<
497 ElementControlUnregisterDependencyTokenRequest,
498 ElementControlUnregisterDependencyTokenResult,
499 >(
500 (token,),
501 0x65a31a3661499529,
502 fidl::encoding::DynamicFlags::FLEXIBLE,
503 _decode,
504 )
505 }
506}
507
508pub struct ElementControlEventStream {
509 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
510}
511
512impl std::marker::Unpin for ElementControlEventStream {}
513
514impl futures::stream::FusedStream for ElementControlEventStream {
515 fn is_terminated(&self) -> bool {
516 self.event_receiver.is_terminated()
517 }
518}
519
520impl futures::Stream for ElementControlEventStream {
521 type Item = Result<ElementControlEvent, fidl::Error>;
522
523 fn poll_next(
524 mut self: std::pin::Pin<&mut Self>,
525 cx: &mut std::task::Context<'_>,
526 ) -> std::task::Poll<Option<Self::Item>> {
527 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
528 &mut self.event_receiver,
529 cx
530 )?) {
531 Some(buf) => std::task::Poll::Ready(Some(ElementControlEvent::decode(buf))),
532 None => std::task::Poll::Ready(None),
533 }
534 }
535}
536
537#[derive(Debug)]
538pub enum ElementControlEvent {
539 #[non_exhaustive]
540 _UnknownEvent {
541 ordinal: u64,
543 },
544}
545
546impl ElementControlEvent {
547 fn decode(
549 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
550 ) -> Result<ElementControlEvent, fidl::Error> {
551 let (bytes, _handles) = buf.split_mut();
552 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
553 debug_assert_eq!(tx_header.tx_id, 0);
554 match tx_header.ordinal {
555 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
556 Ok(ElementControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
557 }
558 _ => Err(fidl::Error::UnknownOrdinal {
559 ordinal: tx_header.ordinal,
560 protocol_name:
561 <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
562 }),
563 }
564 }
565}
566
567pub struct ElementControlRequestStream {
569 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
570 is_terminated: bool,
571}
572
573impl std::marker::Unpin for ElementControlRequestStream {}
574
575impl futures::stream::FusedStream for ElementControlRequestStream {
576 fn is_terminated(&self) -> bool {
577 self.is_terminated
578 }
579}
580
581impl fidl::endpoints::RequestStream for ElementControlRequestStream {
582 type Protocol = ElementControlMarker;
583 type ControlHandle = ElementControlControlHandle;
584
585 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
586 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
587 }
588
589 fn control_handle(&self) -> Self::ControlHandle {
590 ElementControlControlHandle { inner: self.inner.clone() }
591 }
592
593 fn into_inner(
594 self,
595 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
596 {
597 (self.inner, self.is_terminated)
598 }
599
600 fn from_inner(
601 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
602 is_terminated: bool,
603 ) -> Self {
604 Self { inner, is_terminated }
605 }
606}
607
608impl futures::Stream for ElementControlRequestStream {
609 type Item = Result<ElementControlRequest, fidl::Error>;
610
611 fn poll_next(
612 mut self: std::pin::Pin<&mut Self>,
613 cx: &mut std::task::Context<'_>,
614 ) -> std::task::Poll<Option<Self::Item>> {
615 let this = &mut *self;
616 if this.inner.check_shutdown(cx) {
617 this.is_terminated = true;
618 return std::task::Poll::Ready(None);
619 }
620 if this.is_terminated {
621 panic!("polled ElementControlRequestStream after completion");
622 }
623 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
624 |bytes, handles| {
625 match this.inner.channel().read_etc(cx, bytes, handles) {
626 std::task::Poll::Ready(Ok(())) => {}
627 std::task::Poll::Pending => return std::task::Poll::Pending,
628 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
629 this.is_terminated = true;
630 return std::task::Poll::Ready(None);
631 }
632 std::task::Poll::Ready(Err(e)) => {
633 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
634 e.into(),
635 ))));
636 }
637 }
638
639 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
641
642 std::task::Poll::Ready(Some(match header.ordinal {
643 0x4d7772e93dba6300 => {
644 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
645 let mut req = fidl::new_empty!(
646 ElementControlOpenStatusChannelRequest,
647 fidl::encoding::DefaultFuchsiaResourceDialect
648 );
649 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlOpenStatusChannelRequest>(&header, _body_bytes, handles, &mut req)?;
650 let control_handle =
651 ElementControlControlHandle { inner: this.inner.clone() };
652 Ok(ElementControlRequest::OpenStatusChannel {
653 status_channel: req.status_channel,
654
655 control_handle,
656 })
657 }
658 0x3a5016663d198d61 => {
659 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
660 let mut req = fidl::new_empty!(
661 ElementControlRegisterDependencyTokenRequest,
662 fidl::encoding::DefaultFuchsiaResourceDialect
663 );
664 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlRegisterDependencyTokenRequest>(&header, _body_bytes, handles, &mut req)?;
665 let control_handle =
666 ElementControlControlHandle { inner: this.inner.clone() };
667 Ok(ElementControlRequest::RegisterDependencyToken {
668 token: req.token,
669 dependency_type: req.dependency_type,
670
671 responder: ElementControlRegisterDependencyTokenResponder {
672 control_handle: std::mem::ManuallyDrop::new(control_handle),
673 tx_id: header.tx_id,
674 },
675 })
676 }
677 0x65a31a3661499529 => {
678 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
679 let mut req = fidl::new_empty!(
680 ElementControlUnregisterDependencyTokenRequest,
681 fidl::encoding::DefaultFuchsiaResourceDialect
682 );
683 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlUnregisterDependencyTokenRequest>(&header, _body_bytes, handles, &mut req)?;
684 let control_handle =
685 ElementControlControlHandle { inner: this.inner.clone() };
686 Ok(ElementControlRequest::UnregisterDependencyToken {
687 token: req.token,
688
689 responder: ElementControlUnregisterDependencyTokenResponder {
690 control_handle: std::mem::ManuallyDrop::new(control_handle),
691 tx_id: header.tx_id,
692 },
693 })
694 }
695 _ if header.tx_id == 0
696 && header
697 .dynamic_flags()
698 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
699 {
700 Ok(ElementControlRequest::_UnknownMethod {
701 ordinal: header.ordinal,
702 control_handle: ElementControlControlHandle {
703 inner: this.inner.clone(),
704 },
705 method_type: fidl::MethodType::OneWay,
706 })
707 }
708 _ if header
709 .dynamic_flags()
710 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
711 {
712 this.inner.send_framework_err(
713 fidl::encoding::FrameworkErr::UnknownMethod,
714 header.tx_id,
715 header.ordinal,
716 header.dynamic_flags(),
717 (bytes, handles),
718 )?;
719 Ok(ElementControlRequest::_UnknownMethod {
720 ordinal: header.ordinal,
721 control_handle: ElementControlControlHandle {
722 inner: this.inner.clone(),
723 },
724 method_type: fidl::MethodType::TwoWay,
725 })
726 }
727 _ => Err(fidl::Error::UnknownOrdinal {
728 ordinal: header.ordinal,
729 protocol_name:
730 <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
731 }),
732 }))
733 },
734 )
735 }
736}
737
738#[derive(Debug)]
741pub enum ElementControlRequest {
742 OpenStatusChannel {
748 status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
749 control_handle: ElementControlControlHandle,
750 },
751 RegisterDependencyToken {
755 token: fidl::Event,
756 dependency_type: DependencyType,
757 responder: ElementControlRegisterDependencyTokenResponder,
758 },
759 UnregisterDependencyToken {
761 token: fidl::Event,
762 responder: ElementControlUnregisterDependencyTokenResponder,
763 },
764 #[non_exhaustive]
766 _UnknownMethod {
767 ordinal: u64,
769 control_handle: ElementControlControlHandle,
770 method_type: fidl::MethodType,
771 },
772}
773
774impl ElementControlRequest {
775 #[allow(irrefutable_let_patterns)]
776 pub fn into_open_status_channel(
777 self,
778 ) -> Option<(fidl::endpoints::ServerEnd<StatusMarker>, ElementControlControlHandle)> {
779 if let ElementControlRequest::OpenStatusChannel { status_channel, control_handle } = self {
780 Some((status_channel, control_handle))
781 } else {
782 None
783 }
784 }
785
786 #[allow(irrefutable_let_patterns)]
787 pub fn into_register_dependency_token(
788 self,
789 ) -> Option<(fidl::Event, DependencyType, ElementControlRegisterDependencyTokenResponder)> {
790 if let ElementControlRequest::RegisterDependencyToken {
791 token,
792 dependency_type,
793 responder,
794 } = self
795 {
796 Some((token, dependency_type, responder))
797 } else {
798 None
799 }
800 }
801
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_unregister_dependency_token(
804 self,
805 ) -> Option<(fidl::Event, ElementControlUnregisterDependencyTokenResponder)> {
806 if let ElementControlRequest::UnregisterDependencyToken { token, responder } = self {
807 Some((token, responder))
808 } else {
809 None
810 }
811 }
812
813 pub fn method_name(&self) -> &'static str {
815 match *self {
816 ElementControlRequest::OpenStatusChannel { .. } => "open_status_channel",
817 ElementControlRequest::RegisterDependencyToken { .. } => "register_dependency_token",
818 ElementControlRequest::UnregisterDependencyToken { .. } => {
819 "unregister_dependency_token"
820 }
821 ElementControlRequest::_UnknownMethod {
822 method_type: fidl::MethodType::OneWay, ..
823 } => "unknown one-way method",
824 ElementControlRequest::_UnknownMethod {
825 method_type: fidl::MethodType::TwoWay, ..
826 } => "unknown two-way method",
827 }
828 }
829}
830
831#[derive(Debug, Clone)]
832pub struct ElementControlControlHandle {
833 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
834}
835
836impl fidl::endpoints::ControlHandle for ElementControlControlHandle {
837 fn shutdown(&self) {
838 self.inner.shutdown()
839 }
840 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
841 self.inner.shutdown_with_epitaph(status)
842 }
843
844 fn is_closed(&self) -> bool {
845 self.inner.channel().is_closed()
846 }
847 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
848 self.inner.channel().on_closed()
849 }
850
851 #[cfg(target_os = "fuchsia")]
852 fn signal_peer(
853 &self,
854 clear_mask: zx::Signals,
855 set_mask: zx::Signals,
856 ) -> Result<(), zx_status::Status> {
857 use fidl::Peered;
858 self.inner.channel().signal_peer(clear_mask, set_mask)
859 }
860}
861
862impl ElementControlControlHandle {}
863
864#[must_use = "FIDL methods require a response to be sent"]
865#[derive(Debug)]
866pub struct ElementControlRegisterDependencyTokenResponder {
867 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
868 tx_id: u32,
869}
870
871impl std::ops::Drop for ElementControlRegisterDependencyTokenResponder {
875 fn drop(&mut self) {
876 self.control_handle.shutdown();
877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
879 }
880}
881
882impl fidl::endpoints::Responder for ElementControlRegisterDependencyTokenResponder {
883 type ControlHandle = ElementControlControlHandle;
884
885 fn control_handle(&self) -> &ElementControlControlHandle {
886 &self.control_handle
887 }
888
889 fn drop_without_shutdown(mut self) {
890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892 std::mem::forget(self);
894 }
895}
896
897impl ElementControlRegisterDependencyTokenResponder {
898 pub fn send(
902 self,
903 mut result: Result<(), RegisterDependencyTokenError>,
904 ) -> Result<(), fidl::Error> {
905 let _result = self.send_raw(result);
906 if _result.is_err() {
907 self.control_handle.shutdown();
908 }
909 self.drop_without_shutdown();
910 _result
911 }
912
913 pub fn send_no_shutdown_on_err(
915 self,
916 mut result: Result<(), RegisterDependencyTokenError>,
917 ) -> Result<(), fidl::Error> {
918 let _result = self.send_raw(result);
919 self.drop_without_shutdown();
920 _result
921 }
922
923 fn send_raw(
924 &self,
925 mut result: Result<(), RegisterDependencyTokenError>,
926 ) -> Result<(), fidl::Error> {
927 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
928 fidl::encoding::EmptyStruct,
929 RegisterDependencyTokenError,
930 >>(
931 fidl::encoding::FlexibleResult::new(result),
932 self.tx_id,
933 0x3a5016663d198d61,
934 fidl::encoding::DynamicFlags::FLEXIBLE,
935 )
936 }
937}
938
939#[must_use = "FIDL methods require a response to be sent"]
940#[derive(Debug)]
941pub struct ElementControlUnregisterDependencyTokenResponder {
942 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
943 tx_id: u32,
944}
945
946impl std::ops::Drop for ElementControlUnregisterDependencyTokenResponder {
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 ElementControlUnregisterDependencyTokenResponder {
958 type ControlHandle = ElementControlControlHandle;
959
960 fn control_handle(&self) -> &ElementControlControlHandle {
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 ElementControlUnregisterDependencyTokenResponder {
973 pub fn send(
977 self,
978 mut result: Result<(), UnregisterDependencyTokenError>,
979 ) -> Result<(), fidl::Error> {
980 let _result = self.send_raw(result);
981 if _result.is_err() {
982 self.control_handle.shutdown();
983 }
984 self.drop_without_shutdown();
985 _result
986 }
987
988 pub fn send_no_shutdown_on_err(
990 self,
991 mut result: Result<(), UnregisterDependencyTokenError>,
992 ) -> Result<(), fidl::Error> {
993 let _result = self.send_raw(result);
994 self.drop_without_shutdown();
995 _result
996 }
997
998 fn send_raw(
999 &self,
1000 mut result: Result<(), UnregisterDependencyTokenError>,
1001 ) -> Result<(), fidl::Error> {
1002 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1003 fidl::encoding::EmptyStruct,
1004 UnregisterDependencyTokenError,
1005 >>(
1006 fidl::encoding::FlexibleResult::new(result),
1007 self.tx_id,
1008 0x65a31a3661499529,
1009 fidl::encoding::DynamicFlags::FLEXIBLE,
1010 )
1011 }
1012}
1013
1014#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1015pub struct ElementInfoProviderMarker;
1016
1017impl fidl::endpoints::ProtocolMarker for ElementInfoProviderMarker {
1018 type Proxy = ElementInfoProviderProxy;
1019 type RequestStream = ElementInfoProviderRequestStream;
1020 #[cfg(target_os = "fuchsia")]
1021 type SynchronousProxy = ElementInfoProviderSynchronousProxy;
1022
1023 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
1024}
1025impl fidl::endpoints::DiscoverableProtocolMarker for ElementInfoProviderMarker {}
1026pub type ElementInfoProviderGetElementPowerLevelNamesResult =
1027 Result<Vec<ElementPowerLevelNames>, ElementInfoProviderError>;
1028pub type ElementInfoProviderGetStatusEndpointsResult =
1029 Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>;
1030
1031pub trait ElementInfoProviderProxyInterface: Send + Sync {
1032 type GetElementPowerLevelNamesResponseFut: std::future::Future<
1033 Output = Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error>,
1034 > + Send;
1035 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut;
1036 type GetStatusEndpointsResponseFut: std::future::Future<
1037 Output = Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error>,
1038 > + Send;
1039 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut;
1040}
1041#[derive(Debug)]
1042#[cfg(target_os = "fuchsia")]
1043pub struct ElementInfoProviderSynchronousProxy {
1044 client: fidl::client::sync::Client,
1045}
1046
1047#[cfg(target_os = "fuchsia")]
1048impl fidl::endpoints::SynchronousProxy for ElementInfoProviderSynchronousProxy {
1049 type Proxy = ElementInfoProviderProxy;
1050 type Protocol = ElementInfoProviderMarker;
1051
1052 fn from_channel(inner: fidl::Channel) -> Self {
1053 Self::new(inner)
1054 }
1055
1056 fn into_channel(self) -> fidl::Channel {
1057 self.client.into_channel()
1058 }
1059
1060 fn as_channel(&self) -> &fidl::Channel {
1061 self.client.as_channel()
1062 }
1063}
1064
1065#[cfg(target_os = "fuchsia")]
1066impl ElementInfoProviderSynchronousProxy {
1067 pub fn new(channel: fidl::Channel) -> Self {
1068 let protocol_name =
1069 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1070 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1071 }
1072
1073 pub fn into_channel(self) -> fidl::Channel {
1074 self.client.into_channel()
1075 }
1076
1077 pub fn wait_for_event(
1080 &self,
1081 deadline: zx::MonotonicInstant,
1082 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1083 ElementInfoProviderEvent::decode(self.client.wait_for_event(deadline)?)
1084 }
1085
1086 pub fn r#get_element_power_level_names(
1089 &self,
1090 ___deadline: zx::MonotonicInstant,
1091 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1092 let _response = self
1093 .client
1094 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1095 ElementInfoProviderGetElementPowerLevelNamesResponse,
1096 ElementInfoProviderError,
1097 >>(
1098 (), 0x298f63881fc9ed49, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1099 )?
1100 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1101 Ok(_response.map(|x| x.level_names))
1102 }
1103
1104 pub fn r#get_status_endpoints(
1108 &self,
1109 ___deadline: zx::MonotonicInstant,
1110 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1111 let _response = self
1112 .client
1113 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1114 ElementInfoProviderGetStatusEndpointsResponse,
1115 ElementInfoProviderError,
1116 >>(
1117 (), 0x456f2b6c5bf0777c, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1118 )?
1119 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1120 Ok(_response.map(|x| x.endpoints))
1121 }
1122}
1123
1124#[cfg(target_os = "fuchsia")]
1125impl From<ElementInfoProviderSynchronousProxy> for zx::Handle {
1126 fn from(value: ElementInfoProviderSynchronousProxy) -> Self {
1127 value.into_channel().into()
1128 }
1129}
1130
1131#[cfg(target_os = "fuchsia")]
1132impl From<fidl::Channel> for ElementInfoProviderSynchronousProxy {
1133 fn from(value: fidl::Channel) -> Self {
1134 Self::new(value)
1135 }
1136}
1137
1138#[cfg(target_os = "fuchsia")]
1139impl fidl::endpoints::FromClient for ElementInfoProviderSynchronousProxy {
1140 type Protocol = ElementInfoProviderMarker;
1141
1142 fn from_client(value: fidl::endpoints::ClientEnd<ElementInfoProviderMarker>) -> Self {
1143 Self::new(value.into_channel())
1144 }
1145}
1146
1147#[derive(Debug, Clone)]
1148pub struct ElementInfoProviderProxy {
1149 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1150}
1151
1152impl fidl::endpoints::Proxy for ElementInfoProviderProxy {
1153 type Protocol = ElementInfoProviderMarker;
1154
1155 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1156 Self::new(inner)
1157 }
1158
1159 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1160 self.client.into_channel().map_err(|client| Self { client })
1161 }
1162
1163 fn as_channel(&self) -> &::fidl::AsyncChannel {
1164 self.client.as_channel()
1165 }
1166}
1167
1168impl ElementInfoProviderProxy {
1169 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1171 let protocol_name =
1172 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1173 Self { client: fidl::client::Client::new(channel, protocol_name) }
1174 }
1175
1176 pub fn take_event_stream(&self) -> ElementInfoProviderEventStream {
1182 ElementInfoProviderEventStream { event_receiver: self.client.take_event_receiver() }
1183 }
1184
1185 pub fn r#get_element_power_level_names(
1188 &self,
1189 ) -> fidl::client::QueryResponseFut<
1190 ElementInfoProviderGetElementPowerLevelNamesResult,
1191 fidl::encoding::DefaultFuchsiaResourceDialect,
1192 > {
1193 ElementInfoProviderProxyInterface::r#get_element_power_level_names(self)
1194 }
1195
1196 pub fn r#get_status_endpoints(
1200 &self,
1201 ) -> fidl::client::QueryResponseFut<
1202 ElementInfoProviderGetStatusEndpointsResult,
1203 fidl::encoding::DefaultFuchsiaResourceDialect,
1204 > {
1205 ElementInfoProviderProxyInterface::r#get_status_endpoints(self)
1206 }
1207}
1208
1209impl ElementInfoProviderProxyInterface for ElementInfoProviderProxy {
1210 type GetElementPowerLevelNamesResponseFut = fidl::client::QueryResponseFut<
1211 ElementInfoProviderGetElementPowerLevelNamesResult,
1212 fidl::encoding::DefaultFuchsiaResourceDialect,
1213 >;
1214 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut {
1215 fn _decode(
1216 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1217 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1218 let _response = fidl::client::decode_transaction_body::<
1219 fidl::encoding::FlexibleResultType<
1220 ElementInfoProviderGetElementPowerLevelNamesResponse,
1221 ElementInfoProviderError,
1222 >,
1223 fidl::encoding::DefaultFuchsiaResourceDialect,
1224 0x298f63881fc9ed49,
1225 >(_buf?)?
1226 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1227 Ok(_response.map(|x| x.level_names))
1228 }
1229 self.client.send_query_and_decode::<
1230 fidl::encoding::EmptyPayload,
1231 ElementInfoProviderGetElementPowerLevelNamesResult,
1232 >(
1233 (),
1234 0x298f63881fc9ed49,
1235 fidl::encoding::DynamicFlags::FLEXIBLE,
1236 _decode,
1237 )
1238 }
1239
1240 type GetStatusEndpointsResponseFut = fidl::client::QueryResponseFut<
1241 ElementInfoProviderGetStatusEndpointsResult,
1242 fidl::encoding::DefaultFuchsiaResourceDialect,
1243 >;
1244 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut {
1245 fn _decode(
1246 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1247 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1248 let _response = fidl::client::decode_transaction_body::<
1249 fidl::encoding::FlexibleResultType<
1250 ElementInfoProviderGetStatusEndpointsResponse,
1251 ElementInfoProviderError,
1252 >,
1253 fidl::encoding::DefaultFuchsiaResourceDialect,
1254 0x456f2b6c5bf0777c,
1255 >(_buf?)?
1256 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1257 Ok(_response.map(|x| x.endpoints))
1258 }
1259 self.client.send_query_and_decode::<
1260 fidl::encoding::EmptyPayload,
1261 ElementInfoProviderGetStatusEndpointsResult,
1262 >(
1263 (),
1264 0x456f2b6c5bf0777c,
1265 fidl::encoding::DynamicFlags::FLEXIBLE,
1266 _decode,
1267 )
1268 }
1269}
1270
1271pub struct ElementInfoProviderEventStream {
1272 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1273}
1274
1275impl std::marker::Unpin for ElementInfoProviderEventStream {}
1276
1277impl futures::stream::FusedStream for ElementInfoProviderEventStream {
1278 fn is_terminated(&self) -> bool {
1279 self.event_receiver.is_terminated()
1280 }
1281}
1282
1283impl futures::Stream for ElementInfoProviderEventStream {
1284 type Item = Result<ElementInfoProviderEvent, fidl::Error>;
1285
1286 fn poll_next(
1287 mut self: std::pin::Pin<&mut Self>,
1288 cx: &mut std::task::Context<'_>,
1289 ) -> std::task::Poll<Option<Self::Item>> {
1290 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1291 &mut self.event_receiver,
1292 cx
1293 )?) {
1294 Some(buf) => std::task::Poll::Ready(Some(ElementInfoProviderEvent::decode(buf))),
1295 None => std::task::Poll::Ready(None),
1296 }
1297 }
1298}
1299
1300#[derive(Debug)]
1301pub enum ElementInfoProviderEvent {
1302 #[non_exhaustive]
1303 _UnknownEvent {
1304 ordinal: u64,
1306 },
1307}
1308
1309impl ElementInfoProviderEvent {
1310 fn decode(
1312 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1313 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1314 let (bytes, _handles) = buf.split_mut();
1315 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1316 debug_assert_eq!(tx_header.tx_id, 0);
1317 match tx_header.ordinal {
1318 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1319 Ok(ElementInfoProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1320 }
1321 _ => Err(fidl::Error::UnknownOrdinal {
1322 ordinal: tx_header.ordinal,
1323 protocol_name:
1324 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1325 }),
1326 }
1327 }
1328}
1329
1330pub struct ElementInfoProviderRequestStream {
1332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1333 is_terminated: bool,
1334}
1335
1336impl std::marker::Unpin for ElementInfoProviderRequestStream {}
1337
1338impl futures::stream::FusedStream for ElementInfoProviderRequestStream {
1339 fn is_terminated(&self) -> bool {
1340 self.is_terminated
1341 }
1342}
1343
1344impl fidl::endpoints::RequestStream for ElementInfoProviderRequestStream {
1345 type Protocol = ElementInfoProviderMarker;
1346 type ControlHandle = ElementInfoProviderControlHandle;
1347
1348 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1349 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1350 }
1351
1352 fn control_handle(&self) -> Self::ControlHandle {
1353 ElementInfoProviderControlHandle { inner: self.inner.clone() }
1354 }
1355
1356 fn into_inner(
1357 self,
1358 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1359 {
1360 (self.inner, self.is_terminated)
1361 }
1362
1363 fn from_inner(
1364 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1365 is_terminated: bool,
1366 ) -> Self {
1367 Self { inner, is_terminated }
1368 }
1369}
1370
1371impl futures::Stream for ElementInfoProviderRequestStream {
1372 type Item = Result<ElementInfoProviderRequest, fidl::Error>;
1373
1374 fn poll_next(
1375 mut self: std::pin::Pin<&mut Self>,
1376 cx: &mut std::task::Context<'_>,
1377 ) -> std::task::Poll<Option<Self::Item>> {
1378 let this = &mut *self;
1379 if this.inner.check_shutdown(cx) {
1380 this.is_terminated = true;
1381 return std::task::Poll::Ready(None);
1382 }
1383 if this.is_terminated {
1384 panic!("polled ElementInfoProviderRequestStream after completion");
1385 }
1386 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1387 |bytes, handles| {
1388 match this.inner.channel().read_etc(cx, bytes, handles) {
1389 std::task::Poll::Ready(Ok(())) => {}
1390 std::task::Poll::Pending => return std::task::Poll::Pending,
1391 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1392 this.is_terminated = true;
1393 return std::task::Poll::Ready(None);
1394 }
1395 std::task::Poll::Ready(Err(e)) => {
1396 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1397 e.into(),
1398 ))));
1399 }
1400 }
1401
1402 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1404
1405 std::task::Poll::Ready(Some(match header.ordinal {
1406 0x298f63881fc9ed49 => {
1407 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1408 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1409 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1410 let control_handle = ElementInfoProviderControlHandle {
1411 inner: this.inner.clone(),
1412 };
1413 Ok(ElementInfoProviderRequest::GetElementPowerLevelNames {
1414 responder: ElementInfoProviderGetElementPowerLevelNamesResponder {
1415 control_handle: std::mem::ManuallyDrop::new(control_handle),
1416 tx_id: header.tx_id,
1417 },
1418 })
1419 }
1420 0x456f2b6c5bf0777c => {
1421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1422 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1423 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1424 let control_handle = ElementInfoProviderControlHandle {
1425 inner: this.inner.clone(),
1426 };
1427 Ok(ElementInfoProviderRequest::GetStatusEndpoints {
1428 responder: ElementInfoProviderGetStatusEndpointsResponder {
1429 control_handle: std::mem::ManuallyDrop::new(control_handle),
1430 tx_id: header.tx_id,
1431 },
1432 })
1433 }
1434 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1435 Ok(ElementInfoProviderRequest::_UnknownMethod {
1436 ordinal: header.ordinal,
1437 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
1438 method_type: fidl::MethodType::OneWay,
1439 })
1440 }
1441 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1442 this.inner.send_framework_err(
1443 fidl::encoding::FrameworkErr::UnknownMethod,
1444 header.tx_id,
1445 header.ordinal,
1446 header.dynamic_flags(),
1447 (bytes, handles),
1448 )?;
1449 Ok(ElementInfoProviderRequest::_UnknownMethod {
1450 ordinal: header.ordinal,
1451 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
1452 method_type: fidl::MethodType::TwoWay,
1453 })
1454 }
1455 _ => Err(fidl::Error::UnknownOrdinal {
1456 ordinal: header.ordinal,
1457 protocol_name: <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1458 }),
1459 }))
1460 },
1461 )
1462 }
1463}
1464
1465#[derive(Debug)]
1467pub enum ElementInfoProviderRequest {
1468 GetElementPowerLevelNames { responder: ElementInfoProviderGetElementPowerLevelNamesResponder },
1471 GetStatusEndpoints { responder: ElementInfoProviderGetStatusEndpointsResponder },
1475 #[non_exhaustive]
1477 _UnknownMethod {
1478 ordinal: u64,
1480 control_handle: ElementInfoProviderControlHandle,
1481 method_type: fidl::MethodType,
1482 },
1483}
1484
1485impl ElementInfoProviderRequest {
1486 #[allow(irrefutable_let_patterns)]
1487 pub fn into_get_element_power_level_names(
1488 self,
1489 ) -> Option<(ElementInfoProviderGetElementPowerLevelNamesResponder)> {
1490 if let ElementInfoProviderRequest::GetElementPowerLevelNames { responder } = self {
1491 Some((responder))
1492 } else {
1493 None
1494 }
1495 }
1496
1497 #[allow(irrefutable_let_patterns)]
1498 pub fn into_get_status_endpoints(
1499 self,
1500 ) -> Option<(ElementInfoProviderGetStatusEndpointsResponder)> {
1501 if let ElementInfoProviderRequest::GetStatusEndpoints { responder } = self {
1502 Some((responder))
1503 } else {
1504 None
1505 }
1506 }
1507
1508 pub fn method_name(&self) -> &'static str {
1510 match *self {
1511 ElementInfoProviderRequest::GetElementPowerLevelNames { .. } => {
1512 "get_element_power_level_names"
1513 }
1514 ElementInfoProviderRequest::GetStatusEndpoints { .. } => "get_status_endpoints",
1515 ElementInfoProviderRequest::_UnknownMethod {
1516 method_type: fidl::MethodType::OneWay,
1517 ..
1518 } => "unknown one-way method",
1519 ElementInfoProviderRequest::_UnknownMethod {
1520 method_type: fidl::MethodType::TwoWay,
1521 ..
1522 } => "unknown two-way method",
1523 }
1524 }
1525}
1526
1527#[derive(Debug, Clone)]
1528pub struct ElementInfoProviderControlHandle {
1529 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1530}
1531
1532impl fidl::endpoints::ControlHandle for ElementInfoProviderControlHandle {
1533 fn shutdown(&self) {
1534 self.inner.shutdown()
1535 }
1536 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1537 self.inner.shutdown_with_epitaph(status)
1538 }
1539
1540 fn is_closed(&self) -> bool {
1541 self.inner.channel().is_closed()
1542 }
1543 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1544 self.inner.channel().on_closed()
1545 }
1546
1547 #[cfg(target_os = "fuchsia")]
1548 fn signal_peer(
1549 &self,
1550 clear_mask: zx::Signals,
1551 set_mask: zx::Signals,
1552 ) -> Result<(), zx_status::Status> {
1553 use fidl::Peered;
1554 self.inner.channel().signal_peer(clear_mask, set_mask)
1555 }
1556}
1557
1558impl ElementInfoProviderControlHandle {}
1559
1560#[must_use = "FIDL methods require a response to be sent"]
1561#[derive(Debug)]
1562pub struct ElementInfoProviderGetElementPowerLevelNamesResponder {
1563 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
1564 tx_id: u32,
1565}
1566
1567impl std::ops::Drop for ElementInfoProviderGetElementPowerLevelNamesResponder {
1571 fn drop(&mut self) {
1572 self.control_handle.shutdown();
1573 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1575 }
1576}
1577
1578impl fidl::endpoints::Responder for ElementInfoProviderGetElementPowerLevelNamesResponder {
1579 type ControlHandle = ElementInfoProviderControlHandle;
1580
1581 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
1582 &self.control_handle
1583 }
1584
1585 fn drop_without_shutdown(mut self) {
1586 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1588 std::mem::forget(self);
1590 }
1591}
1592
1593impl ElementInfoProviderGetElementPowerLevelNamesResponder {
1594 pub fn send(
1598 self,
1599 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1600 ) -> Result<(), fidl::Error> {
1601 let _result = self.send_raw(result);
1602 if _result.is_err() {
1603 self.control_handle.shutdown();
1604 }
1605 self.drop_without_shutdown();
1606 _result
1607 }
1608
1609 pub fn send_no_shutdown_on_err(
1611 self,
1612 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1613 ) -> Result<(), fidl::Error> {
1614 let _result = self.send_raw(result);
1615 self.drop_without_shutdown();
1616 _result
1617 }
1618
1619 fn send_raw(
1620 &self,
1621 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1622 ) -> Result<(), fidl::Error> {
1623 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1624 ElementInfoProviderGetElementPowerLevelNamesResponse,
1625 ElementInfoProviderError,
1626 >>(
1627 fidl::encoding::FlexibleResult::new(result.map(|level_names| (level_names,))),
1628 self.tx_id,
1629 0x298f63881fc9ed49,
1630 fidl::encoding::DynamicFlags::FLEXIBLE,
1631 )
1632 }
1633}
1634
1635#[must_use = "FIDL methods require a response to be sent"]
1636#[derive(Debug)]
1637pub struct ElementInfoProviderGetStatusEndpointsResponder {
1638 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
1639 tx_id: u32,
1640}
1641
1642impl std::ops::Drop for ElementInfoProviderGetStatusEndpointsResponder {
1646 fn drop(&mut self) {
1647 self.control_handle.shutdown();
1648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1650 }
1651}
1652
1653impl fidl::endpoints::Responder for ElementInfoProviderGetStatusEndpointsResponder {
1654 type ControlHandle = ElementInfoProviderControlHandle;
1655
1656 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
1657 &self.control_handle
1658 }
1659
1660 fn drop_without_shutdown(mut self) {
1661 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1663 std::mem::forget(self);
1665 }
1666}
1667
1668impl ElementInfoProviderGetStatusEndpointsResponder {
1669 pub fn send(
1673 self,
1674 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1675 ) -> Result<(), fidl::Error> {
1676 let _result = self.send_raw(result);
1677 if _result.is_err() {
1678 self.control_handle.shutdown();
1679 }
1680 self.drop_without_shutdown();
1681 _result
1682 }
1683
1684 pub fn send_no_shutdown_on_err(
1686 self,
1687 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1688 ) -> Result<(), fidl::Error> {
1689 let _result = self.send_raw(result);
1690 self.drop_without_shutdown();
1691 _result
1692 }
1693
1694 fn send_raw(
1695 &self,
1696 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1697 ) -> Result<(), fidl::Error> {
1698 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1699 ElementInfoProviderGetStatusEndpointsResponse,
1700 ElementInfoProviderError,
1701 >>(
1702 fidl::encoding::FlexibleResult::new(
1703 result.as_mut().map_err(|e| *e).map(|endpoints| (endpoints.as_mut_slice(),)),
1704 ),
1705 self.tx_id,
1706 0x456f2b6c5bf0777c,
1707 fidl::encoding::DynamicFlags::FLEXIBLE,
1708 )
1709 }
1710}
1711
1712#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1713pub struct ElementRunnerMarker;
1714
1715impl fidl::endpoints::ProtocolMarker for ElementRunnerMarker {
1716 type Proxy = ElementRunnerProxy;
1717 type RequestStream = ElementRunnerRequestStream;
1718 #[cfg(target_os = "fuchsia")]
1719 type SynchronousProxy = ElementRunnerSynchronousProxy;
1720
1721 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementRunner";
1722}
1723impl fidl::endpoints::DiscoverableProtocolMarker for ElementRunnerMarker {}
1724
1725pub trait ElementRunnerProxyInterface: Send + Sync {
1726 type SetLevelResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1727 fn r#set_level(&self, level: u8) -> Self::SetLevelResponseFut;
1728}
1729#[derive(Debug)]
1730#[cfg(target_os = "fuchsia")]
1731pub struct ElementRunnerSynchronousProxy {
1732 client: fidl::client::sync::Client,
1733}
1734
1735#[cfg(target_os = "fuchsia")]
1736impl fidl::endpoints::SynchronousProxy for ElementRunnerSynchronousProxy {
1737 type Proxy = ElementRunnerProxy;
1738 type Protocol = ElementRunnerMarker;
1739
1740 fn from_channel(inner: fidl::Channel) -> Self {
1741 Self::new(inner)
1742 }
1743
1744 fn into_channel(self) -> fidl::Channel {
1745 self.client.into_channel()
1746 }
1747
1748 fn as_channel(&self) -> &fidl::Channel {
1749 self.client.as_channel()
1750 }
1751}
1752
1753#[cfg(target_os = "fuchsia")]
1754impl ElementRunnerSynchronousProxy {
1755 pub fn new(channel: fidl::Channel) -> Self {
1756 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1757 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1758 }
1759
1760 pub fn into_channel(self) -> fidl::Channel {
1761 self.client.into_channel()
1762 }
1763
1764 pub fn wait_for_event(
1767 &self,
1768 deadline: zx::MonotonicInstant,
1769 ) -> Result<ElementRunnerEvent, fidl::Error> {
1770 ElementRunnerEvent::decode(self.client.wait_for_event(deadline)?)
1771 }
1772
1773 pub fn r#set_level(
1780 &self,
1781 mut level: u8,
1782 ___deadline: zx::MonotonicInstant,
1783 ) -> Result<(), fidl::Error> {
1784 let _response = self.client.send_query::<
1785 ElementRunnerSetLevelRequest,
1786 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1787 >(
1788 (level,),
1789 0x11a93092b228f0b,
1790 fidl::encoding::DynamicFlags::FLEXIBLE,
1791 ___deadline,
1792 )?
1793 .into_result::<ElementRunnerMarker>("set_level")?;
1794 Ok(_response)
1795 }
1796}
1797
1798#[cfg(target_os = "fuchsia")]
1799impl From<ElementRunnerSynchronousProxy> for zx::Handle {
1800 fn from(value: ElementRunnerSynchronousProxy) -> Self {
1801 value.into_channel().into()
1802 }
1803}
1804
1805#[cfg(target_os = "fuchsia")]
1806impl From<fidl::Channel> for ElementRunnerSynchronousProxy {
1807 fn from(value: fidl::Channel) -> Self {
1808 Self::new(value)
1809 }
1810}
1811
1812#[cfg(target_os = "fuchsia")]
1813impl fidl::endpoints::FromClient for ElementRunnerSynchronousProxy {
1814 type Protocol = ElementRunnerMarker;
1815
1816 fn from_client(value: fidl::endpoints::ClientEnd<ElementRunnerMarker>) -> Self {
1817 Self::new(value.into_channel())
1818 }
1819}
1820
1821#[derive(Debug, Clone)]
1822pub struct ElementRunnerProxy {
1823 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1824}
1825
1826impl fidl::endpoints::Proxy for ElementRunnerProxy {
1827 type Protocol = ElementRunnerMarker;
1828
1829 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1830 Self::new(inner)
1831 }
1832
1833 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1834 self.client.into_channel().map_err(|client| Self { client })
1835 }
1836
1837 fn as_channel(&self) -> &::fidl::AsyncChannel {
1838 self.client.as_channel()
1839 }
1840}
1841
1842impl ElementRunnerProxy {
1843 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1845 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1846 Self { client: fidl::client::Client::new(channel, protocol_name) }
1847 }
1848
1849 pub fn take_event_stream(&self) -> ElementRunnerEventStream {
1855 ElementRunnerEventStream { event_receiver: self.client.take_event_receiver() }
1856 }
1857
1858 pub fn r#set_level(
1865 &self,
1866 mut level: u8,
1867 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1868 ElementRunnerProxyInterface::r#set_level(self, level)
1869 }
1870}
1871
1872impl ElementRunnerProxyInterface for ElementRunnerProxy {
1873 type SetLevelResponseFut =
1874 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1875 fn r#set_level(&self, mut level: u8) -> Self::SetLevelResponseFut {
1876 fn _decode(
1877 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1878 ) -> Result<(), fidl::Error> {
1879 let _response = fidl::client::decode_transaction_body::<
1880 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1881 fidl::encoding::DefaultFuchsiaResourceDialect,
1882 0x11a93092b228f0b,
1883 >(_buf?)?
1884 .into_result::<ElementRunnerMarker>("set_level")?;
1885 Ok(_response)
1886 }
1887 self.client.send_query_and_decode::<ElementRunnerSetLevelRequest, ()>(
1888 (level,),
1889 0x11a93092b228f0b,
1890 fidl::encoding::DynamicFlags::FLEXIBLE,
1891 _decode,
1892 )
1893 }
1894}
1895
1896pub struct ElementRunnerEventStream {
1897 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1898}
1899
1900impl std::marker::Unpin for ElementRunnerEventStream {}
1901
1902impl futures::stream::FusedStream for ElementRunnerEventStream {
1903 fn is_terminated(&self) -> bool {
1904 self.event_receiver.is_terminated()
1905 }
1906}
1907
1908impl futures::Stream for ElementRunnerEventStream {
1909 type Item = Result<ElementRunnerEvent, fidl::Error>;
1910
1911 fn poll_next(
1912 mut self: std::pin::Pin<&mut Self>,
1913 cx: &mut std::task::Context<'_>,
1914 ) -> std::task::Poll<Option<Self::Item>> {
1915 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1916 &mut self.event_receiver,
1917 cx
1918 )?) {
1919 Some(buf) => std::task::Poll::Ready(Some(ElementRunnerEvent::decode(buf))),
1920 None => std::task::Poll::Ready(None),
1921 }
1922 }
1923}
1924
1925#[derive(Debug)]
1926pub enum ElementRunnerEvent {
1927 #[non_exhaustive]
1928 _UnknownEvent {
1929 ordinal: u64,
1931 },
1932}
1933
1934impl ElementRunnerEvent {
1935 fn decode(
1937 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1938 ) -> Result<ElementRunnerEvent, fidl::Error> {
1939 let (bytes, _handles) = buf.split_mut();
1940 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1941 debug_assert_eq!(tx_header.tx_id, 0);
1942 match tx_header.ordinal {
1943 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1944 Ok(ElementRunnerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1945 }
1946 _ => Err(fidl::Error::UnknownOrdinal {
1947 ordinal: tx_header.ordinal,
1948 protocol_name: <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1949 }),
1950 }
1951 }
1952}
1953
1954pub struct ElementRunnerRequestStream {
1956 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1957 is_terminated: bool,
1958}
1959
1960impl std::marker::Unpin for ElementRunnerRequestStream {}
1961
1962impl futures::stream::FusedStream for ElementRunnerRequestStream {
1963 fn is_terminated(&self) -> bool {
1964 self.is_terminated
1965 }
1966}
1967
1968impl fidl::endpoints::RequestStream for ElementRunnerRequestStream {
1969 type Protocol = ElementRunnerMarker;
1970 type ControlHandle = ElementRunnerControlHandle;
1971
1972 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1973 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1974 }
1975
1976 fn control_handle(&self) -> Self::ControlHandle {
1977 ElementRunnerControlHandle { inner: self.inner.clone() }
1978 }
1979
1980 fn into_inner(
1981 self,
1982 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1983 {
1984 (self.inner, self.is_terminated)
1985 }
1986
1987 fn from_inner(
1988 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1989 is_terminated: bool,
1990 ) -> Self {
1991 Self { inner, is_terminated }
1992 }
1993}
1994
1995impl futures::Stream for ElementRunnerRequestStream {
1996 type Item = Result<ElementRunnerRequest, fidl::Error>;
1997
1998 fn poll_next(
1999 mut self: std::pin::Pin<&mut Self>,
2000 cx: &mut std::task::Context<'_>,
2001 ) -> std::task::Poll<Option<Self::Item>> {
2002 let this = &mut *self;
2003 if this.inner.check_shutdown(cx) {
2004 this.is_terminated = true;
2005 return std::task::Poll::Ready(None);
2006 }
2007 if this.is_terminated {
2008 panic!("polled ElementRunnerRequestStream after completion");
2009 }
2010 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2011 |bytes, handles| {
2012 match this.inner.channel().read_etc(cx, bytes, handles) {
2013 std::task::Poll::Ready(Ok(())) => {}
2014 std::task::Poll::Pending => return std::task::Poll::Pending,
2015 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2016 this.is_terminated = true;
2017 return std::task::Poll::Ready(None);
2018 }
2019 std::task::Poll::Ready(Err(e)) => {
2020 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2021 e.into(),
2022 ))));
2023 }
2024 }
2025
2026 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2028
2029 std::task::Poll::Ready(Some(match header.ordinal {
2030 0x11a93092b228f0b => {
2031 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2032 let mut req = fidl::new_empty!(
2033 ElementRunnerSetLevelRequest,
2034 fidl::encoding::DefaultFuchsiaResourceDialect
2035 );
2036 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementRunnerSetLevelRequest>(&header, _body_bytes, handles, &mut req)?;
2037 let control_handle =
2038 ElementRunnerControlHandle { inner: this.inner.clone() };
2039 Ok(ElementRunnerRequest::SetLevel {
2040 level: req.level,
2041
2042 responder: ElementRunnerSetLevelResponder {
2043 control_handle: std::mem::ManuallyDrop::new(control_handle),
2044 tx_id: header.tx_id,
2045 },
2046 })
2047 }
2048 _ if header.tx_id == 0
2049 && header
2050 .dynamic_flags()
2051 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2052 {
2053 Ok(ElementRunnerRequest::_UnknownMethod {
2054 ordinal: header.ordinal,
2055 control_handle: ElementRunnerControlHandle {
2056 inner: this.inner.clone(),
2057 },
2058 method_type: fidl::MethodType::OneWay,
2059 })
2060 }
2061 _ if header
2062 .dynamic_flags()
2063 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2064 {
2065 this.inner.send_framework_err(
2066 fidl::encoding::FrameworkErr::UnknownMethod,
2067 header.tx_id,
2068 header.ordinal,
2069 header.dynamic_flags(),
2070 (bytes, handles),
2071 )?;
2072 Ok(ElementRunnerRequest::_UnknownMethod {
2073 ordinal: header.ordinal,
2074 control_handle: ElementRunnerControlHandle {
2075 inner: this.inner.clone(),
2076 },
2077 method_type: fidl::MethodType::TwoWay,
2078 })
2079 }
2080 _ => Err(fidl::Error::UnknownOrdinal {
2081 ordinal: header.ordinal,
2082 protocol_name:
2083 <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2084 }),
2085 }))
2086 },
2087 )
2088 }
2089}
2090
2091#[derive(Debug)]
2097pub enum ElementRunnerRequest {
2098 SetLevel { level: u8, responder: ElementRunnerSetLevelResponder },
2105 #[non_exhaustive]
2107 _UnknownMethod {
2108 ordinal: u64,
2110 control_handle: ElementRunnerControlHandle,
2111 method_type: fidl::MethodType,
2112 },
2113}
2114
2115impl ElementRunnerRequest {
2116 #[allow(irrefutable_let_patterns)]
2117 pub fn into_set_level(self) -> Option<(u8, ElementRunnerSetLevelResponder)> {
2118 if let ElementRunnerRequest::SetLevel { level, responder } = self {
2119 Some((level, responder))
2120 } else {
2121 None
2122 }
2123 }
2124
2125 pub fn method_name(&self) -> &'static str {
2127 match *self {
2128 ElementRunnerRequest::SetLevel { .. } => "set_level",
2129 ElementRunnerRequest::_UnknownMethod {
2130 method_type: fidl::MethodType::OneWay, ..
2131 } => "unknown one-way method",
2132 ElementRunnerRequest::_UnknownMethod {
2133 method_type: fidl::MethodType::TwoWay, ..
2134 } => "unknown two-way method",
2135 }
2136 }
2137}
2138
2139#[derive(Debug, Clone)]
2140pub struct ElementRunnerControlHandle {
2141 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2142}
2143
2144impl fidl::endpoints::ControlHandle for ElementRunnerControlHandle {
2145 fn shutdown(&self) {
2146 self.inner.shutdown()
2147 }
2148 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2149 self.inner.shutdown_with_epitaph(status)
2150 }
2151
2152 fn is_closed(&self) -> bool {
2153 self.inner.channel().is_closed()
2154 }
2155 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2156 self.inner.channel().on_closed()
2157 }
2158
2159 #[cfg(target_os = "fuchsia")]
2160 fn signal_peer(
2161 &self,
2162 clear_mask: zx::Signals,
2163 set_mask: zx::Signals,
2164 ) -> Result<(), zx_status::Status> {
2165 use fidl::Peered;
2166 self.inner.channel().signal_peer(clear_mask, set_mask)
2167 }
2168}
2169
2170impl ElementRunnerControlHandle {}
2171
2172#[must_use = "FIDL methods require a response to be sent"]
2173#[derive(Debug)]
2174pub struct ElementRunnerSetLevelResponder {
2175 control_handle: std::mem::ManuallyDrop<ElementRunnerControlHandle>,
2176 tx_id: u32,
2177}
2178
2179impl std::ops::Drop for ElementRunnerSetLevelResponder {
2183 fn drop(&mut self) {
2184 self.control_handle.shutdown();
2185 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2187 }
2188}
2189
2190impl fidl::endpoints::Responder for ElementRunnerSetLevelResponder {
2191 type ControlHandle = ElementRunnerControlHandle;
2192
2193 fn control_handle(&self) -> &ElementRunnerControlHandle {
2194 &self.control_handle
2195 }
2196
2197 fn drop_without_shutdown(mut self) {
2198 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2200 std::mem::forget(self);
2202 }
2203}
2204
2205impl ElementRunnerSetLevelResponder {
2206 pub fn send(self) -> Result<(), fidl::Error> {
2210 let _result = self.send_raw();
2211 if _result.is_err() {
2212 self.control_handle.shutdown();
2213 }
2214 self.drop_without_shutdown();
2215 _result
2216 }
2217
2218 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2220 let _result = self.send_raw();
2221 self.drop_without_shutdown();
2222 _result
2223 }
2224
2225 fn send_raw(&self) -> Result<(), fidl::Error> {
2226 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2227 fidl::encoding::Flexible::new(()),
2228 self.tx_id,
2229 0x11a93092b228f0b,
2230 fidl::encoding::DynamicFlags::FLEXIBLE,
2231 )
2232 }
2233}
2234
2235#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2236pub struct LeaseControlMarker;
2237
2238impl fidl::endpoints::ProtocolMarker for LeaseControlMarker {
2239 type Proxy = LeaseControlProxy;
2240 type RequestStream = LeaseControlRequestStream;
2241 #[cfg(target_os = "fuchsia")]
2242 type SynchronousProxy = LeaseControlSynchronousProxy;
2243
2244 const DEBUG_NAME: &'static str = "(anonymous) LeaseControl";
2245}
2246
2247pub trait LeaseControlProxyInterface: Send + Sync {
2248 type WatchStatusResponseFut: std::future::Future<Output = Result<LeaseStatus, fidl::Error>>
2249 + Send;
2250 fn r#watch_status(&self, last_status: LeaseStatus) -> Self::WatchStatusResponseFut;
2251}
2252#[derive(Debug)]
2253#[cfg(target_os = "fuchsia")]
2254pub struct LeaseControlSynchronousProxy {
2255 client: fidl::client::sync::Client,
2256}
2257
2258#[cfg(target_os = "fuchsia")]
2259impl fidl::endpoints::SynchronousProxy for LeaseControlSynchronousProxy {
2260 type Proxy = LeaseControlProxy;
2261 type Protocol = LeaseControlMarker;
2262
2263 fn from_channel(inner: fidl::Channel) -> Self {
2264 Self::new(inner)
2265 }
2266
2267 fn into_channel(self) -> fidl::Channel {
2268 self.client.into_channel()
2269 }
2270
2271 fn as_channel(&self) -> &fidl::Channel {
2272 self.client.as_channel()
2273 }
2274}
2275
2276#[cfg(target_os = "fuchsia")]
2277impl LeaseControlSynchronousProxy {
2278 pub fn new(channel: fidl::Channel) -> Self {
2279 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2280 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2281 }
2282
2283 pub fn into_channel(self) -> fidl::Channel {
2284 self.client.into_channel()
2285 }
2286
2287 pub fn wait_for_event(
2290 &self,
2291 deadline: zx::MonotonicInstant,
2292 ) -> Result<LeaseControlEvent, fidl::Error> {
2293 LeaseControlEvent::decode(self.client.wait_for_event(deadline)?)
2294 }
2295
2296 pub fn r#watch_status(
2301 &self,
2302 mut last_status: LeaseStatus,
2303 ___deadline: zx::MonotonicInstant,
2304 ) -> Result<LeaseStatus, fidl::Error> {
2305 let _response = self.client.send_query::<
2306 LeaseControlWatchStatusRequest,
2307 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2308 >(
2309 (last_status,),
2310 0x293ab9b0301ca881,
2311 fidl::encoding::DynamicFlags::FLEXIBLE,
2312 ___deadline,
2313 )?
2314 .into_result::<LeaseControlMarker>("watch_status")?;
2315 Ok(_response.status)
2316 }
2317}
2318
2319#[cfg(target_os = "fuchsia")]
2320impl From<LeaseControlSynchronousProxy> for zx::Handle {
2321 fn from(value: LeaseControlSynchronousProxy) -> Self {
2322 value.into_channel().into()
2323 }
2324}
2325
2326#[cfg(target_os = "fuchsia")]
2327impl From<fidl::Channel> for LeaseControlSynchronousProxy {
2328 fn from(value: fidl::Channel) -> Self {
2329 Self::new(value)
2330 }
2331}
2332
2333#[cfg(target_os = "fuchsia")]
2334impl fidl::endpoints::FromClient for LeaseControlSynchronousProxy {
2335 type Protocol = LeaseControlMarker;
2336
2337 fn from_client(value: fidl::endpoints::ClientEnd<LeaseControlMarker>) -> Self {
2338 Self::new(value.into_channel())
2339 }
2340}
2341
2342#[derive(Debug, Clone)]
2343pub struct LeaseControlProxy {
2344 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2345}
2346
2347impl fidl::endpoints::Proxy for LeaseControlProxy {
2348 type Protocol = LeaseControlMarker;
2349
2350 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2351 Self::new(inner)
2352 }
2353
2354 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2355 self.client.into_channel().map_err(|client| Self { client })
2356 }
2357
2358 fn as_channel(&self) -> &::fidl::AsyncChannel {
2359 self.client.as_channel()
2360 }
2361}
2362
2363impl LeaseControlProxy {
2364 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2366 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2367 Self { client: fidl::client::Client::new(channel, protocol_name) }
2368 }
2369
2370 pub fn take_event_stream(&self) -> LeaseControlEventStream {
2376 LeaseControlEventStream { event_receiver: self.client.take_event_receiver() }
2377 }
2378
2379 pub fn r#watch_status(
2384 &self,
2385 mut last_status: LeaseStatus,
2386 ) -> fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2387 {
2388 LeaseControlProxyInterface::r#watch_status(self, last_status)
2389 }
2390}
2391
2392impl LeaseControlProxyInterface for LeaseControlProxy {
2393 type WatchStatusResponseFut =
2394 fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
2395 fn r#watch_status(&self, mut last_status: LeaseStatus) -> Self::WatchStatusResponseFut {
2396 fn _decode(
2397 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2398 ) -> Result<LeaseStatus, fidl::Error> {
2399 let _response = fidl::client::decode_transaction_body::<
2400 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 0x293ab9b0301ca881,
2403 >(_buf?)?
2404 .into_result::<LeaseControlMarker>("watch_status")?;
2405 Ok(_response.status)
2406 }
2407 self.client.send_query_and_decode::<LeaseControlWatchStatusRequest, LeaseStatus>(
2408 (last_status,),
2409 0x293ab9b0301ca881,
2410 fidl::encoding::DynamicFlags::FLEXIBLE,
2411 _decode,
2412 )
2413 }
2414}
2415
2416pub struct LeaseControlEventStream {
2417 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2418}
2419
2420impl std::marker::Unpin for LeaseControlEventStream {}
2421
2422impl futures::stream::FusedStream for LeaseControlEventStream {
2423 fn is_terminated(&self) -> bool {
2424 self.event_receiver.is_terminated()
2425 }
2426}
2427
2428impl futures::Stream for LeaseControlEventStream {
2429 type Item = Result<LeaseControlEvent, fidl::Error>;
2430
2431 fn poll_next(
2432 mut self: std::pin::Pin<&mut Self>,
2433 cx: &mut std::task::Context<'_>,
2434 ) -> std::task::Poll<Option<Self::Item>> {
2435 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2436 &mut self.event_receiver,
2437 cx
2438 )?) {
2439 Some(buf) => std::task::Poll::Ready(Some(LeaseControlEvent::decode(buf))),
2440 None => std::task::Poll::Ready(None),
2441 }
2442 }
2443}
2444
2445#[derive(Debug)]
2446pub enum LeaseControlEvent {
2447 #[non_exhaustive]
2448 _UnknownEvent {
2449 ordinal: u64,
2451 },
2452}
2453
2454impl LeaseControlEvent {
2455 fn decode(
2457 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2458 ) -> Result<LeaseControlEvent, fidl::Error> {
2459 let (bytes, _handles) = buf.split_mut();
2460 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2461 debug_assert_eq!(tx_header.tx_id, 0);
2462 match tx_header.ordinal {
2463 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2464 Ok(LeaseControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2465 }
2466 _ => Err(fidl::Error::UnknownOrdinal {
2467 ordinal: tx_header.ordinal,
2468 protocol_name: <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2469 }),
2470 }
2471 }
2472}
2473
2474pub struct LeaseControlRequestStream {
2476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2477 is_terminated: bool,
2478}
2479
2480impl std::marker::Unpin for LeaseControlRequestStream {}
2481
2482impl futures::stream::FusedStream for LeaseControlRequestStream {
2483 fn is_terminated(&self) -> bool {
2484 self.is_terminated
2485 }
2486}
2487
2488impl fidl::endpoints::RequestStream for LeaseControlRequestStream {
2489 type Protocol = LeaseControlMarker;
2490 type ControlHandle = LeaseControlControlHandle;
2491
2492 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2493 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2494 }
2495
2496 fn control_handle(&self) -> Self::ControlHandle {
2497 LeaseControlControlHandle { inner: self.inner.clone() }
2498 }
2499
2500 fn into_inner(
2501 self,
2502 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2503 {
2504 (self.inner, self.is_terminated)
2505 }
2506
2507 fn from_inner(
2508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2509 is_terminated: bool,
2510 ) -> Self {
2511 Self { inner, is_terminated }
2512 }
2513}
2514
2515impl futures::Stream for LeaseControlRequestStream {
2516 type Item = Result<LeaseControlRequest, fidl::Error>;
2517
2518 fn poll_next(
2519 mut self: std::pin::Pin<&mut Self>,
2520 cx: &mut std::task::Context<'_>,
2521 ) -> std::task::Poll<Option<Self::Item>> {
2522 let this = &mut *self;
2523 if this.inner.check_shutdown(cx) {
2524 this.is_terminated = true;
2525 return std::task::Poll::Ready(None);
2526 }
2527 if this.is_terminated {
2528 panic!("polled LeaseControlRequestStream after completion");
2529 }
2530 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2531 |bytes, handles| {
2532 match this.inner.channel().read_etc(cx, bytes, handles) {
2533 std::task::Poll::Ready(Ok(())) => {}
2534 std::task::Poll::Pending => return std::task::Poll::Pending,
2535 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2536 this.is_terminated = true;
2537 return std::task::Poll::Ready(None);
2538 }
2539 std::task::Poll::Ready(Err(e)) => {
2540 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2541 e.into(),
2542 ))));
2543 }
2544 }
2545
2546 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2548
2549 std::task::Poll::Ready(Some(match header.ordinal {
2550 0x293ab9b0301ca881 => {
2551 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2552 let mut req = fidl::new_empty!(
2553 LeaseControlWatchStatusRequest,
2554 fidl::encoding::DefaultFuchsiaResourceDialect
2555 );
2556 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LeaseControlWatchStatusRequest>(&header, _body_bytes, handles, &mut req)?;
2557 let control_handle =
2558 LeaseControlControlHandle { inner: this.inner.clone() };
2559 Ok(LeaseControlRequest::WatchStatus {
2560 last_status: req.last_status,
2561
2562 responder: LeaseControlWatchStatusResponder {
2563 control_handle: std::mem::ManuallyDrop::new(control_handle),
2564 tx_id: header.tx_id,
2565 },
2566 })
2567 }
2568 _ if header.tx_id == 0
2569 && header
2570 .dynamic_flags()
2571 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2572 {
2573 Ok(LeaseControlRequest::_UnknownMethod {
2574 ordinal: header.ordinal,
2575 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
2576 method_type: fidl::MethodType::OneWay,
2577 })
2578 }
2579 _ if header
2580 .dynamic_flags()
2581 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2582 {
2583 this.inner.send_framework_err(
2584 fidl::encoding::FrameworkErr::UnknownMethod,
2585 header.tx_id,
2586 header.ordinal,
2587 header.dynamic_flags(),
2588 (bytes, handles),
2589 )?;
2590 Ok(LeaseControlRequest::_UnknownMethod {
2591 ordinal: header.ordinal,
2592 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
2593 method_type: fidl::MethodType::TwoWay,
2594 })
2595 }
2596 _ => Err(fidl::Error::UnknownOrdinal {
2597 ordinal: header.ordinal,
2598 protocol_name:
2599 <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2600 }),
2601 }))
2602 },
2603 )
2604 }
2605}
2606
2607#[derive(Debug)]
2612pub enum LeaseControlRequest {
2613 WatchStatus { last_status: LeaseStatus, responder: LeaseControlWatchStatusResponder },
2618 #[non_exhaustive]
2620 _UnknownMethod {
2621 ordinal: u64,
2623 control_handle: LeaseControlControlHandle,
2624 method_type: fidl::MethodType,
2625 },
2626}
2627
2628impl LeaseControlRequest {
2629 #[allow(irrefutable_let_patterns)]
2630 pub fn into_watch_status(self) -> Option<(LeaseStatus, LeaseControlWatchStatusResponder)> {
2631 if let LeaseControlRequest::WatchStatus { last_status, responder } = self {
2632 Some((last_status, responder))
2633 } else {
2634 None
2635 }
2636 }
2637
2638 pub fn method_name(&self) -> &'static str {
2640 match *self {
2641 LeaseControlRequest::WatchStatus { .. } => "watch_status",
2642 LeaseControlRequest::_UnknownMethod {
2643 method_type: fidl::MethodType::OneWay, ..
2644 } => "unknown one-way method",
2645 LeaseControlRequest::_UnknownMethod {
2646 method_type: fidl::MethodType::TwoWay, ..
2647 } => "unknown two-way method",
2648 }
2649 }
2650}
2651
2652#[derive(Debug, Clone)]
2653pub struct LeaseControlControlHandle {
2654 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2655}
2656
2657impl fidl::endpoints::ControlHandle for LeaseControlControlHandle {
2658 fn shutdown(&self) {
2659 self.inner.shutdown()
2660 }
2661 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2662 self.inner.shutdown_with_epitaph(status)
2663 }
2664
2665 fn is_closed(&self) -> bool {
2666 self.inner.channel().is_closed()
2667 }
2668 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2669 self.inner.channel().on_closed()
2670 }
2671
2672 #[cfg(target_os = "fuchsia")]
2673 fn signal_peer(
2674 &self,
2675 clear_mask: zx::Signals,
2676 set_mask: zx::Signals,
2677 ) -> Result<(), zx_status::Status> {
2678 use fidl::Peered;
2679 self.inner.channel().signal_peer(clear_mask, set_mask)
2680 }
2681}
2682
2683impl LeaseControlControlHandle {}
2684
2685#[must_use = "FIDL methods require a response to be sent"]
2686#[derive(Debug)]
2687pub struct LeaseControlWatchStatusResponder {
2688 control_handle: std::mem::ManuallyDrop<LeaseControlControlHandle>,
2689 tx_id: u32,
2690}
2691
2692impl std::ops::Drop for LeaseControlWatchStatusResponder {
2696 fn drop(&mut self) {
2697 self.control_handle.shutdown();
2698 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2700 }
2701}
2702
2703impl fidl::endpoints::Responder for LeaseControlWatchStatusResponder {
2704 type ControlHandle = LeaseControlControlHandle;
2705
2706 fn control_handle(&self) -> &LeaseControlControlHandle {
2707 &self.control_handle
2708 }
2709
2710 fn drop_without_shutdown(mut self) {
2711 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2713 std::mem::forget(self);
2715 }
2716}
2717
2718impl LeaseControlWatchStatusResponder {
2719 pub fn send(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2723 let _result = self.send_raw(status);
2724 if _result.is_err() {
2725 self.control_handle.shutdown();
2726 }
2727 self.drop_without_shutdown();
2728 _result
2729 }
2730
2731 pub fn send_no_shutdown_on_err(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2733 let _result = self.send_raw(status);
2734 self.drop_without_shutdown();
2735 _result
2736 }
2737
2738 fn send_raw(&self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2739 self.control_handle
2740 .inner
2741 .send::<fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>>(
2742 fidl::encoding::Flexible::new((status,)),
2743 self.tx_id,
2744 0x293ab9b0301ca881,
2745 fidl::encoding::DynamicFlags::FLEXIBLE,
2746 )
2747 }
2748}
2749
2750#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2751pub struct LessorMarker;
2752
2753impl fidl::endpoints::ProtocolMarker for LessorMarker {
2754 type Proxy = LessorProxy;
2755 type RequestStream = LessorRequestStream;
2756 #[cfg(target_os = "fuchsia")]
2757 type SynchronousProxy = LessorSynchronousProxy;
2758
2759 const DEBUG_NAME: &'static str = "(anonymous) Lessor";
2760}
2761pub type LessorLeaseResult = Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>;
2762
2763pub trait LessorProxyInterface: Send + Sync {
2764 type LeaseResponseFut: std::future::Future<Output = Result<LessorLeaseResult, fidl::Error>>
2765 + Send;
2766 fn r#lease(&self, level: u8) -> Self::LeaseResponseFut;
2767}
2768#[derive(Debug)]
2769#[cfg(target_os = "fuchsia")]
2770pub struct LessorSynchronousProxy {
2771 client: fidl::client::sync::Client,
2772}
2773
2774#[cfg(target_os = "fuchsia")]
2775impl fidl::endpoints::SynchronousProxy for LessorSynchronousProxy {
2776 type Proxy = LessorProxy;
2777 type Protocol = LessorMarker;
2778
2779 fn from_channel(inner: fidl::Channel) -> Self {
2780 Self::new(inner)
2781 }
2782
2783 fn into_channel(self) -> fidl::Channel {
2784 self.client.into_channel()
2785 }
2786
2787 fn as_channel(&self) -> &fidl::Channel {
2788 self.client.as_channel()
2789 }
2790}
2791
2792#[cfg(target_os = "fuchsia")]
2793impl LessorSynchronousProxy {
2794 pub fn new(channel: fidl::Channel) -> Self {
2795 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2796 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2797 }
2798
2799 pub fn into_channel(self) -> fidl::Channel {
2800 self.client.into_channel()
2801 }
2802
2803 pub fn wait_for_event(
2806 &self,
2807 deadline: zx::MonotonicInstant,
2808 ) -> Result<LessorEvent, fidl::Error> {
2809 LessorEvent::decode(self.client.wait_for_event(deadline)?)
2810 }
2811
2812 pub fn r#lease(
2821 &self,
2822 mut level: u8,
2823 ___deadline: zx::MonotonicInstant,
2824 ) -> Result<LessorLeaseResult, fidl::Error> {
2825 let _response = self.client.send_query::<
2826 LessorLeaseRequest,
2827 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
2828 >(
2829 (level,),
2830 0x38999f84b2f1f9ad,
2831 fidl::encoding::DynamicFlags::FLEXIBLE,
2832 ___deadline,
2833 )?
2834 .into_result::<LessorMarker>("lease")?;
2835 Ok(_response.map(|x| x.lease_control))
2836 }
2837}
2838
2839#[cfg(target_os = "fuchsia")]
2840impl From<LessorSynchronousProxy> for zx::Handle {
2841 fn from(value: LessorSynchronousProxy) -> Self {
2842 value.into_channel().into()
2843 }
2844}
2845
2846#[cfg(target_os = "fuchsia")]
2847impl From<fidl::Channel> for LessorSynchronousProxy {
2848 fn from(value: fidl::Channel) -> Self {
2849 Self::new(value)
2850 }
2851}
2852
2853#[cfg(target_os = "fuchsia")]
2854impl fidl::endpoints::FromClient for LessorSynchronousProxy {
2855 type Protocol = LessorMarker;
2856
2857 fn from_client(value: fidl::endpoints::ClientEnd<LessorMarker>) -> Self {
2858 Self::new(value.into_channel())
2859 }
2860}
2861
2862#[derive(Debug, Clone)]
2863pub struct LessorProxy {
2864 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2865}
2866
2867impl fidl::endpoints::Proxy for LessorProxy {
2868 type Protocol = LessorMarker;
2869
2870 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2871 Self::new(inner)
2872 }
2873
2874 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2875 self.client.into_channel().map_err(|client| Self { client })
2876 }
2877
2878 fn as_channel(&self) -> &::fidl::AsyncChannel {
2879 self.client.as_channel()
2880 }
2881}
2882
2883impl LessorProxy {
2884 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2886 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2887 Self { client: fidl::client::Client::new(channel, protocol_name) }
2888 }
2889
2890 pub fn take_event_stream(&self) -> LessorEventStream {
2896 LessorEventStream { event_receiver: self.client.take_event_receiver() }
2897 }
2898
2899 pub fn r#lease(
2908 &self,
2909 mut level: u8,
2910 ) -> fidl::client::QueryResponseFut<
2911 LessorLeaseResult,
2912 fidl::encoding::DefaultFuchsiaResourceDialect,
2913 > {
2914 LessorProxyInterface::r#lease(self, level)
2915 }
2916}
2917
2918impl LessorProxyInterface for LessorProxy {
2919 type LeaseResponseFut = fidl::client::QueryResponseFut<
2920 LessorLeaseResult,
2921 fidl::encoding::DefaultFuchsiaResourceDialect,
2922 >;
2923 fn r#lease(&self, mut level: u8) -> Self::LeaseResponseFut {
2924 fn _decode(
2925 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2926 ) -> Result<LessorLeaseResult, fidl::Error> {
2927 let _response = fidl::client::decode_transaction_body::<
2928 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
2929 fidl::encoding::DefaultFuchsiaResourceDialect,
2930 0x38999f84b2f1f9ad,
2931 >(_buf?)?
2932 .into_result::<LessorMarker>("lease")?;
2933 Ok(_response.map(|x| x.lease_control))
2934 }
2935 self.client.send_query_and_decode::<LessorLeaseRequest, LessorLeaseResult>(
2936 (level,),
2937 0x38999f84b2f1f9ad,
2938 fidl::encoding::DynamicFlags::FLEXIBLE,
2939 _decode,
2940 )
2941 }
2942}
2943
2944pub struct LessorEventStream {
2945 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2946}
2947
2948impl std::marker::Unpin for LessorEventStream {}
2949
2950impl futures::stream::FusedStream for LessorEventStream {
2951 fn is_terminated(&self) -> bool {
2952 self.event_receiver.is_terminated()
2953 }
2954}
2955
2956impl futures::Stream for LessorEventStream {
2957 type Item = Result<LessorEvent, fidl::Error>;
2958
2959 fn poll_next(
2960 mut self: std::pin::Pin<&mut Self>,
2961 cx: &mut std::task::Context<'_>,
2962 ) -> std::task::Poll<Option<Self::Item>> {
2963 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2964 &mut self.event_receiver,
2965 cx
2966 )?) {
2967 Some(buf) => std::task::Poll::Ready(Some(LessorEvent::decode(buf))),
2968 None => std::task::Poll::Ready(None),
2969 }
2970 }
2971}
2972
2973#[derive(Debug)]
2974pub enum LessorEvent {
2975 #[non_exhaustive]
2976 _UnknownEvent {
2977 ordinal: u64,
2979 },
2980}
2981
2982impl LessorEvent {
2983 fn decode(
2985 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2986 ) -> Result<LessorEvent, fidl::Error> {
2987 let (bytes, _handles) = buf.split_mut();
2988 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2989 debug_assert_eq!(tx_header.tx_id, 0);
2990 match tx_header.ordinal {
2991 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2992 Ok(LessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2993 }
2994 _ => Err(fidl::Error::UnknownOrdinal {
2995 ordinal: tx_header.ordinal,
2996 protocol_name: <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2997 }),
2998 }
2999 }
3000}
3001
3002pub struct LessorRequestStream {
3004 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3005 is_terminated: bool,
3006}
3007
3008impl std::marker::Unpin for LessorRequestStream {}
3009
3010impl futures::stream::FusedStream for LessorRequestStream {
3011 fn is_terminated(&self) -> bool {
3012 self.is_terminated
3013 }
3014}
3015
3016impl fidl::endpoints::RequestStream for LessorRequestStream {
3017 type Protocol = LessorMarker;
3018 type ControlHandle = LessorControlHandle;
3019
3020 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3021 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3022 }
3023
3024 fn control_handle(&self) -> Self::ControlHandle {
3025 LessorControlHandle { inner: self.inner.clone() }
3026 }
3027
3028 fn into_inner(
3029 self,
3030 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3031 {
3032 (self.inner, self.is_terminated)
3033 }
3034
3035 fn from_inner(
3036 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3037 is_terminated: bool,
3038 ) -> Self {
3039 Self { inner, is_terminated }
3040 }
3041}
3042
3043impl futures::Stream for LessorRequestStream {
3044 type Item = Result<LessorRequest, fidl::Error>;
3045
3046 fn poll_next(
3047 mut self: std::pin::Pin<&mut Self>,
3048 cx: &mut std::task::Context<'_>,
3049 ) -> std::task::Poll<Option<Self::Item>> {
3050 let this = &mut *self;
3051 if this.inner.check_shutdown(cx) {
3052 this.is_terminated = true;
3053 return std::task::Poll::Ready(None);
3054 }
3055 if this.is_terminated {
3056 panic!("polled LessorRequestStream after completion");
3057 }
3058 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3059 |bytes, handles| {
3060 match this.inner.channel().read_etc(cx, bytes, handles) {
3061 std::task::Poll::Ready(Ok(())) => {}
3062 std::task::Poll::Pending => return std::task::Poll::Pending,
3063 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3064 this.is_terminated = true;
3065 return std::task::Poll::Ready(None);
3066 }
3067 std::task::Poll::Ready(Err(e)) => {
3068 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3069 e.into(),
3070 ))));
3071 }
3072 }
3073
3074 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3076
3077 std::task::Poll::Ready(Some(match header.ordinal {
3078 0x38999f84b2f1f9ad => {
3079 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3080 let mut req = fidl::new_empty!(
3081 LessorLeaseRequest,
3082 fidl::encoding::DefaultFuchsiaResourceDialect
3083 );
3084 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LessorLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
3085 let control_handle = LessorControlHandle { inner: this.inner.clone() };
3086 Ok(LessorRequest::Lease {
3087 level: req.level,
3088
3089 responder: LessorLeaseResponder {
3090 control_handle: std::mem::ManuallyDrop::new(control_handle),
3091 tx_id: header.tx_id,
3092 },
3093 })
3094 }
3095 _ if header.tx_id == 0
3096 && header
3097 .dynamic_flags()
3098 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3099 {
3100 Ok(LessorRequest::_UnknownMethod {
3101 ordinal: header.ordinal,
3102 control_handle: LessorControlHandle { inner: this.inner.clone() },
3103 method_type: fidl::MethodType::OneWay,
3104 })
3105 }
3106 _ if header
3107 .dynamic_flags()
3108 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3109 {
3110 this.inner.send_framework_err(
3111 fidl::encoding::FrameworkErr::UnknownMethod,
3112 header.tx_id,
3113 header.ordinal,
3114 header.dynamic_flags(),
3115 (bytes, handles),
3116 )?;
3117 Ok(LessorRequest::_UnknownMethod {
3118 ordinal: header.ordinal,
3119 control_handle: LessorControlHandle { inner: this.inner.clone() },
3120 method_type: fidl::MethodType::TwoWay,
3121 })
3122 }
3123 _ => Err(fidl::Error::UnknownOrdinal {
3124 ordinal: header.ordinal,
3125 protocol_name:
3126 <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3127 }),
3128 }))
3129 },
3130 )
3131 }
3132}
3133
3134#[derive(Debug)]
3137pub enum LessorRequest {
3138 Lease { level: u8, responder: LessorLeaseResponder },
3147 #[non_exhaustive]
3149 _UnknownMethod {
3150 ordinal: u64,
3152 control_handle: LessorControlHandle,
3153 method_type: fidl::MethodType,
3154 },
3155}
3156
3157impl LessorRequest {
3158 #[allow(irrefutable_let_patterns)]
3159 pub fn into_lease(self) -> Option<(u8, LessorLeaseResponder)> {
3160 if let LessorRequest::Lease { level, responder } = self {
3161 Some((level, responder))
3162 } else {
3163 None
3164 }
3165 }
3166
3167 pub fn method_name(&self) -> &'static str {
3169 match *self {
3170 LessorRequest::Lease { .. } => "lease",
3171 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3172 "unknown one-way method"
3173 }
3174 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3175 "unknown two-way method"
3176 }
3177 }
3178 }
3179}
3180
3181#[derive(Debug, Clone)]
3182pub struct LessorControlHandle {
3183 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3184}
3185
3186impl fidl::endpoints::ControlHandle for LessorControlHandle {
3187 fn shutdown(&self) {
3188 self.inner.shutdown()
3189 }
3190 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3191 self.inner.shutdown_with_epitaph(status)
3192 }
3193
3194 fn is_closed(&self) -> bool {
3195 self.inner.channel().is_closed()
3196 }
3197 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3198 self.inner.channel().on_closed()
3199 }
3200
3201 #[cfg(target_os = "fuchsia")]
3202 fn signal_peer(
3203 &self,
3204 clear_mask: zx::Signals,
3205 set_mask: zx::Signals,
3206 ) -> Result<(), zx_status::Status> {
3207 use fidl::Peered;
3208 self.inner.channel().signal_peer(clear_mask, set_mask)
3209 }
3210}
3211
3212impl LessorControlHandle {}
3213
3214#[must_use = "FIDL methods require a response to be sent"]
3215#[derive(Debug)]
3216pub struct LessorLeaseResponder {
3217 control_handle: std::mem::ManuallyDrop<LessorControlHandle>,
3218 tx_id: u32,
3219}
3220
3221impl std::ops::Drop for LessorLeaseResponder {
3225 fn drop(&mut self) {
3226 self.control_handle.shutdown();
3227 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3229 }
3230}
3231
3232impl fidl::endpoints::Responder for LessorLeaseResponder {
3233 type ControlHandle = LessorControlHandle;
3234
3235 fn control_handle(&self) -> &LessorControlHandle {
3236 &self.control_handle
3237 }
3238
3239 fn drop_without_shutdown(mut self) {
3240 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3242 std::mem::forget(self);
3244 }
3245}
3246
3247impl LessorLeaseResponder {
3248 pub fn send(
3252 self,
3253 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3254 ) -> Result<(), fidl::Error> {
3255 let _result = self.send_raw(result);
3256 if _result.is_err() {
3257 self.control_handle.shutdown();
3258 }
3259 self.drop_without_shutdown();
3260 _result
3261 }
3262
3263 pub fn send_no_shutdown_on_err(
3265 self,
3266 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3267 ) -> Result<(), fidl::Error> {
3268 let _result = self.send_raw(result);
3269 self.drop_without_shutdown();
3270 _result
3271 }
3272
3273 fn send_raw(
3274 &self,
3275 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3276 ) -> Result<(), fidl::Error> {
3277 self.control_handle
3278 .inner
3279 .send::<fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>>(
3280 fidl::encoding::FlexibleResult::new(result.map(|lease_control| (lease_control,))),
3281 self.tx_id,
3282 0x38999f84b2f1f9ad,
3283 fidl::encoding::DynamicFlags::FLEXIBLE,
3284 )
3285 }
3286}
3287
3288#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3289pub struct StatusMarker;
3290
3291impl fidl::endpoints::ProtocolMarker for StatusMarker {
3292 type Proxy = StatusProxy;
3293 type RequestStream = StatusRequestStream;
3294 #[cfg(target_os = "fuchsia")]
3295 type SynchronousProxy = StatusSynchronousProxy;
3296
3297 const DEBUG_NAME: &'static str = "(anonymous) Status";
3298}
3299pub type StatusWatchPowerLevelResult = Result<u8, StatusError>;
3300
3301pub trait StatusProxyInterface: Send + Sync {
3302 type WatchPowerLevelResponseFut: std::future::Future<Output = Result<StatusWatchPowerLevelResult, fidl::Error>>
3303 + Send;
3304 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut;
3305}
3306#[derive(Debug)]
3307#[cfg(target_os = "fuchsia")]
3308pub struct StatusSynchronousProxy {
3309 client: fidl::client::sync::Client,
3310}
3311
3312#[cfg(target_os = "fuchsia")]
3313impl fidl::endpoints::SynchronousProxy for StatusSynchronousProxy {
3314 type Proxy = StatusProxy;
3315 type Protocol = StatusMarker;
3316
3317 fn from_channel(inner: fidl::Channel) -> Self {
3318 Self::new(inner)
3319 }
3320
3321 fn into_channel(self) -> fidl::Channel {
3322 self.client.into_channel()
3323 }
3324
3325 fn as_channel(&self) -> &fidl::Channel {
3326 self.client.as_channel()
3327 }
3328}
3329
3330#[cfg(target_os = "fuchsia")]
3331impl StatusSynchronousProxy {
3332 pub fn new(channel: fidl::Channel) -> Self {
3333 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3334 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3335 }
3336
3337 pub fn into_channel(self) -> fidl::Channel {
3338 self.client.into_channel()
3339 }
3340
3341 pub fn wait_for_event(
3344 &self,
3345 deadline: zx::MonotonicInstant,
3346 ) -> Result<StatusEvent, fidl::Error> {
3347 StatusEvent::decode(self.client.wait_for_event(deadline)?)
3348 }
3349
3350 pub fn r#watch_power_level(
3354 &self,
3355 ___deadline: zx::MonotonicInstant,
3356 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
3357 let _response = self.client.send_query::<
3358 fidl::encoding::EmptyPayload,
3359 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
3360 >(
3361 (),
3362 0x2f11ba8df9b5614e,
3363 fidl::encoding::DynamicFlags::FLEXIBLE,
3364 ___deadline,
3365 )?
3366 .into_result::<StatusMarker>("watch_power_level")?;
3367 Ok(_response.map(|x| x.current_level))
3368 }
3369}
3370
3371#[cfg(target_os = "fuchsia")]
3372impl From<StatusSynchronousProxy> for zx::Handle {
3373 fn from(value: StatusSynchronousProxy) -> Self {
3374 value.into_channel().into()
3375 }
3376}
3377
3378#[cfg(target_os = "fuchsia")]
3379impl From<fidl::Channel> for StatusSynchronousProxy {
3380 fn from(value: fidl::Channel) -> Self {
3381 Self::new(value)
3382 }
3383}
3384
3385#[cfg(target_os = "fuchsia")]
3386impl fidl::endpoints::FromClient for StatusSynchronousProxy {
3387 type Protocol = StatusMarker;
3388
3389 fn from_client(value: fidl::endpoints::ClientEnd<StatusMarker>) -> Self {
3390 Self::new(value.into_channel())
3391 }
3392}
3393
3394#[derive(Debug, Clone)]
3395pub struct StatusProxy {
3396 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3397}
3398
3399impl fidl::endpoints::Proxy for StatusProxy {
3400 type Protocol = StatusMarker;
3401
3402 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3403 Self::new(inner)
3404 }
3405
3406 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3407 self.client.into_channel().map_err(|client| Self { client })
3408 }
3409
3410 fn as_channel(&self) -> &::fidl::AsyncChannel {
3411 self.client.as_channel()
3412 }
3413}
3414
3415impl StatusProxy {
3416 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3418 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3419 Self { client: fidl::client::Client::new(channel, protocol_name) }
3420 }
3421
3422 pub fn take_event_stream(&self) -> StatusEventStream {
3428 StatusEventStream { event_receiver: self.client.take_event_receiver() }
3429 }
3430
3431 pub fn r#watch_power_level(
3435 &self,
3436 ) -> fidl::client::QueryResponseFut<
3437 StatusWatchPowerLevelResult,
3438 fidl::encoding::DefaultFuchsiaResourceDialect,
3439 > {
3440 StatusProxyInterface::r#watch_power_level(self)
3441 }
3442}
3443
3444impl StatusProxyInterface for StatusProxy {
3445 type WatchPowerLevelResponseFut = fidl::client::QueryResponseFut<
3446 StatusWatchPowerLevelResult,
3447 fidl::encoding::DefaultFuchsiaResourceDialect,
3448 >;
3449 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut {
3450 fn _decode(
3451 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3452 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
3453 let _response = fidl::client::decode_transaction_body::<
3454 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
3455 fidl::encoding::DefaultFuchsiaResourceDialect,
3456 0x2f11ba8df9b5614e,
3457 >(_buf?)?
3458 .into_result::<StatusMarker>("watch_power_level")?;
3459 Ok(_response.map(|x| x.current_level))
3460 }
3461 self.client
3462 .send_query_and_decode::<fidl::encoding::EmptyPayload, StatusWatchPowerLevelResult>(
3463 (),
3464 0x2f11ba8df9b5614e,
3465 fidl::encoding::DynamicFlags::FLEXIBLE,
3466 _decode,
3467 )
3468 }
3469}
3470
3471pub struct StatusEventStream {
3472 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3473}
3474
3475impl std::marker::Unpin for StatusEventStream {}
3476
3477impl futures::stream::FusedStream for StatusEventStream {
3478 fn is_terminated(&self) -> bool {
3479 self.event_receiver.is_terminated()
3480 }
3481}
3482
3483impl futures::Stream for StatusEventStream {
3484 type Item = Result<StatusEvent, fidl::Error>;
3485
3486 fn poll_next(
3487 mut self: std::pin::Pin<&mut Self>,
3488 cx: &mut std::task::Context<'_>,
3489 ) -> std::task::Poll<Option<Self::Item>> {
3490 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3491 &mut self.event_receiver,
3492 cx
3493 )?) {
3494 Some(buf) => std::task::Poll::Ready(Some(StatusEvent::decode(buf))),
3495 None => std::task::Poll::Ready(None),
3496 }
3497 }
3498}
3499
3500#[derive(Debug)]
3501pub enum StatusEvent {
3502 #[non_exhaustive]
3503 _UnknownEvent {
3504 ordinal: u64,
3506 },
3507}
3508
3509impl StatusEvent {
3510 fn decode(
3512 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3513 ) -> Result<StatusEvent, fidl::Error> {
3514 let (bytes, _handles) = buf.split_mut();
3515 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3516 debug_assert_eq!(tx_header.tx_id, 0);
3517 match tx_header.ordinal {
3518 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3519 Ok(StatusEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3520 }
3521 _ => Err(fidl::Error::UnknownOrdinal {
3522 ordinal: tx_header.ordinal,
3523 protocol_name: <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3524 }),
3525 }
3526 }
3527}
3528
3529pub struct StatusRequestStream {
3531 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3532 is_terminated: bool,
3533}
3534
3535impl std::marker::Unpin for StatusRequestStream {}
3536
3537impl futures::stream::FusedStream for StatusRequestStream {
3538 fn is_terminated(&self) -> bool {
3539 self.is_terminated
3540 }
3541}
3542
3543impl fidl::endpoints::RequestStream for StatusRequestStream {
3544 type Protocol = StatusMarker;
3545 type ControlHandle = StatusControlHandle;
3546
3547 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3548 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3549 }
3550
3551 fn control_handle(&self) -> Self::ControlHandle {
3552 StatusControlHandle { inner: self.inner.clone() }
3553 }
3554
3555 fn into_inner(
3556 self,
3557 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3558 {
3559 (self.inner, self.is_terminated)
3560 }
3561
3562 fn from_inner(
3563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3564 is_terminated: bool,
3565 ) -> Self {
3566 Self { inner, is_terminated }
3567 }
3568}
3569
3570impl futures::Stream for StatusRequestStream {
3571 type Item = Result<StatusRequest, fidl::Error>;
3572
3573 fn poll_next(
3574 mut self: std::pin::Pin<&mut Self>,
3575 cx: &mut std::task::Context<'_>,
3576 ) -> std::task::Poll<Option<Self::Item>> {
3577 let this = &mut *self;
3578 if this.inner.check_shutdown(cx) {
3579 this.is_terminated = true;
3580 return std::task::Poll::Ready(None);
3581 }
3582 if this.is_terminated {
3583 panic!("polled StatusRequestStream after completion");
3584 }
3585 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3586 |bytes, handles| {
3587 match this.inner.channel().read_etc(cx, bytes, handles) {
3588 std::task::Poll::Ready(Ok(())) => {}
3589 std::task::Poll::Pending => return std::task::Poll::Pending,
3590 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3591 this.is_terminated = true;
3592 return std::task::Poll::Ready(None);
3593 }
3594 std::task::Poll::Ready(Err(e)) => {
3595 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3596 e.into(),
3597 ))));
3598 }
3599 }
3600
3601 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3603
3604 std::task::Poll::Ready(Some(match header.ordinal {
3605 0x2f11ba8df9b5614e => {
3606 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3607 let mut req = fidl::new_empty!(
3608 fidl::encoding::EmptyPayload,
3609 fidl::encoding::DefaultFuchsiaResourceDialect
3610 );
3611 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3612 let control_handle = StatusControlHandle { inner: this.inner.clone() };
3613 Ok(StatusRequest::WatchPowerLevel {
3614 responder: StatusWatchPowerLevelResponder {
3615 control_handle: std::mem::ManuallyDrop::new(control_handle),
3616 tx_id: header.tx_id,
3617 },
3618 })
3619 }
3620 _ if header.tx_id == 0
3621 && header
3622 .dynamic_flags()
3623 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3624 {
3625 Ok(StatusRequest::_UnknownMethod {
3626 ordinal: header.ordinal,
3627 control_handle: StatusControlHandle { inner: this.inner.clone() },
3628 method_type: fidl::MethodType::OneWay,
3629 })
3630 }
3631 _ if header
3632 .dynamic_flags()
3633 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3634 {
3635 this.inner.send_framework_err(
3636 fidl::encoding::FrameworkErr::UnknownMethod,
3637 header.tx_id,
3638 header.ordinal,
3639 header.dynamic_flags(),
3640 (bytes, handles),
3641 )?;
3642 Ok(StatusRequest::_UnknownMethod {
3643 ordinal: header.ordinal,
3644 control_handle: StatusControlHandle { inner: this.inner.clone() },
3645 method_type: fidl::MethodType::TwoWay,
3646 })
3647 }
3648 _ => Err(fidl::Error::UnknownOrdinal {
3649 ordinal: header.ordinal,
3650 protocol_name:
3651 <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3652 }),
3653 }))
3654 },
3655 )
3656 }
3657}
3658
3659#[derive(Debug)]
3665pub enum StatusRequest {
3666 WatchPowerLevel { responder: StatusWatchPowerLevelResponder },
3670 #[non_exhaustive]
3672 _UnknownMethod {
3673 ordinal: u64,
3675 control_handle: StatusControlHandle,
3676 method_type: fidl::MethodType,
3677 },
3678}
3679
3680impl StatusRequest {
3681 #[allow(irrefutable_let_patterns)]
3682 pub fn into_watch_power_level(self) -> Option<(StatusWatchPowerLevelResponder)> {
3683 if let StatusRequest::WatchPowerLevel { responder } = self {
3684 Some((responder))
3685 } else {
3686 None
3687 }
3688 }
3689
3690 pub fn method_name(&self) -> &'static str {
3692 match *self {
3693 StatusRequest::WatchPowerLevel { .. } => "watch_power_level",
3694 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3695 "unknown one-way method"
3696 }
3697 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3698 "unknown two-way method"
3699 }
3700 }
3701 }
3702}
3703
3704#[derive(Debug, Clone)]
3705pub struct StatusControlHandle {
3706 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3707}
3708
3709impl fidl::endpoints::ControlHandle for StatusControlHandle {
3710 fn shutdown(&self) {
3711 self.inner.shutdown()
3712 }
3713 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3714 self.inner.shutdown_with_epitaph(status)
3715 }
3716
3717 fn is_closed(&self) -> bool {
3718 self.inner.channel().is_closed()
3719 }
3720 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3721 self.inner.channel().on_closed()
3722 }
3723
3724 #[cfg(target_os = "fuchsia")]
3725 fn signal_peer(
3726 &self,
3727 clear_mask: zx::Signals,
3728 set_mask: zx::Signals,
3729 ) -> Result<(), zx_status::Status> {
3730 use fidl::Peered;
3731 self.inner.channel().signal_peer(clear_mask, set_mask)
3732 }
3733}
3734
3735impl StatusControlHandle {}
3736
3737#[must_use = "FIDL methods require a response to be sent"]
3738#[derive(Debug)]
3739pub struct StatusWatchPowerLevelResponder {
3740 control_handle: std::mem::ManuallyDrop<StatusControlHandle>,
3741 tx_id: u32,
3742}
3743
3744impl std::ops::Drop for StatusWatchPowerLevelResponder {
3748 fn drop(&mut self) {
3749 self.control_handle.shutdown();
3750 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3752 }
3753}
3754
3755impl fidl::endpoints::Responder for StatusWatchPowerLevelResponder {
3756 type ControlHandle = StatusControlHandle;
3757
3758 fn control_handle(&self) -> &StatusControlHandle {
3759 &self.control_handle
3760 }
3761
3762 fn drop_without_shutdown(mut self) {
3763 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3765 std::mem::forget(self);
3767 }
3768}
3769
3770impl StatusWatchPowerLevelResponder {
3771 pub fn send(self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
3775 let _result = self.send_raw(result);
3776 if _result.is_err() {
3777 self.control_handle.shutdown();
3778 }
3779 self.drop_without_shutdown();
3780 _result
3781 }
3782
3783 pub fn send_no_shutdown_on_err(
3785 self,
3786 mut result: Result<u8, StatusError>,
3787 ) -> Result<(), fidl::Error> {
3788 let _result = self.send_raw(result);
3789 self.drop_without_shutdown();
3790 _result
3791 }
3792
3793 fn send_raw(&self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
3794 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3795 StatusWatchPowerLevelResponse,
3796 StatusError,
3797 >>(
3798 fidl::encoding::FlexibleResult::new(result.map(|current_level| (current_level,))),
3799 self.tx_id,
3800 0x2f11ba8df9b5614e,
3801 fidl::encoding::DynamicFlags::FLEXIBLE,
3802 )
3803 }
3804}
3805
3806#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3807pub struct TopologyMarker;
3808
3809impl fidl::endpoints::ProtocolMarker for TopologyMarker {
3810 type Proxy = TopologyProxy;
3811 type RequestStream = TopologyRequestStream;
3812 #[cfg(target_os = "fuchsia")]
3813 type SynchronousProxy = TopologySynchronousProxy;
3814
3815 const DEBUG_NAME: &'static str = "fuchsia.power.broker.Topology";
3816}
3817impl fidl::endpoints::DiscoverableProtocolMarker for TopologyMarker {}
3818pub type TopologyAddElementResult = Result<(), AddElementError>;
3819
3820pub trait TopologyProxyInterface: Send + Sync {
3821 type AddElementResponseFut: std::future::Future<Output = Result<TopologyAddElementResult, fidl::Error>>
3822 + Send;
3823 fn r#add_element(&self, payload: ElementSchema) -> Self::AddElementResponseFut;
3824}
3825#[derive(Debug)]
3826#[cfg(target_os = "fuchsia")]
3827pub struct TopologySynchronousProxy {
3828 client: fidl::client::sync::Client,
3829}
3830
3831#[cfg(target_os = "fuchsia")]
3832impl fidl::endpoints::SynchronousProxy for TopologySynchronousProxy {
3833 type Proxy = TopologyProxy;
3834 type Protocol = TopologyMarker;
3835
3836 fn from_channel(inner: fidl::Channel) -> Self {
3837 Self::new(inner)
3838 }
3839
3840 fn into_channel(self) -> fidl::Channel {
3841 self.client.into_channel()
3842 }
3843
3844 fn as_channel(&self) -> &fidl::Channel {
3845 self.client.as_channel()
3846 }
3847}
3848
3849#[cfg(target_os = "fuchsia")]
3850impl TopologySynchronousProxy {
3851 pub fn new(channel: fidl::Channel) -> Self {
3852 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3853 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3854 }
3855
3856 pub fn into_channel(self) -> fidl::Channel {
3857 self.client.into_channel()
3858 }
3859
3860 pub fn wait_for_event(
3863 &self,
3864 deadline: zx::MonotonicInstant,
3865 ) -> Result<TopologyEvent, fidl::Error> {
3866 TopologyEvent::decode(self.client.wait_for_event(deadline)?)
3867 }
3868
3869 pub fn r#add_element(
3872 &self,
3873 mut payload: ElementSchema,
3874 ___deadline: zx::MonotonicInstant,
3875 ) -> Result<TopologyAddElementResult, fidl::Error> {
3876 let _response = self.client.send_query::<
3877 ElementSchema,
3878 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
3879 >(
3880 &mut payload,
3881 0x269ed93c9e87fa03,
3882 fidl::encoding::DynamicFlags::FLEXIBLE,
3883 ___deadline,
3884 )?
3885 .into_result::<TopologyMarker>("add_element")?;
3886 Ok(_response.map(|x| x))
3887 }
3888}
3889
3890#[cfg(target_os = "fuchsia")]
3891impl From<TopologySynchronousProxy> for zx::Handle {
3892 fn from(value: TopologySynchronousProxy) -> Self {
3893 value.into_channel().into()
3894 }
3895}
3896
3897#[cfg(target_os = "fuchsia")]
3898impl From<fidl::Channel> for TopologySynchronousProxy {
3899 fn from(value: fidl::Channel) -> Self {
3900 Self::new(value)
3901 }
3902}
3903
3904#[cfg(target_os = "fuchsia")]
3905impl fidl::endpoints::FromClient for TopologySynchronousProxy {
3906 type Protocol = TopologyMarker;
3907
3908 fn from_client(value: fidl::endpoints::ClientEnd<TopologyMarker>) -> Self {
3909 Self::new(value.into_channel())
3910 }
3911}
3912
3913#[derive(Debug, Clone)]
3914pub struct TopologyProxy {
3915 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3916}
3917
3918impl fidl::endpoints::Proxy for TopologyProxy {
3919 type Protocol = TopologyMarker;
3920
3921 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3922 Self::new(inner)
3923 }
3924
3925 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3926 self.client.into_channel().map_err(|client| Self { client })
3927 }
3928
3929 fn as_channel(&self) -> &::fidl::AsyncChannel {
3930 self.client.as_channel()
3931 }
3932}
3933
3934impl TopologyProxy {
3935 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3937 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3938 Self { client: fidl::client::Client::new(channel, protocol_name) }
3939 }
3940
3941 pub fn take_event_stream(&self) -> TopologyEventStream {
3947 TopologyEventStream { event_receiver: self.client.take_event_receiver() }
3948 }
3949
3950 pub fn r#add_element(
3953 &self,
3954 mut payload: ElementSchema,
3955 ) -> fidl::client::QueryResponseFut<
3956 TopologyAddElementResult,
3957 fidl::encoding::DefaultFuchsiaResourceDialect,
3958 > {
3959 TopologyProxyInterface::r#add_element(self, payload)
3960 }
3961}
3962
3963impl TopologyProxyInterface for TopologyProxy {
3964 type AddElementResponseFut = fidl::client::QueryResponseFut<
3965 TopologyAddElementResult,
3966 fidl::encoding::DefaultFuchsiaResourceDialect,
3967 >;
3968 fn r#add_element(&self, mut payload: ElementSchema) -> Self::AddElementResponseFut {
3969 fn _decode(
3970 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3971 ) -> Result<TopologyAddElementResult, fidl::Error> {
3972 let _response = fidl::client::decode_transaction_body::<
3973 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
3974 fidl::encoding::DefaultFuchsiaResourceDialect,
3975 0x269ed93c9e87fa03,
3976 >(_buf?)?
3977 .into_result::<TopologyMarker>("add_element")?;
3978 Ok(_response.map(|x| x))
3979 }
3980 self.client.send_query_and_decode::<ElementSchema, TopologyAddElementResult>(
3981 &mut payload,
3982 0x269ed93c9e87fa03,
3983 fidl::encoding::DynamicFlags::FLEXIBLE,
3984 _decode,
3985 )
3986 }
3987}
3988
3989pub struct TopologyEventStream {
3990 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3991}
3992
3993impl std::marker::Unpin for TopologyEventStream {}
3994
3995impl futures::stream::FusedStream for TopologyEventStream {
3996 fn is_terminated(&self) -> bool {
3997 self.event_receiver.is_terminated()
3998 }
3999}
4000
4001impl futures::Stream for TopologyEventStream {
4002 type Item = Result<TopologyEvent, fidl::Error>;
4003
4004 fn poll_next(
4005 mut self: std::pin::Pin<&mut Self>,
4006 cx: &mut std::task::Context<'_>,
4007 ) -> std::task::Poll<Option<Self::Item>> {
4008 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4009 &mut self.event_receiver,
4010 cx
4011 )?) {
4012 Some(buf) => std::task::Poll::Ready(Some(TopologyEvent::decode(buf))),
4013 None => std::task::Poll::Ready(None),
4014 }
4015 }
4016}
4017
4018#[derive(Debug)]
4019pub enum TopologyEvent {
4020 #[non_exhaustive]
4021 _UnknownEvent {
4022 ordinal: u64,
4024 },
4025}
4026
4027impl TopologyEvent {
4028 fn decode(
4030 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4031 ) -> Result<TopologyEvent, fidl::Error> {
4032 let (bytes, _handles) = buf.split_mut();
4033 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4034 debug_assert_eq!(tx_header.tx_id, 0);
4035 match tx_header.ordinal {
4036 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4037 Ok(TopologyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4038 }
4039 _ => Err(fidl::Error::UnknownOrdinal {
4040 ordinal: tx_header.ordinal,
4041 protocol_name: <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4042 }),
4043 }
4044 }
4045}
4046
4047pub struct TopologyRequestStream {
4049 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4050 is_terminated: bool,
4051}
4052
4053impl std::marker::Unpin for TopologyRequestStream {}
4054
4055impl futures::stream::FusedStream for TopologyRequestStream {
4056 fn is_terminated(&self) -> bool {
4057 self.is_terminated
4058 }
4059}
4060
4061impl fidl::endpoints::RequestStream for TopologyRequestStream {
4062 type Protocol = TopologyMarker;
4063 type ControlHandle = TopologyControlHandle;
4064
4065 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4066 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4067 }
4068
4069 fn control_handle(&self) -> Self::ControlHandle {
4070 TopologyControlHandle { inner: self.inner.clone() }
4071 }
4072
4073 fn into_inner(
4074 self,
4075 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4076 {
4077 (self.inner, self.is_terminated)
4078 }
4079
4080 fn from_inner(
4081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4082 is_terminated: bool,
4083 ) -> Self {
4084 Self { inner, is_terminated }
4085 }
4086}
4087
4088impl futures::Stream for TopologyRequestStream {
4089 type Item = Result<TopologyRequest, fidl::Error>;
4090
4091 fn poll_next(
4092 mut self: std::pin::Pin<&mut Self>,
4093 cx: &mut std::task::Context<'_>,
4094 ) -> std::task::Poll<Option<Self::Item>> {
4095 let this = &mut *self;
4096 if this.inner.check_shutdown(cx) {
4097 this.is_terminated = true;
4098 return std::task::Poll::Ready(None);
4099 }
4100 if this.is_terminated {
4101 panic!("polled TopologyRequestStream after completion");
4102 }
4103 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4104 |bytes, handles| {
4105 match this.inner.channel().read_etc(cx, bytes, handles) {
4106 std::task::Poll::Ready(Ok(())) => {}
4107 std::task::Poll::Pending => return std::task::Poll::Pending,
4108 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4109 this.is_terminated = true;
4110 return std::task::Poll::Ready(None);
4111 }
4112 std::task::Poll::Ready(Err(e)) => {
4113 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4114 e.into(),
4115 ))));
4116 }
4117 }
4118
4119 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4121
4122 std::task::Poll::Ready(Some(match header.ordinal {
4123 0x269ed93c9e87fa03 => {
4124 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4125 let mut req = fidl::new_empty!(
4126 ElementSchema,
4127 fidl::encoding::DefaultFuchsiaResourceDialect
4128 );
4129 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementSchema>(&header, _body_bytes, handles, &mut req)?;
4130 let control_handle = TopologyControlHandle { inner: this.inner.clone() };
4131 Ok(TopologyRequest::AddElement {
4132 payload: req,
4133 responder: TopologyAddElementResponder {
4134 control_handle: std::mem::ManuallyDrop::new(control_handle),
4135 tx_id: header.tx_id,
4136 },
4137 })
4138 }
4139 _ if header.tx_id == 0
4140 && header
4141 .dynamic_flags()
4142 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4143 {
4144 Ok(TopologyRequest::_UnknownMethod {
4145 ordinal: header.ordinal,
4146 control_handle: TopologyControlHandle { inner: this.inner.clone() },
4147 method_type: fidl::MethodType::OneWay,
4148 })
4149 }
4150 _ if header
4151 .dynamic_flags()
4152 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4153 {
4154 this.inner.send_framework_err(
4155 fidl::encoding::FrameworkErr::UnknownMethod,
4156 header.tx_id,
4157 header.ordinal,
4158 header.dynamic_flags(),
4159 (bytes, handles),
4160 )?;
4161 Ok(TopologyRequest::_UnknownMethod {
4162 ordinal: header.ordinal,
4163 control_handle: TopologyControlHandle { inner: this.inner.clone() },
4164 method_type: fidl::MethodType::TwoWay,
4165 })
4166 }
4167 _ => Err(fidl::Error::UnknownOrdinal {
4168 ordinal: header.ordinal,
4169 protocol_name:
4170 <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4171 }),
4172 }))
4173 },
4174 )
4175 }
4176}
4177
4178#[derive(Debug)]
4184pub enum TopologyRequest {
4185 AddElement { payload: ElementSchema, responder: TopologyAddElementResponder },
4188 #[non_exhaustive]
4190 _UnknownMethod {
4191 ordinal: u64,
4193 control_handle: TopologyControlHandle,
4194 method_type: fidl::MethodType,
4195 },
4196}
4197
4198impl TopologyRequest {
4199 #[allow(irrefutable_let_patterns)]
4200 pub fn into_add_element(self) -> Option<(ElementSchema, TopologyAddElementResponder)> {
4201 if let TopologyRequest::AddElement { payload, responder } = self {
4202 Some((payload, responder))
4203 } else {
4204 None
4205 }
4206 }
4207
4208 pub fn method_name(&self) -> &'static str {
4210 match *self {
4211 TopologyRequest::AddElement { .. } => "add_element",
4212 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4213 "unknown one-way method"
4214 }
4215 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4216 "unknown two-way method"
4217 }
4218 }
4219 }
4220}
4221
4222#[derive(Debug, Clone)]
4223pub struct TopologyControlHandle {
4224 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4225}
4226
4227impl fidl::endpoints::ControlHandle for TopologyControlHandle {
4228 fn shutdown(&self) {
4229 self.inner.shutdown()
4230 }
4231 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4232 self.inner.shutdown_with_epitaph(status)
4233 }
4234
4235 fn is_closed(&self) -> bool {
4236 self.inner.channel().is_closed()
4237 }
4238 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4239 self.inner.channel().on_closed()
4240 }
4241
4242 #[cfg(target_os = "fuchsia")]
4243 fn signal_peer(
4244 &self,
4245 clear_mask: zx::Signals,
4246 set_mask: zx::Signals,
4247 ) -> Result<(), zx_status::Status> {
4248 use fidl::Peered;
4249 self.inner.channel().signal_peer(clear_mask, set_mask)
4250 }
4251}
4252
4253impl TopologyControlHandle {}
4254
4255#[must_use = "FIDL methods require a response to be sent"]
4256#[derive(Debug)]
4257pub struct TopologyAddElementResponder {
4258 control_handle: std::mem::ManuallyDrop<TopologyControlHandle>,
4259 tx_id: u32,
4260}
4261
4262impl std::ops::Drop for TopologyAddElementResponder {
4266 fn drop(&mut self) {
4267 self.control_handle.shutdown();
4268 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4270 }
4271}
4272
4273impl fidl::endpoints::Responder for TopologyAddElementResponder {
4274 type ControlHandle = TopologyControlHandle;
4275
4276 fn control_handle(&self) -> &TopologyControlHandle {
4277 &self.control_handle
4278 }
4279
4280 fn drop_without_shutdown(mut self) {
4281 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4283 std::mem::forget(self);
4285 }
4286}
4287
4288impl TopologyAddElementResponder {
4289 pub fn send(self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
4293 let _result = self.send_raw(result);
4294 if _result.is_err() {
4295 self.control_handle.shutdown();
4296 }
4297 self.drop_without_shutdown();
4298 _result
4299 }
4300
4301 pub fn send_no_shutdown_on_err(
4303 self,
4304 mut result: Result<(), AddElementError>,
4305 ) -> Result<(), fidl::Error> {
4306 let _result = self.send_raw(result);
4307 self.drop_without_shutdown();
4308 _result
4309 }
4310
4311 fn send_raw(&self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
4312 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4313 fidl::encoding::EmptyStruct,
4314 AddElementError,
4315 >>(
4316 fidl::encoding::FlexibleResult::new(result),
4317 self.tx_id,
4318 0x269ed93c9e87fa03,
4319 fidl::encoding::DynamicFlags::FLEXIBLE,
4320 )
4321 }
4322}
4323
4324#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4325pub struct ElementInfoProviderServiceMarker;
4326
4327#[cfg(target_os = "fuchsia")]
4328impl fidl::endpoints::ServiceMarker for ElementInfoProviderServiceMarker {
4329 type Proxy = ElementInfoProviderServiceProxy;
4330 type Request = ElementInfoProviderServiceRequest;
4331 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
4332}
4333
4334#[cfg(target_os = "fuchsia")]
4337pub enum ElementInfoProviderServiceRequest {
4338 StatusProvider(ElementInfoProviderRequestStream),
4339}
4340
4341#[cfg(target_os = "fuchsia")]
4342impl fidl::endpoints::ServiceRequest for ElementInfoProviderServiceRequest {
4343 type Service = ElementInfoProviderServiceMarker;
4344
4345 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4346 match name {
4347 "status_provider" => Self::StatusProvider(
4348 <ElementInfoProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
4349 _channel,
4350 ),
4351 ),
4352 _ => panic!("no such member protocol name for service ElementInfoProviderService"),
4353 }
4354 }
4355
4356 fn member_names() -> &'static [&'static str] {
4357 &["status_provider"]
4358 }
4359}
4360#[cfg(target_os = "fuchsia")]
4361pub struct ElementInfoProviderServiceProxy(
4362 #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
4363);
4364
4365#[cfg(target_os = "fuchsia")]
4366impl fidl::endpoints::ServiceProxy for ElementInfoProviderServiceProxy {
4367 type Service = ElementInfoProviderServiceMarker;
4368
4369 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
4370 Self(opener)
4371 }
4372}
4373
4374#[cfg(target_os = "fuchsia")]
4375impl ElementInfoProviderServiceProxy {
4376 pub fn connect_to_status_provider(&self) -> Result<ElementInfoProviderProxy, fidl::Error> {
4377 let (proxy, server_end) = fidl::endpoints::create_proxy::<ElementInfoProviderMarker>();
4378 self.connect_channel_to_status_provider(server_end)?;
4379 Ok(proxy)
4380 }
4381
4382 pub fn connect_to_status_provider_sync(
4385 &self,
4386 ) -> Result<ElementInfoProviderSynchronousProxy, fidl::Error> {
4387 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ElementInfoProviderMarker>();
4388 self.connect_channel_to_status_provider(server_end)?;
4389 Ok(proxy)
4390 }
4391
4392 pub fn connect_channel_to_status_provider(
4395 &self,
4396 server_end: fidl::endpoints::ServerEnd<ElementInfoProviderMarker>,
4397 ) -> Result<(), fidl::Error> {
4398 self.0.open_member("status_provider", server_end.into_channel())
4399 }
4400
4401 pub fn instance_name(&self) -> &str {
4402 self.0.instance_name()
4403 }
4404}
4405
4406mod internal {
4407 use super::*;
4408
4409 impl fidl::encoding::ResourceTypeMarker for ElementControlOpenStatusChannelRequest {
4410 type Borrowed<'a> = &'a mut Self;
4411 fn take_or_borrow<'a>(
4412 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4413 ) -> Self::Borrowed<'a> {
4414 value
4415 }
4416 }
4417
4418 unsafe impl fidl::encoding::TypeMarker for ElementControlOpenStatusChannelRequest {
4419 type Owned = Self;
4420
4421 #[inline(always)]
4422 fn inline_align(_context: fidl::encoding::Context) -> usize {
4423 4
4424 }
4425
4426 #[inline(always)]
4427 fn inline_size(_context: fidl::encoding::Context) -> usize {
4428 4
4429 }
4430 }
4431
4432 unsafe impl
4433 fidl::encoding::Encode<
4434 ElementControlOpenStatusChannelRequest,
4435 fidl::encoding::DefaultFuchsiaResourceDialect,
4436 > for &mut ElementControlOpenStatusChannelRequest
4437 {
4438 #[inline]
4439 unsafe fn encode(
4440 self,
4441 encoder: &mut fidl::encoding::Encoder<
4442 '_,
4443 fidl::encoding::DefaultFuchsiaResourceDialect,
4444 >,
4445 offset: usize,
4446 _depth: fidl::encoding::Depth,
4447 ) -> fidl::Result<()> {
4448 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
4449 fidl::encoding::Encode::<ElementControlOpenStatusChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4451 (
4452 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.status_channel),
4453 ),
4454 encoder, offset, _depth
4455 )
4456 }
4457 }
4458 unsafe impl<
4459 T0: fidl::encoding::Encode<
4460 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4461 fidl::encoding::DefaultFuchsiaResourceDialect,
4462 >,
4463 >
4464 fidl::encoding::Encode<
4465 ElementControlOpenStatusChannelRequest,
4466 fidl::encoding::DefaultFuchsiaResourceDialect,
4467 > for (T0,)
4468 {
4469 #[inline]
4470 unsafe fn encode(
4471 self,
4472 encoder: &mut fidl::encoding::Encoder<
4473 '_,
4474 fidl::encoding::DefaultFuchsiaResourceDialect,
4475 >,
4476 offset: usize,
4477 depth: fidl::encoding::Depth,
4478 ) -> fidl::Result<()> {
4479 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
4480 self.0.encode(encoder, offset + 0, depth)?;
4484 Ok(())
4485 }
4486 }
4487
4488 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4489 for ElementControlOpenStatusChannelRequest
4490 {
4491 #[inline(always)]
4492 fn new_empty() -> Self {
4493 Self {
4494 status_channel: fidl::new_empty!(
4495 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4496 fidl::encoding::DefaultFuchsiaResourceDialect
4497 ),
4498 }
4499 }
4500
4501 #[inline]
4502 unsafe fn decode(
4503 &mut self,
4504 decoder: &mut fidl::encoding::Decoder<
4505 '_,
4506 fidl::encoding::DefaultFuchsiaResourceDialect,
4507 >,
4508 offset: usize,
4509 _depth: fidl::encoding::Depth,
4510 ) -> fidl::Result<()> {
4511 decoder.debug_check_bounds::<Self>(offset);
4512 fidl::decode!(
4514 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4515 fidl::encoding::DefaultFuchsiaResourceDialect,
4516 &mut self.status_channel,
4517 decoder,
4518 offset + 0,
4519 _depth
4520 )?;
4521 Ok(())
4522 }
4523 }
4524
4525 impl fidl::encoding::ResourceTypeMarker for ElementControlRegisterDependencyTokenRequest {
4526 type Borrowed<'a> = &'a mut Self;
4527 fn take_or_borrow<'a>(
4528 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4529 ) -> Self::Borrowed<'a> {
4530 value
4531 }
4532 }
4533
4534 unsafe impl fidl::encoding::TypeMarker for ElementControlRegisterDependencyTokenRequest {
4535 type Owned = Self;
4536
4537 #[inline(always)]
4538 fn inline_align(_context: fidl::encoding::Context) -> usize {
4539 4
4540 }
4541
4542 #[inline(always)]
4543 fn inline_size(_context: fidl::encoding::Context) -> usize {
4544 8
4545 }
4546 }
4547
4548 unsafe impl
4549 fidl::encoding::Encode<
4550 ElementControlRegisterDependencyTokenRequest,
4551 fidl::encoding::DefaultFuchsiaResourceDialect,
4552 > for &mut ElementControlRegisterDependencyTokenRequest
4553 {
4554 #[inline]
4555 unsafe fn encode(
4556 self,
4557 encoder: &mut fidl::encoding::Encoder<
4558 '_,
4559 fidl::encoding::DefaultFuchsiaResourceDialect,
4560 >,
4561 offset: usize,
4562 _depth: fidl::encoding::Depth,
4563 ) -> fidl::Result<()> {
4564 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
4565 fidl::encoding::Encode::<
4567 ElementControlRegisterDependencyTokenRequest,
4568 fidl::encoding::DefaultFuchsiaResourceDialect,
4569 >::encode(
4570 (
4571 <fidl::encoding::HandleType<
4572 fidl::Event,
4573 { fidl::ObjectType::EVENT.into_raw() },
4574 2147483648,
4575 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4576 &mut self.token
4577 ),
4578 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(
4579 &self.dependency_type,
4580 ),
4581 ),
4582 encoder,
4583 offset,
4584 _depth,
4585 )
4586 }
4587 }
4588 unsafe impl<
4589 T0: fidl::encoding::Encode<
4590 fidl::encoding::HandleType<
4591 fidl::Event,
4592 { fidl::ObjectType::EVENT.into_raw() },
4593 2147483648,
4594 >,
4595 fidl::encoding::DefaultFuchsiaResourceDialect,
4596 >,
4597 T1: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
4598 >
4599 fidl::encoding::Encode<
4600 ElementControlRegisterDependencyTokenRequest,
4601 fidl::encoding::DefaultFuchsiaResourceDialect,
4602 > for (T0, T1)
4603 {
4604 #[inline]
4605 unsafe fn encode(
4606 self,
4607 encoder: &mut fidl::encoding::Encoder<
4608 '_,
4609 fidl::encoding::DefaultFuchsiaResourceDialect,
4610 >,
4611 offset: usize,
4612 depth: fidl::encoding::Depth,
4613 ) -> fidl::Result<()> {
4614 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
4615 self.0.encode(encoder, offset + 0, depth)?;
4619 self.1.encode(encoder, offset + 4, depth)?;
4620 Ok(())
4621 }
4622 }
4623
4624 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4625 for ElementControlRegisterDependencyTokenRequest
4626 {
4627 #[inline(always)]
4628 fn new_empty() -> Self {
4629 Self {
4630 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4631 dependency_type: fidl::new_empty!(
4632 DependencyType,
4633 fidl::encoding::DefaultFuchsiaResourceDialect
4634 ),
4635 }
4636 }
4637
4638 #[inline]
4639 unsafe fn decode(
4640 &mut self,
4641 decoder: &mut fidl::encoding::Decoder<
4642 '_,
4643 fidl::encoding::DefaultFuchsiaResourceDialect,
4644 >,
4645 offset: usize,
4646 _depth: fidl::encoding::Depth,
4647 ) -> fidl::Result<()> {
4648 decoder.debug_check_bounds::<Self>(offset);
4649 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4651 fidl::decode!(
4652 DependencyType,
4653 fidl::encoding::DefaultFuchsiaResourceDialect,
4654 &mut self.dependency_type,
4655 decoder,
4656 offset + 4,
4657 _depth
4658 )?;
4659 Ok(())
4660 }
4661 }
4662
4663 impl fidl::encoding::ResourceTypeMarker for ElementControlUnregisterDependencyTokenRequest {
4664 type Borrowed<'a> = &'a mut Self;
4665 fn take_or_borrow<'a>(
4666 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4667 ) -> Self::Borrowed<'a> {
4668 value
4669 }
4670 }
4671
4672 unsafe impl fidl::encoding::TypeMarker for ElementControlUnregisterDependencyTokenRequest {
4673 type Owned = Self;
4674
4675 #[inline(always)]
4676 fn inline_align(_context: fidl::encoding::Context) -> usize {
4677 4
4678 }
4679
4680 #[inline(always)]
4681 fn inline_size(_context: fidl::encoding::Context) -> usize {
4682 4
4683 }
4684 }
4685
4686 unsafe impl
4687 fidl::encoding::Encode<
4688 ElementControlUnregisterDependencyTokenRequest,
4689 fidl::encoding::DefaultFuchsiaResourceDialect,
4690 > for &mut ElementControlUnregisterDependencyTokenRequest
4691 {
4692 #[inline]
4693 unsafe fn encode(
4694 self,
4695 encoder: &mut fidl::encoding::Encoder<
4696 '_,
4697 fidl::encoding::DefaultFuchsiaResourceDialect,
4698 >,
4699 offset: usize,
4700 _depth: fidl::encoding::Depth,
4701 ) -> fidl::Result<()> {
4702 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
4703 fidl::encoding::Encode::<
4705 ElementControlUnregisterDependencyTokenRequest,
4706 fidl::encoding::DefaultFuchsiaResourceDialect,
4707 >::encode(
4708 (<fidl::encoding::HandleType<
4709 fidl::Event,
4710 { fidl::ObjectType::EVENT.into_raw() },
4711 2147483648,
4712 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4713 &mut self.token
4714 ),),
4715 encoder,
4716 offset,
4717 _depth,
4718 )
4719 }
4720 }
4721 unsafe impl<
4722 T0: fidl::encoding::Encode<
4723 fidl::encoding::HandleType<
4724 fidl::Event,
4725 { fidl::ObjectType::EVENT.into_raw() },
4726 2147483648,
4727 >,
4728 fidl::encoding::DefaultFuchsiaResourceDialect,
4729 >,
4730 >
4731 fidl::encoding::Encode<
4732 ElementControlUnregisterDependencyTokenRequest,
4733 fidl::encoding::DefaultFuchsiaResourceDialect,
4734 > for (T0,)
4735 {
4736 #[inline]
4737 unsafe fn encode(
4738 self,
4739 encoder: &mut fidl::encoding::Encoder<
4740 '_,
4741 fidl::encoding::DefaultFuchsiaResourceDialect,
4742 >,
4743 offset: usize,
4744 depth: fidl::encoding::Depth,
4745 ) -> fidl::Result<()> {
4746 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
4747 self.0.encode(encoder, offset + 0, depth)?;
4751 Ok(())
4752 }
4753 }
4754
4755 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4756 for ElementControlUnregisterDependencyTokenRequest
4757 {
4758 #[inline(always)]
4759 fn new_empty() -> Self {
4760 Self {
4761 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4762 }
4763 }
4764
4765 #[inline]
4766 unsafe fn decode(
4767 &mut self,
4768 decoder: &mut fidl::encoding::Decoder<
4769 '_,
4770 fidl::encoding::DefaultFuchsiaResourceDialect,
4771 >,
4772 offset: usize,
4773 _depth: fidl::encoding::Depth,
4774 ) -> fidl::Result<()> {
4775 decoder.debug_check_bounds::<Self>(offset);
4776 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4778 Ok(())
4779 }
4780 }
4781
4782 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
4783 type Borrowed<'a> = &'a mut Self;
4784 fn take_or_borrow<'a>(
4785 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4786 ) -> Self::Borrowed<'a> {
4787 value
4788 }
4789 }
4790
4791 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
4792 type Owned = Self;
4793
4794 #[inline(always)]
4795 fn inline_align(_context: fidl::encoding::Context) -> usize {
4796 8
4797 }
4798
4799 #[inline(always)]
4800 fn inline_size(_context: fidl::encoding::Context) -> usize {
4801 16
4802 }
4803 }
4804
4805 unsafe impl
4806 fidl::encoding::Encode<
4807 ElementInfoProviderGetElementPowerLevelNamesResponse,
4808 fidl::encoding::DefaultFuchsiaResourceDialect,
4809 > for &mut ElementInfoProviderGetElementPowerLevelNamesResponse
4810 {
4811 #[inline]
4812 unsafe fn encode(
4813 self,
4814 encoder: &mut fidl::encoding::Encoder<
4815 '_,
4816 fidl::encoding::DefaultFuchsiaResourceDialect,
4817 >,
4818 offset: usize,
4819 _depth: fidl::encoding::Depth,
4820 ) -> fidl::Result<()> {
4821 encoder
4822 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
4823 fidl::encoding::Encode::<ElementInfoProviderGetElementPowerLevelNamesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4825 (
4826 <fidl::encoding::UnboundedVector<ElementPowerLevelNames> as fidl::encoding::ValueTypeMarker>::borrow(&self.level_names),
4827 ),
4828 encoder, offset, _depth
4829 )
4830 }
4831 }
4832 unsafe impl<
4833 T0: fidl::encoding::Encode<
4834 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4835 fidl::encoding::DefaultFuchsiaResourceDialect,
4836 >,
4837 >
4838 fidl::encoding::Encode<
4839 ElementInfoProviderGetElementPowerLevelNamesResponse,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 > for (T0,)
4842 {
4843 #[inline]
4844 unsafe fn encode(
4845 self,
4846 encoder: &mut fidl::encoding::Encoder<
4847 '_,
4848 fidl::encoding::DefaultFuchsiaResourceDialect,
4849 >,
4850 offset: usize,
4851 depth: fidl::encoding::Depth,
4852 ) -> fidl::Result<()> {
4853 encoder
4854 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
4855 self.0.encode(encoder, offset + 0, depth)?;
4859 Ok(())
4860 }
4861 }
4862
4863 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4864 for ElementInfoProviderGetElementPowerLevelNamesResponse
4865 {
4866 #[inline(always)]
4867 fn new_empty() -> Self {
4868 Self {
4869 level_names: fidl::new_empty!(
4870 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4871 fidl::encoding::DefaultFuchsiaResourceDialect
4872 ),
4873 }
4874 }
4875
4876 #[inline]
4877 unsafe fn decode(
4878 &mut self,
4879 decoder: &mut fidl::encoding::Decoder<
4880 '_,
4881 fidl::encoding::DefaultFuchsiaResourceDialect,
4882 >,
4883 offset: usize,
4884 _depth: fidl::encoding::Depth,
4885 ) -> fidl::Result<()> {
4886 decoder.debug_check_bounds::<Self>(offset);
4887 fidl::decode!(
4889 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4890 fidl::encoding::DefaultFuchsiaResourceDialect,
4891 &mut self.level_names,
4892 decoder,
4893 offset + 0,
4894 _depth
4895 )?;
4896 Ok(())
4897 }
4898 }
4899
4900 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
4901 type Borrowed<'a> = &'a mut Self;
4902 fn take_or_borrow<'a>(
4903 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4904 ) -> Self::Borrowed<'a> {
4905 value
4906 }
4907 }
4908
4909 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
4910 type Owned = Self;
4911
4912 #[inline(always)]
4913 fn inline_align(_context: fidl::encoding::Context) -> usize {
4914 8
4915 }
4916
4917 #[inline(always)]
4918 fn inline_size(_context: fidl::encoding::Context) -> usize {
4919 16
4920 }
4921 }
4922
4923 unsafe impl
4924 fidl::encoding::Encode<
4925 ElementInfoProviderGetStatusEndpointsResponse,
4926 fidl::encoding::DefaultFuchsiaResourceDialect,
4927 > for &mut ElementInfoProviderGetStatusEndpointsResponse
4928 {
4929 #[inline]
4930 unsafe fn encode(
4931 self,
4932 encoder: &mut fidl::encoding::Encoder<
4933 '_,
4934 fidl::encoding::DefaultFuchsiaResourceDialect,
4935 >,
4936 offset: usize,
4937 _depth: fidl::encoding::Depth,
4938 ) -> fidl::Result<()> {
4939 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
4940 fidl::encoding::Encode::<ElementInfoProviderGetStatusEndpointsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4942 (
4943 <fidl::encoding::UnboundedVector<ElementStatusEndpoint> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoints),
4944 ),
4945 encoder, offset, _depth
4946 )
4947 }
4948 }
4949 unsafe impl<
4950 T0: fidl::encoding::Encode<
4951 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
4952 fidl::encoding::DefaultFuchsiaResourceDialect,
4953 >,
4954 >
4955 fidl::encoding::Encode<
4956 ElementInfoProviderGetStatusEndpointsResponse,
4957 fidl::encoding::DefaultFuchsiaResourceDialect,
4958 > for (T0,)
4959 {
4960 #[inline]
4961 unsafe fn encode(
4962 self,
4963 encoder: &mut fidl::encoding::Encoder<
4964 '_,
4965 fidl::encoding::DefaultFuchsiaResourceDialect,
4966 >,
4967 offset: usize,
4968 depth: fidl::encoding::Depth,
4969 ) -> fidl::Result<()> {
4970 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
4971 self.0.encode(encoder, offset + 0, depth)?;
4975 Ok(())
4976 }
4977 }
4978
4979 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4980 for ElementInfoProviderGetStatusEndpointsResponse
4981 {
4982 #[inline(always)]
4983 fn new_empty() -> Self {
4984 Self {
4985 endpoints: fidl::new_empty!(
4986 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
4987 fidl::encoding::DefaultFuchsiaResourceDialect
4988 ),
4989 }
4990 }
4991
4992 #[inline]
4993 unsafe fn decode(
4994 &mut self,
4995 decoder: &mut fidl::encoding::Decoder<
4996 '_,
4997 fidl::encoding::DefaultFuchsiaResourceDialect,
4998 >,
4999 offset: usize,
5000 _depth: fidl::encoding::Depth,
5001 ) -> fidl::Result<()> {
5002 decoder.debug_check_bounds::<Self>(offset);
5003 fidl::decode!(
5005 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
5006 fidl::encoding::DefaultFuchsiaResourceDialect,
5007 &mut self.endpoints,
5008 decoder,
5009 offset + 0,
5010 _depth
5011 )?;
5012 Ok(())
5013 }
5014 }
5015
5016 impl fidl::encoding::ResourceTypeMarker for LessorLeaseRequest {
5017 type Borrowed<'a> = &'a mut Self;
5018 fn take_or_borrow<'a>(
5019 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5020 ) -> Self::Borrowed<'a> {
5021 value
5022 }
5023 }
5024
5025 unsafe impl fidl::encoding::TypeMarker for LessorLeaseRequest {
5026 type Owned = Self;
5027
5028 #[inline(always)]
5029 fn inline_align(_context: fidl::encoding::Context) -> usize {
5030 1
5031 }
5032
5033 #[inline(always)]
5034 fn inline_size(_context: fidl::encoding::Context) -> usize {
5035 1
5036 }
5037 #[inline(always)]
5038 fn encode_is_copy() -> bool {
5039 true
5040 }
5041
5042 #[inline(always)]
5043 fn decode_is_copy() -> bool {
5044 true
5045 }
5046 }
5047
5048 unsafe impl
5049 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5050 for &mut LessorLeaseRequest
5051 {
5052 #[inline]
5053 unsafe fn encode(
5054 self,
5055 encoder: &mut fidl::encoding::Encoder<
5056 '_,
5057 fidl::encoding::DefaultFuchsiaResourceDialect,
5058 >,
5059 offset: usize,
5060 _depth: fidl::encoding::Depth,
5061 ) -> fidl::Result<()> {
5062 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
5063 unsafe {
5064 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5066 (buf_ptr as *mut LessorLeaseRequest)
5067 .write_unaligned((self as *const LessorLeaseRequest).read());
5068 }
5071 Ok(())
5072 }
5073 }
5074 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
5075 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5076 for (T0,)
5077 {
5078 #[inline]
5079 unsafe fn encode(
5080 self,
5081 encoder: &mut fidl::encoding::Encoder<
5082 '_,
5083 fidl::encoding::DefaultFuchsiaResourceDialect,
5084 >,
5085 offset: usize,
5086 depth: fidl::encoding::Depth,
5087 ) -> fidl::Result<()> {
5088 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
5089 self.0.encode(encoder, offset + 0, depth)?;
5093 Ok(())
5094 }
5095 }
5096
5097 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5098 for LessorLeaseRequest
5099 {
5100 #[inline(always)]
5101 fn new_empty() -> Self {
5102 Self { level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect) }
5103 }
5104
5105 #[inline]
5106 unsafe fn decode(
5107 &mut self,
5108 decoder: &mut fidl::encoding::Decoder<
5109 '_,
5110 fidl::encoding::DefaultFuchsiaResourceDialect,
5111 >,
5112 offset: usize,
5113 _depth: fidl::encoding::Depth,
5114 ) -> fidl::Result<()> {
5115 decoder.debug_check_bounds::<Self>(offset);
5116 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5117 unsafe {
5120 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
5121 }
5122 Ok(())
5123 }
5124 }
5125
5126 impl fidl::encoding::ResourceTypeMarker for LessorLeaseResponse {
5127 type Borrowed<'a> = &'a mut Self;
5128 fn take_or_borrow<'a>(
5129 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5130 ) -> Self::Borrowed<'a> {
5131 value
5132 }
5133 }
5134
5135 unsafe impl fidl::encoding::TypeMarker for LessorLeaseResponse {
5136 type Owned = Self;
5137
5138 #[inline(always)]
5139 fn inline_align(_context: fidl::encoding::Context) -> usize {
5140 4
5141 }
5142
5143 #[inline(always)]
5144 fn inline_size(_context: fidl::encoding::Context) -> usize {
5145 4
5146 }
5147 }
5148
5149 unsafe impl
5150 fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5151 for &mut LessorLeaseResponse
5152 {
5153 #[inline]
5154 unsafe fn encode(
5155 self,
5156 encoder: &mut fidl::encoding::Encoder<
5157 '_,
5158 fidl::encoding::DefaultFuchsiaResourceDialect,
5159 >,
5160 offset: usize,
5161 _depth: fidl::encoding::Depth,
5162 ) -> fidl::Result<()> {
5163 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
5164 fidl::encoding::Encode::<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5166 (
5167 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lease_control),
5168 ),
5169 encoder, offset, _depth
5170 )
5171 }
5172 }
5173 unsafe impl<
5174 T0: fidl::encoding::Encode<
5175 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5176 fidl::encoding::DefaultFuchsiaResourceDialect,
5177 >,
5178 > fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5179 for (T0,)
5180 {
5181 #[inline]
5182 unsafe fn encode(
5183 self,
5184 encoder: &mut fidl::encoding::Encoder<
5185 '_,
5186 fidl::encoding::DefaultFuchsiaResourceDialect,
5187 >,
5188 offset: usize,
5189 depth: fidl::encoding::Depth,
5190 ) -> fidl::Result<()> {
5191 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
5192 self.0.encode(encoder, offset + 0, depth)?;
5196 Ok(())
5197 }
5198 }
5199
5200 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5201 for LessorLeaseResponse
5202 {
5203 #[inline(always)]
5204 fn new_empty() -> Self {
5205 Self {
5206 lease_control: fidl::new_empty!(
5207 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5208 fidl::encoding::DefaultFuchsiaResourceDialect
5209 ),
5210 }
5211 }
5212
5213 #[inline]
5214 unsafe fn decode(
5215 &mut self,
5216 decoder: &mut fidl::encoding::Decoder<
5217 '_,
5218 fidl::encoding::DefaultFuchsiaResourceDialect,
5219 >,
5220 offset: usize,
5221 _depth: fidl::encoding::Depth,
5222 ) -> fidl::Result<()> {
5223 decoder.debug_check_bounds::<Self>(offset);
5224 fidl::decode!(
5226 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5227 fidl::encoding::DefaultFuchsiaResourceDialect,
5228 &mut self.lease_control,
5229 decoder,
5230 offset + 0,
5231 _depth
5232 )?;
5233 Ok(())
5234 }
5235 }
5236
5237 impl fidl::encoding::ResourceTypeMarker for LevelDependency {
5238 type Borrowed<'a> = &'a mut Self;
5239 fn take_or_borrow<'a>(
5240 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5241 ) -> Self::Borrowed<'a> {
5242 value
5243 }
5244 }
5245
5246 unsafe impl fidl::encoding::TypeMarker for LevelDependency {
5247 type Owned = Self;
5248
5249 #[inline(always)]
5250 fn inline_align(_context: fidl::encoding::Context) -> usize {
5251 8
5252 }
5253
5254 #[inline(always)]
5255 fn inline_size(_context: fidl::encoding::Context) -> usize {
5256 32
5257 }
5258 }
5259
5260 unsafe impl
5261 fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
5262 for &mut LevelDependency
5263 {
5264 #[inline]
5265 unsafe fn encode(
5266 self,
5267 encoder: &mut fidl::encoding::Encoder<
5268 '_,
5269 fidl::encoding::DefaultFuchsiaResourceDialect,
5270 >,
5271 offset: usize,
5272 _depth: fidl::encoding::Depth,
5273 ) -> fidl::Result<()> {
5274 encoder.debug_check_bounds::<LevelDependency>(offset);
5275 fidl::encoding::Encode::<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5277 (
5278 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(&self.dependency_type),
5279 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
5280 <fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.requires_token),
5281 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level_by_preference),
5282 ),
5283 encoder, offset, _depth
5284 )
5285 }
5286 }
5287 unsafe impl<
5288 T0: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
5289 T1: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
5290 T2: fidl::encoding::Encode<
5291 fidl::encoding::HandleType<
5292 fidl::Event,
5293 { fidl::ObjectType::EVENT.into_raw() },
5294 2147483648,
5295 >,
5296 fidl::encoding::DefaultFuchsiaResourceDialect,
5297 >,
5298 T3: fidl::encoding::Encode<
5299 fidl::encoding::Vector<u8, 256>,
5300 fidl::encoding::DefaultFuchsiaResourceDialect,
5301 >,
5302 > fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
5303 for (T0, T1, T2, T3)
5304 {
5305 #[inline]
5306 unsafe fn encode(
5307 self,
5308 encoder: &mut fidl::encoding::Encoder<
5309 '_,
5310 fidl::encoding::DefaultFuchsiaResourceDialect,
5311 >,
5312 offset: usize,
5313 depth: fidl::encoding::Depth,
5314 ) -> fidl::Result<()> {
5315 encoder.debug_check_bounds::<LevelDependency>(offset);
5316 unsafe {
5319 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5320 (ptr as *mut u64).write_unaligned(0);
5321 }
5322 unsafe {
5323 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5324 (ptr as *mut u64).write_unaligned(0);
5325 }
5326 self.0.encode(encoder, offset + 0, depth)?;
5328 self.1.encode(encoder, offset + 4, depth)?;
5329 self.2.encode(encoder, offset + 8, depth)?;
5330 self.3.encode(encoder, offset + 16, depth)?;
5331 Ok(())
5332 }
5333 }
5334
5335 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5336 for LevelDependency
5337 {
5338 #[inline(always)]
5339 fn new_empty() -> Self {
5340 Self {
5341 dependency_type: fidl::new_empty!(
5342 DependencyType,
5343 fidl::encoding::DefaultFuchsiaResourceDialect
5344 ),
5345 dependent_level: fidl::new_empty!(
5346 u8,
5347 fidl::encoding::DefaultFuchsiaResourceDialect
5348 ),
5349 requires_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5350 requires_level_by_preference: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
5351 }
5352 }
5353
5354 #[inline]
5355 unsafe fn decode(
5356 &mut self,
5357 decoder: &mut fidl::encoding::Decoder<
5358 '_,
5359 fidl::encoding::DefaultFuchsiaResourceDialect,
5360 >,
5361 offset: usize,
5362 _depth: fidl::encoding::Depth,
5363 ) -> fidl::Result<()> {
5364 decoder.debug_check_bounds::<Self>(offset);
5365 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5367 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5368 let mask = 0xffffff0000000000u64;
5369 let maskedval = padval & mask;
5370 if maskedval != 0 {
5371 return Err(fidl::Error::NonZeroPadding {
5372 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5373 });
5374 }
5375 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5376 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5377 let mask = 0xffffffff00000000u64;
5378 let maskedval = padval & mask;
5379 if maskedval != 0 {
5380 return Err(fidl::Error::NonZeroPadding {
5381 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5382 });
5383 }
5384 fidl::decode!(
5385 DependencyType,
5386 fidl::encoding::DefaultFuchsiaResourceDialect,
5387 &mut self.dependency_type,
5388 decoder,
5389 offset + 0,
5390 _depth
5391 )?;
5392 fidl::decode!(
5393 u8,
5394 fidl::encoding::DefaultFuchsiaResourceDialect,
5395 &mut self.dependent_level,
5396 decoder,
5397 offset + 4,
5398 _depth
5399 )?;
5400 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_token, decoder, offset + 8, _depth)?;
5401 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_level_by_preference, decoder, offset + 16, _depth)?;
5402 Ok(())
5403 }
5404 }
5405
5406 impl fidl::encoding::ResourceTypeMarker for StatusWatchPowerLevelResponse {
5407 type Borrowed<'a> = &'a mut Self;
5408 fn take_or_borrow<'a>(
5409 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5410 ) -> Self::Borrowed<'a> {
5411 value
5412 }
5413 }
5414
5415 unsafe impl fidl::encoding::TypeMarker for StatusWatchPowerLevelResponse {
5416 type Owned = Self;
5417
5418 #[inline(always)]
5419 fn inline_align(_context: fidl::encoding::Context) -> usize {
5420 1
5421 }
5422
5423 #[inline(always)]
5424 fn inline_size(_context: fidl::encoding::Context) -> usize {
5425 1
5426 }
5427 #[inline(always)]
5428 fn encode_is_copy() -> bool {
5429 true
5430 }
5431
5432 #[inline(always)]
5433 fn decode_is_copy() -> bool {
5434 true
5435 }
5436 }
5437
5438 unsafe impl
5439 fidl::encoding::Encode<
5440 StatusWatchPowerLevelResponse,
5441 fidl::encoding::DefaultFuchsiaResourceDialect,
5442 > for &mut StatusWatchPowerLevelResponse
5443 {
5444 #[inline]
5445 unsafe fn encode(
5446 self,
5447 encoder: &mut fidl::encoding::Encoder<
5448 '_,
5449 fidl::encoding::DefaultFuchsiaResourceDialect,
5450 >,
5451 offset: usize,
5452 _depth: fidl::encoding::Depth,
5453 ) -> fidl::Result<()> {
5454 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
5455 unsafe {
5456 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5458 (buf_ptr as *mut StatusWatchPowerLevelResponse)
5459 .write_unaligned((self as *const StatusWatchPowerLevelResponse).read());
5460 }
5463 Ok(())
5464 }
5465 }
5466 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
5467 fidl::encoding::Encode<
5468 StatusWatchPowerLevelResponse,
5469 fidl::encoding::DefaultFuchsiaResourceDialect,
5470 > for (T0,)
5471 {
5472 #[inline]
5473 unsafe fn encode(
5474 self,
5475 encoder: &mut fidl::encoding::Encoder<
5476 '_,
5477 fidl::encoding::DefaultFuchsiaResourceDialect,
5478 >,
5479 offset: usize,
5480 depth: fidl::encoding::Depth,
5481 ) -> fidl::Result<()> {
5482 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
5483 self.0.encode(encoder, offset + 0, depth)?;
5487 Ok(())
5488 }
5489 }
5490
5491 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5492 for StatusWatchPowerLevelResponse
5493 {
5494 #[inline(always)]
5495 fn new_empty() -> Self {
5496 Self {
5497 current_level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
5498 }
5499 }
5500
5501 #[inline]
5502 unsafe fn decode(
5503 &mut self,
5504 decoder: &mut fidl::encoding::Decoder<
5505 '_,
5506 fidl::encoding::DefaultFuchsiaResourceDialect,
5507 >,
5508 offset: usize,
5509 _depth: fidl::encoding::Depth,
5510 ) -> fidl::Result<()> {
5511 decoder.debug_check_bounds::<Self>(offset);
5512 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5513 unsafe {
5516 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
5517 }
5518 Ok(())
5519 }
5520 }
5521
5522 impl ElementSchema {
5523 #[inline(always)]
5524 fn max_ordinal_present(&self) -> u64 {
5525 if let Some(_) = self.element_runner {
5526 return 10;
5527 }
5528 if let Some(_) = self.element_control {
5529 return 9;
5530 }
5531 if let Some(_) = self.lessor_channel {
5532 return 8;
5533 }
5534 if let Some(_) = self.dependencies {
5535 return 4;
5536 }
5537 if let Some(_) = self.valid_levels {
5538 return 3;
5539 }
5540 if let Some(_) = self.initial_current_level {
5541 return 2;
5542 }
5543 if let Some(_) = self.element_name {
5544 return 1;
5545 }
5546 0
5547 }
5548 }
5549
5550 impl fidl::encoding::ResourceTypeMarker for ElementSchema {
5551 type Borrowed<'a> = &'a mut Self;
5552 fn take_or_borrow<'a>(
5553 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5554 ) -> Self::Borrowed<'a> {
5555 value
5556 }
5557 }
5558
5559 unsafe impl fidl::encoding::TypeMarker for ElementSchema {
5560 type Owned = Self;
5561
5562 #[inline(always)]
5563 fn inline_align(_context: fidl::encoding::Context) -> usize {
5564 8
5565 }
5566
5567 #[inline(always)]
5568 fn inline_size(_context: fidl::encoding::Context) -> usize {
5569 16
5570 }
5571 }
5572
5573 unsafe impl fidl::encoding::Encode<ElementSchema, fidl::encoding::DefaultFuchsiaResourceDialect>
5574 for &mut ElementSchema
5575 {
5576 unsafe fn encode(
5577 self,
5578 encoder: &mut fidl::encoding::Encoder<
5579 '_,
5580 fidl::encoding::DefaultFuchsiaResourceDialect,
5581 >,
5582 offset: usize,
5583 mut depth: fidl::encoding::Depth,
5584 ) -> fidl::Result<()> {
5585 encoder.debug_check_bounds::<ElementSchema>(offset);
5586 let max_ordinal: u64 = self.max_ordinal_present();
5588 encoder.write_num(max_ordinal, offset);
5589 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5590 if max_ordinal == 0 {
5592 return Ok(());
5593 }
5594 depth.increment()?;
5595 let envelope_size = 8;
5596 let bytes_len = max_ordinal as usize * envelope_size;
5597 #[allow(unused_variables)]
5598 let offset = encoder.out_of_line_offset(bytes_len);
5599 let mut _prev_end_offset: usize = 0;
5600 if 1 > max_ordinal {
5601 return Ok(());
5602 }
5603
5604 let cur_offset: usize = (1 - 1) * envelope_size;
5607
5608 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5610
5611 fidl::encoding::encode_in_envelope_optional::<
5616 fidl::encoding::BoundedString<64>,
5617 fidl::encoding::DefaultFuchsiaResourceDialect,
5618 >(
5619 self.element_name.as_ref().map(
5620 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
5621 ),
5622 encoder,
5623 offset + cur_offset,
5624 depth,
5625 )?;
5626
5627 _prev_end_offset = cur_offset + envelope_size;
5628 if 2 > max_ordinal {
5629 return Ok(());
5630 }
5631
5632 let cur_offset: usize = (2 - 1) * envelope_size;
5635
5636 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5638
5639 fidl::encoding::encode_in_envelope_optional::<
5644 u8,
5645 fidl::encoding::DefaultFuchsiaResourceDialect,
5646 >(
5647 self.initial_current_level
5648 .as_ref()
5649 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5650 encoder,
5651 offset + cur_offset,
5652 depth,
5653 )?;
5654
5655 _prev_end_offset = cur_offset + envelope_size;
5656 if 3 > max_ordinal {
5657 return Ok(());
5658 }
5659
5660 let cur_offset: usize = (3 - 1) * envelope_size;
5663
5664 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5666
5667 fidl::encoding::encode_in_envelope_optional::<
5672 fidl::encoding::Vector<u8, 256>,
5673 fidl::encoding::DefaultFuchsiaResourceDialect,
5674 >(
5675 self.valid_levels.as_ref().map(
5676 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow,
5677 ),
5678 encoder,
5679 offset + cur_offset,
5680 depth,
5681 )?;
5682
5683 _prev_end_offset = cur_offset + envelope_size;
5684 if 4 > max_ordinal {
5685 return Ok(());
5686 }
5687
5688 let cur_offset: usize = (4 - 1) * envelope_size;
5691
5692 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5694
5695 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5700 self.dependencies.as_mut().map(<fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5701 encoder, offset + cur_offset, depth
5702 )?;
5703
5704 _prev_end_offset = cur_offset + envelope_size;
5705 if 8 > max_ordinal {
5706 return Ok(());
5707 }
5708
5709 let cur_offset: usize = (8 - 1) * envelope_size;
5712
5713 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5715
5716 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5721 self.lessor_channel.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5722 encoder, offset + cur_offset, depth
5723 )?;
5724
5725 _prev_end_offset = cur_offset + envelope_size;
5726 if 9 > max_ordinal {
5727 return Ok(());
5728 }
5729
5730 let cur_offset: usize = (9 - 1) * envelope_size;
5733
5734 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5736
5737 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5742 self.element_control.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5743 encoder, offset + cur_offset, depth
5744 )?;
5745
5746 _prev_end_offset = cur_offset + envelope_size;
5747 if 10 > max_ordinal {
5748 return Ok(());
5749 }
5750
5751 let cur_offset: usize = (10 - 1) * envelope_size;
5754
5755 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5757
5758 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5763 self.element_runner.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5764 encoder, offset + cur_offset, depth
5765 )?;
5766
5767 _prev_end_offset = cur_offset + envelope_size;
5768
5769 Ok(())
5770 }
5771 }
5772
5773 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ElementSchema {
5774 #[inline(always)]
5775 fn new_empty() -> Self {
5776 Self::default()
5777 }
5778
5779 unsafe fn decode(
5780 &mut self,
5781 decoder: &mut fidl::encoding::Decoder<
5782 '_,
5783 fidl::encoding::DefaultFuchsiaResourceDialect,
5784 >,
5785 offset: usize,
5786 mut depth: fidl::encoding::Depth,
5787 ) -> fidl::Result<()> {
5788 decoder.debug_check_bounds::<Self>(offset);
5789 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5790 None => return Err(fidl::Error::NotNullable),
5791 Some(len) => len,
5792 };
5793 if len == 0 {
5795 return Ok(());
5796 };
5797 depth.increment()?;
5798 let envelope_size = 8;
5799 let bytes_len = len * envelope_size;
5800 let offset = decoder.out_of_line_offset(bytes_len)?;
5801 let mut _next_ordinal_to_read = 0;
5803 let mut next_offset = offset;
5804 let end_offset = offset + bytes_len;
5805 _next_ordinal_to_read += 1;
5806 if next_offset >= end_offset {
5807 return Ok(());
5808 }
5809
5810 while _next_ordinal_to_read < 1 {
5812 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5813 _next_ordinal_to_read += 1;
5814 next_offset += envelope_size;
5815 }
5816
5817 let next_out_of_line = decoder.next_out_of_line();
5818 let handles_before = decoder.remaining_handles();
5819 if let Some((inlined, num_bytes, num_handles)) =
5820 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5821 {
5822 let member_inline_size =
5823 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
5824 decoder.context,
5825 );
5826 if inlined != (member_inline_size <= 4) {
5827 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5828 }
5829 let inner_offset;
5830 let mut inner_depth = depth.clone();
5831 if inlined {
5832 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5833 inner_offset = next_offset;
5834 } else {
5835 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5836 inner_depth.increment()?;
5837 }
5838 let val_ref = self.element_name.get_or_insert_with(|| {
5839 fidl::new_empty!(
5840 fidl::encoding::BoundedString<64>,
5841 fidl::encoding::DefaultFuchsiaResourceDialect
5842 )
5843 });
5844 fidl::decode!(
5845 fidl::encoding::BoundedString<64>,
5846 fidl::encoding::DefaultFuchsiaResourceDialect,
5847 val_ref,
5848 decoder,
5849 inner_offset,
5850 inner_depth
5851 )?;
5852 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5853 {
5854 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5855 }
5856 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5857 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5858 }
5859 }
5860
5861 next_offset += envelope_size;
5862 _next_ordinal_to_read += 1;
5863 if next_offset >= end_offset {
5864 return Ok(());
5865 }
5866
5867 while _next_ordinal_to_read < 2 {
5869 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5870 _next_ordinal_to_read += 1;
5871 next_offset += envelope_size;
5872 }
5873
5874 let next_out_of_line = decoder.next_out_of_line();
5875 let handles_before = decoder.remaining_handles();
5876 if let Some((inlined, num_bytes, num_handles)) =
5877 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5878 {
5879 let member_inline_size =
5880 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5881 if inlined != (member_inline_size <= 4) {
5882 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5883 }
5884 let inner_offset;
5885 let mut inner_depth = depth.clone();
5886 if inlined {
5887 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5888 inner_offset = next_offset;
5889 } else {
5890 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5891 inner_depth.increment()?;
5892 }
5893 let val_ref = self.initial_current_level.get_or_insert_with(|| {
5894 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
5895 });
5896 fidl::decode!(
5897 u8,
5898 fidl::encoding::DefaultFuchsiaResourceDialect,
5899 val_ref,
5900 decoder,
5901 inner_offset,
5902 inner_depth
5903 )?;
5904 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5905 {
5906 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5907 }
5908 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5909 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5910 }
5911 }
5912
5913 next_offset += envelope_size;
5914 _next_ordinal_to_read += 1;
5915 if next_offset >= end_offset {
5916 return Ok(());
5917 }
5918
5919 while _next_ordinal_to_read < 3 {
5921 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5922 _next_ordinal_to_read += 1;
5923 next_offset += envelope_size;
5924 }
5925
5926 let next_out_of_line = decoder.next_out_of_line();
5927 let handles_before = decoder.remaining_handles();
5928 if let Some((inlined, num_bytes, num_handles)) =
5929 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5930 {
5931 let member_inline_size =
5932 <fidl::encoding::Vector<u8, 256> as fidl::encoding::TypeMarker>::inline_size(
5933 decoder.context,
5934 );
5935 if inlined != (member_inline_size <= 4) {
5936 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5937 }
5938 let inner_offset;
5939 let mut inner_depth = depth.clone();
5940 if inlined {
5941 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5942 inner_offset = next_offset;
5943 } else {
5944 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5945 inner_depth.increment()?;
5946 }
5947 let val_ref =
5948 self.valid_levels.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
5949 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5950 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5951 {
5952 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5953 }
5954 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5955 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5956 }
5957 }
5958
5959 next_offset += envelope_size;
5960 _next_ordinal_to_read += 1;
5961 if next_offset >= end_offset {
5962 return Ok(());
5963 }
5964
5965 while _next_ordinal_to_read < 4 {
5967 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5968 _next_ordinal_to_read += 1;
5969 next_offset += envelope_size;
5970 }
5971
5972 let next_out_of_line = decoder.next_out_of_line();
5973 let handles_before = decoder.remaining_handles();
5974 if let Some((inlined, num_bytes, num_handles)) =
5975 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5976 {
5977 let member_inline_size = <fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5978 if inlined != (member_inline_size <= 4) {
5979 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5980 }
5981 let inner_offset;
5982 let mut inner_depth = depth.clone();
5983 if inlined {
5984 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5985 inner_offset = next_offset;
5986 } else {
5987 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5988 inner_depth.increment()?;
5989 }
5990 let val_ref =
5991 self.dependencies.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
5992 fidl::decode!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5993 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5994 {
5995 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5996 }
5997 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5998 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5999 }
6000 }
6001
6002 next_offset += envelope_size;
6003 _next_ordinal_to_read += 1;
6004 if next_offset >= end_offset {
6005 return Ok(());
6006 }
6007
6008 while _next_ordinal_to_read < 8 {
6010 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6011 _next_ordinal_to_read += 1;
6012 next_offset += envelope_size;
6013 }
6014
6015 let next_out_of_line = decoder.next_out_of_line();
6016 let handles_before = decoder.remaining_handles();
6017 if let Some((inlined, num_bytes, num_handles)) =
6018 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6019 {
6020 let member_inline_size = <fidl::encoding::Endpoint<
6021 fidl::endpoints::ServerEnd<LessorMarker>,
6022 > as fidl::encoding::TypeMarker>::inline_size(
6023 decoder.context
6024 );
6025 if inlined != (member_inline_size <= 4) {
6026 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6027 }
6028 let inner_offset;
6029 let mut inner_depth = depth.clone();
6030 if inlined {
6031 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6032 inner_offset = next_offset;
6033 } else {
6034 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6035 inner_depth.increment()?;
6036 }
6037 let val_ref = self.lessor_channel.get_or_insert_with(|| {
6038 fidl::new_empty!(
6039 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
6040 fidl::encoding::DefaultFuchsiaResourceDialect
6041 )
6042 });
6043 fidl::decode!(
6044 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
6045 fidl::encoding::DefaultFuchsiaResourceDialect,
6046 val_ref,
6047 decoder,
6048 inner_offset,
6049 inner_depth
6050 )?;
6051 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6052 {
6053 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6054 }
6055 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6056 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6057 }
6058 }
6059
6060 next_offset += envelope_size;
6061 _next_ordinal_to_read += 1;
6062 if next_offset >= end_offset {
6063 return Ok(());
6064 }
6065
6066 while _next_ordinal_to_read < 9 {
6068 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6069 _next_ordinal_to_read += 1;
6070 next_offset += envelope_size;
6071 }
6072
6073 let next_out_of_line = decoder.next_out_of_line();
6074 let handles_before = decoder.remaining_handles();
6075 if let Some((inlined, num_bytes, num_handles)) =
6076 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6077 {
6078 let member_inline_size = <fidl::encoding::Endpoint<
6079 fidl::endpoints::ServerEnd<ElementControlMarker>,
6080 > as fidl::encoding::TypeMarker>::inline_size(
6081 decoder.context
6082 );
6083 if inlined != (member_inline_size <= 4) {
6084 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6085 }
6086 let inner_offset;
6087 let mut inner_depth = depth.clone();
6088 if inlined {
6089 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6090 inner_offset = next_offset;
6091 } else {
6092 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6093 inner_depth.increment()?;
6094 }
6095 let val_ref = self.element_control.get_or_insert_with(|| {
6096 fidl::new_empty!(
6097 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
6098 fidl::encoding::DefaultFuchsiaResourceDialect
6099 )
6100 });
6101 fidl::decode!(
6102 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
6103 fidl::encoding::DefaultFuchsiaResourceDialect,
6104 val_ref,
6105 decoder,
6106 inner_offset,
6107 inner_depth
6108 )?;
6109 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6110 {
6111 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6112 }
6113 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6114 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6115 }
6116 }
6117
6118 next_offset += envelope_size;
6119 _next_ordinal_to_read += 1;
6120 if next_offset >= end_offset {
6121 return Ok(());
6122 }
6123
6124 while _next_ordinal_to_read < 10 {
6126 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6127 _next_ordinal_to_read += 1;
6128 next_offset += envelope_size;
6129 }
6130
6131 let next_out_of_line = decoder.next_out_of_line();
6132 let handles_before = decoder.remaining_handles();
6133 if let Some((inlined, num_bytes, num_handles)) =
6134 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6135 {
6136 let member_inline_size = <fidl::encoding::Endpoint<
6137 fidl::endpoints::ClientEnd<ElementRunnerMarker>,
6138 > as fidl::encoding::TypeMarker>::inline_size(
6139 decoder.context
6140 );
6141 if inlined != (member_inline_size <= 4) {
6142 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6143 }
6144 let inner_offset;
6145 let mut inner_depth = depth.clone();
6146 if inlined {
6147 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6148 inner_offset = next_offset;
6149 } else {
6150 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6151 inner_depth.increment()?;
6152 }
6153 let val_ref = self.element_runner.get_or_insert_with(|| {
6154 fidl::new_empty!(
6155 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
6156 fidl::encoding::DefaultFuchsiaResourceDialect
6157 )
6158 });
6159 fidl::decode!(
6160 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
6161 fidl::encoding::DefaultFuchsiaResourceDialect,
6162 val_ref,
6163 decoder,
6164 inner_offset,
6165 inner_depth
6166 )?;
6167 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6168 {
6169 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6170 }
6171 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6172 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6173 }
6174 }
6175
6176 next_offset += envelope_size;
6177
6178 while next_offset < end_offset {
6180 _next_ordinal_to_read += 1;
6181 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6182 next_offset += envelope_size;
6183 }
6184
6185 Ok(())
6186 }
6187 }
6188
6189 impl ElementStatusEndpoint {
6190 #[inline(always)]
6191 fn max_ordinal_present(&self) -> u64 {
6192 if let Some(_) = self.status {
6193 return 2;
6194 }
6195 if let Some(_) = self.identifier {
6196 return 1;
6197 }
6198 0
6199 }
6200 }
6201
6202 impl fidl::encoding::ResourceTypeMarker for ElementStatusEndpoint {
6203 type Borrowed<'a> = &'a mut Self;
6204 fn take_or_borrow<'a>(
6205 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6206 ) -> Self::Borrowed<'a> {
6207 value
6208 }
6209 }
6210
6211 unsafe impl fidl::encoding::TypeMarker for ElementStatusEndpoint {
6212 type Owned = Self;
6213
6214 #[inline(always)]
6215 fn inline_align(_context: fidl::encoding::Context) -> usize {
6216 8
6217 }
6218
6219 #[inline(always)]
6220 fn inline_size(_context: fidl::encoding::Context) -> usize {
6221 16
6222 }
6223 }
6224
6225 unsafe impl
6226 fidl::encoding::Encode<ElementStatusEndpoint, fidl::encoding::DefaultFuchsiaResourceDialect>
6227 for &mut ElementStatusEndpoint
6228 {
6229 unsafe fn encode(
6230 self,
6231 encoder: &mut fidl::encoding::Encoder<
6232 '_,
6233 fidl::encoding::DefaultFuchsiaResourceDialect,
6234 >,
6235 offset: usize,
6236 mut depth: fidl::encoding::Depth,
6237 ) -> fidl::Result<()> {
6238 encoder.debug_check_bounds::<ElementStatusEndpoint>(offset);
6239 let max_ordinal: u64 = self.max_ordinal_present();
6241 encoder.write_num(max_ordinal, offset);
6242 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6243 if max_ordinal == 0 {
6245 return Ok(());
6246 }
6247 depth.increment()?;
6248 let envelope_size = 8;
6249 let bytes_len = max_ordinal as usize * envelope_size;
6250 #[allow(unused_variables)]
6251 let offset = encoder.out_of_line_offset(bytes_len);
6252 let mut _prev_end_offset: usize = 0;
6253 if 1 > max_ordinal {
6254 return Ok(());
6255 }
6256
6257 let cur_offset: usize = (1 - 1) * envelope_size;
6260
6261 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6263
6264 fidl::encoding::encode_in_envelope_optional::<
6269 fidl::encoding::BoundedString<64>,
6270 fidl::encoding::DefaultFuchsiaResourceDialect,
6271 >(
6272 self.identifier.as_ref().map(
6273 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6274 ),
6275 encoder,
6276 offset + cur_offset,
6277 depth,
6278 )?;
6279
6280 _prev_end_offset = cur_offset + envelope_size;
6281 if 2 > max_ordinal {
6282 return Ok(());
6283 }
6284
6285 let cur_offset: usize = (2 - 1) * envelope_size;
6288
6289 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6291
6292 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6297 self.status.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6298 encoder, offset + cur_offset, depth
6299 )?;
6300
6301 _prev_end_offset = cur_offset + envelope_size;
6302
6303 Ok(())
6304 }
6305 }
6306
6307 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6308 for ElementStatusEndpoint
6309 {
6310 #[inline(always)]
6311 fn new_empty() -> Self {
6312 Self::default()
6313 }
6314
6315 unsafe fn decode(
6316 &mut self,
6317 decoder: &mut fidl::encoding::Decoder<
6318 '_,
6319 fidl::encoding::DefaultFuchsiaResourceDialect,
6320 >,
6321 offset: usize,
6322 mut depth: fidl::encoding::Depth,
6323 ) -> fidl::Result<()> {
6324 decoder.debug_check_bounds::<Self>(offset);
6325 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6326 None => return Err(fidl::Error::NotNullable),
6327 Some(len) => len,
6328 };
6329 if len == 0 {
6331 return Ok(());
6332 };
6333 depth.increment()?;
6334 let envelope_size = 8;
6335 let bytes_len = len * envelope_size;
6336 let offset = decoder.out_of_line_offset(bytes_len)?;
6337 let mut _next_ordinal_to_read = 0;
6339 let mut next_offset = offset;
6340 let end_offset = offset + bytes_len;
6341 _next_ordinal_to_read += 1;
6342 if next_offset >= end_offset {
6343 return Ok(());
6344 }
6345
6346 while _next_ordinal_to_read < 1 {
6348 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6349 _next_ordinal_to_read += 1;
6350 next_offset += envelope_size;
6351 }
6352
6353 let next_out_of_line = decoder.next_out_of_line();
6354 let handles_before = decoder.remaining_handles();
6355 if let Some((inlined, num_bytes, num_handles)) =
6356 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6357 {
6358 let member_inline_size =
6359 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
6360 decoder.context,
6361 );
6362 if inlined != (member_inline_size <= 4) {
6363 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6364 }
6365 let inner_offset;
6366 let mut inner_depth = depth.clone();
6367 if inlined {
6368 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6369 inner_offset = next_offset;
6370 } else {
6371 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6372 inner_depth.increment()?;
6373 }
6374 let val_ref = self.identifier.get_or_insert_with(|| {
6375 fidl::new_empty!(
6376 fidl::encoding::BoundedString<64>,
6377 fidl::encoding::DefaultFuchsiaResourceDialect
6378 )
6379 });
6380 fidl::decode!(
6381 fidl::encoding::BoundedString<64>,
6382 fidl::encoding::DefaultFuchsiaResourceDialect,
6383 val_ref,
6384 decoder,
6385 inner_offset,
6386 inner_depth
6387 )?;
6388 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6389 {
6390 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6391 }
6392 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6393 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6394 }
6395 }
6396
6397 next_offset += envelope_size;
6398 _next_ordinal_to_read += 1;
6399 if next_offset >= end_offset {
6400 return Ok(());
6401 }
6402
6403 while _next_ordinal_to_read < 2 {
6405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6406 _next_ordinal_to_read += 1;
6407 next_offset += envelope_size;
6408 }
6409
6410 let next_out_of_line = decoder.next_out_of_line();
6411 let handles_before = decoder.remaining_handles();
6412 if let Some((inlined, num_bytes, num_handles)) =
6413 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6414 {
6415 let member_inline_size = <fidl::encoding::Endpoint<
6416 fidl::endpoints::ClientEnd<StatusMarker>,
6417 > as fidl::encoding::TypeMarker>::inline_size(
6418 decoder.context
6419 );
6420 if inlined != (member_inline_size <= 4) {
6421 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6422 }
6423 let inner_offset;
6424 let mut inner_depth = depth.clone();
6425 if inlined {
6426 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6427 inner_offset = next_offset;
6428 } else {
6429 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6430 inner_depth.increment()?;
6431 }
6432 let val_ref = self.status.get_or_insert_with(|| {
6433 fidl::new_empty!(
6434 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
6435 fidl::encoding::DefaultFuchsiaResourceDialect
6436 )
6437 });
6438 fidl::decode!(
6439 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
6440 fidl::encoding::DefaultFuchsiaResourceDialect,
6441 val_ref,
6442 decoder,
6443 inner_offset,
6444 inner_depth
6445 )?;
6446 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6447 {
6448 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6449 }
6450 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6451 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6452 }
6453 }
6454
6455 next_offset += envelope_size;
6456
6457 while next_offset < end_offset {
6459 _next_ordinal_to_read += 1;
6460 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6461 next_offset += envelope_size;
6462 }
6463
6464 Ok(())
6465 }
6466 }
6467}