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::NullableHandle {
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
841 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
842 self.inner.shutdown_with_epitaph(status)
843 }
844
845 fn is_closed(&self) -> bool {
846 self.inner.channel().is_closed()
847 }
848 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
849 self.inner.channel().on_closed()
850 }
851
852 #[cfg(target_os = "fuchsia")]
853 fn signal_peer(
854 &self,
855 clear_mask: zx::Signals,
856 set_mask: zx::Signals,
857 ) -> Result<(), zx_status::Status> {
858 use fidl::Peered;
859 self.inner.channel().signal_peer(clear_mask, set_mask)
860 }
861}
862
863impl ElementControlControlHandle {}
864
865#[must_use = "FIDL methods require a response to be sent"]
866#[derive(Debug)]
867pub struct ElementControlRegisterDependencyTokenResponder {
868 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
869 tx_id: u32,
870}
871
872impl std::ops::Drop for ElementControlRegisterDependencyTokenResponder {
876 fn drop(&mut self) {
877 self.control_handle.shutdown();
878 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
880 }
881}
882
883impl fidl::endpoints::Responder for ElementControlRegisterDependencyTokenResponder {
884 type ControlHandle = ElementControlControlHandle;
885
886 fn control_handle(&self) -> &ElementControlControlHandle {
887 &self.control_handle
888 }
889
890 fn drop_without_shutdown(mut self) {
891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
893 std::mem::forget(self);
895 }
896}
897
898impl ElementControlRegisterDependencyTokenResponder {
899 pub fn send(
903 self,
904 mut result: Result<(), RegisterDependencyTokenError>,
905 ) -> Result<(), fidl::Error> {
906 let _result = self.send_raw(result);
907 if _result.is_err() {
908 self.control_handle.shutdown();
909 }
910 self.drop_without_shutdown();
911 _result
912 }
913
914 pub fn send_no_shutdown_on_err(
916 self,
917 mut result: Result<(), RegisterDependencyTokenError>,
918 ) -> Result<(), fidl::Error> {
919 let _result = self.send_raw(result);
920 self.drop_without_shutdown();
921 _result
922 }
923
924 fn send_raw(
925 &self,
926 mut result: Result<(), RegisterDependencyTokenError>,
927 ) -> Result<(), fidl::Error> {
928 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
929 fidl::encoding::EmptyStruct,
930 RegisterDependencyTokenError,
931 >>(
932 fidl::encoding::FlexibleResult::new(result),
933 self.tx_id,
934 0x3a5016663d198d61,
935 fidl::encoding::DynamicFlags::FLEXIBLE,
936 )
937 }
938}
939
940#[must_use = "FIDL methods require a response to be sent"]
941#[derive(Debug)]
942pub struct ElementControlUnregisterDependencyTokenResponder {
943 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
944 tx_id: u32,
945}
946
947impl std::ops::Drop for ElementControlUnregisterDependencyTokenResponder {
951 fn drop(&mut self) {
952 self.control_handle.shutdown();
953 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
955 }
956}
957
958impl fidl::endpoints::Responder for ElementControlUnregisterDependencyTokenResponder {
959 type ControlHandle = ElementControlControlHandle;
960
961 fn control_handle(&self) -> &ElementControlControlHandle {
962 &self.control_handle
963 }
964
965 fn drop_without_shutdown(mut self) {
966 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
968 std::mem::forget(self);
970 }
971}
972
973impl ElementControlUnregisterDependencyTokenResponder {
974 pub fn send(
978 self,
979 mut result: Result<(), UnregisterDependencyTokenError>,
980 ) -> Result<(), fidl::Error> {
981 let _result = self.send_raw(result);
982 if _result.is_err() {
983 self.control_handle.shutdown();
984 }
985 self.drop_without_shutdown();
986 _result
987 }
988
989 pub fn send_no_shutdown_on_err(
991 self,
992 mut result: Result<(), UnregisterDependencyTokenError>,
993 ) -> Result<(), fidl::Error> {
994 let _result = self.send_raw(result);
995 self.drop_without_shutdown();
996 _result
997 }
998
999 fn send_raw(
1000 &self,
1001 mut result: Result<(), UnregisterDependencyTokenError>,
1002 ) -> Result<(), fidl::Error> {
1003 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1004 fidl::encoding::EmptyStruct,
1005 UnregisterDependencyTokenError,
1006 >>(
1007 fidl::encoding::FlexibleResult::new(result),
1008 self.tx_id,
1009 0x65a31a3661499529,
1010 fidl::encoding::DynamicFlags::FLEXIBLE,
1011 )
1012 }
1013}
1014
1015#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1016pub struct ElementInfoProviderMarker;
1017
1018impl fidl::endpoints::ProtocolMarker for ElementInfoProviderMarker {
1019 type Proxy = ElementInfoProviderProxy;
1020 type RequestStream = ElementInfoProviderRequestStream;
1021 #[cfg(target_os = "fuchsia")]
1022 type SynchronousProxy = ElementInfoProviderSynchronousProxy;
1023
1024 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
1025}
1026impl fidl::endpoints::DiscoverableProtocolMarker for ElementInfoProviderMarker {}
1027pub type ElementInfoProviderGetElementPowerLevelNamesResult =
1028 Result<Vec<ElementPowerLevelNames>, ElementInfoProviderError>;
1029pub type ElementInfoProviderGetStatusEndpointsResult =
1030 Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>;
1031
1032pub trait ElementInfoProviderProxyInterface: Send + Sync {
1033 type GetElementPowerLevelNamesResponseFut: std::future::Future<
1034 Output = Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error>,
1035 > + Send;
1036 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut;
1037 type GetStatusEndpointsResponseFut: std::future::Future<
1038 Output = Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error>,
1039 > + Send;
1040 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut;
1041}
1042#[derive(Debug)]
1043#[cfg(target_os = "fuchsia")]
1044pub struct ElementInfoProviderSynchronousProxy {
1045 client: fidl::client::sync::Client,
1046}
1047
1048#[cfg(target_os = "fuchsia")]
1049impl fidl::endpoints::SynchronousProxy for ElementInfoProviderSynchronousProxy {
1050 type Proxy = ElementInfoProviderProxy;
1051 type Protocol = ElementInfoProviderMarker;
1052
1053 fn from_channel(inner: fidl::Channel) -> Self {
1054 Self::new(inner)
1055 }
1056
1057 fn into_channel(self) -> fidl::Channel {
1058 self.client.into_channel()
1059 }
1060
1061 fn as_channel(&self) -> &fidl::Channel {
1062 self.client.as_channel()
1063 }
1064}
1065
1066#[cfg(target_os = "fuchsia")]
1067impl ElementInfoProviderSynchronousProxy {
1068 pub fn new(channel: fidl::Channel) -> Self {
1069 let protocol_name =
1070 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1071 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1072 }
1073
1074 pub fn into_channel(self) -> fidl::Channel {
1075 self.client.into_channel()
1076 }
1077
1078 pub fn wait_for_event(
1081 &self,
1082 deadline: zx::MonotonicInstant,
1083 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1084 ElementInfoProviderEvent::decode(self.client.wait_for_event(deadline)?)
1085 }
1086
1087 pub fn r#get_element_power_level_names(
1090 &self,
1091 ___deadline: zx::MonotonicInstant,
1092 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1093 let _response = self
1094 .client
1095 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1096 ElementInfoProviderGetElementPowerLevelNamesResponse,
1097 ElementInfoProviderError,
1098 >>(
1099 (), 0x298f63881fc9ed49, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1100 )?
1101 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1102 Ok(_response.map(|x| x.level_names))
1103 }
1104
1105 pub fn r#get_status_endpoints(
1109 &self,
1110 ___deadline: zx::MonotonicInstant,
1111 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1112 let _response = self
1113 .client
1114 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1115 ElementInfoProviderGetStatusEndpointsResponse,
1116 ElementInfoProviderError,
1117 >>(
1118 (), 0x456f2b6c5bf0777c, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1119 )?
1120 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1121 Ok(_response.map(|x| x.endpoints))
1122 }
1123}
1124
1125#[cfg(target_os = "fuchsia")]
1126impl From<ElementInfoProviderSynchronousProxy> for zx::NullableHandle {
1127 fn from(value: ElementInfoProviderSynchronousProxy) -> Self {
1128 value.into_channel().into()
1129 }
1130}
1131
1132#[cfg(target_os = "fuchsia")]
1133impl From<fidl::Channel> for ElementInfoProviderSynchronousProxy {
1134 fn from(value: fidl::Channel) -> Self {
1135 Self::new(value)
1136 }
1137}
1138
1139#[cfg(target_os = "fuchsia")]
1140impl fidl::endpoints::FromClient for ElementInfoProviderSynchronousProxy {
1141 type Protocol = ElementInfoProviderMarker;
1142
1143 fn from_client(value: fidl::endpoints::ClientEnd<ElementInfoProviderMarker>) -> Self {
1144 Self::new(value.into_channel())
1145 }
1146}
1147
1148#[derive(Debug, Clone)]
1149pub struct ElementInfoProviderProxy {
1150 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1151}
1152
1153impl fidl::endpoints::Proxy for ElementInfoProviderProxy {
1154 type Protocol = ElementInfoProviderMarker;
1155
1156 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1157 Self::new(inner)
1158 }
1159
1160 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1161 self.client.into_channel().map_err(|client| Self { client })
1162 }
1163
1164 fn as_channel(&self) -> &::fidl::AsyncChannel {
1165 self.client.as_channel()
1166 }
1167}
1168
1169impl ElementInfoProviderProxy {
1170 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1172 let protocol_name =
1173 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1174 Self { client: fidl::client::Client::new(channel, protocol_name) }
1175 }
1176
1177 pub fn take_event_stream(&self) -> ElementInfoProviderEventStream {
1183 ElementInfoProviderEventStream { event_receiver: self.client.take_event_receiver() }
1184 }
1185
1186 pub fn r#get_element_power_level_names(
1189 &self,
1190 ) -> fidl::client::QueryResponseFut<
1191 ElementInfoProviderGetElementPowerLevelNamesResult,
1192 fidl::encoding::DefaultFuchsiaResourceDialect,
1193 > {
1194 ElementInfoProviderProxyInterface::r#get_element_power_level_names(self)
1195 }
1196
1197 pub fn r#get_status_endpoints(
1201 &self,
1202 ) -> fidl::client::QueryResponseFut<
1203 ElementInfoProviderGetStatusEndpointsResult,
1204 fidl::encoding::DefaultFuchsiaResourceDialect,
1205 > {
1206 ElementInfoProviderProxyInterface::r#get_status_endpoints(self)
1207 }
1208}
1209
1210impl ElementInfoProviderProxyInterface for ElementInfoProviderProxy {
1211 type GetElementPowerLevelNamesResponseFut = fidl::client::QueryResponseFut<
1212 ElementInfoProviderGetElementPowerLevelNamesResult,
1213 fidl::encoding::DefaultFuchsiaResourceDialect,
1214 >;
1215 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut {
1216 fn _decode(
1217 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1218 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1219 let _response = fidl::client::decode_transaction_body::<
1220 fidl::encoding::FlexibleResultType<
1221 ElementInfoProviderGetElementPowerLevelNamesResponse,
1222 ElementInfoProviderError,
1223 >,
1224 fidl::encoding::DefaultFuchsiaResourceDialect,
1225 0x298f63881fc9ed49,
1226 >(_buf?)?
1227 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1228 Ok(_response.map(|x| x.level_names))
1229 }
1230 self.client.send_query_and_decode::<
1231 fidl::encoding::EmptyPayload,
1232 ElementInfoProviderGetElementPowerLevelNamesResult,
1233 >(
1234 (),
1235 0x298f63881fc9ed49,
1236 fidl::encoding::DynamicFlags::FLEXIBLE,
1237 _decode,
1238 )
1239 }
1240
1241 type GetStatusEndpointsResponseFut = fidl::client::QueryResponseFut<
1242 ElementInfoProviderGetStatusEndpointsResult,
1243 fidl::encoding::DefaultFuchsiaResourceDialect,
1244 >;
1245 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut {
1246 fn _decode(
1247 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1248 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1249 let _response = fidl::client::decode_transaction_body::<
1250 fidl::encoding::FlexibleResultType<
1251 ElementInfoProviderGetStatusEndpointsResponse,
1252 ElementInfoProviderError,
1253 >,
1254 fidl::encoding::DefaultFuchsiaResourceDialect,
1255 0x456f2b6c5bf0777c,
1256 >(_buf?)?
1257 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1258 Ok(_response.map(|x| x.endpoints))
1259 }
1260 self.client.send_query_and_decode::<
1261 fidl::encoding::EmptyPayload,
1262 ElementInfoProviderGetStatusEndpointsResult,
1263 >(
1264 (),
1265 0x456f2b6c5bf0777c,
1266 fidl::encoding::DynamicFlags::FLEXIBLE,
1267 _decode,
1268 )
1269 }
1270}
1271
1272pub struct ElementInfoProviderEventStream {
1273 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1274}
1275
1276impl std::marker::Unpin for ElementInfoProviderEventStream {}
1277
1278impl futures::stream::FusedStream for ElementInfoProviderEventStream {
1279 fn is_terminated(&self) -> bool {
1280 self.event_receiver.is_terminated()
1281 }
1282}
1283
1284impl futures::Stream for ElementInfoProviderEventStream {
1285 type Item = Result<ElementInfoProviderEvent, fidl::Error>;
1286
1287 fn poll_next(
1288 mut self: std::pin::Pin<&mut Self>,
1289 cx: &mut std::task::Context<'_>,
1290 ) -> std::task::Poll<Option<Self::Item>> {
1291 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1292 &mut self.event_receiver,
1293 cx
1294 )?) {
1295 Some(buf) => std::task::Poll::Ready(Some(ElementInfoProviderEvent::decode(buf))),
1296 None => std::task::Poll::Ready(None),
1297 }
1298 }
1299}
1300
1301#[derive(Debug)]
1302pub enum ElementInfoProviderEvent {
1303 #[non_exhaustive]
1304 _UnknownEvent {
1305 ordinal: u64,
1307 },
1308}
1309
1310impl ElementInfoProviderEvent {
1311 fn decode(
1313 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1314 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1315 let (bytes, _handles) = buf.split_mut();
1316 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1317 debug_assert_eq!(tx_header.tx_id, 0);
1318 match tx_header.ordinal {
1319 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1320 Ok(ElementInfoProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1321 }
1322 _ => Err(fidl::Error::UnknownOrdinal {
1323 ordinal: tx_header.ordinal,
1324 protocol_name:
1325 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1326 }),
1327 }
1328 }
1329}
1330
1331pub struct ElementInfoProviderRequestStream {
1333 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1334 is_terminated: bool,
1335}
1336
1337impl std::marker::Unpin for ElementInfoProviderRequestStream {}
1338
1339impl futures::stream::FusedStream for ElementInfoProviderRequestStream {
1340 fn is_terminated(&self) -> bool {
1341 self.is_terminated
1342 }
1343}
1344
1345impl fidl::endpoints::RequestStream for ElementInfoProviderRequestStream {
1346 type Protocol = ElementInfoProviderMarker;
1347 type ControlHandle = ElementInfoProviderControlHandle;
1348
1349 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1350 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1351 }
1352
1353 fn control_handle(&self) -> Self::ControlHandle {
1354 ElementInfoProviderControlHandle { inner: self.inner.clone() }
1355 }
1356
1357 fn into_inner(
1358 self,
1359 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1360 {
1361 (self.inner, self.is_terminated)
1362 }
1363
1364 fn from_inner(
1365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1366 is_terminated: bool,
1367 ) -> Self {
1368 Self { inner, is_terminated }
1369 }
1370}
1371
1372impl futures::Stream for ElementInfoProviderRequestStream {
1373 type Item = Result<ElementInfoProviderRequest, fidl::Error>;
1374
1375 fn poll_next(
1376 mut self: std::pin::Pin<&mut Self>,
1377 cx: &mut std::task::Context<'_>,
1378 ) -> std::task::Poll<Option<Self::Item>> {
1379 let this = &mut *self;
1380 if this.inner.check_shutdown(cx) {
1381 this.is_terminated = true;
1382 return std::task::Poll::Ready(None);
1383 }
1384 if this.is_terminated {
1385 panic!("polled ElementInfoProviderRequestStream after completion");
1386 }
1387 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1388 |bytes, handles| {
1389 match this.inner.channel().read_etc(cx, bytes, handles) {
1390 std::task::Poll::Ready(Ok(())) => {}
1391 std::task::Poll::Pending => return std::task::Poll::Pending,
1392 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1393 this.is_terminated = true;
1394 return std::task::Poll::Ready(None);
1395 }
1396 std::task::Poll::Ready(Err(e)) => {
1397 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1398 e.into(),
1399 ))));
1400 }
1401 }
1402
1403 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1405
1406 std::task::Poll::Ready(Some(match header.ordinal {
1407 0x298f63881fc9ed49 => {
1408 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1409 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1410 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1411 let control_handle = ElementInfoProviderControlHandle {
1412 inner: this.inner.clone(),
1413 };
1414 Ok(ElementInfoProviderRequest::GetElementPowerLevelNames {
1415 responder: ElementInfoProviderGetElementPowerLevelNamesResponder {
1416 control_handle: std::mem::ManuallyDrop::new(control_handle),
1417 tx_id: header.tx_id,
1418 },
1419 })
1420 }
1421 0x456f2b6c5bf0777c => {
1422 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1423 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1424 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1425 let control_handle = ElementInfoProviderControlHandle {
1426 inner: this.inner.clone(),
1427 };
1428 Ok(ElementInfoProviderRequest::GetStatusEndpoints {
1429 responder: ElementInfoProviderGetStatusEndpointsResponder {
1430 control_handle: std::mem::ManuallyDrop::new(control_handle),
1431 tx_id: header.tx_id,
1432 },
1433 })
1434 }
1435 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1436 Ok(ElementInfoProviderRequest::_UnknownMethod {
1437 ordinal: header.ordinal,
1438 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
1439 method_type: fidl::MethodType::OneWay,
1440 })
1441 }
1442 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1443 this.inner.send_framework_err(
1444 fidl::encoding::FrameworkErr::UnknownMethod,
1445 header.tx_id,
1446 header.ordinal,
1447 header.dynamic_flags(),
1448 (bytes, handles),
1449 )?;
1450 Ok(ElementInfoProviderRequest::_UnknownMethod {
1451 ordinal: header.ordinal,
1452 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
1453 method_type: fidl::MethodType::TwoWay,
1454 })
1455 }
1456 _ => Err(fidl::Error::UnknownOrdinal {
1457 ordinal: header.ordinal,
1458 protocol_name: <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1459 }),
1460 }))
1461 },
1462 )
1463 }
1464}
1465
1466#[derive(Debug)]
1468pub enum ElementInfoProviderRequest {
1469 GetElementPowerLevelNames { responder: ElementInfoProviderGetElementPowerLevelNamesResponder },
1472 GetStatusEndpoints { responder: ElementInfoProviderGetStatusEndpointsResponder },
1476 #[non_exhaustive]
1478 _UnknownMethod {
1479 ordinal: u64,
1481 control_handle: ElementInfoProviderControlHandle,
1482 method_type: fidl::MethodType,
1483 },
1484}
1485
1486impl ElementInfoProviderRequest {
1487 #[allow(irrefutable_let_patterns)]
1488 pub fn into_get_element_power_level_names(
1489 self,
1490 ) -> Option<(ElementInfoProviderGetElementPowerLevelNamesResponder)> {
1491 if let ElementInfoProviderRequest::GetElementPowerLevelNames { responder } = self {
1492 Some((responder))
1493 } else {
1494 None
1495 }
1496 }
1497
1498 #[allow(irrefutable_let_patterns)]
1499 pub fn into_get_status_endpoints(
1500 self,
1501 ) -> Option<(ElementInfoProviderGetStatusEndpointsResponder)> {
1502 if let ElementInfoProviderRequest::GetStatusEndpoints { responder } = self {
1503 Some((responder))
1504 } else {
1505 None
1506 }
1507 }
1508
1509 pub fn method_name(&self) -> &'static str {
1511 match *self {
1512 ElementInfoProviderRequest::GetElementPowerLevelNames { .. } => {
1513 "get_element_power_level_names"
1514 }
1515 ElementInfoProviderRequest::GetStatusEndpoints { .. } => "get_status_endpoints",
1516 ElementInfoProviderRequest::_UnknownMethod {
1517 method_type: fidl::MethodType::OneWay,
1518 ..
1519 } => "unknown one-way method",
1520 ElementInfoProviderRequest::_UnknownMethod {
1521 method_type: fidl::MethodType::TwoWay,
1522 ..
1523 } => "unknown two-way method",
1524 }
1525 }
1526}
1527
1528#[derive(Debug, Clone)]
1529pub struct ElementInfoProviderControlHandle {
1530 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1531}
1532
1533impl fidl::endpoints::ControlHandle for ElementInfoProviderControlHandle {
1534 fn shutdown(&self) {
1535 self.inner.shutdown()
1536 }
1537
1538 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1539 self.inner.shutdown_with_epitaph(status)
1540 }
1541
1542 fn is_closed(&self) -> bool {
1543 self.inner.channel().is_closed()
1544 }
1545 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1546 self.inner.channel().on_closed()
1547 }
1548
1549 #[cfg(target_os = "fuchsia")]
1550 fn signal_peer(
1551 &self,
1552 clear_mask: zx::Signals,
1553 set_mask: zx::Signals,
1554 ) -> Result<(), zx_status::Status> {
1555 use fidl::Peered;
1556 self.inner.channel().signal_peer(clear_mask, set_mask)
1557 }
1558}
1559
1560impl ElementInfoProviderControlHandle {}
1561
1562#[must_use = "FIDL methods require a response to be sent"]
1563#[derive(Debug)]
1564pub struct ElementInfoProviderGetElementPowerLevelNamesResponder {
1565 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
1566 tx_id: u32,
1567}
1568
1569impl std::ops::Drop for ElementInfoProviderGetElementPowerLevelNamesResponder {
1573 fn drop(&mut self) {
1574 self.control_handle.shutdown();
1575 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1577 }
1578}
1579
1580impl fidl::endpoints::Responder for ElementInfoProviderGetElementPowerLevelNamesResponder {
1581 type ControlHandle = ElementInfoProviderControlHandle;
1582
1583 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
1584 &self.control_handle
1585 }
1586
1587 fn drop_without_shutdown(mut self) {
1588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1590 std::mem::forget(self);
1592 }
1593}
1594
1595impl ElementInfoProviderGetElementPowerLevelNamesResponder {
1596 pub fn send(
1600 self,
1601 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1602 ) -> Result<(), fidl::Error> {
1603 let _result = self.send_raw(result);
1604 if _result.is_err() {
1605 self.control_handle.shutdown();
1606 }
1607 self.drop_without_shutdown();
1608 _result
1609 }
1610
1611 pub fn send_no_shutdown_on_err(
1613 self,
1614 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1615 ) -> Result<(), fidl::Error> {
1616 let _result = self.send_raw(result);
1617 self.drop_without_shutdown();
1618 _result
1619 }
1620
1621 fn send_raw(
1622 &self,
1623 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
1624 ) -> Result<(), fidl::Error> {
1625 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1626 ElementInfoProviderGetElementPowerLevelNamesResponse,
1627 ElementInfoProviderError,
1628 >>(
1629 fidl::encoding::FlexibleResult::new(result.map(|level_names| (level_names,))),
1630 self.tx_id,
1631 0x298f63881fc9ed49,
1632 fidl::encoding::DynamicFlags::FLEXIBLE,
1633 )
1634 }
1635}
1636
1637#[must_use = "FIDL methods require a response to be sent"]
1638#[derive(Debug)]
1639pub struct ElementInfoProviderGetStatusEndpointsResponder {
1640 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
1641 tx_id: u32,
1642}
1643
1644impl std::ops::Drop for ElementInfoProviderGetStatusEndpointsResponder {
1648 fn drop(&mut self) {
1649 self.control_handle.shutdown();
1650 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1652 }
1653}
1654
1655impl fidl::endpoints::Responder for ElementInfoProviderGetStatusEndpointsResponder {
1656 type ControlHandle = ElementInfoProviderControlHandle;
1657
1658 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
1659 &self.control_handle
1660 }
1661
1662 fn drop_without_shutdown(mut self) {
1663 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1665 std::mem::forget(self);
1667 }
1668}
1669
1670impl ElementInfoProviderGetStatusEndpointsResponder {
1671 pub fn send(
1675 self,
1676 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1677 ) -> Result<(), fidl::Error> {
1678 let _result = self.send_raw(result);
1679 if _result.is_err() {
1680 self.control_handle.shutdown();
1681 }
1682 self.drop_without_shutdown();
1683 _result
1684 }
1685
1686 pub fn send_no_shutdown_on_err(
1688 self,
1689 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1690 ) -> Result<(), fidl::Error> {
1691 let _result = self.send_raw(result);
1692 self.drop_without_shutdown();
1693 _result
1694 }
1695
1696 fn send_raw(
1697 &self,
1698 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
1699 ) -> Result<(), fidl::Error> {
1700 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1701 ElementInfoProviderGetStatusEndpointsResponse,
1702 ElementInfoProviderError,
1703 >>(
1704 fidl::encoding::FlexibleResult::new(
1705 result.as_mut().map_err(|e| *e).map(|endpoints| (endpoints.as_mut_slice(),)),
1706 ),
1707 self.tx_id,
1708 0x456f2b6c5bf0777c,
1709 fidl::encoding::DynamicFlags::FLEXIBLE,
1710 )
1711 }
1712}
1713
1714#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1715pub struct ElementRunnerMarker;
1716
1717impl fidl::endpoints::ProtocolMarker for ElementRunnerMarker {
1718 type Proxy = ElementRunnerProxy;
1719 type RequestStream = ElementRunnerRequestStream;
1720 #[cfg(target_os = "fuchsia")]
1721 type SynchronousProxy = ElementRunnerSynchronousProxy;
1722
1723 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementRunner";
1724}
1725impl fidl::endpoints::DiscoverableProtocolMarker for ElementRunnerMarker {}
1726
1727pub trait ElementRunnerProxyInterface: Send + Sync {
1728 type SetLevelResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1729 fn r#set_level(&self, level: u8) -> Self::SetLevelResponseFut;
1730}
1731#[derive(Debug)]
1732#[cfg(target_os = "fuchsia")]
1733pub struct ElementRunnerSynchronousProxy {
1734 client: fidl::client::sync::Client,
1735}
1736
1737#[cfg(target_os = "fuchsia")]
1738impl fidl::endpoints::SynchronousProxy for ElementRunnerSynchronousProxy {
1739 type Proxy = ElementRunnerProxy;
1740 type Protocol = ElementRunnerMarker;
1741
1742 fn from_channel(inner: fidl::Channel) -> Self {
1743 Self::new(inner)
1744 }
1745
1746 fn into_channel(self) -> fidl::Channel {
1747 self.client.into_channel()
1748 }
1749
1750 fn as_channel(&self) -> &fidl::Channel {
1751 self.client.as_channel()
1752 }
1753}
1754
1755#[cfg(target_os = "fuchsia")]
1756impl ElementRunnerSynchronousProxy {
1757 pub fn new(channel: fidl::Channel) -> Self {
1758 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1759 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1760 }
1761
1762 pub fn into_channel(self) -> fidl::Channel {
1763 self.client.into_channel()
1764 }
1765
1766 pub fn wait_for_event(
1769 &self,
1770 deadline: zx::MonotonicInstant,
1771 ) -> Result<ElementRunnerEvent, fidl::Error> {
1772 ElementRunnerEvent::decode(self.client.wait_for_event(deadline)?)
1773 }
1774
1775 pub fn r#set_level(
1782 &self,
1783 mut level: u8,
1784 ___deadline: zx::MonotonicInstant,
1785 ) -> Result<(), fidl::Error> {
1786 let _response = self.client.send_query::<
1787 ElementRunnerSetLevelRequest,
1788 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1789 >(
1790 (level,),
1791 0x11a93092b228f0b,
1792 fidl::encoding::DynamicFlags::FLEXIBLE,
1793 ___deadline,
1794 )?
1795 .into_result::<ElementRunnerMarker>("set_level")?;
1796 Ok(_response)
1797 }
1798}
1799
1800#[cfg(target_os = "fuchsia")]
1801impl From<ElementRunnerSynchronousProxy> for zx::NullableHandle {
1802 fn from(value: ElementRunnerSynchronousProxy) -> Self {
1803 value.into_channel().into()
1804 }
1805}
1806
1807#[cfg(target_os = "fuchsia")]
1808impl From<fidl::Channel> for ElementRunnerSynchronousProxy {
1809 fn from(value: fidl::Channel) -> Self {
1810 Self::new(value)
1811 }
1812}
1813
1814#[cfg(target_os = "fuchsia")]
1815impl fidl::endpoints::FromClient for ElementRunnerSynchronousProxy {
1816 type Protocol = ElementRunnerMarker;
1817
1818 fn from_client(value: fidl::endpoints::ClientEnd<ElementRunnerMarker>) -> Self {
1819 Self::new(value.into_channel())
1820 }
1821}
1822
1823#[derive(Debug, Clone)]
1824pub struct ElementRunnerProxy {
1825 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1826}
1827
1828impl fidl::endpoints::Proxy for ElementRunnerProxy {
1829 type Protocol = ElementRunnerMarker;
1830
1831 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1832 Self::new(inner)
1833 }
1834
1835 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1836 self.client.into_channel().map_err(|client| Self { client })
1837 }
1838
1839 fn as_channel(&self) -> &::fidl::AsyncChannel {
1840 self.client.as_channel()
1841 }
1842}
1843
1844impl ElementRunnerProxy {
1845 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1847 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1848 Self { client: fidl::client::Client::new(channel, protocol_name) }
1849 }
1850
1851 pub fn take_event_stream(&self) -> ElementRunnerEventStream {
1857 ElementRunnerEventStream { event_receiver: self.client.take_event_receiver() }
1858 }
1859
1860 pub fn r#set_level(
1867 &self,
1868 mut level: u8,
1869 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1870 ElementRunnerProxyInterface::r#set_level(self, level)
1871 }
1872}
1873
1874impl ElementRunnerProxyInterface for ElementRunnerProxy {
1875 type SetLevelResponseFut =
1876 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1877 fn r#set_level(&self, mut level: u8) -> Self::SetLevelResponseFut {
1878 fn _decode(
1879 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1880 ) -> Result<(), fidl::Error> {
1881 let _response = fidl::client::decode_transaction_body::<
1882 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 0x11a93092b228f0b,
1885 >(_buf?)?
1886 .into_result::<ElementRunnerMarker>("set_level")?;
1887 Ok(_response)
1888 }
1889 self.client.send_query_and_decode::<ElementRunnerSetLevelRequest, ()>(
1890 (level,),
1891 0x11a93092b228f0b,
1892 fidl::encoding::DynamicFlags::FLEXIBLE,
1893 _decode,
1894 )
1895 }
1896}
1897
1898pub struct ElementRunnerEventStream {
1899 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1900}
1901
1902impl std::marker::Unpin for ElementRunnerEventStream {}
1903
1904impl futures::stream::FusedStream for ElementRunnerEventStream {
1905 fn is_terminated(&self) -> bool {
1906 self.event_receiver.is_terminated()
1907 }
1908}
1909
1910impl futures::Stream for ElementRunnerEventStream {
1911 type Item = Result<ElementRunnerEvent, fidl::Error>;
1912
1913 fn poll_next(
1914 mut self: std::pin::Pin<&mut Self>,
1915 cx: &mut std::task::Context<'_>,
1916 ) -> std::task::Poll<Option<Self::Item>> {
1917 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1918 &mut self.event_receiver,
1919 cx
1920 )?) {
1921 Some(buf) => std::task::Poll::Ready(Some(ElementRunnerEvent::decode(buf))),
1922 None => std::task::Poll::Ready(None),
1923 }
1924 }
1925}
1926
1927#[derive(Debug)]
1928pub enum ElementRunnerEvent {
1929 #[non_exhaustive]
1930 _UnknownEvent {
1931 ordinal: u64,
1933 },
1934}
1935
1936impl ElementRunnerEvent {
1937 fn decode(
1939 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1940 ) -> Result<ElementRunnerEvent, fidl::Error> {
1941 let (bytes, _handles) = buf.split_mut();
1942 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1943 debug_assert_eq!(tx_header.tx_id, 0);
1944 match tx_header.ordinal {
1945 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1946 Ok(ElementRunnerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1947 }
1948 _ => Err(fidl::Error::UnknownOrdinal {
1949 ordinal: tx_header.ordinal,
1950 protocol_name: <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1951 }),
1952 }
1953 }
1954}
1955
1956pub struct ElementRunnerRequestStream {
1958 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1959 is_terminated: bool,
1960}
1961
1962impl std::marker::Unpin for ElementRunnerRequestStream {}
1963
1964impl futures::stream::FusedStream for ElementRunnerRequestStream {
1965 fn is_terminated(&self) -> bool {
1966 self.is_terminated
1967 }
1968}
1969
1970impl fidl::endpoints::RequestStream for ElementRunnerRequestStream {
1971 type Protocol = ElementRunnerMarker;
1972 type ControlHandle = ElementRunnerControlHandle;
1973
1974 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1975 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1976 }
1977
1978 fn control_handle(&self) -> Self::ControlHandle {
1979 ElementRunnerControlHandle { inner: self.inner.clone() }
1980 }
1981
1982 fn into_inner(
1983 self,
1984 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1985 {
1986 (self.inner, self.is_terminated)
1987 }
1988
1989 fn from_inner(
1990 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1991 is_terminated: bool,
1992 ) -> Self {
1993 Self { inner, is_terminated }
1994 }
1995}
1996
1997impl futures::Stream for ElementRunnerRequestStream {
1998 type Item = Result<ElementRunnerRequest, fidl::Error>;
1999
2000 fn poll_next(
2001 mut self: std::pin::Pin<&mut Self>,
2002 cx: &mut std::task::Context<'_>,
2003 ) -> std::task::Poll<Option<Self::Item>> {
2004 let this = &mut *self;
2005 if this.inner.check_shutdown(cx) {
2006 this.is_terminated = true;
2007 return std::task::Poll::Ready(None);
2008 }
2009 if this.is_terminated {
2010 panic!("polled ElementRunnerRequestStream after completion");
2011 }
2012 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2013 |bytes, handles| {
2014 match this.inner.channel().read_etc(cx, bytes, handles) {
2015 std::task::Poll::Ready(Ok(())) => {}
2016 std::task::Poll::Pending => return std::task::Poll::Pending,
2017 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2018 this.is_terminated = true;
2019 return std::task::Poll::Ready(None);
2020 }
2021 std::task::Poll::Ready(Err(e)) => {
2022 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2023 e.into(),
2024 ))));
2025 }
2026 }
2027
2028 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2030
2031 std::task::Poll::Ready(Some(match header.ordinal {
2032 0x11a93092b228f0b => {
2033 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2034 let mut req = fidl::new_empty!(
2035 ElementRunnerSetLevelRequest,
2036 fidl::encoding::DefaultFuchsiaResourceDialect
2037 );
2038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementRunnerSetLevelRequest>(&header, _body_bytes, handles, &mut req)?;
2039 let control_handle =
2040 ElementRunnerControlHandle { inner: this.inner.clone() };
2041 Ok(ElementRunnerRequest::SetLevel {
2042 level: req.level,
2043
2044 responder: ElementRunnerSetLevelResponder {
2045 control_handle: std::mem::ManuallyDrop::new(control_handle),
2046 tx_id: header.tx_id,
2047 },
2048 })
2049 }
2050 _ if header.tx_id == 0
2051 && header
2052 .dynamic_flags()
2053 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2054 {
2055 Ok(ElementRunnerRequest::_UnknownMethod {
2056 ordinal: header.ordinal,
2057 control_handle: ElementRunnerControlHandle {
2058 inner: this.inner.clone(),
2059 },
2060 method_type: fidl::MethodType::OneWay,
2061 })
2062 }
2063 _ if header
2064 .dynamic_flags()
2065 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2066 {
2067 this.inner.send_framework_err(
2068 fidl::encoding::FrameworkErr::UnknownMethod,
2069 header.tx_id,
2070 header.ordinal,
2071 header.dynamic_flags(),
2072 (bytes, handles),
2073 )?;
2074 Ok(ElementRunnerRequest::_UnknownMethod {
2075 ordinal: header.ordinal,
2076 control_handle: ElementRunnerControlHandle {
2077 inner: this.inner.clone(),
2078 },
2079 method_type: fidl::MethodType::TwoWay,
2080 })
2081 }
2082 _ => Err(fidl::Error::UnknownOrdinal {
2083 ordinal: header.ordinal,
2084 protocol_name:
2085 <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2086 }),
2087 }))
2088 },
2089 )
2090 }
2091}
2092
2093#[derive(Debug)]
2099pub enum ElementRunnerRequest {
2100 SetLevel { level: u8, responder: ElementRunnerSetLevelResponder },
2107 #[non_exhaustive]
2109 _UnknownMethod {
2110 ordinal: u64,
2112 control_handle: ElementRunnerControlHandle,
2113 method_type: fidl::MethodType,
2114 },
2115}
2116
2117impl ElementRunnerRequest {
2118 #[allow(irrefutable_let_patterns)]
2119 pub fn into_set_level(self) -> Option<(u8, ElementRunnerSetLevelResponder)> {
2120 if let ElementRunnerRequest::SetLevel { level, responder } = self {
2121 Some((level, responder))
2122 } else {
2123 None
2124 }
2125 }
2126
2127 pub fn method_name(&self) -> &'static str {
2129 match *self {
2130 ElementRunnerRequest::SetLevel { .. } => "set_level",
2131 ElementRunnerRequest::_UnknownMethod {
2132 method_type: fidl::MethodType::OneWay, ..
2133 } => "unknown one-way method",
2134 ElementRunnerRequest::_UnknownMethod {
2135 method_type: fidl::MethodType::TwoWay, ..
2136 } => "unknown two-way method",
2137 }
2138 }
2139}
2140
2141#[derive(Debug, Clone)]
2142pub struct ElementRunnerControlHandle {
2143 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2144}
2145
2146impl fidl::endpoints::ControlHandle for ElementRunnerControlHandle {
2147 fn shutdown(&self) {
2148 self.inner.shutdown()
2149 }
2150
2151 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2152 self.inner.shutdown_with_epitaph(status)
2153 }
2154
2155 fn is_closed(&self) -> bool {
2156 self.inner.channel().is_closed()
2157 }
2158 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2159 self.inner.channel().on_closed()
2160 }
2161
2162 #[cfg(target_os = "fuchsia")]
2163 fn signal_peer(
2164 &self,
2165 clear_mask: zx::Signals,
2166 set_mask: zx::Signals,
2167 ) -> Result<(), zx_status::Status> {
2168 use fidl::Peered;
2169 self.inner.channel().signal_peer(clear_mask, set_mask)
2170 }
2171}
2172
2173impl ElementRunnerControlHandle {}
2174
2175#[must_use = "FIDL methods require a response to be sent"]
2176#[derive(Debug)]
2177pub struct ElementRunnerSetLevelResponder {
2178 control_handle: std::mem::ManuallyDrop<ElementRunnerControlHandle>,
2179 tx_id: u32,
2180}
2181
2182impl std::ops::Drop for ElementRunnerSetLevelResponder {
2186 fn drop(&mut self) {
2187 self.control_handle.shutdown();
2188 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2190 }
2191}
2192
2193impl fidl::endpoints::Responder for ElementRunnerSetLevelResponder {
2194 type ControlHandle = ElementRunnerControlHandle;
2195
2196 fn control_handle(&self) -> &ElementRunnerControlHandle {
2197 &self.control_handle
2198 }
2199
2200 fn drop_without_shutdown(mut self) {
2201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2203 std::mem::forget(self);
2205 }
2206}
2207
2208impl ElementRunnerSetLevelResponder {
2209 pub fn send(self) -> Result<(), fidl::Error> {
2213 let _result = self.send_raw();
2214 if _result.is_err() {
2215 self.control_handle.shutdown();
2216 }
2217 self.drop_without_shutdown();
2218 _result
2219 }
2220
2221 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2223 let _result = self.send_raw();
2224 self.drop_without_shutdown();
2225 _result
2226 }
2227
2228 fn send_raw(&self) -> Result<(), fidl::Error> {
2229 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2230 fidl::encoding::Flexible::new(()),
2231 self.tx_id,
2232 0x11a93092b228f0b,
2233 fidl::encoding::DynamicFlags::FLEXIBLE,
2234 )
2235 }
2236}
2237
2238#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2239pub struct LeaseControlMarker;
2240
2241impl fidl::endpoints::ProtocolMarker for LeaseControlMarker {
2242 type Proxy = LeaseControlProxy;
2243 type RequestStream = LeaseControlRequestStream;
2244 #[cfg(target_os = "fuchsia")]
2245 type SynchronousProxy = LeaseControlSynchronousProxy;
2246
2247 const DEBUG_NAME: &'static str = "(anonymous) LeaseControl";
2248}
2249
2250pub trait LeaseControlProxyInterface: Send + Sync {
2251 type WatchStatusResponseFut: std::future::Future<Output = Result<LeaseStatus, fidl::Error>>
2252 + Send;
2253 fn r#watch_status(&self, last_status: LeaseStatus) -> Self::WatchStatusResponseFut;
2254}
2255#[derive(Debug)]
2256#[cfg(target_os = "fuchsia")]
2257pub struct LeaseControlSynchronousProxy {
2258 client: fidl::client::sync::Client,
2259}
2260
2261#[cfg(target_os = "fuchsia")]
2262impl fidl::endpoints::SynchronousProxy for LeaseControlSynchronousProxy {
2263 type Proxy = LeaseControlProxy;
2264 type Protocol = LeaseControlMarker;
2265
2266 fn from_channel(inner: fidl::Channel) -> Self {
2267 Self::new(inner)
2268 }
2269
2270 fn into_channel(self) -> fidl::Channel {
2271 self.client.into_channel()
2272 }
2273
2274 fn as_channel(&self) -> &fidl::Channel {
2275 self.client.as_channel()
2276 }
2277}
2278
2279#[cfg(target_os = "fuchsia")]
2280impl LeaseControlSynchronousProxy {
2281 pub fn new(channel: fidl::Channel) -> Self {
2282 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2283 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2284 }
2285
2286 pub fn into_channel(self) -> fidl::Channel {
2287 self.client.into_channel()
2288 }
2289
2290 pub fn wait_for_event(
2293 &self,
2294 deadline: zx::MonotonicInstant,
2295 ) -> Result<LeaseControlEvent, fidl::Error> {
2296 LeaseControlEvent::decode(self.client.wait_for_event(deadline)?)
2297 }
2298
2299 pub fn r#watch_status(
2304 &self,
2305 mut last_status: LeaseStatus,
2306 ___deadline: zx::MonotonicInstant,
2307 ) -> Result<LeaseStatus, fidl::Error> {
2308 let _response = self.client.send_query::<
2309 LeaseControlWatchStatusRequest,
2310 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2311 >(
2312 (last_status,),
2313 0x293ab9b0301ca881,
2314 fidl::encoding::DynamicFlags::FLEXIBLE,
2315 ___deadline,
2316 )?
2317 .into_result::<LeaseControlMarker>("watch_status")?;
2318 Ok(_response.status)
2319 }
2320}
2321
2322#[cfg(target_os = "fuchsia")]
2323impl From<LeaseControlSynchronousProxy> for zx::NullableHandle {
2324 fn from(value: LeaseControlSynchronousProxy) -> Self {
2325 value.into_channel().into()
2326 }
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl From<fidl::Channel> for LeaseControlSynchronousProxy {
2331 fn from(value: fidl::Channel) -> Self {
2332 Self::new(value)
2333 }
2334}
2335
2336#[cfg(target_os = "fuchsia")]
2337impl fidl::endpoints::FromClient for LeaseControlSynchronousProxy {
2338 type Protocol = LeaseControlMarker;
2339
2340 fn from_client(value: fidl::endpoints::ClientEnd<LeaseControlMarker>) -> Self {
2341 Self::new(value.into_channel())
2342 }
2343}
2344
2345#[derive(Debug, Clone)]
2346pub struct LeaseControlProxy {
2347 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2348}
2349
2350impl fidl::endpoints::Proxy for LeaseControlProxy {
2351 type Protocol = LeaseControlMarker;
2352
2353 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2354 Self::new(inner)
2355 }
2356
2357 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2358 self.client.into_channel().map_err(|client| Self { client })
2359 }
2360
2361 fn as_channel(&self) -> &::fidl::AsyncChannel {
2362 self.client.as_channel()
2363 }
2364}
2365
2366impl LeaseControlProxy {
2367 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2369 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2370 Self { client: fidl::client::Client::new(channel, protocol_name) }
2371 }
2372
2373 pub fn take_event_stream(&self) -> LeaseControlEventStream {
2379 LeaseControlEventStream { event_receiver: self.client.take_event_receiver() }
2380 }
2381
2382 pub fn r#watch_status(
2387 &self,
2388 mut last_status: LeaseStatus,
2389 ) -> fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2390 {
2391 LeaseControlProxyInterface::r#watch_status(self, last_status)
2392 }
2393}
2394
2395impl LeaseControlProxyInterface for LeaseControlProxy {
2396 type WatchStatusResponseFut =
2397 fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
2398 fn r#watch_status(&self, mut last_status: LeaseStatus) -> Self::WatchStatusResponseFut {
2399 fn _decode(
2400 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2401 ) -> Result<LeaseStatus, fidl::Error> {
2402 let _response = fidl::client::decode_transaction_body::<
2403 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2404 fidl::encoding::DefaultFuchsiaResourceDialect,
2405 0x293ab9b0301ca881,
2406 >(_buf?)?
2407 .into_result::<LeaseControlMarker>("watch_status")?;
2408 Ok(_response.status)
2409 }
2410 self.client.send_query_and_decode::<LeaseControlWatchStatusRequest, LeaseStatus>(
2411 (last_status,),
2412 0x293ab9b0301ca881,
2413 fidl::encoding::DynamicFlags::FLEXIBLE,
2414 _decode,
2415 )
2416 }
2417}
2418
2419pub struct LeaseControlEventStream {
2420 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2421}
2422
2423impl std::marker::Unpin for LeaseControlEventStream {}
2424
2425impl futures::stream::FusedStream for LeaseControlEventStream {
2426 fn is_terminated(&self) -> bool {
2427 self.event_receiver.is_terminated()
2428 }
2429}
2430
2431impl futures::Stream for LeaseControlEventStream {
2432 type Item = Result<LeaseControlEvent, fidl::Error>;
2433
2434 fn poll_next(
2435 mut self: std::pin::Pin<&mut Self>,
2436 cx: &mut std::task::Context<'_>,
2437 ) -> std::task::Poll<Option<Self::Item>> {
2438 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2439 &mut self.event_receiver,
2440 cx
2441 )?) {
2442 Some(buf) => std::task::Poll::Ready(Some(LeaseControlEvent::decode(buf))),
2443 None => std::task::Poll::Ready(None),
2444 }
2445 }
2446}
2447
2448#[derive(Debug)]
2449pub enum LeaseControlEvent {
2450 #[non_exhaustive]
2451 _UnknownEvent {
2452 ordinal: u64,
2454 },
2455}
2456
2457impl LeaseControlEvent {
2458 fn decode(
2460 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2461 ) -> Result<LeaseControlEvent, fidl::Error> {
2462 let (bytes, _handles) = buf.split_mut();
2463 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2464 debug_assert_eq!(tx_header.tx_id, 0);
2465 match tx_header.ordinal {
2466 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2467 Ok(LeaseControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2468 }
2469 _ => Err(fidl::Error::UnknownOrdinal {
2470 ordinal: tx_header.ordinal,
2471 protocol_name: <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2472 }),
2473 }
2474 }
2475}
2476
2477pub struct LeaseControlRequestStream {
2479 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2480 is_terminated: bool,
2481}
2482
2483impl std::marker::Unpin for LeaseControlRequestStream {}
2484
2485impl futures::stream::FusedStream for LeaseControlRequestStream {
2486 fn is_terminated(&self) -> bool {
2487 self.is_terminated
2488 }
2489}
2490
2491impl fidl::endpoints::RequestStream for LeaseControlRequestStream {
2492 type Protocol = LeaseControlMarker;
2493 type ControlHandle = LeaseControlControlHandle;
2494
2495 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2496 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2497 }
2498
2499 fn control_handle(&self) -> Self::ControlHandle {
2500 LeaseControlControlHandle { inner: self.inner.clone() }
2501 }
2502
2503 fn into_inner(
2504 self,
2505 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2506 {
2507 (self.inner, self.is_terminated)
2508 }
2509
2510 fn from_inner(
2511 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2512 is_terminated: bool,
2513 ) -> Self {
2514 Self { inner, is_terminated }
2515 }
2516}
2517
2518impl futures::Stream for LeaseControlRequestStream {
2519 type Item = Result<LeaseControlRequest, fidl::Error>;
2520
2521 fn poll_next(
2522 mut self: std::pin::Pin<&mut Self>,
2523 cx: &mut std::task::Context<'_>,
2524 ) -> std::task::Poll<Option<Self::Item>> {
2525 let this = &mut *self;
2526 if this.inner.check_shutdown(cx) {
2527 this.is_terminated = true;
2528 return std::task::Poll::Ready(None);
2529 }
2530 if this.is_terminated {
2531 panic!("polled LeaseControlRequestStream after completion");
2532 }
2533 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2534 |bytes, handles| {
2535 match this.inner.channel().read_etc(cx, bytes, handles) {
2536 std::task::Poll::Ready(Ok(())) => {}
2537 std::task::Poll::Pending => return std::task::Poll::Pending,
2538 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2539 this.is_terminated = true;
2540 return std::task::Poll::Ready(None);
2541 }
2542 std::task::Poll::Ready(Err(e)) => {
2543 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2544 e.into(),
2545 ))));
2546 }
2547 }
2548
2549 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2551
2552 std::task::Poll::Ready(Some(match header.ordinal {
2553 0x293ab9b0301ca881 => {
2554 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2555 let mut req = fidl::new_empty!(
2556 LeaseControlWatchStatusRequest,
2557 fidl::encoding::DefaultFuchsiaResourceDialect
2558 );
2559 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LeaseControlWatchStatusRequest>(&header, _body_bytes, handles, &mut req)?;
2560 let control_handle =
2561 LeaseControlControlHandle { inner: this.inner.clone() };
2562 Ok(LeaseControlRequest::WatchStatus {
2563 last_status: req.last_status,
2564
2565 responder: LeaseControlWatchStatusResponder {
2566 control_handle: std::mem::ManuallyDrop::new(control_handle),
2567 tx_id: header.tx_id,
2568 },
2569 })
2570 }
2571 _ if header.tx_id == 0
2572 && header
2573 .dynamic_flags()
2574 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2575 {
2576 Ok(LeaseControlRequest::_UnknownMethod {
2577 ordinal: header.ordinal,
2578 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
2579 method_type: fidl::MethodType::OneWay,
2580 })
2581 }
2582 _ if header
2583 .dynamic_flags()
2584 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2585 {
2586 this.inner.send_framework_err(
2587 fidl::encoding::FrameworkErr::UnknownMethod,
2588 header.tx_id,
2589 header.ordinal,
2590 header.dynamic_flags(),
2591 (bytes, handles),
2592 )?;
2593 Ok(LeaseControlRequest::_UnknownMethod {
2594 ordinal: header.ordinal,
2595 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
2596 method_type: fidl::MethodType::TwoWay,
2597 })
2598 }
2599 _ => Err(fidl::Error::UnknownOrdinal {
2600 ordinal: header.ordinal,
2601 protocol_name:
2602 <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2603 }),
2604 }))
2605 },
2606 )
2607 }
2608}
2609
2610#[derive(Debug)]
2615pub enum LeaseControlRequest {
2616 WatchStatus { last_status: LeaseStatus, responder: LeaseControlWatchStatusResponder },
2621 #[non_exhaustive]
2623 _UnknownMethod {
2624 ordinal: u64,
2626 control_handle: LeaseControlControlHandle,
2627 method_type: fidl::MethodType,
2628 },
2629}
2630
2631impl LeaseControlRequest {
2632 #[allow(irrefutable_let_patterns)]
2633 pub fn into_watch_status(self) -> Option<(LeaseStatus, LeaseControlWatchStatusResponder)> {
2634 if let LeaseControlRequest::WatchStatus { last_status, responder } = self {
2635 Some((last_status, responder))
2636 } else {
2637 None
2638 }
2639 }
2640
2641 pub fn method_name(&self) -> &'static str {
2643 match *self {
2644 LeaseControlRequest::WatchStatus { .. } => "watch_status",
2645 LeaseControlRequest::_UnknownMethod {
2646 method_type: fidl::MethodType::OneWay, ..
2647 } => "unknown one-way method",
2648 LeaseControlRequest::_UnknownMethod {
2649 method_type: fidl::MethodType::TwoWay, ..
2650 } => "unknown two-way method",
2651 }
2652 }
2653}
2654
2655#[derive(Debug, Clone)]
2656pub struct LeaseControlControlHandle {
2657 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2658}
2659
2660impl fidl::endpoints::ControlHandle for LeaseControlControlHandle {
2661 fn shutdown(&self) {
2662 self.inner.shutdown()
2663 }
2664
2665 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2666 self.inner.shutdown_with_epitaph(status)
2667 }
2668
2669 fn is_closed(&self) -> bool {
2670 self.inner.channel().is_closed()
2671 }
2672 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2673 self.inner.channel().on_closed()
2674 }
2675
2676 #[cfg(target_os = "fuchsia")]
2677 fn signal_peer(
2678 &self,
2679 clear_mask: zx::Signals,
2680 set_mask: zx::Signals,
2681 ) -> Result<(), zx_status::Status> {
2682 use fidl::Peered;
2683 self.inner.channel().signal_peer(clear_mask, set_mask)
2684 }
2685}
2686
2687impl LeaseControlControlHandle {}
2688
2689#[must_use = "FIDL methods require a response to be sent"]
2690#[derive(Debug)]
2691pub struct LeaseControlWatchStatusResponder {
2692 control_handle: std::mem::ManuallyDrop<LeaseControlControlHandle>,
2693 tx_id: u32,
2694}
2695
2696impl std::ops::Drop for LeaseControlWatchStatusResponder {
2700 fn drop(&mut self) {
2701 self.control_handle.shutdown();
2702 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2704 }
2705}
2706
2707impl fidl::endpoints::Responder for LeaseControlWatchStatusResponder {
2708 type ControlHandle = LeaseControlControlHandle;
2709
2710 fn control_handle(&self) -> &LeaseControlControlHandle {
2711 &self.control_handle
2712 }
2713
2714 fn drop_without_shutdown(mut self) {
2715 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2717 std::mem::forget(self);
2719 }
2720}
2721
2722impl LeaseControlWatchStatusResponder {
2723 pub fn send(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2727 let _result = self.send_raw(status);
2728 if _result.is_err() {
2729 self.control_handle.shutdown();
2730 }
2731 self.drop_without_shutdown();
2732 _result
2733 }
2734
2735 pub fn send_no_shutdown_on_err(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2737 let _result = self.send_raw(status);
2738 self.drop_without_shutdown();
2739 _result
2740 }
2741
2742 fn send_raw(&self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
2743 self.control_handle
2744 .inner
2745 .send::<fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>>(
2746 fidl::encoding::Flexible::new((status,)),
2747 self.tx_id,
2748 0x293ab9b0301ca881,
2749 fidl::encoding::DynamicFlags::FLEXIBLE,
2750 )
2751 }
2752}
2753
2754#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2755pub struct LessorMarker;
2756
2757impl fidl::endpoints::ProtocolMarker for LessorMarker {
2758 type Proxy = LessorProxy;
2759 type RequestStream = LessorRequestStream;
2760 #[cfg(target_os = "fuchsia")]
2761 type SynchronousProxy = LessorSynchronousProxy;
2762
2763 const DEBUG_NAME: &'static str = "(anonymous) Lessor";
2764}
2765pub type LessorLeaseResult = Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>;
2766
2767pub trait LessorProxyInterface: Send + Sync {
2768 type LeaseResponseFut: std::future::Future<Output = Result<LessorLeaseResult, fidl::Error>>
2769 + Send;
2770 fn r#lease(&self, level: u8) -> Self::LeaseResponseFut;
2771}
2772#[derive(Debug)]
2773#[cfg(target_os = "fuchsia")]
2774pub struct LessorSynchronousProxy {
2775 client: fidl::client::sync::Client,
2776}
2777
2778#[cfg(target_os = "fuchsia")]
2779impl fidl::endpoints::SynchronousProxy for LessorSynchronousProxy {
2780 type Proxy = LessorProxy;
2781 type Protocol = LessorMarker;
2782
2783 fn from_channel(inner: fidl::Channel) -> Self {
2784 Self::new(inner)
2785 }
2786
2787 fn into_channel(self) -> fidl::Channel {
2788 self.client.into_channel()
2789 }
2790
2791 fn as_channel(&self) -> &fidl::Channel {
2792 self.client.as_channel()
2793 }
2794}
2795
2796#[cfg(target_os = "fuchsia")]
2797impl LessorSynchronousProxy {
2798 pub fn new(channel: fidl::Channel) -> Self {
2799 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2800 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2801 }
2802
2803 pub fn into_channel(self) -> fidl::Channel {
2804 self.client.into_channel()
2805 }
2806
2807 pub fn wait_for_event(
2810 &self,
2811 deadline: zx::MonotonicInstant,
2812 ) -> Result<LessorEvent, fidl::Error> {
2813 LessorEvent::decode(self.client.wait_for_event(deadline)?)
2814 }
2815
2816 pub fn r#lease(
2828 &self,
2829 mut level: u8,
2830 ___deadline: zx::MonotonicInstant,
2831 ) -> Result<LessorLeaseResult, fidl::Error> {
2832 let _response = self.client.send_query::<
2833 LessorLeaseRequest,
2834 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
2835 >(
2836 (level,),
2837 0x38999f84b2f1f9ad,
2838 fidl::encoding::DynamicFlags::FLEXIBLE,
2839 ___deadline,
2840 )?
2841 .into_result::<LessorMarker>("lease")?;
2842 Ok(_response.map(|x| x.lease_control))
2843 }
2844}
2845
2846#[cfg(target_os = "fuchsia")]
2847impl From<LessorSynchronousProxy> for zx::NullableHandle {
2848 fn from(value: LessorSynchronousProxy) -> Self {
2849 value.into_channel().into()
2850 }
2851}
2852
2853#[cfg(target_os = "fuchsia")]
2854impl From<fidl::Channel> for LessorSynchronousProxy {
2855 fn from(value: fidl::Channel) -> Self {
2856 Self::new(value)
2857 }
2858}
2859
2860#[cfg(target_os = "fuchsia")]
2861impl fidl::endpoints::FromClient for LessorSynchronousProxy {
2862 type Protocol = LessorMarker;
2863
2864 fn from_client(value: fidl::endpoints::ClientEnd<LessorMarker>) -> Self {
2865 Self::new(value.into_channel())
2866 }
2867}
2868
2869#[derive(Debug, Clone)]
2870pub struct LessorProxy {
2871 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2872}
2873
2874impl fidl::endpoints::Proxy for LessorProxy {
2875 type Protocol = LessorMarker;
2876
2877 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2878 Self::new(inner)
2879 }
2880
2881 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2882 self.client.into_channel().map_err(|client| Self { client })
2883 }
2884
2885 fn as_channel(&self) -> &::fidl::AsyncChannel {
2886 self.client.as_channel()
2887 }
2888}
2889
2890impl LessorProxy {
2891 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2893 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2894 Self { client: fidl::client::Client::new(channel, protocol_name) }
2895 }
2896
2897 pub fn take_event_stream(&self) -> LessorEventStream {
2903 LessorEventStream { event_receiver: self.client.take_event_receiver() }
2904 }
2905
2906 pub fn r#lease(
2918 &self,
2919 mut level: u8,
2920 ) -> fidl::client::QueryResponseFut<
2921 LessorLeaseResult,
2922 fidl::encoding::DefaultFuchsiaResourceDialect,
2923 > {
2924 LessorProxyInterface::r#lease(self, level)
2925 }
2926}
2927
2928impl LessorProxyInterface for LessorProxy {
2929 type LeaseResponseFut = fidl::client::QueryResponseFut<
2930 LessorLeaseResult,
2931 fidl::encoding::DefaultFuchsiaResourceDialect,
2932 >;
2933 fn r#lease(&self, mut level: u8) -> Self::LeaseResponseFut {
2934 fn _decode(
2935 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2936 ) -> Result<LessorLeaseResult, fidl::Error> {
2937 let _response = fidl::client::decode_transaction_body::<
2938 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
2939 fidl::encoding::DefaultFuchsiaResourceDialect,
2940 0x38999f84b2f1f9ad,
2941 >(_buf?)?
2942 .into_result::<LessorMarker>("lease")?;
2943 Ok(_response.map(|x| x.lease_control))
2944 }
2945 self.client.send_query_and_decode::<LessorLeaseRequest, LessorLeaseResult>(
2946 (level,),
2947 0x38999f84b2f1f9ad,
2948 fidl::encoding::DynamicFlags::FLEXIBLE,
2949 _decode,
2950 )
2951 }
2952}
2953
2954pub struct LessorEventStream {
2955 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2956}
2957
2958impl std::marker::Unpin for LessorEventStream {}
2959
2960impl futures::stream::FusedStream for LessorEventStream {
2961 fn is_terminated(&self) -> bool {
2962 self.event_receiver.is_terminated()
2963 }
2964}
2965
2966impl futures::Stream for LessorEventStream {
2967 type Item = Result<LessorEvent, fidl::Error>;
2968
2969 fn poll_next(
2970 mut self: std::pin::Pin<&mut Self>,
2971 cx: &mut std::task::Context<'_>,
2972 ) -> std::task::Poll<Option<Self::Item>> {
2973 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2974 &mut self.event_receiver,
2975 cx
2976 )?) {
2977 Some(buf) => std::task::Poll::Ready(Some(LessorEvent::decode(buf))),
2978 None => std::task::Poll::Ready(None),
2979 }
2980 }
2981}
2982
2983#[derive(Debug)]
2984pub enum LessorEvent {
2985 #[non_exhaustive]
2986 _UnknownEvent {
2987 ordinal: u64,
2989 },
2990}
2991
2992impl LessorEvent {
2993 fn decode(
2995 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2996 ) -> Result<LessorEvent, fidl::Error> {
2997 let (bytes, _handles) = buf.split_mut();
2998 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2999 debug_assert_eq!(tx_header.tx_id, 0);
3000 match tx_header.ordinal {
3001 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3002 Ok(LessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3003 }
3004 _ => Err(fidl::Error::UnknownOrdinal {
3005 ordinal: tx_header.ordinal,
3006 protocol_name: <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3007 }),
3008 }
3009 }
3010}
3011
3012pub struct LessorRequestStream {
3014 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3015 is_terminated: bool,
3016}
3017
3018impl std::marker::Unpin for LessorRequestStream {}
3019
3020impl futures::stream::FusedStream for LessorRequestStream {
3021 fn is_terminated(&self) -> bool {
3022 self.is_terminated
3023 }
3024}
3025
3026impl fidl::endpoints::RequestStream for LessorRequestStream {
3027 type Protocol = LessorMarker;
3028 type ControlHandle = LessorControlHandle;
3029
3030 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3031 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3032 }
3033
3034 fn control_handle(&self) -> Self::ControlHandle {
3035 LessorControlHandle { inner: self.inner.clone() }
3036 }
3037
3038 fn into_inner(
3039 self,
3040 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3041 {
3042 (self.inner, self.is_terminated)
3043 }
3044
3045 fn from_inner(
3046 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3047 is_terminated: bool,
3048 ) -> Self {
3049 Self { inner, is_terminated }
3050 }
3051}
3052
3053impl futures::Stream for LessorRequestStream {
3054 type Item = Result<LessorRequest, fidl::Error>;
3055
3056 fn poll_next(
3057 mut self: std::pin::Pin<&mut Self>,
3058 cx: &mut std::task::Context<'_>,
3059 ) -> std::task::Poll<Option<Self::Item>> {
3060 let this = &mut *self;
3061 if this.inner.check_shutdown(cx) {
3062 this.is_terminated = true;
3063 return std::task::Poll::Ready(None);
3064 }
3065 if this.is_terminated {
3066 panic!("polled LessorRequestStream after completion");
3067 }
3068 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3069 |bytes, handles| {
3070 match this.inner.channel().read_etc(cx, bytes, handles) {
3071 std::task::Poll::Ready(Ok(())) => {}
3072 std::task::Poll::Pending => return std::task::Poll::Pending,
3073 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3074 this.is_terminated = true;
3075 return std::task::Poll::Ready(None);
3076 }
3077 std::task::Poll::Ready(Err(e)) => {
3078 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3079 e.into(),
3080 ))));
3081 }
3082 }
3083
3084 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3086
3087 std::task::Poll::Ready(Some(match header.ordinal {
3088 0x38999f84b2f1f9ad => {
3089 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3090 let mut req = fidl::new_empty!(
3091 LessorLeaseRequest,
3092 fidl::encoding::DefaultFuchsiaResourceDialect
3093 );
3094 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LessorLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
3095 let control_handle = LessorControlHandle { inner: this.inner.clone() };
3096 Ok(LessorRequest::Lease {
3097 level: req.level,
3098
3099 responder: LessorLeaseResponder {
3100 control_handle: std::mem::ManuallyDrop::new(control_handle),
3101 tx_id: header.tx_id,
3102 },
3103 })
3104 }
3105 _ if header.tx_id == 0
3106 && header
3107 .dynamic_flags()
3108 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3109 {
3110 Ok(LessorRequest::_UnknownMethod {
3111 ordinal: header.ordinal,
3112 control_handle: LessorControlHandle { inner: this.inner.clone() },
3113 method_type: fidl::MethodType::OneWay,
3114 })
3115 }
3116 _ if header
3117 .dynamic_flags()
3118 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3119 {
3120 this.inner.send_framework_err(
3121 fidl::encoding::FrameworkErr::UnknownMethod,
3122 header.tx_id,
3123 header.ordinal,
3124 header.dynamic_flags(),
3125 (bytes, handles),
3126 )?;
3127 Ok(LessorRequest::_UnknownMethod {
3128 ordinal: header.ordinal,
3129 control_handle: LessorControlHandle { inner: this.inner.clone() },
3130 method_type: fidl::MethodType::TwoWay,
3131 })
3132 }
3133 _ => Err(fidl::Error::UnknownOrdinal {
3134 ordinal: header.ordinal,
3135 protocol_name:
3136 <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3137 }),
3138 }))
3139 },
3140 )
3141 }
3142}
3143
3144#[derive(Debug)]
3147pub enum LessorRequest {
3148 Lease { level: u8, responder: LessorLeaseResponder },
3160 #[non_exhaustive]
3162 _UnknownMethod {
3163 ordinal: u64,
3165 control_handle: LessorControlHandle,
3166 method_type: fidl::MethodType,
3167 },
3168}
3169
3170impl LessorRequest {
3171 #[allow(irrefutable_let_patterns)]
3172 pub fn into_lease(self) -> Option<(u8, LessorLeaseResponder)> {
3173 if let LessorRequest::Lease { level, responder } = self {
3174 Some((level, responder))
3175 } else {
3176 None
3177 }
3178 }
3179
3180 pub fn method_name(&self) -> &'static str {
3182 match *self {
3183 LessorRequest::Lease { .. } => "lease",
3184 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3185 "unknown one-way method"
3186 }
3187 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3188 "unknown two-way method"
3189 }
3190 }
3191 }
3192}
3193
3194#[derive(Debug, Clone)]
3195pub struct LessorControlHandle {
3196 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3197}
3198
3199impl fidl::endpoints::ControlHandle for LessorControlHandle {
3200 fn shutdown(&self) {
3201 self.inner.shutdown()
3202 }
3203
3204 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3205 self.inner.shutdown_with_epitaph(status)
3206 }
3207
3208 fn is_closed(&self) -> bool {
3209 self.inner.channel().is_closed()
3210 }
3211 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3212 self.inner.channel().on_closed()
3213 }
3214
3215 #[cfg(target_os = "fuchsia")]
3216 fn signal_peer(
3217 &self,
3218 clear_mask: zx::Signals,
3219 set_mask: zx::Signals,
3220 ) -> Result<(), zx_status::Status> {
3221 use fidl::Peered;
3222 self.inner.channel().signal_peer(clear_mask, set_mask)
3223 }
3224}
3225
3226impl LessorControlHandle {}
3227
3228#[must_use = "FIDL methods require a response to be sent"]
3229#[derive(Debug)]
3230pub struct LessorLeaseResponder {
3231 control_handle: std::mem::ManuallyDrop<LessorControlHandle>,
3232 tx_id: u32,
3233}
3234
3235impl std::ops::Drop for LessorLeaseResponder {
3239 fn drop(&mut self) {
3240 self.control_handle.shutdown();
3241 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3243 }
3244}
3245
3246impl fidl::endpoints::Responder for LessorLeaseResponder {
3247 type ControlHandle = LessorControlHandle;
3248
3249 fn control_handle(&self) -> &LessorControlHandle {
3250 &self.control_handle
3251 }
3252
3253 fn drop_without_shutdown(mut self) {
3254 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3256 std::mem::forget(self);
3258 }
3259}
3260
3261impl LessorLeaseResponder {
3262 pub fn send(
3266 self,
3267 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3268 ) -> Result<(), fidl::Error> {
3269 let _result = self.send_raw(result);
3270 if _result.is_err() {
3271 self.control_handle.shutdown();
3272 }
3273 self.drop_without_shutdown();
3274 _result
3275 }
3276
3277 pub fn send_no_shutdown_on_err(
3279 self,
3280 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3281 ) -> Result<(), fidl::Error> {
3282 let _result = self.send_raw(result);
3283 self.drop_without_shutdown();
3284 _result
3285 }
3286
3287 fn send_raw(
3288 &self,
3289 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3290 ) -> Result<(), fidl::Error> {
3291 self.control_handle
3292 .inner
3293 .send::<fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>>(
3294 fidl::encoding::FlexibleResult::new(result.map(|lease_control| (lease_control,))),
3295 self.tx_id,
3296 0x38999f84b2f1f9ad,
3297 fidl::encoding::DynamicFlags::FLEXIBLE,
3298 )
3299 }
3300}
3301
3302#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3303pub struct StatusMarker;
3304
3305impl fidl::endpoints::ProtocolMarker for StatusMarker {
3306 type Proxy = StatusProxy;
3307 type RequestStream = StatusRequestStream;
3308 #[cfg(target_os = "fuchsia")]
3309 type SynchronousProxy = StatusSynchronousProxy;
3310
3311 const DEBUG_NAME: &'static str = "(anonymous) Status";
3312}
3313pub type StatusWatchPowerLevelResult = Result<u8, StatusError>;
3314
3315pub trait StatusProxyInterface: Send + Sync {
3316 type WatchPowerLevelResponseFut: std::future::Future<Output = Result<StatusWatchPowerLevelResult, fidl::Error>>
3317 + Send;
3318 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut;
3319}
3320#[derive(Debug)]
3321#[cfg(target_os = "fuchsia")]
3322pub struct StatusSynchronousProxy {
3323 client: fidl::client::sync::Client,
3324}
3325
3326#[cfg(target_os = "fuchsia")]
3327impl fidl::endpoints::SynchronousProxy for StatusSynchronousProxy {
3328 type Proxy = StatusProxy;
3329 type Protocol = StatusMarker;
3330
3331 fn from_channel(inner: fidl::Channel) -> Self {
3332 Self::new(inner)
3333 }
3334
3335 fn into_channel(self) -> fidl::Channel {
3336 self.client.into_channel()
3337 }
3338
3339 fn as_channel(&self) -> &fidl::Channel {
3340 self.client.as_channel()
3341 }
3342}
3343
3344#[cfg(target_os = "fuchsia")]
3345impl StatusSynchronousProxy {
3346 pub fn new(channel: fidl::Channel) -> Self {
3347 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3348 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3349 }
3350
3351 pub fn into_channel(self) -> fidl::Channel {
3352 self.client.into_channel()
3353 }
3354
3355 pub fn wait_for_event(
3358 &self,
3359 deadline: zx::MonotonicInstant,
3360 ) -> Result<StatusEvent, fidl::Error> {
3361 StatusEvent::decode(self.client.wait_for_event(deadline)?)
3362 }
3363
3364 pub fn r#watch_power_level(
3368 &self,
3369 ___deadline: zx::MonotonicInstant,
3370 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
3371 let _response = self.client.send_query::<
3372 fidl::encoding::EmptyPayload,
3373 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
3374 >(
3375 (),
3376 0x2f11ba8df9b5614e,
3377 fidl::encoding::DynamicFlags::FLEXIBLE,
3378 ___deadline,
3379 )?
3380 .into_result::<StatusMarker>("watch_power_level")?;
3381 Ok(_response.map(|x| x.current_level))
3382 }
3383}
3384
3385#[cfg(target_os = "fuchsia")]
3386impl From<StatusSynchronousProxy> for zx::NullableHandle {
3387 fn from(value: StatusSynchronousProxy) -> Self {
3388 value.into_channel().into()
3389 }
3390}
3391
3392#[cfg(target_os = "fuchsia")]
3393impl From<fidl::Channel> for StatusSynchronousProxy {
3394 fn from(value: fidl::Channel) -> Self {
3395 Self::new(value)
3396 }
3397}
3398
3399#[cfg(target_os = "fuchsia")]
3400impl fidl::endpoints::FromClient for StatusSynchronousProxy {
3401 type Protocol = StatusMarker;
3402
3403 fn from_client(value: fidl::endpoints::ClientEnd<StatusMarker>) -> Self {
3404 Self::new(value.into_channel())
3405 }
3406}
3407
3408#[derive(Debug, Clone)]
3409pub struct StatusProxy {
3410 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3411}
3412
3413impl fidl::endpoints::Proxy for StatusProxy {
3414 type Protocol = StatusMarker;
3415
3416 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3417 Self::new(inner)
3418 }
3419
3420 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3421 self.client.into_channel().map_err(|client| Self { client })
3422 }
3423
3424 fn as_channel(&self) -> &::fidl::AsyncChannel {
3425 self.client.as_channel()
3426 }
3427}
3428
3429impl StatusProxy {
3430 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3432 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3433 Self { client: fidl::client::Client::new(channel, protocol_name) }
3434 }
3435
3436 pub fn take_event_stream(&self) -> StatusEventStream {
3442 StatusEventStream { event_receiver: self.client.take_event_receiver() }
3443 }
3444
3445 pub fn r#watch_power_level(
3449 &self,
3450 ) -> fidl::client::QueryResponseFut<
3451 StatusWatchPowerLevelResult,
3452 fidl::encoding::DefaultFuchsiaResourceDialect,
3453 > {
3454 StatusProxyInterface::r#watch_power_level(self)
3455 }
3456}
3457
3458impl StatusProxyInterface for StatusProxy {
3459 type WatchPowerLevelResponseFut = fidl::client::QueryResponseFut<
3460 StatusWatchPowerLevelResult,
3461 fidl::encoding::DefaultFuchsiaResourceDialect,
3462 >;
3463 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut {
3464 fn _decode(
3465 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3466 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
3467 let _response = fidl::client::decode_transaction_body::<
3468 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
3469 fidl::encoding::DefaultFuchsiaResourceDialect,
3470 0x2f11ba8df9b5614e,
3471 >(_buf?)?
3472 .into_result::<StatusMarker>("watch_power_level")?;
3473 Ok(_response.map(|x| x.current_level))
3474 }
3475 self.client
3476 .send_query_and_decode::<fidl::encoding::EmptyPayload, StatusWatchPowerLevelResult>(
3477 (),
3478 0x2f11ba8df9b5614e,
3479 fidl::encoding::DynamicFlags::FLEXIBLE,
3480 _decode,
3481 )
3482 }
3483}
3484
3485pub struct StatusEventStream {
3486 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3487}
3488
3489impl std::marker::Unpin for StatusEventStream {}
3490
3491impl futures::stream::FusedStream for StatusEventStream {
3492 fn is_terminated(&self) -> bool {
3493 self.event_receiver.is_terminated()
3494 }
3495}
3496
3497impl futures::Stream for StatusEventStream {
3498 type Item = Result<StatusEvent, fidl::Error>;
3499
3500 fn poll_next(
3501 mut self: std::pin::Pin<&mut Self>,
3502 cx: &mut std::task::Context<'_>,
3503 ) -> std::task::Poll<Option<Self::Item>> {
3504 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3505 &mut self.event_receiver,
3506 cx
3507 )?) {
3508 Some(buf) => std::task::Poll::Ready(Some(StatusEvent::decode(buf))),
3509 None => std::task::Poll::Ready(None),
3510 }
3511 }
3512}
3513
3514#[derive(Debug)]
3515pub enum StatusEvent {
3516 #[non_exhaustive]
3517 _UnknownEvent {
3518 ordinal: u64,
3520 },
3521}
3522
3523impl StatusEvent {
3524 fn decode(
3526 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3527 ) -> Result<StatusEvent, fidl::Error> {
3528 let (bytes, _handles) = buf.split_mut();
3529 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3530 debug_assert_eq!(tx_header.tx_id, 0);
3531 match tx_header.ordinal {
3532 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3533 Ok(StatusEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3534 }
3535 _ => Err(fidl::Error::UnknownOrdinal {
3536 ordinal: tx_header.ordinal,
3537 protocol_name: <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3538 }),
3539 }
3540 }
3541}
3542
3543pub struct StatusRequestStream {
3545 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3546 is_terminated: bool,
3547}
3548
3549impl std::marker::Unpin for StatusRequestStream {}
3550
3551impl futures::stream::FusedStream for StatusRequestStream {
3552 fn is_terminated(&self) -> bool {
3553 self.is_terminated
3554 }
3555}
3556
3557impl fidl::endpoints::RequestStream for StatusRequestStream {
3558 type Protocol = StatusMarker;
3559 type ControlHandle = StatusControlHandle;
3560
3561 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3562 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3563 }
3564
3565 fn control_handle(&self) -> Self::ControlHandle {
3566 StatusControlHandle { inner: self.inner.clone() }
3567 }
3568
3569 fn into_inner(
3570 self,
3571 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3572 {
3573 (self.inner, self.is_terminated)
3574 }
3575
3576 fn from_inner(
3577 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3578 is_terminated: bool,
3579 ) -> Self {
3580 Self { inner, is_terminated }
3581 }
3582}
3583
3584impl futures::Stream for StatusRequestStream {
3585 type Item = Result<StatusRequest, fidl::Error>;
3586
3587 fn poll_next(
3588 mut self: std::pin::Pin<&mut Self>,
3589 cx: &mut std::task::Context<'_>,
3590 ) -> std::task::Poll<Option<Self::Item>> {
3591 let this = &mut *self;
3592 if this.inner.check_shutdown(cx) {
3593 this.is_terminated = true;
3594 return std::task::Poll::Ready(None);
3595 }
3596 if this.is_terminated {
3597 panic!("polled StatusRequestStream after completion");
3598 }
3599 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3600 |bytes, handles| {
3601 match this.inner.channel().read_etc(cx, bytes, handles) {
3602 std::task::Poll::Ready(Ok(())) => {}
3603 std::task::Poll::Pending => return std::task::Poll::Pending,
3604 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3605 this.is_terminated = true;
3606 return std::task::Poll::Ready(None);
3607 }
3608 std::task::Poll::Ready(Err(e)) => {
3609 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3610 e.into(),
3611 ))));
3612 }
3613 }
3614
3615 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3617
3618 std::task::Poll::Ready(Some(match header.ordinal {
3619 0x2f11ba8df9b5614e => {
3620 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3621 let mut req = fidl::new_empty!(
3622 fidl::encoding::EmptyPayload,
3623 fidl::encoding::DefaultFuchsiaResourceDialect
3624 );
3625 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3626 let control_handle = StatusControlHandle { inner: this.inner.clone() };
3627 Ok(StatusRequest::WatchPowerLevel {
3628 responder: StatusWatchPowerLevelResponder {
3629 control_handle: std::mem::ManuallyDrop::new(control_handle),
3630 tx_id: header.tx_id,
3631 },
3632 })
3633 }
3634 _ if header.tx_id == 0
3635 && header
3636 .dynamic_flags()
3637 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3638 {
3639 Ok(StatusRequest::_UnknownMethod {
3640 ordinal: header.ordinal,
3641 control_handle: StatusControlHandle { inner: this.inner.clone() },
3642 method_type: fidl::MethodType::OneWay,
3643 })
3644 }
3645 _ if header
3646 .dynamic_flags()
3647 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3648 {
3649 this.inner.send_framework_err(
3650 fidl::encoding::FrameworkErr::UnknownMethod,
3651 header.tx_id,
3652 header.ordinal,
3653 header.dynamic_flags(),
3654 (bytes, handles),
3655 )?;
3656 Ok(StatusRequest::_UnknownMethod {
3657 ordinal: header.ordinal,
3658 control_handle: StatusControlHandle { inner: this.inner.clone() },
3659 method_type: fidl::MethodType::TwoWay,
3660 })
3661 }
3662 _ => Err(fidl::Error::UnknownOrdinal {
3663 ordinal: header.ordinal,
3664 protocol_name:
3665 <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3666 }),
3667 }))
3668 },
3669 )
3670 }
3671}
3672
3673#[derive(Debug)]
3679pub enum StatusRequest {
3680 WatchPowerLevel { responder: StatusWatchPowerLevelResponder },
3684 #[non_exhaustive]
3686 _UnknownMethod {
3687 ordinal: u64,
3689 control_handle: StatusControlHandle,
3690 method_type: fidl::MethodType,
3691 },
3692}
3693
3694impl StatusRequest {
3695 #[allow(irrefutable_let_patterns)]
3696 pub fn into_watch_power_level(self) -> Option<(StatusWatchPowerLevelResponder)> {
3697 if let StatusRequest::WatchPowerLevel { responder } = self {
3698 Some((responder))
3699 } else {
3700 None
3701 }
3702 }
3703
3704 pub fn method_name(&self) -> &'static str {
3706 match *self {
3707 StatusRequest::WatchPowerLevel { .. } => "watch_power_level",
3708 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3709 "unknown one-way method"
3710 }
3711 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3712 "unknown two-way method"
3713 }
3714 }
3715 }
3716}
3717
3718#[derive(Debug, Clone)]
3719pub struct StatusControlHandle {
3720 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3721}
3722
3723impl fidl::endpoints::ControlHandle for StatusControlHandle {
3724 fn shutdown(&self) {
3725 self.inner.shutdown()
3726 }
3727
3728 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3729 self.inner.shutdown_with_epitaph(status)
3730 }
3731
3732 fn is_closed(&self) -> bool {
3733 self.inner.channel().is_closed()
3734 }
3735 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3736 self.inner.channel().on_closed()
3737 }
3738
3739 #[cfg(target_os = "fuchsia")]
3740 fn signal_peer(
3741 &self,
3742 clear_mask: zx::Signals,
3743 set_mask: zx::Signals,
3744 ) -> Result<(), zx_status::Status> {
3745 use fidl::Peered;
3746 self.inner.channel().signal_peer(clear_mask, set_mask)
3747 }
3748}
3749
3750impl StatusControlHandle {}
3751
3752#[must_use = "FIDL methods require a response to be sent"]
3753#[derive(Debug)]
3754pub struct StatusWatchPowerLevelResponder {
3755 control_handle: std::mem::ManuallyDrop<StatusControlHandle>,
3756 tx_id: u32,
3757}
3758
3759impl std::ops::Drop for StatusWatchPowerLevelResponder {
3763 fn drop(&mut self) {
3764 self.control_handle.shutdown();
3765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3767 }
3768}
3769
3770impl fidl::endpoints::Responder for StatusWatchPowerLevelResponder {
3771 type ControlHandle = StatusControlHandle;
3772
3773 fn control_handle(&self) -> &StatusControlHandle {
3774 &self.control_handle
3775 }
3776
3777 fn drop_without_shutdown(mut self) {
3778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3780 std::mem::forget(self);
3782 }
3783}
3784
3785impl StatusWatchPowerLevelResponder {
3786 pub fn send(self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
3790 let _result = self.send_raw(result);
3791 if _result.is_err() {
3792 self.control_handle.shutdown();
3793 }
3794 self.drop_without_shutdown();
3795 _result
3796 }
3797
3798 pub fn send_no_shutdown_on_err(
3800 self,
3801 mut result: Result<u8, StatusError>,
3802 ) -> Result<(), fidl::Error> {
3803 let _result = self.send_raw(result);
3804 self.drop_without_shutdown();
3805 _result
3806 }
3807
3808 fn send_raw(&self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
3809 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3810 StatusWatchPowerLevelResponse,
3811 StatusError,
3812 >>(
3813 fidl::encoding::FlexibleResult::new(result.map(|current_level| (current_level,))),
3814 self.tx_id,
3815 0x2f11ba8df9b5614e,
3816 fidl::encoding::DynamicFlags::FLEXIBLE,
3817 )
3818 }
3819}
3820
3821#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3822pub struct TopologyMarker;
3823
3824impl fidl::endpoints::ProtocolMarker for TopologyMarker {
3825 type Proxy = TopologyProxy;
3826 type RequestStream = TopologyRequestStream;
3827 #[cfg(target_os = "fuchsia")]
3828 type SynchronousProxy = TopologySynchronousProxy;
3829
3830 const DEBUG_NAME: &'static str = "fuchsia.power.broker.Topology";
3831}
3832impl fidl::endpoints::DiscoverableProtocolMarker for TopologyMarker {}
3833pub type TopologyAddElementResult = Result<(), AddElementError>;
3834
3835pub trait TopologyProxyInterface: Send + Sync {
3836 type AddElementResponseFut: std::future::Future<Output = Result<TopologyAddElementResult, fidl::Error>>
3837 + Send;
3838 fn r#add_element(&self, payload: ElementSchema) -> Self::AddElementResponseFut;
3839}
3840#[derive(Debug)]
3841#[cfg(target_os = "fuchsia")]
3842pub struct TopologySynchronousProxy {
3843 client: fidl::client::sync::Client,
3844}
3845
3846#[cfg(target_os = "fuchsia")]
3847impl fidl::endpoints::SynchronousProxy for TopologySynchronousProxy {
3848 type Proxy = TopologyProxy;
3849 type Protocol = TopologyMarker;
3850
3851 fn from_channel(inner: fidl::Channel) -> Self {
3852 Self::new(inner)
3853 }
3854
3855 fn into_channel(self) -> fidl::Channel {
3856 self.client.into_channel()
3857 }
3858
3859 fn as_channel(&self) -> &fidl::Channel {
3860 self.client.as_channel()
3861 }
3862}
3863
3864#[cfg(target_os = "fuchsia")]
3865impl TopologySynchronousProxy {
3866 pub fn new(channel: fidl::Channel) -> Self {
3867 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3868 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3869 }
3870
3871 pub fn into_channel(self) -> fidl::Channel {
3872 self.client.into_channel()
3873 }
3874
3875 pub fn wait_for_event(
3878 &self,
3879 deadline: zx::MonotonicInstant,
3880 ) -> Result<TopologyEvent, fidl::Error> {
3881 TopologyEvent::decode(self.client.wait_for_event(deadline)?)
3882 }
3883
3884 pub fn r#add_element(
3887 &self,
3888 mut payload: ElementSchema,
3889 ___deadline: zx::MonotonicInstant,
3890 ) -> Result<TopologyAddElementResult, fidl::Error> {
3891 let _response = self.client.send_query::<
3892 ElementSchema,
3893 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
3894 >(
3895 &mut payload,
3896 0x269ed93c9e87fa03,
3897 fidl::encoding::DynamicFlags::FLEXIBLE,
3898 ___deadline,
3899 )?
3900 .into_result::<TopologyMarker>("add_element")?;
3901 Ok(_response.map(|x| x))
3902 }
3903}
3904
3905#[cfg(target_os = "fuchsia")]
3906impl From<TopologySynchronousProxy> for zx::NullableHandle {
3907 fn from(value: TopologySynchronousProxy) -> Self {
3908 value.into_channel().into()
3909 }
3910}
3911
3912#[cfg(target_os = "fuchsia")]
3913impl From<fidl::Channel> for TopologySynchronousProxy {
3914 fn from(value: fidl::Channel) -> Self {
3915 Self::new(value)
3916 }
3917}
3918
3919#[cfg(target_os = "fuchsia")]
3920impl fidl::endpoints::FromClient for TopologySynchronousProxy {
3921 type Protocol = TopologyMarker;
3922
3923 fn from_client(value: fidl::endpoints::ClientEnd<TopologyMarker>) -> Self {
3924 Self::new(value.into_channel())
3925 }
3926}
3927
3928#[derive(Debug, Clone)]
3929pub struct TopologyProxy {
3930 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3931}
3932
3933impl fidl::endpoints::Proxy for TopologyProxy {
3934 type Protocol = TopologyMarker;
3935
3936 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3937 Self::new(inner)
3938 }
3939
3940 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3941 self.client.into_channel().map_err(|client| Self { client })
3942 }
3943
3944 fn as_channel(&self) -> &::fidl::AsyncChannel {
3945 self.client.as_channel()
3946 }
3947}
3948
3949impl TopologyProxy {
3950 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3952 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3953 Self { client: fidl::client::Client::new(channel, protocol_name) }
3954 }
3955
3956 pub fn take_event_stream(&self) -> TopologyEventStream {
3962 TopologyEventStream { event_receiver: self.client.take_event_receiver() }
3963 }
3964
3965 pub fn r#add_element(
3968 &self,
3969 mut payload: ElementSchema,
3970 ) -> fidl::client::QueryResponseFut<
3971 TopologyAddElementResult,
3972 fidl::encoding::DefaultFuchsiaResourceDialect,
3973 > {
3974 TopologyProxyInterface::r#add_element(self, payload)
3975 }
3976}
3977
3978impl TopologyProxyInterface for TopologyProxy {
3979 type AddElementResponseFut = fidl::client::QueryResponseFut<
3980 TopologyAddElementResult,
3981 fidl::encoding::DefaultFuchsiaResourceDialect,
3982 >;
3983 fn r#add_element(&self, mut payload: ElementSchema) -> Self::AddElementResponseFut {
3984 fn _decode(
3985 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3986 ) -> Result<TopologyAddElementResult, fidl::Error> {
3987 let _response = fidl::client::decode_transaction_body::<
3988 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
3989 fidl::encoding::DefaultFuchsiaResourceDialect,
3990 0x269ed93c9e87fa03,
3991 >(_buf?)?
3992 .into_result::<TopologyMarker>("add_element")?;
3993 Ok(_response.map(|x| x))
3994 }
3995 self.client.send_query_and_decode::<ElementSchema, TopologyAddElementResult>(
3996 &mut payload,
3997 0x269ed93c9e87fa03,
3998 fidl::encoding::DynamicFlags::FLEXIBLE,
3999 _decode,
4000 )
4001 }
4002}
4003
4004pub struct TopologyEventStream {
4005 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4006}
4007
4008impl std::marker::Unpin for TopologyEventStream {}
4009
4010impl futures::stream::FusedStream for TopologyEventStream {
4011 fn is_terminated(&self) -> bool {
4012 self.event_receiver.is_terminated()
4013 }
4014}
4015
4016impl futures::Stream for TopologyEventStream {
4017 type Item = Result<TopologyEvent, fidl::Error>;
4018
4019 fn poll_next(
4020 mut self: std::pin::Pin<&mut Self>,
4021 cx: &mut std::task::Context<'_>,
4022 ) -> std::task::Poll<Option<Self::Item>> {
4023 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4024 &mut self.event_receiver,
4025 cx
4026 )?) {
4027 Some(buf) => std::task::Poll::Ready(Some(TopologyEvent::decode(buf))),
4028 None => std::task::Poll::Ready(None),
4029 }
4030 }
4031}
4032
4033#[derive(Debug)]
4034pub enum TopologyEvent {
4035 #[non_exhaustive]
4036 _UnknownEvent {
4037 ordinal: u64,
4039 },
4040}
4041
4042impl TopologyEvent {
4043 fn decode(
4045 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4046 ) -> Result<TopologyEvent, fidl::Error> {
4047 let (bytes, _handles) = buf.split_mut();
4048 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4049 debug_assert_eq!(tx_header.tx_id, 0);
4050 match tx_header.ordinal {
4051 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4052 Ok(TopologyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4053 }
4054 _ => Err(fidl::Error::UnknownOrdinal {
4055 ordinal: tx_header.ordinal,
4056 protocol_name: <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4057 }),
4058 }
4059 }
4060}
4061
4062pub struct TopologyRequestStream {
4064 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4065 is_terminated: bool,
4066}
4067
4068impl std::marker::Unpin for TopologyRequestStream {}
4069
4070impl futures::stream::FusedStream for TopologyRequestStream {
4071 fn is_terminated(&self) -> bool {
4072 self.is_terminated
4073 }
4074}
4075
4076impl fidl::endpoints::RequestStream for TopologyRequestStream {
4077 type Protocol = TopologyMarker;
4078 type ControlHandle = TopologyControlHandle;
4079
4080 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4081 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4082 }
4083
4084 fn control_handle(&self) -> Self::ControlHandle {
4085 TopologyControlHandle { inner: self.inner.clone() }
4086 }
4087
4088 fn into_inner(
4089 self,
4090 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4091 {
4092 (self.inner, self.is_terminated)
4093 }
4094
4095 fn from_inner(
4096 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4097 is_terminated: bool,
4098 ) -> Self {
4099 Self { inner, is_terminated }
4100 }
4101}
4102
4103impl futures::Stream for TopologyRequestStream {
4104 type Item = Result<TopologyRequest, fidl::Error>;
4105
4106 fn poll_next(
4107 mut self: std::pin::Pin<&mut Self>,
4108 cx: &mut std::task::Context<'_>,
4109 ) -> std::task::Poll<Option<Self::Item>> {
4110 let this = &mut *self;
4111 if this.inner.check_shutdown(cx) {
4112 this.is_terminated = true;
4113 return std::task::Poll::Ready(None);
4114 }
4115 if this.is_terminated {
4116 panic!("polled TopologyRequestStream after completion");
4117 }
4118 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4119 |bytes, handles| {
4120 match this.inner.channel().read_etc(cx, bytes, handles) {
4121 std::task::Poll::Ready(Ok(())) => {}
4122 std::task::Poll::Pending => return std::task::Poll::Pending,
4123 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4124 this.is_terminated = true;
4125 return std::task::Poll::Ready(None);
4126 }
4127 std::task::Poll::Ready(Err(e)) => {
4128 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4129 e.into(),
4130 ))));
4131 }
4132 }
4133
4134 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4136
4137 std::task::Poll::Ready(Some(match header.ordinal {
4138 0x269ed93c9e87fa03 => {
4139 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4140 let mut req = fidl::new_empty!(
4141 ElementSchema,
4142 fidl::encoding::DefaultFuchsiaResourceDialect
4143 );
4144 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementSchema>(&header, _body_bytes, handles, &mut req)?;
4145 let control_handle = TopologyControlHandle { inner: this.inner.clone() };
4146 Ok(TopologyRequest::AddElement {
4147 payload: req,
4148 responder: TopologyAddElementResponder {
4149 control_handle: std::mem::ManuallyDrop::new(control_handle),
4150 tx_id: header.tx_id,
4151 },
4152 })
4153 }
4154 _ if header.tx_id == 0
4155 && header
4156 .dynamic_flags()
4157 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4158 {
4159 Ok(TopologyRequest::_UnknownMethod {
4160 ordinal: header.ordinal,
4161 control_handle: TopologyControlHandle { inner: this.inner.clone() },
4162 method_type: fidl::MethodType::OneWay,
4163 })
4164 }
4165 _ if header
4166 .dynamic_flags()
4167 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4168 {
4169 this.inner.send_framework_err(
4170 fidl::encoding::FrameworkErr::UnknownMethod,
4171 header.tx_id,
4172 header.ordinal,
4173 header.dynamic_flags(),
4174 (bytes, handles),
4175 )?;
4176 Ok(TopologyRequest::_UnknownMethod {
4177 ordinal: header.ordinal,
4178 control_handle: TopologyControlHandle { inner: this.inner.clone() },
4179 method_type: fidl::MethodType::TwoWay,
4180 })
4181 }
4182 _ => Err(fidl::Error::UnknownOrdinal {
4183 ordinal: header.ordinal,
4184 protocol_name:
4185 <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4186 }),
4187 }))
4188 },
4189 )
4190 }
4191}
4192
4193#[derive(Debug)]
4199pub enum TopologyRequest {
4200 AddElement { payload: ElementSchema, responder: TopologyAddElementResponder },
4203 #[non_exhaustive]
4205 _UnknownMethod {
4206 ordinal: u64,
4208 control_handle: TopologyControlHandle,
4209 method_type: fidl::MethodType,
4210 },
4211}
4212
4213impl TopologyRequest {
4214 #[allow(irrefutable_let_patterns)]
4215 pub fn into_add_element(self) -> Option<(ElementSchema, TopologyAddElementResponder)> {
4216 if let TopologyRequest::AddElement { payload, responder } = self {
4217 Some((payload, responder))
4218 } else {
4219 None
4220 }
4221 }
4222
4223 pub fn method_name(&self) -> &'static str {
4225 match *self {
4226 TopologyRequest::AddElement { .. } => "add_element",
4227 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4228 "unknown one-way method"
4229 }
4230 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4231 "unknown two-way method"
4232 }
4233 }
4234 }
4235}
4236
4237#[derive(Debug, Clone)]
4238pub struct TopologyControlHandle {
4239 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4240}
4241
4242impl fidl::endpoints::ControlHandle for TopologyControlHandle {
4243 fn shutdown(&self) {
4244 self.inner.shutdown()
4245 }
4246
4247 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4248 self.inner.shutdown_with_epitaph(status)
4249 }
4250
4251 fn is_closed(&self) -> bool {
4252 self.inner.channel().is_closed()
4253 }
4254 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4255 self.inner.channel().on_closed()
4256 }
4257
4258 #[cfg(target_os = "fuchsia")]
4259 fn signal_peer(
4260 &self,
4261 clear_mask: zx::Signals,
4262 set_mask: zx::Signals,
4263 ) -> Result<(), zx_status::Status> {
4264 use fidl::Peered;
4265 self.inner.channel().signal_peer(clear_mask, set_mask)
4266 }
4267}
4268
4269impl TopologyControlHandle {}
4270
4271#[must_use = "FIDL methods require a response to be sent"]
4272#[derive(Debug)]
4273pub struct TopologyAddElementResponder {
4274 control_handle: std::mem::ManuallyDrop<TopologyControlHandle>,
4275 tx_id: u32,
4276}
4277
4278impl std::ops::Drop for TopologyAddElementResponder {
4282 fn drop(&mut self) {
4283 self.control_handle.shutdown();
4284 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4286 }
4287}
4288
4289impl fidl::endpoints::Responder for TopologyAddElementResponder {
4290 type ControlHandle = TopologyControlHandle;
4291
4292 fn control_handle(&self) -> &TopologyControlHandle {
4293 &self.control_handle
4294 }
4295
4296 fn drop_without_shutdown(mut self) {
4297 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4299 std::mem::forget(self);
4301 }
4302}
4303
4304impl TopologyAddElementResponder {
4305 pub fn send(self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
4309 let _result = self.send_raw(result);
4310 if _result.is_err() {
4311 self.control_handle.shutdown();
4312 }
4313 self.drop_without_shutdown();
4314 _result
4315 }
4316
4317 pub fn send_no_shutdown_on_err(
4319 self,
4320 mut result: Result<(), AddElementError>,
4321 ) -> Result<(), fidl::Error> {
4322 let _result = self.send_raw(result);
4323 self.drop_without_shutdown();
4324 _result
4325 }
4326
4327 fn send_raw(&self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
4328 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4329 fidl::encoding::EmptyStruct,
4330 AddElementError,
4331 >>(
4332 fidl::encoding::FlexibleResult::new(result),
4333 self.tx_id,
4334 0x269ed93c9e87fa03,
4335 fidl::encoding::DynamicFlags::FLEXIBLE,
4336 )
4337 }
4338}
4339
4340#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4341pub struct ElementInfoProviderServiceMarker;
4342
4343#[cfg(target_os = "fuchsia")]
4344impl fidl::endpoints::ServiceMarker for ElementInfoProviderServiceMarker {
4345 type Proxy = ElementInfoProviderServiceProxy;
4346 type Request = ElementInfoProviderServiceRequest;
4347 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
4348}
4349
4350#[cfg(target_os = "fuchsia")]
4353pub enum ElementInfoProviderServiceRequest {
4354 StatusProvider(ElementInfoProviderRequestStream),
4355}
4356
4357#[cfg(target_os = "fuchsia")]
4358impl fidl::endpoints::ServiceRequest for ElementInfoProviderServiceRequest {
4359 type Service = ElementInfoProviderServiceMarker;
4360
4361 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4362 match name {
4363 "status_provider" => Self::StatusProvider(
4364 <ElementInfoProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
4365 _channel,
4366 ),
4367 ),
4368 _ => panic!("no such member protocol name for service ElementInfoProviderService"),
4369 }
4370 }
4371
4372 fn member_names() -> &'static [&'static str] {
4373 &["status_provider"]
4374 }
4375}
4376#[cfg(target_os = "fuchsia")]
4377pub struct ElementInfoProviderServiceProxy(
4378 #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
4379);
4380
4381#[cfg(target_os = "fuchsia")]
4382impl fidl::endpoints::ServiceProxy for ElementInfoProviderServiceProxy {
4383 type Service = ElementInfoProviderServiceMarker;
4384
4385 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
4386 Self(opener)
4387 }
4388}
4389
4390#[cfg(target_os = "fuchsia")]
4391impl ElementInfoProviderServiceProxy {
4392 pub fn connect_to_status_provider(&self) -> Result<ElementInfoProviderProxy, fidl::Error> {
4393 let (proxy, server_end) = fidl::endpoints::create_proxy::<ElementInfoProviderMarker>();
4394 self.connect_channel_to_status_provider(server_end)?;
4395 Ok(proxy)
4396 }
4397
4398 pub fn connect_to_status_provider_sync(
4401 &self,
4402 ) -> Result<ElementInfoProviderSynchronousProxy, fidl::Error> {
4403 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ElementInfoProviderMarker>();
4404 self.connect_channel_to_status_provider(server_end)?;
4405 Ok(proxy)
4406 }
4407
4408 pub fn connect_channel_to_status_provider(
4411 &self,
4412 server_end: fidl::endpoints::ServerEnd<ElementInfoProviderMarker>,
4413 ) -> Result<(), fidl::Error> {
4414 self.0.open_member("status_provider", server_end.into_channel())
4415 }
4416
4417 pub fn instance_name(&self) -> &str {
4418 self.0.instance_name()
4419 }
4420}
4421
4422mod internal {
4423 use super::*;
4424
4425 impl fidl::encoding::ResourceTypeMarker for ElementControlOpenStatusChannelRequest {
4426 type Borrowed<'a> = &'a mut Self;
4427 fn take_or_borrow<'a>(
4428 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4429 ) -> Self::Borrowed<'a> {
4430 value
4431 }
4432 }
4433
4434 unsafe impl fidl::encoding::TypeMarker for ElementControlOpenStatusChannelRequest {
4435 type Owned = Self;
4436
4437 #[inline(always)]
4438 fn inline_align(_context: fidl::encoding::Context) -> usize {
4439 4
4440 }
4441
4442 #[inline(always)]
4443 fn inline_size(_context: fidl::encoding::Context) -> usize {
4444 4
4445 }
4446 }
4447
4448 unsafe impl
4449 fidl::encoding::Encode<
4450 ElementControlOpenStatusChannelRequest,
4451 fidl::encoding::DefaultFuchsiaResourceDialect,
4452 > for &mut ElementControlOpenStatusChannelRequest
4453 {
4454 #[inline]
4455 unsafe fn encode(
4456 self,
4457 encoder: &mut fidl::encoding::Encoder<
4458 '_,
4459 fidl::encoding::DefaultFuchsiaResourceDialect,
4460 >,
4461 offset: usize,
4462 _depth: fidl::encoding::Depth,
4463 ) -> fidl::Result<()> {
4464 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
4465 fidl::encoding::Encode::<ElementControlOpenStatusChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4467 (
4468 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.status_channel),
4469 ),
4470 encoder, offset, _depth
4471 )
4472 }
4473 }
4474 unsafe impl<
4475 T0: fidl::encoding::Encode<
4476 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4477 fidl::encoding::DefaultFuchsiaResourceDialect,
4478 >,
4479 >
4480 fidl::encoding::Encode<
4481 ElementControlOpenStatusChannelRequest,
4482 fidl::encoding::DefaultFuchsiaResourceDialect,
4483 > for (T0,)
4484 {
4485 #[inline]
4486 unsafe fn encode(
4487 self,
4488 encoder: &mut fidl::encoding::Encoder<
4489 '_,
4490 fidl::encoding::DefaultFuchsiaResourceDialect,
4491 >,
4492 offset: usize,
4493 depth: fidl::encoding::Depth,
4494 ) -> fidl::Result<()> {
4495 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
4496 self.0.encode(encoder, offset + 0, depth)?;
4500 Ok(())
4501 }
4502 }
4503
4504 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4505 for ElementControlOpenStatusChannelRequest
4506 {
4507 #[inline(always)]
4508 fn new_empty() -> Self {
4509 Self {
4510 status_channel: fidl::new_empty!(
4511 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4512 fidl::encoding::DefaultFuchsiaResourceDialect
4513 ),
4514 }
4515 }
4516
4517 #[inline]
4518 unsafe fn decode(
4519 &mut self,
4520 decoder: &mut fidl::encoding::Decoder<
4521 '_,
4522 fidl::encoding::DefaultFuchsiaResourceDialect,
4523 >,
4524 offset: usize,
4525 _depth: fidl::encoding::Depth,
4526 ) -> fidl::Result<()> {
4527 decoder.debug_check_bounds::<Self>(offset);
4528 fidl::decode!(
4530 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
4531 fidl::encoding::DefaultFuchsiaResourceDialect,
4532 &mut self.status_channel,
4533 decoder,
4534 offset + 0,
4535 _depth
4536 )?;
4537 Ok(())
4538 }
4539 }
4540
4541 impl fidl::encoding::ResourceTypeMarker for ElementControlRegisterDependencyTokenRequest {
4542 type Borrowed<'a> = &'a mut Self;
4543 fn take_or_borrow<'a>(
4544 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4545 ) -> Self::Borrowed<'a> {
4546 value
4547 }
4548 }
4549
4550 unsafe impl fidl::encoding::TypeMarker for ElementControlRegisterDependencyTokenRequest {
4551 type Owned = Self;
4552
4553 #[inline(always)]
4554 fn inline_align(_context: fidl::encoding::Context) -> usize {
4555 4
4556 }
4557
4558 #[inline(always)]
4559 fn inline_size(_context: fidl::encoding::Context) -> usize {
4560 8
4561 }
4562 }
4563
4564 unsafe impl
4565 fidl::encoding::Encode<
4566 ElementControlRegisterDependencyTokenRequest,
4567 fidl::encoding::DefaultFuchsiaResourceDialect,
4568 > for &mut ElementControlRegisterDependencyTokenRequest
4569 {
4570 #[inline]
4571 unsafe fn encode(
4572 self,
4573 encoder: &mut fidl::encoding::Encoder<
4574 '_,
4575 fidl::encoding::DefaultFuchsiaResourceDialect,
4576 >,
4577 offset: usize,
4578 _depth: fidl::encoding::Depth,
4579 ) -> fidl::Result<()> {
4580 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
4581 fidl::encoding::Encode::<
4583 ElementControlRegisterDependencyTokenRequest,
4584 fidl::encoding::DefaultFuchsiaResourceDialect,
4585 >::encode(
4586 (
4587 <fidl::encoding::HandleType<
4588 fidl::Event,
4589 { fidl::ObjectType::EVENT.into_raw() },
4590 2147483648,
4591 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4592 &mut self.token
4593 ),
4594 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(
4595 &self.dependency_type,
4596 ),
4597 ),
4598 encoder,
4599 offset,
4600 _depth,
4601 )
4602 }
4603 }
4604 unsafe impl<
4605 T0: fidl::encoding::Encode<
4606 fidl::encoding::HandleType<
4607 fidl::Event,
4608 { fidl::ObjectType::EVENT.into_raw() },
4609 2147483648,
4610 >,
4611 fidl::encoding::DefaultFuchsiaResourceDialect,
4612 >,
4613 T1: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
4614 >
4615 fidl::encoding::Encode<
4616 ElementControlRegisterDependencyTokenRequest,
4617 fidl::encoding::DefaultFuchsiaResourceDialect,
4618 > for (T0, T1)
4619 {
4620 #[inline]
4621 unsafe fn encode(
4622 self,
4623 encoder: &mut fidl::encoding::Encoder<
4624 '_,
4625 fidl::encoding::DefaultFuchsiaResourceDialect,
4626 >,
4627 offset: usize,
4628 depth: fidl::encoding::Depth,
4629 ) -> fidl::Result<()> {
4630 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
4631 self.0.encode(encoder, offset + 0, depth)?;
4635 self.1.encode(encoder, offset + 4, depth)?;
4636 Ok(())
4637 }
4638 }
4639
4640 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4641 for ElementControlRegisterDependencyTokenRequest
4642 {
4643 #[inline(always)]
4644 fn new_empty() -> Self {
4645 Self {
4646 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4647 dependency_type: fidl::new_empty!(
4648 DependencyType,
4649 fidl::encoding::DefaultFuchsiaResourceDialect
4650 ),
4651 }
4652 }
4653
4654 #[inline]
4655 unsafe fn decode(
4656 &mut self,
4657 decoder: &mut fidl::encoding::Decoder<
4658 '_,
4659 fidl::encoding::DefaultFuchsiaResourceDialect,
4660 >,
4661 offset: usize,
4662 _depth: fidl::encoding::Depth,
4663 ) -> fidl::Result<()> {
4664 decoder.debug_check_bounds::<Self>(offset);
4665 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4667 fidl::decode!(
4668 DependencyType,
4669 fidl::encoding::DefaultFuchsiaResourceDialect,
4670 &mut self.dependency_type,
4671 decoder,
4672 offset + 4,
4673 _depth
4674 )?;
4675 Ok(())
4676 }
4677 }
4678
4679 impl fidl::encoding::ResourceTypeMarker for ElementControlUnregisterDependencyTokenRequest {
4680 type Borrowed<'a> = &'a mut Self;
4681 fn take_or_borrow<'a>(
4682 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4683 ) -> Self::Borrowed<'a> {
4684 value
4685 }
4686 }
4687
4688 unsafe impl fidl::encoding::TypeMarker for ElementControlUnregisterDependencyTokenRequest {
4689 type Owned = Self;
4690
4691 #[inline(always)]
4692 fn inline_align(_context: fidl::encoding::Context) -> usize {
4693 4
4694 }
4695
4696 #[inline(always)]
4697 fn inline_size(_context: fidl::encoding::Context) -> usize {
4698 4
4699 }
4700 }
4701
4702 unsafe impl
4703 fidl::encoding::Encode<
4704 ElementControlUnregisterDependencyTokenRequest,
4705 fidl::encoding::DefaultFuchsiaResourceDialect,
4706 > for &mut ElementControlUnregisterDependencyTokenRequest
4707 {
4708 #[inline]
4709 unsafe fn encode(
4710 self,
4711 encoder: &mut fidl::encoding::Encoder<
4712 '_,
4713 fidl::encoding::DefaultFuchsiaResourceDialect,
4714 >,
4715 offset: usize,
4716 _depth: fidl::encoding::Depth,
4717 ) -> fidl::Result<()> {
4718 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
4719 fidl::encoding::Encode::<
4721 ElementControlUnregisterDependencyTokenRequest,
4722 fidl::encoding::DefaultFuchsiaResourceDialect,
4723 >::encode(
4724 (<fidl::encoding::HandleType<
4725 fidl::Event,
4726 { fidl::ObjectType::EVENT.into_raw() },
4727 2147483648,
4728 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4729 &mut self.token
4730 ),),
4731 encoder,
4732 offset,
4733 _depth,
4734 )
4735 }
4736 }
4737 unsafe impl<
4738 T0: fidl::encoding::Encode<
4739 fidl::encoding::HandleType<
4740 fidl::Event,
4741 { fidl::ObjectType::EVENT.into_raw() },
4742 2147483648,
4743 >,
4744 fidl::encoding::DefaultFuchsiaResourceDialect,
4745 >,
4746 >
4747 fidl::encoding::Encode<
4748 ElementControlUnregisterDependencyTokenRequest,
4749 fidl::encoding::DefaultFuchsiaResourceDialect,
4750 > for (T0,)
4751 {
4752 #[inline]
4753 unsafe fn encode(
4754 self,
4755 encoder: &mut fidl::encoding::Encoder<
4756 '_,
4757 fidl::encoding::DefaultFuchsiaResourceDialect,
4758 >,
4759 offset: usize,
4760 depth: fidl::encoding::Depth,
4761 ) -> fidl::Result<()> {
4762 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
4763 self.0.encode(encoder, offset + 0, depth)?;
4767 Ok(())
4768 }
4769 }
4770
4771 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4772 for ElementControlUnregisterDependencyTokenRequest
4773 {
4774 #[inline(always)]
4775 fn new_empty() -> Self {
4776 Self {
4777 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4778 }
4779 }
4780
4781 #[inline]
4782 unsafe fn decode(
4783 &mut self,
4784 decoder: &mut fidl::encoding::Decoder<
4785 '_,
4786 fidl::encoding::DefaultFuchsiaResourceDialect,
4787 >,
4788 offset: usize,
4789 _depth: fidl::encoding::Depth,
4790 ) -> fidl::Result<()> {
4791 decoder.debug_check_bounds::<Self>(offset);
4792 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
4794 Ok(())
4795 }
4796 }
4797
4798 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
4799 type Borrowed<'a> = &'a mut Self;
4800 fn take_or_borrow<'a>(
4801 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4802 ) -> Self::Borrowed<'a> {
4803 value
4804 }
4805 }
4806
4807 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
4808 type Owned = Self;
4809
4810 #[inline(always)]
4811 fn inline_align(_context: fidl::encoding::Context) -> usize {
4812 8
4813 }
4814
4815 #[inline(always)]
4816 fn inline_size(_context: fidl::encoding::Context) -> usize {
4817 16
4818 }
4819 }
4820
4821 unsafe impl
4822 fidl::encoding::Encode<
4823 ElementInfoProviderGetElementPowerLevelNamesResponse,
4824 fidl::encoding::DefaultFuchsiaResourceDialect,
4825 > for &mut ElementInfoProviderGetElementPowerLevelNamesResponse
4826 {
4827 #[inline]
4828 unsafe fn encode(
4829 self,
4830 encoder: &mut fidl::encoding::Encoder<
4831 '_,
4832 fidl::encoding::DefaultFuchsiaResourceDialect,
4833 >,
4834 offset: usize,
4835 _depth: fidl::encoding::Depth,
4836 ) -> fidl::Result<()> {
4837 encoder
4838 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
4839 fidl::encoding::Encode::<ElementInfoProviderGetElementPowerLevelNamesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4841 (
4842 <fidl::encoding::UnboundedVector<ElementPowerLevelNames> as fidl::encoding::ValueTypeMarker>::borrow(&self.level_names),
4843 ),
4844 encoder, offset, _depth
4845 )
4846 }
4847 }
4848 unsafe impl<
4849 T0: fidl::encoding::Encode<
4850 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4851 fidl::encoding::DefaultFuchsiaResourceDialect,
4852 >,
4853 >
4854 fidl::encoding::Encode<
4855 ElementInfoProviderGetElementPowerLevelNamesResponse,
4856 fidl::encoding::DefaultFuchsiaResourceDialect,
4857 > for (T0,)
4858 {
4859 #[inline]
4860 unsafe fn encode(
4861 self,
4862 encoder: &mut fidl::encoding::Encoder<
4863 '_,
4864 fidl::encoding::DefaultFuchsiaResourceDialect,
4865 >,
4866 offset: usize,
4867 depth: fidl::encoding::Depth,
4868 ) -> fidl::Result<()> {
4869 encoder
4870 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
4871 self.0.encode(encoder, offset + 0, depth)?;
4875 Ok(())
4876 }
4877 }
4878
4879 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4880 for ElementInfoProviderGetElementPowerLevelNamesResponse
4881 {
4882 #[inline(always)]
4883 fn new_empty() -> Self {
4884 Self {
4885 level_names: fidl::new_empty!(
4886 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4887 fidl::encoding::DefaultFuchsiaResourceDialect
4888 ),
4889 }
4890 }
4891
4892 #[inline]
4893 unsafe fn decode(
4894 &mut self,
4895 decoder: &mut fidl::encoding::Decoder<
4896 '_,
4897 fidl::encoding::DefaultFuchsiaResourceDialect,
4898 >,
4899 offset: usize,
4900 _depth: fidl::encoding::Depth,
4901 ) -> fidl::Result<()> {
4902 decoder.debug_check_bounds::<Self>(offset);
4903 fidl::decode!(
4905 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
4906 fidl::encoding::DefaultFuchsiaResourceDialect,
4907 &mut self.level_names,
4908 decoder,
4909 offset + 0,
4910 _depth
4911 )?;
4912 Ok(())
4913 }
4914 }
4915
4916 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
4917 type Borrowed<'a> = &'a mut Self;
4918 fn take_or_borrow<'a>(
4919 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4920 ) -> Self::Borrowed<'a> {
4921 value
4922 }
4923 }
4924
4925 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
4926 type Owned = Self;
4927
4928 #[inline(always)]
4929 fn inline_align(_context: fidl::encoding::Context) -> usize {
4930 8
4931 }
4932
4933 #[inline(always)]
4934 fn inline_size(_context: fidl::encoding::Context) -> usize {
4935 16
4936 }
4937 }
4938
4939 unsafe impl
4940 fidl::encoding::Encode<
4941 ElementInfoProviderGetStatusEndpointsResponse,
4942 fidl::encoding::DefaultFuchsiaResourceDialect,
4943 > for &mut ElementInfoProviderGetStatusEndpointsResponse
4944 {
4945 #[inline]
4946 unsafe fn encode(
4947 self,
4948 encoder: &mut fidl::encoding::Encoder<
4949 '_,
4950 fidl::encoding::DefaultFuchsiaResourceDialect,
4951 >,
4952 offset: usize,
4953 _depth: fidl::encoding::Depth,
4954 ) -> fidl::Result<()> {
4955 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
4956 fidl::encoding::Encode::<ElementInfoProviderGetStatusEndpointsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4958 (
4959 <fidl::encoding::UnboundedVector<ElementStatusEndpoint> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoints),
4960 ),
4961 encoder, offset, _depth
4962 )
4963 }
4964 }
4965 unsafe impl<
4966 T0: fidl::encoding::Encode<
4967 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
4968 fidl::encoding::DefaultFuchsiaResourceDialect,
4969 >,
4970 >
4971 fidl::encoding::Encode<
4972 ElementInfoProviderGetStatusEndpointsResponse,
4973 fidl::encoding::DefaultFuchsiaResourceDialect,
4974 > for (T0,)
4975 {
4976 #[inline]
4977 unsafe fn encode(
4978 self,
4979 encoder: &mut fidl::encoding::Encoder<
4980 '_,
4981 fidl::encoding::DefaultFuchsiaResourceDialect,
4982 >,
4983 offset: usize,
4984 depth: fidl::encoding::Depth,
4985 ) -> fidl::Result<()> {
4986 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
4987 self.0.encode(encoder, offset + 0, depth)?;
4991 Ok(())
4992 }
4993 }
4994
4995 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4996 for ElementInfoProviderGetStatusEndpointsResponse
4997 {
4998 #[inline(always)]
4999 fn new_empty() -> Self {
5000 Self {
5001 endpoints: fidl::new_empty!(
5002 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
5003 fidl::encoding::DefaultFuchsiaResourceDialect
5004 ),
5005 }
5006 }
5007
5008 #[inline]
5009 unsafe fn decode(
5010 &mut self,
5011 decoder: &mut fidl::encoding::Decoder<
5012 '_,
5013 fidl::encoding::DefaultFuchsiaResourceDialect,
5014 >,
5015 offset: usize,
5016 _depth: fidl::encoding::Depth,
5017 ) -> fidl::Result<()> {
5018 decoder.debug_check_bounds::<Self>(offset);
5019 fidl::decode!(
5021 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
5022 fidl::encoding::DefaultFuchsiaResourceDialect,
5023 &mut self.endpoints,
5024 decoder,
5025 offset + 0,
5026 _depth
5027 )?;
5028 Ok(())
5029 }
5030 }
5031
5032 impl fidl::encoding::ResourceTypeMarker for LessorLeaseRequest {
5033 type Borrowed<'a> = &'a mut Self;
5034 fn take_or_borrow<'a>(
5035 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5036 ) -> Self::Borrowed<'a> {
5037 value
5038 }
5039 }
5040
5041 unsafe impl fidl::encoding::TypeMarker for LessorLeaseRequest {
5042 type Owned = Self;
5043
5044 #[inline(always)]
5045 fn inline_align(_context: fidl::encoding::Context) -> usize {
5046 1
5047 }
5048
5049 #[inline(always)]
5050 fn inline_size(_context: fidl::encoding::Context) -> usize {
5051 1
5052 }
5053 #[inline(always)]
5054 fn encode_is_copy() -> bool {
5055 true
5056 }
5057
5058 #[inline(always)]
5059 fn decode_is_copy() -> bool {
5060 true
5061 }
5062 }
5063
5064 unsafe impl
5065 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5066 for &mut LessorLeaseRequest
5067 {
5068 #[inline]
5069 unsafe fn encode(
5070 self,
5071 encoder: &mut fidl::encoding::Encoder<
5072 '_,
5073 fidl::encoding::DefaultFuchsiaResourceDialect,
5074 >,
5075 offset: usize,
5076 _depth: fidl::encoding::Depth,
5077 ) -> fidl::Result<()> {
5078 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
5079 unsafe {
5080 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5082 (buf_ptr as *mut LessorLeaseRequest)
5083 .write_unaligned((self as *const LessorLeaseRequest).read());
5084 }
5087 Ok(())
5088 }
5089 }
5090 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
5091 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5092 for (T0,)
5093 {
5094 #[inline]
5095 unsafe fn encode(
5096 self,
5097 encoder: &mut fidl::encoding::Encoder<
5098 '_,
5099 fidl::encoding::DefaultFuchsiaResourceDialect,
5100 >,
5101 offset: usize,
5102 depth: fidl::encoding::Depth,
5103 ) -> fidl::Result<()> {
5104 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
5105 self.0.encode(encoder, offset + 0, depth)?;
5109 Ok(())
5110 }
5111 }
5112
5113 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5114 for LessorLeaseRequest
5115 {
5116 #[inline(always)]
5117 fn new_empty() -> Self {
5118 Self { level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect) }
5119 }
5120
5121 #[inline]
5122 unsafe fn decode(
5123 &mut self,
5124 decoder: &mut fidl::encoding::Decoder<
5125 '_,
5126 fidl::encoding::DefaultFuchsiaResourceDialect,
5127 >,
5128 offset: usize,
5129 _depth: fidl::encoding::Depth,
5130 ) -> fidl::Result<()> {
5131 decoder.debug_check_bounds::<Self>(offset);
5132 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5133 unsafe {
5136 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
5137 }
5138 Ok(())
5139 }
5140 }
5141
5142 impl fidl::encoding::ResourceTypeMarker for LessorLeaseResponse {
5143 type Borrowed<'a> = &'a mut Self;
5144 fn take_or_borrow<'a>(
5145 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5146 ) -> Self::Borrowed<'a> {
5147 value
5148 }
5149 }
5150
5151 unsafe impl fidl::encoding::TypeMarker for LessorLeaseResponse {
5152 type Owned = Self;
5153
5154 #[inline(always)]
5155 fn inline_align(_context: fidl::encoding::Context) -> usize {
5156 4
5157 }
5158
5159 #[inline(always)]
5160 fn inline_size(_context: fidl::encoding::Context) -> usize {
5161 4
5162 }
5163 }
5164
5165 unsafe impl
5166 fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5167 for &mut LessorLeaseResponse
5168 {
5169 #[inline]
5170 unsafe fn encode(
5171 self,
5172 encoder: &mut fidl::encoding::Encoder<
5173 '_,
5174 fidl::encoding::DefaultFuchsiaResourceDialect,
5175 >,
5176 offset: usize,
5177 _depth: fidl::encoding::Depth,
5178 ) -> fidl::Result<()> {
5179 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
5180 fidl::encoding::Encode::<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5182 (
5183 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lease_control),
5184 ),
5185 encoder, offset, _depth
5186 )
5187 }
5188 }
5189 unsafe impl<
5190 T0: fidl::encoding::Encode<
5191 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5192 fidl::encoding::DefaultFuchsiaResourceDialect,
5193 >,
5194 > fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
5195 for (T0,)
5196 {
5197 #[inline]
5198 unsafe fn encode(
5199 self,
5200 encoder: &mut fidl::encoding::Encoder<
5201 '_,
5202 fidl::encoding::DefaultFuchsiaResourceDialect,
5203 >,
5204 offset: usize,
5205 depth: fidl::encoding::Depth,
5206 ) -> fidl::Result<()> {
5207 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
5208 self.0.encode(encoder, offset + 0, depth)?;
5212 Ok(())
5213 }
5214 }
5215
5216 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5217 for LessorLeaseResponse
5218 {
5219 #[inline(always)]
5220 fn new_empty() -> Self {
5221 Self {
5222 lease_control: fidl::new_empty!(
5223 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5224 fidl::encoding::DefaultFuchsiaResourceDialect
5225 ),
5226 }
5227 }
5228
5229 #[inline]
5230 unsafe fn decode(
5231 &mut self,
5232 decoder: &mut fidl::encoding::Decoder<
5233 '_,
5234 fidl::encoding::DefaultFuchsiaResourceDialect,
5235 >,
5236 offset: usize,
5237 _depth: fidl::encoding::Depth,
5238 ) -> fidl::Result<()> {
5239 decoder.debug_check_bounds::<Self>(offset);
5240 fidl::decode!(
5242 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
5243 fidl::encoding::DefaultFuchsiaResourceDialect,
5244 &mut self.lease_control,
5245 decoder,
5246 offset + 0,
5247 _depth
5248 )?;
5249 Ok(())
5250 }
5251 }
5252
5253 impl fidl::encoding::ResourceTypeMarker for LevelDependency {
5254 type Borrowed<'a> = &'a mut Self;
5255 fn take_or_borrow<'a>(
5256 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5257 ) -> Self::Borrowed<'a> {
5258 value
5259 }
5260 }
5261
5262 unsafe impl fidl::encoding::TypeMarker for LevelDependency {
5263 type Owned = Self;
5264
5265 #[inline(always)]
5266 fn inline_align(_context: fidl::encoding::Context) -> usize {
5267 8
5268 }
5269
5270 #[inline(always)]
5271 fn inline_size(_context: fidl::encoding::Context) -> usize {
5272 32
5273 }
5274 }
5275
5276 unsafe impl
5277 fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
5278 for &mut LevelDependency
5279 {
5280 #[inline]
5281 unsafe fn encode(
5282 self,
5283 encoder: &mut fidl::encoding::Encoder<
5284 '_,
5285 fidl::encoding::DefaultFuchsiaResourceDialect,
5286 >,
5287 offset: usize,
5288 _depth: fidl::encoding::Depth,
5289 ) -> fidl::Result<()> {
5290 encoder.debug_check_bounds::<LevelDependency>(offset);
5291 fidl::encoding::Encode::<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5293 (
5294 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(&self.dependency_type),
5295 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
5296 <fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.requires_token),
5297 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level_by_preference),
5298 ),
5299 encoder, offset, _depth
5300 )
5301 }
5302 }
5303 unsafe impl<
5304 T0: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
5305 T1: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
5306 T2: fidl::encoding::Encode<
5307 fidl::encoding::HandleType<
5308 fidl::Event,
5309 { fidl::ObjectType::EVENT.into_raw() },
5310 2147483648,
5311 >,
5312 fidl::encoding::DefaultFuchsiaResourceDialect,
5313 >,
5314 T3: fidl::encoding::Encode<
5315 fidl::encoding::Vector<u8, 256>,
5316 fidl::encoding::DefaultFuchsiaResourceDialect,
5317 >,
5318 > fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
5319 for (T0, T1, T2, T3)
5320 {
5321 #[inline]
5322 unsafe fn encode(
5323 self,
5324 encoder: &mut fidl::encoding::Encoder<
5325 '_,
5326 fidl::encoding::DefaultFuchsiaResourceDialect,
5327 >,
5328 offset: usize,
5329 depth: fidl::encoding::Depth,
5330 ) -> fidl::Result<()> {
5331 encoder.debug_check_bounds::<LevelDependency>(offset);
5332 unsafe {
5335 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5336 (ptr as *mut u64).write_unaligned(0);
5337 }
5338 unsafe {
5339 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5340 (ptr as *mut u64).write_unaligned(0);
5341 }
5342 self.0.encode(encoder, offset + 0, depth)?;
5344 self.1.encode(encoder, offset + 4, depth)?;
5345 self.2.encode(encoder, offset + 8, depth)?;
5346 self.3.encode(encoder, offset + 16, depth)?;
5347 Ok(())
5348 }
5349 }
5350
5351 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5352 for LevelDependency
5353 {
5354 #[inline(always)]
5355 fn new_empty() -> Self {
5356 Self {
5357 dependency_type: fidl::new_empty!(
5358 DependencyType,
5359 fidl::encoding::DefaultFuchsiaResourceDialect
5360 ),
5361 dependent_level: fidl::new_empty!(
5362 u8,
5363 fidl::encoding::DefaultFuchsiaResourceDialect
5364 ),
5365 requires_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5366 requires_level_by_preference: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
5367 }
5368 }
5369
5370 #[inline]
5371 unsafe fn decode(
5372 &mut self,
5373 decoder: &mut fidl::encoding::Decoder<
5374 '_,
5375 fidl::encoding::DefaultFuchsiaResourceDialect,
5376 >,
5377 offset: usize,
5378 _depth: fidl::encoding::Depth,
5379 ) -> fidl::Result<()> {
5380 decoder.debug_check_bounds::<Self>(offset);
5381 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5383 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5384 let mask = 0xffffff0000000000u64;
5385 let maskedval = padval & mask;
5386 if maskedval != 0 {
5387 return Err(fidl::Error::NonZeroPadding {
5388 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5389 });
5390 }
5391 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5392 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5393 let mask = 0xffffffff00000000u64;
5394 let maskedval = padval & mask;
5395 if maskedval != 0 {
5396 return Err(fidl::Error::NonZeroPadding {
5397 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5398 });
5399 }
5400 fidl::decode!(
5401 DependencyType,
5402 fidl::encoding::DefaultFuchsiaResourceDialect,
5403 &mut self.dependency_type,
5404 decoder,
5405 offset + 0,
5406 _depth
5407 )?;
5408 fidl::decode!(
5409 u8,
5410 fidl::encoding::DefaultFuchsiaResourceDialect,
5411 &mut self.dependent_level,
5412 decoder,
5413 offset + 4,
5414 _depth
5415 )?;
5416 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_token, decoder, offset + 8, _depth)?;
5417 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_level_by_preference, decoder, offset + 16, _depth)?;
5418 Ok(())
5419 }
5420 }
5421
5422 impl fidl::encoding::ResourceTypeMarker for StatusWatchPowerLevelResponse {
5423 type Borrowed<'a> = &'a mut Self;
5424 fn take_or_borrow<'a>(
5425 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5426 ) -> Self::Borrowed<'a> {
5427 value
5428 }
5429 }
5430
5431 unsafe impl fidl::encoding::TypeMarker for StatusWatchPowerLevelResponse {
5432 type Owned = Self;
5433
5434 #[inline(always)]
5435 fn inline_align(_context: fidl::encoding::Context) -> usize {
5436 1
5437 }
5438
5439 #[inline(always)]
5440 fn inline_size(_context: fidl::encoding::Context) -> usize {
5441 1
5442 }
5443 #[inline(always)]
5444 fn encode_is_copy() -> bool {
5445 true
5446 }
5447
5448 #[inline(always)]
5449 fn decode_is_copy() -> bool {
5450 true
5451 }
5452 }
5453
5454 unsafe impl
5455 fidl::encoding::Encode<
5456 StatusWatchPowerLevelResponse,
5457 fidl::encoding::DefaultFuchsiaResourceDialect,
5458 > for &mut StatusWatchPowerLevelResponse
5459 {
5460 #[inline]
5461 unsafe fn encode(
5462 self,
5463 encoder: &mut fidl::encoding::Encoder<
5464 '_,
5465 fidl::encoding::DefaultFuchsiaResourceDialect,
5466 >,
5467 offset: usize,
5468 _depth: fidl::encoding::Depth,
5469 ) -> fidl::Result<()> {
5470 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
5471 unsafe {
5472 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5474 (buf_ptr as *mut StatusWatchPowerLevelResponse)
5475 .write_unaligned((self as *const StatusWatchPowerLevelResponse).read());
5476 }
5479 Ok(())
5480 }
5481 }
5482 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
5483 fidl::encoding::Encode<
5484 StatusWatchPowerLevelResponse,
5485 fidl::encoding::DefaultFuchsiaResourceDialect,
5486 > for (T0,)
5487 {
5488 #[inline]
5489 unsafe fn encode(
5490 self,
5491 encoder: &mut fidl::encoding::Encoder<
5492 '_,
5493 fidl::encoding::DefaultFuchsiaResourceDialect,
5494 >,
5495 offset: usize,
5496 depth: fidl::encoding::Depth,
5497 ) -> fidl::Result<()> {
5498 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
5499 self.0.encode(encoder, offset + 0, depth)?;
5503 Ok(())
5504 }
5505 }
5506
5507 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5508 for StatusWatchPowerLevelResponse
5509 {
5510 #[inline(always)]
5511 fn new_empty() -> Self {
5512 Self {
5513 current_level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
5514 }
5515 }
5516
5517 #[inline]
5518 unsafe fn decode(
5519 &mut self,
5520 decoder: &mut fidl::encoding::Decoder<
5521 '_,
5522 fidl::encoding::DefaultFuchsiaResourceDialect,
5523 >,
5524 offset: usize,
5525 _depth: fidl::encoding::Depth,
5526 ) -> fidl::Result<()> {
5527 decoder.debug_check_bounds::<Self>(offset);
5528 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5529 unsafe {
5532 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
5533 }
5534 Ok(())
5535 }
5536 }
5537
5538 impl ElementSchema {
5539 #[inline(always)]
5540 fn max_ordinal_present(&self) -> u64 {
5541 if let Some(_) = self.element_runner {
5542 return 10;
5543 }
5544 if let Some(_) = self.element_control {
5545 return 9;
5546 }
5547 if let Some(_) = self.lessor_channel {
5548 return 8;
5549 }
5550 if let Some(_) = self.dependencies {
5551 return 4;
5552 }
5553 if let Some(_) = self.valid_levels {
5554 return 3;
5555 }
5556 if let Some(_) = self.initial_current_level {
5557 return 2;
5558 }
5559 if let Some(_) = self.element_name {
5560 return 1;
5561 }
5562 0
5563 }
5564 }
5565
5566 impl fidl::encoding::ResourceTypeMarker for ElementSchema {
5567 type Borrowed<'a> = &'a mut Self;
5568 fn take_or_borrow<'a>(
5569 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5570 ) -> Self::Borrowed<'a> {
5571 value
5572 }
5573 }
5574
5575 unsafe impl fidl::encoding::TypeMarker for ElementSchema {
5576 type Owned = Self;
5577
5578 #[inline(always)]
5579 fn inline_align(_context: fidl::encoding::Context) -> usize {
5580 8
5581 }
5582
5583 #[inline(always)]
5584 fn inline_size(_context: fidl::encoding::Context) -> usize {
5585 16
5586 }
5587 }
5588
5589 unsafe impl fidl::encoding::Encode<ElementSchema, fidl::encoding::DefaultFuchsiaResourceDialect>
5590 for &mut ElementSchema
5591 {
5592 unsafe fn encode(
5593 self,
5594 encoder: &mut fidl::encoding::Encoder<
5595 '_,
5596 fidl::encoding::DefaultFuchsiaResourceDialect,
5597 >,
5598 offset: usize,
5599 mut depth: fidl::encoding::Depth,
5600 ) -> fidl::Result<()> {
5601 encoder.debug_check_bounds::<ElementSchema>(offset);
5602 let max_ordinal: u64 = self.max_ordinal_present();
5604 encoder.write_num(max_ordinal, offset);
5605 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5606 if max_ordinal == 0 {
5608 return Ok(());
5609 }
5610 depth.increment()?;
5611 let envelope_size = 8;
5612 let bytes_len = max_ordinal as usize * envelope_size;
5613 #[allow(unused_variables)]
5614 let offset = encoder.out_of_line_offset(bytes_len);
5615 let mut _prev_end_offset: usize = 0;
5616 if 1 > max_ordinal {
5617 return Ok(());
5618 }
5619
5620 let cur_offset: usize = (1 - 1) * envelope_size;
5623
5624 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5626
5627 fidl::encoding::encode_in_envelope_optional::<
5632 fidl::encoding::BoundedString<64>,
5633 fidl::encoding::DefaultFuchsiaResourceDialect,
5634 >(
5635 self.element_name.as_ref().map(
5636 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
5637 ),
5638 encoder,
5639 offset + cur_offset,
5640 depth,
5641 )?;
5642
5643 _prev_end_offset = cur_offset + envelope_size;
5644 if 2 > max_ordinal {
5645 return Ok(());
5646 }
5647
5648 let cur_offset: usize = (2 - 1) * envelope_size;
5651
5652 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5654
5655 fidl::encoding::encode_in_envelope_optional::<
5660 u8,
5661 fidl::encoding::DefaultFuchsiaResourceDialect,
5662 >(
5663 self.initial_current_level
5664 .as_ref()
5665 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5666 encoder,
5667 offset + cur_offset,
5668 depth,
5669 )?;
5670
5671 _prev_end_offset = cur_offset + envelope_size;
5672 if 3 > max_ordinal {
5673 return Ok(());
5674 }
5675
5676 let cur_offset: usize = (3 - 1) * envelope_size;
5679
5680 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5682
5683 fidl::encoding::encode_in_envelope_optional::<
5688 fidl::encoding::Vector<u8, 256>,
5689 fidl::encoding::DefaultFuchsiaResourceDialect,
5690 >(
5691 self.valid_levels.as_ref().map(
5692 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow,
5693 ),
5694 encoder,
5695 offset + cur_offset,
5696 depth,
5697 )?;
5698
5699 _prev_end_offset = cur_offset + envelope_size;
5700 if 4 > max_ordinal {
5701 return Ok(());
5702 }
5703
5704 let cur_offset: usize = (4 - 1) * envelope_size;
5707
5708 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5710
5711 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5716 self.dependencies.as_mut().map(<fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5717 encoder, offset + cur_offset, depth
5718 )?;
5719
5720 _prev_end_offset = cur_offset + envelope_size;
5721 if 8 > max_ordinal {
5722 return Ok(());
5723 }
5724
5725 let cur_offset: usize = (8 - 1) * envelope_size;
5728
5729 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5731
5732 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5737 self.lessor_channel.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5738 encoder, offset + cur_offset, depth
5739 )?;
5740
5741 _prev_end_offset = cur_offset + envelope_size;
5742 if 9 > max_ordinal {
5743 return Ok(());
5744 }
5745
5746 let cur_offset: usize = (9 - 1) * envelope_size;
5749
5750 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5752
5753 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5758 self.element_control.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5759 encoder, offset + cur_offset, depth
5760 )?;
5761
5762 _prev_end_offset = cur_offset + envelope_size;
5763 if 10 > max_ordinal {
5764 return Ok(());
5765 }
5766
5767 let cur_offset: usize = (10 - 1) * envelope_size;
5770
5771 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5773
5774 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5779 self.element_runner.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5780 encoder, offset + cur_offset, depth
5781 )?;
5782
5783 _prev_end_offset = cur_offset + envelope_size;
5784
5785 Ok(())
5786 }
5787 }
5788
5789 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ElementSchema {
5790 #[inline(always)]
5791 fn new_empty() -> Self {
5792 Self::default()
5793 }
5794
5795 unsafe fn decode(
5796 &mut self,
5797 decoder: &mut fidl::encoding::Decoder<
5798 '_,
5799 fidl::encoding::DefaultFuchsiaResourceDialect,
5800 >,
5801 offset: usize,
5802 mut depth: fidl::encoding::Depth,
5803 ) -> fidl::Result<()> {
5804 decoder.debug_check_bounds::<Self>(offset);
5805 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5806 None => return Err(fidl::Error::NotNullable),
5807 Some(len) => len,
5808 };
5809 if len == 0 {
5811 return Ok(());
5812 };
5813 depth.increment()?;
5814 let envelope_size = 8;
5815 let bytes_len = len * envelope_size;
5816 let offset = decoder.out_of_line_offset(bytes_len)?;
5817 let mut _next_ordinal_to_read = 0;
5819 let mut next_offset = offset;
5820 let end_offset = offset + bytes_len;
5821 _next_ordinal_to_read += 1;
5822 if next_offset >= end_offset {
5823 return Ok(());
5824 }
5825
5826 while _next_ordinal_to_read < 1 {
5828 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5829 _next_ordinal_to_read += 1;
5830 next_offset += envelope_size;
5831 }
5832
5833 let next_out_of_line = decoder.next_out_of_line();
5834 let handles_before = decoder.remaining_handles();
5835 if let Some((inlined, num_bytes, num_handles)) =
5836 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5837 {
5838 let member_inline_size =
5839 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
5840 decoder.context,
5841 );
5842 if inlined != (member_inline_size <= 4) {
5843 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5844 }
5845 let inner_offset;
5846 let mut inner_depth = depth.clone();
5847 if inlined {
5848 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5849 inner_offset = next_offset;
5850 } else {
5851 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5852 inner_depth.increment()?;
5853 }
5854 let val_ref = self.element_name.get_or_insert_with(|| {
5855 fidl::new_empty!(
5856 fidl::encoding::BoundedString<64>,
5857 fidl::encoding::DefaultFuchsiaResourceDialect
5858 )
5859 });
5860 fidl::decode!(
5861 fidl::encoding::BoundedString<64>,
5862 fidl::encoding::DefaultFuchsiaResourceDialect,
5863 val_ref,
5864 decoder,
5865 inner_offset,
5866 inner_depth
5867 )?;
5868 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5869 {
5870 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5871 }
5872 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5873 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5874 }
5875 }
5876
5877 next_offset += envelope_size;
5878 _next_ordinal_to_read += 1;
5879 if next_offset >= end_offset {
5880 return Ok(());
5881 }
5882
5883 while _next_ordinal_to_read < 2 {
5885 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5886 _next_ordinal_to_read += 1;
5887 next_offset += envelope_size;
5888 }
5889
5890 let next_out_of_line = decoder.next_out_of_line();
5891 let handles_before = decoder.remaining_handles();
5892 if let Some((inlined, num_bytes, num_handles)) =
5893 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5894 {
5895 let member_inline_size =
5896 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5897 if inlined != (member_inline_size <= 4) {
5898 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5899 }
5900 let inner_offset;
5901 let mut inner_depth = depth.clone();
5902 if inlined {
5903 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5904 inner_offset = next_offset;
5905 } else {
5906 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5907 inner_depth.increment()?;
5908 }
5909 let val_ref = self.initial_current_level.get_or_insert_with(|| {
5910 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
5911 });
5912 fidl::decode!(
5913 u8,
5914 fidl::encoding::DefaultFuchsiaResourceDialect,
5915 val_ref,
5916 decoder,
5917 inner_offset,
5918 inner_depth
5919 )?;
5920 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5921 {
5922 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5923 }
5924 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5925 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5926 }
5927 }
5928
5929 next_offset += envelope_size;
5930 _next_ordinal_to_read += 1;
5931 if next_offset >= end_offset {
5932 return Ok(());
5933 }
5934
5935 while _next_ordinal_to_read < 3 {
5937 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5938 _next_ordinal_to_read += 1;
5939 next_offset += envelope_size;
5940 }
5941
5942 let next_out_of_line = decoder.next_out_of_line();
5943 let handles_before = decoder.remaining_handles();
5944 if let Some((inlined, num_bytes, num_handles)) =
5945 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5946 {
5947 let member_inline_size =
5948 <fidl::encoding::Vector<u8, 256> as fidl::encoding::TypeMarker>::inline_size(
5949 decoder.context,
5950 );
5951 if inlined != (member_inline_size <= 4) {
5952 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5953 }
5954 let inner_offset;
5955 let mut inner_depth = depth.clone();
5956 if inlined {
5957 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5958 inner_offset = next_offset;
5959 } else {
5960 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5961 inner_depth.increment()?;
5962 }
5963 let val_ref =
5964 self.valid_levels.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
5965 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5966 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5967 {
5968 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5969 }
5970 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5971 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5972 }
5973 }
5974
5975 next_offset += envelope_size;
5976 _next_ordinal_to_read += 1;
5977 if next_offset >= end_offset {
5978 return Ok(());
5979 }
5980
5981 while _next_ordinal_to_read < 4 {
5983 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5984 _next_ordinal_to_read += 1;
5985 next_offset += envelope_size;
5986 }
5987
5988 let next_out_of_line = decoder.next_out_of_line();
5989 let handles_before = decoder.remaining_handles();
5990 if let Some((inlined, num_bytes, num_handles)) =
5991 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5992 {
5993 let member_inline_size = <fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5994 if inlined != (member_inline_size <= 4) {
5995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5996 }
5997 let inner_offset;
5998 let mut inner_depth = depth.clone();
5999 if inlined {
6000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6001 inner_offset = next_offset;
6002 } else {
6003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6004 inner_depth.increment()?;
6005 }
6006 let val_ref =
6007 self.dependencies.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
6008 fidl::decode!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6009 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6010 {
6011 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6012 }
6013 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6014 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6015 }
6016 }
6017
6018 next_offset += envelope_size;
6019 _next_ordinal_to_read += 1;
6020 if next_offset >= end_offset {
6021 return Ok(());
6022 }
6023
6024 while _next_ordinal_to_read < 8 {
6026 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6027 _next_ordinal_to_read += 1;
6028 next_offset += envelope_size;
6029 }
6030
6031 let next_out_of_line = decoder.next_out_of_line();
6032 let handles_before = decoder.remaining_handles();
6033 if let Some((inlined, num_bytes, num_handles)) =
6034 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6035 {
6036 let member_inline_size = <fidl::encoding::Endpoint<
6037 fidl::endpoints::ServerEnd<LessorMarker>,
6038 > as fidl::encoding::TypeMarker>::inline_size(
6039 decoder.context
6040 );
6041 if inlined != (member_inline_size <= 4) {
6042 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6043 }
6044 let inner_offset;
6045 let mut inner_depth = depth.clone();
6046 if inlined {
6047 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6048 inner_offset = next_offset;
6049 } else {
6050 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6051 inner_depth.increment()?;
6052 }
6053 let val_ref = self.lessor_channel.get_or_insert_with(|| {
6054 fidl::new_empty!(
6055 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
6056 fidl::encoding::DefaultFuchsiaResourceDialect
6057 )
6058 });
6059 fidl::decode!(
6060 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
6061 fidl::encoding::DefaultFuchsiaResourceDialect,
6062 val_ref,
6063 decoder,
6064 inner_offset,
6065 inner_depth
6066 )?;
6067 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6068 {
6069 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6070 }
6071 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6072 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6073 }
6074 }
6075
6076 next_offset += envelope_size;
6077 _next_ordinal_to_read += 1;
6078 if next_offset >= end_offset {
6079 return Ok(());
6080 }
6081
6082 while _next_ordinal_to_read < 9 {
6084 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6085 _next_ordinal_to_read += 1;
6086 next_offset += envelope_size;
6087 }
6088
6089 let next_out_of_line = decoder.next_out_of_line();
6090 let handles_before = decoder.remaining_handles();
6091 if let Some((inlined, num_bytes, num_handles)) =
6092 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6093 {
6094 let member_inline_size = <fidl::encoding::Endpoint<
6095 fidl::endpoints::ServerEnd<ElementControlMarker>,
6096 > as fidl::encoding::TypeMarker>::inline_size(
6097 decoder.context
6098 );
6099 if inlined != (member_inline_size <= 4) {
6100 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6101 }
6102 let inner_offset;
6103 let mut inner_depth = depth.clone();
6104 if inlined {
6105 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6106 inner_offset = next_offset;
6107 } else {
6108 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6109 inner_depth.increment()?;
6110 }
6111 let val_ref = self.element_control.get_or_insert_with(|| {
6112 fidl::new_empty!(
6113 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
6114 fidl::encoding::DefaultFuchsiaResourceDialect
6115 )
6116 });
6117 fidl::decode!(
6118 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
6119 fidl::encoding::DefaultFuchsiaResourceDialect,
6120 val_ref,
6121 decoder,
6122 inner_offset,
6123 inner_depth
6124 )?;
6125 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6126 {
6127 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6128 }
6129 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6130 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6131 }
6132 }
6133
6134 next_offset += envelope_size;
6135 _next_ordinal_to_read += 1;
6136 if next_offset >= end_offset {
6137 return Ok(());
6138 }
6139
6140 while _next_ordinal_to_read < 10 {
6142 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6143 _next_ordinal_to_read += 1;
6144 next_offset += envelope_size;
6145 }
6146
6147 let next_out_of_line = decoder.next_out_of_line();
6148 let handles_before = decoder.remaining_handles();
6149 if let Some((inlined, num_bytes, num_handles)) =
6150 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6151 {
6152 let member_inline_size = <fidl::encoding::Endpoint<
6153 fidl::endpoints::ClientEnd<ElementRunnerMarker>,
6154 > as fidl::encoding::TypeMarker>::inline_size(
6155 decoder.context
6156 );
6157 if inlined != (member_inline_size <= 4) {
6158 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6159 }
6160 let inner_offset;
6161 let mut inner_depth = depth.clone();
6162 if inlined {
6163 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6164 inner_offset = next_offset;
6165 } else {
6166 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6167 inner_depth.increment()?;
6168 }
6169 let val_ref = self.element_runner.get_or_insert_with(|| {
6170 fidl::new_empty!(
6171 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
6172 fidl::encoding::DefaultFuchsiaResourceDialect
6173 )
6174 });
6175 fidl::decode!(
6176 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
6177 fidl::encoding::DefaultFuchsiaResourceDialect,
6178 val_ref,
6179 decoder,
6180 inner_offset,
6181 inner_depth
6182 )?;
6183 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6184 {
6185 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6186 }
6187 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6188 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6189 }
6190 }
6191
6192 next_offset += envelope_size;
6193
6194 while next_offset < end_offset {
6196 _next_ordinal_to_read += 1;
6197 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6198 next_offset += envelope_size;
6199 }
6200
6201 Ok(())
6202 }
6203 }
6204
6205 impl ElementStatusEndpoint {
6206 #[inline(always)]
6207 fn max_ordinal_present(&self) -> u64 {
6208 if let Some(_) = self.status {
6209 return 2;
6210 }
6211 if let Some(_) = self.identifier {
6212 return 1;
6213 }
6214 0
6215 }
6216 }
6217
6218 impl fidl::encoding::ResourceTypeMarker for ElementStatusEndpoint {
6219 type Borrowed<'a> = &'a mut Self;
6220 fn take_or_borrow<'a>(
6221 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6222 ) -> Self::Borrowed<'a> {
6223 value
6224 }
6225 }
6226
6227 unsafe impl fidl::encoding::TypeMarker for ElementStatusEndpoint {
6228 type Owned = Self;
6229
6230 #[inline(always)]
6231 fn inline_align(_context: fidl::encoding::Context) -> usize {
6232 8
6233 }
6234
6235 #[inline(always)]
6236 fn inline_size(_context: fidl::encoding::Context) -> usize {
6237 16
6238 }
6239 }
6240
6241 unsafe impl
6242 fidl::encoding::Encode<ElementStatusEndpoint, fidl::encoding::DefaultFuchsiaResourceDialect>
6243 for &mut ElementStatusEndpoint
6244 {
6245 unsafe fn encode(
6246 self,
6247 encoder: &mut fidl::encoding::Encoder<
6248 '_,
6249 fidl::encoding::DefaultFuchsiaResourceDialect,
6250 >,
6251 offset: usize,
6252 mut depth: fidl::encoding::Depth,
6253 ) -> fidl::Result<()> {
6254 encoder.debug_check_bounds::<ElementStatusEndpoint>(offset);
6255 let max_ordinal: u64 = self.max_ordinal_present();
6257 encoder.write_num(max_ordinal, offset);
6258 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6259 if max_ordinal == 0 {
6261 return Ok(());
6262 }
6263 depth.increment()?;
6264 let envelope_size = 8;
6265 let bytes_len = max_ordinal as usize * envelope_size;
6266 #[allow(unused_variables)]
6267 let offset = encoder.out_of_line_offset(bytes_len);
6268 let mut _prev_end_offset: usize = 0;
6269 if 1 > max_ordinal {
6270 return Ok(());
6271 }
6272
6273 let cur_offset: usize = (1 - 1) * envelope_size;
6276
6277 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6279
6280 fidl::encoding::encode_in_envelope_optional::<
6285 fidl::encoding::BoundedString<64>,
6286 fidl::encoding::DefaultFuchsiaResourceDialect,
6287 >(
6288 self.identifier.as_ref().map(
6289 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
6290 ),
6291 encoder,
6292 offset + cur_offset,
6293 depth,
6294 )?;
6295
6296 _prev_end_offset = cur_offset + envelope_size;
6297 if 2 > max_ordinal {
6298 return Ok(());
6299 }
6300
6301 let cur_offset: usize = (2 - 1) * envelope_size;
6304
6305 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6307
6308 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6313 self.status.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6314 encoder, offset + cur_offset, depth
6315 )?;
6316
6317 _prev_end_offset = cur_offset + envelope_size;
6318
6319 Ok(())
6320 }
6321 }
6322
6323 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6324 for ElementStatusEndpoint
6325 {
6326 #[inline(always)]
6327 fn new_empty() -> Self {
6328 Self::default()
6329 }
6330
6331 unsafe fn decode(
6332 &mut self,
6333 decoder: &mut fidl::encoding::Decoder<
6334 '_,
6335 fidl::encoding::DefaultFuchsiaResourceDialect,
6336 >,
6337 offset: usize,
6338 mut depth: fidl::encoding::Depth,
6339 ) -> fidl::Result<()> {
6340 decoder.debug_check_bounds::<Self>(offset);
6341 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6342 None => return Err(fidl::Error::NotNullable),
6343 Some(len) => len,
6344 };
6345 if len == 0 {
6347 return Ok(());
6348 };
6349 depth.increment()?;
6350 let envelope_size = 8;
6351 let bytes_len = len * envelope_size;
6352 let offset = decoder.out_of_line_offset(bytes_len)?;
6353 let mut _next_ordinal_to_read = 0;
6355 let mut next_offset = offset;
6356 let end_offset = offset + bytes_len;
6357 _next_ordinal_to_read += 1;
6358 if next_offset >= end_offset {
6359 return Ok(());
6360 }
6361
6362 while _next_ordinal_to_read < 1 {
6364 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6365 _next_ordinal_to_read += 1;
6366 next_offset += envelope_size;
6367 }
6368
6369 let next_out_of_line = decoder.next_out_of_line();
6370 let handles_before = decoder.remaining_handles();
6371 if let Some((inlined, num_bytes, num_handles)) =
6372 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6373 {
6374 let member_inline_size =
6375 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
6376 decoder.context,
6377 );
6378 if inlined != (member_inline_size <= 4) {
6379 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6380 }
6381 let inner_offset;
6382 let mut inner_depth = depth.clone();
6383 if inlined {
6384 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6385 inner_offset = next_offset;
6386 } else {
6387 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6388 inner_depth.increment()?;
6389 }
6390 let val_ref = self.identifier.get_or_insert_with(|| {
6391 fidl::new_empty!(
6392 fidl::encoding::BoundedString<64>,
6393 fidl::encoding::DefaultFuchsiaResourceDialect
6394 )
6395 });
6396 fidl::decode!(
6397 fidl::encoding::BoundedString<64>,
6398 fidl::encoding::DefaultFuchsiaResourceDialect,
6399 val_ref,
6400 decoder,
6401 inner_offset,
6402 inner_depth
6403 )?;
6404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6405 {
6406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6407 }
6408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6410 }
6411 }
6412
6413 next_offset += envelope_size;
6414 _next_ordinal_to_read += 1;
6415 if next_offset >= end_offset {
6416 return Ok(());
6417 }
6418
6419 while _next_ordinal_to_read < 2 {
6421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6422 _next_ordinal_to_read += 1;
6423 next_offset += envelope_size;
6424 }
6425
6426 let next_out_of_line = decoder.next_out_of_line();
6427 let handles_before = decoder.remaining_handles();
6428 if let Some((inlined, num_bytes, num_handles)) =
6429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6430 {
6431 let member_inline_size = <fidl::encoding::Endpoint<
6432 fidl::endpoints::ClientEnd<StatusMarker>,
6433 > as fidl::encoding::TypeMarker>::inline_size(
6434 decoder.context
6435 );
6436 if inlined != (member_inline_size <= 4) {
6437 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6438 }
6439 let inner_offset;
6440 let mut inner_depth = depth.clone();
6441 if inlined {
6442 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6443 inner_offset = next_offset;
6444 } else {
6445 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6446 inner_depth.increment()?;
6447 }
6448 let val_ref = self.status.get_or_insert_with(|| {
6449 fidl::new_empty!(
6450 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
6451 fidl::encoding::DefaultFuchsiaResourceDialect
6452 )
6453 });
6454 fidl::decode!(
6455 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
6456 fidl::encoding::DefaultFuchsiaResourceDialect,
6457 val_ref,
6458 decoder,
6459 inner_offset,
6460 inner_depth
6461 )?;
6462 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6463 {
6464 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6465 }
6466 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6467 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6468 }
6469 }
6470
6471 next_offset += envelope_size;
6472
6473 while next_offset < end_offset {
6475 _next_ordinal_to_read += 1;
6476 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6477 next_offset += envelope_size;
6478 }
6479
6480 Ok(())
6481 }
6482 }
6483}