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)]
20#[repr(C)]
21pub struct CurrentLevelUpdateRequest {
22 pub current_level: u8,
23}
24
25impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CurrentLevelUpdateRequest {}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct ElementControlOpenStatusChannelRequest {
29 pub status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for ElementControlOpenStatusChannelRequest
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ElementControlRegisterDependencyTokenRequest {
39 pub token: fidl::Event,
40 pub dependency_type: DependencyType,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44 for ElementControlRegisterDependencyTokenRequest
45{
46}
47
48#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49pub struct ElementControlUnregisterDependencyTokenRequest {
50 pub token: fidl::Event,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for ElementControlUnregisterDependencyTokenRequest
55{
56}
57
58#[derive(Debug, PartialEq)]
59pub struct ElementInfoProviderGetElementPowerLevelNamesResponse {
60 pub level_names: Vec<ElementPowerLevelNames>,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64 for ElementInfoProviderGetElementPowerLevelNamesResponse
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct ElementInfoProviderGetStatusEndpointsResponse {
70 pub endpoints: Vec<ElementStatusEndpoint>,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
74 for ElementInfoProviderGetStatusEndpointsResponse
75{
76}
77
78#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
79#[repr(C)]
80pub struct LessorLeaseRequest {
81 pub level: u8,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LessorLeaseRequest {}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct LessorLeaseResponse {
89 pub lease_control: fidl::endpoints::ClientEnd<LeaseControlMarker>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LessorLeaseResponse {}
95
96#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct LevelControlChannels {
98 pub current: fidl::endpoints::ServerEnd<CurrentLevelMarker>,
101 pub required: fidl::endpoints::ServerEnd<RequiredLevelMarker>,
104}
105
106impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LevelControlChannels {}
107
108#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
125pub struct LevelDependency {
126 pub dependency_type: DependencyType,
130 pub dependent_level: u8,
134 pub requires_token: fidl::Event,
137 pub requires_level_by_preference: Vec<u8>,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LevelDependency {}
149
150#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
151#[repr(C)]
152pub struct RequiredLevelWatchResponse {
153 pub required_level: u8,
154}
155
156impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
157 for RequiredLevelWatchResponse
158{
159}
160
161#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
162#[repr(C)]
163pub struct StatusWatchPowerLevelResponse {
164 pub current_level: u8,
165}
166
167impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
168 for StatusWatchPowerLevelResponse
169{
170}
171
172#[derive(Debug, Default, PartialEq)]
174pub struct ElementSchema {
175 pub element_name: Option<String>,
177 pub initial_current_level: Option<u8>,
179 pub valid_levels: Option<Vec<u8>>,
187 pub dependencies: Option<Vec<LevelDependency>>,
190 pub level_control_channels: Option<LevelControlChannels>,
193 pub lessor_channel: Option<fidl::endpoints::ServerEnd<LessorMarker>>,
196 pub element_control: Option<fidl::endpoints::ServerEnd<ElementControlMarker>>,
202 pub element_runner: Option<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
207 #[doc(hidden)]
208 pub __source_breaking: fidl::marker::SourceBreaking,
209}
210
211impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ElementSchema {}
212
213#[derive(Debug, Default, PartialEq)]
217pub struct ElementStatusEndpoint {
218 pub identifier: Option<String>,
219 pub status: Option<fidl::endpoints::ClientEnd<StatusMarker>>,
220 #[doc(hidden)]
221 pub __source_breaking: fidl::marker::SourceBreaking,
222}
223
224impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ElementStatusEndpoint {}
225
226#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
227pub struct CurrentLevelMarker;
228
229impl fidl::endpoints::ProtocolMarker for CurrentLevelMarker {
230 type Proxy = CurrentLevelProxy;
231 type RequestStream = CurrentLevelRequestStream;
232 #[cfg(target_os = "fuchsia")]
233 type SynchronousProxy = CurrentLevelSynchronousProxy;
234
235 const DEBUG_NAME: &'static str = "(anonymous) CurrentLevel";
236}
237pub type CurrentLevelUpdateResult = Result<(), CurrentLevelError>;
238
239pub trait CurrentLevelProxyInterface: Send + Sync {
240 type UpdateResponseFut: std::future::Future<Output = Result<CurrentLevelUpdateResult, fidl::Error>>
241 + Send;
242 fn r#update(&self, current_level: u8) -> Self::UpdateResponseFut;
243}
244#[derive(Debug)]
245#[cfg(target_os = "fuchsia")]
246pub struct CurrentLevelSynchronousProxy {
247 client: fidl::client::sync::Client,
248}
249
250#[cfg(target_os = "fuchsia")]
251impl fidl::endpoints::SynchronousProxy for CurrentLevelSynchronousProxy {
252 type Proxy = CurrentLevelProxy;
253 type Protocol = CurrentLevelMarker;
254
255 fn from_channel(inner: fidl::Channel) -> Self {
256 Self::new(inner)
257 }
258
259 fn into_channel(self) -> fidl::Channel {
260 self.client.into_channel()
261 }
262
263 fn as_channel(&self) -> &fidl::Channel {
264 self.client.as_channel()
265 }
266}
267
268#[cfg(target_os = "fuchsia")]
269impl CurrentLevelSynchronousProxy {
270 pub fn new(channel: fidl::Channel) -> Self {
271 let protocol_name = <CurrentLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
272 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
273 }
274
275 pub fn into_channel(self) -> fidl::Channel {
276 self.client.into_channel()
277 }
278
279 pub fn wait_for_event(
282 &self,
283 deadline: zx::MonotonicInstant,
284 ) -> Result<CurrentLevelEvent, fidl::Error> {
285 CurrentLevelEvent::decode(self.client.wait_for_event(deadline)?)
286 }
287
288 pub fn r#update(
291 &self,
292 mut current_level: u8,
293 ___deadline: zx::MonotonicInstant,
294 ) -> Result<CurrentLevelUpdateResult, fidl::Error> {
295 let _response = self.client.send_query::<
296 CurrentLevelUpdateRequest,
297 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, CurrentLevelError>,
298 >(
299 (current_level,),
300 0x21f34aac488d9486,
301 fidl::encoding::DynamicFlags::FLEXIBLE,
302 ___deadline,
303 )?
304 .into_result::<CurrentLevelMarker>("update")?;
305 Ok(_response.map(|x| x))
306 }
307}
308
309#[cfg(target_os = "fuchsia")]
310impl From<CurrentLevelSynchronousProxy> for zx::Handle {
311 fn from(value: CurrentLevelSynchronousProxy) -> Self {
312 value.into_channel().into()
313 }
314}
315
316#[cfg(target_os = "fuchsia")]
317impl From<fidl::Channel> for CurrentLevelSynchronousProxy {
318 fn from(value: fidl::Channel) -> Self {
319 Self::new(value)
320 }
321}
322
323#[cfg(target_os = "fuchsia")]
324impl fidl::endpoints::FromClient for CurrentLevelSynchronousProxy {
325 type Protocol = CurrentLevelMarker;
326
327 fn from_client(value: fidl::endpoints::ClientEnd<CurrentLevelMarker>) -> Self {
328 Self::new(value.into_channel())
329 }
330}
331
332#[derive(Debug, Clone)]
333pub struct CurrentLevelProxy {
334 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
335}
336
337impl fidl::endpoints::Proxy for CurrentLevelProxy {
338 type Protocol = CurrentLevelMarker;
339
340 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
341 Self::new(inner)
342 }
343
344 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
345 self.client.into_channel().map_err(|client| Self { client })
346 }
347
348 fn as_channel(&self) -> &::fidl::AsyncChannel {
349 self.client.as_channel()
350 }
351}
352
353impl CurrentLevelProxy {
354 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
356 let protocol_name = <CurrentLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
357 Self { client: fidl::client::Client::new(channel, protocol_name) }
358 }
359
360 pub fn take_event_stream(&self) -> CurrentLevelEventStream {
366 CurrentLevelEventStream { event_receiver: self.client.take_event_receiver() }
367 }
368
369 pub fn r#update(
372 &self,
373 mut current_level: u8,
374 ) -> fidl::client::QueryResponseFut<
375 CurrentLevelUpdateResult,
376 fidl::encoding::DefaultFuchsiaResourceDialect,
377 > {
378 CurrentLevelProxyInterface::r#update(self, current_level)
379 }
380}
381
382impl CurrentLevelProxyInterface for CurrentLevelProxy {
383 type UpdateResponseFut = fidl::client::QueryResponseFut<
384 CurrentLevelUpdateResult,
385 fidl::encoding::DefaultFuchsiaResourceDialect,
386 >;
387 fn r#update(&self, mut current_level: u8) -> Self::UpdateResponseFut {
388 fn _decode(
389 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390 ) -> Result<CurrentLevelUpdateResult, fidl::Error> {
391 let _response = fidl::client::decode_transaction_body::<
392 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, CurrentLevelError>,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 0x21f34aac488d9486,
395 >(_buf?)?
396 .into_result::<CurrentLevelMarker>("update")?;
397 Ok(_response.map(|x| x))
398 }
399 self.client.send_query_and_decode::<CurrentLevelUpdateRequest, CurrentLevelUpdateResult>(
400 (current_level,),
401 0x21f34aac488d9486,
402 fidl::encoding::DynamicFlags::FLEXIBLE,
403 _decode,
404 )
405 }
406}
407
408pub struct CurrentLevelEventStream {
409 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
410}
411
412impl std::marker::Unpin for CurrentLevelEventStream {}
413
414impl futures::stream::FusedStream for CurrentLevelEventStream {
415 fn is_terminated(&self) -> bool {
416 self.event_receiver.is_terminated()
417 }
418}
419
420impl futures::Stream for CurrentLevelEventStream {
421 type Item = Result<CurrentLevelEvent, fidl::Error>;
422
423 fn poll_next(
424 mut self: std::pin::Pin<&mut Self>,
425 cx: &mut std::task::Context<'_>,
426 ) -> std::task::Poll<Option<Self::Item>> {
427 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
428 &mut self.event_receiver,
429 cx
430 )?) {
431 Some(buf) => std::task::Poll::Ready(Some(CurrentLevelEvent::decode(buf))),
432 None => std::task::Poll::Ready(None),
433 }
434 }
435}
436
437#[derive(Debug)]
438pub enum CurrentLevelEvent {
439 #[non_exhaustive]
440 _UnknownEvent {
441 ordinal: u64,
443 },
444}
445
446impl CurrentLevelEvent {
447 fn decode(
449 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
450 ) -> Result<CurrentLevelEvent, fidl::Error> {
451 let (bytes, _handles) = buf.split_mut();
452 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
453 debug_assert_eq!(tx_header.tx_id, 0);
454 match tx_header.ordinal {
455 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
456 Ok(CurrentLevelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
457 }
458 _ => Err(fidl::Error::UnknownOrdinal {
459 ordinal: tx_header.ordinal,
460 protocol_name: <CurrentLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
461 }),
462 }
463 }
464}
465
466pub struct CurrentLevelRequestStream {
468 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
469 is_terminated: bool,
470}
471
472impl std::marker::Unpin for CurrentLevelRequestStream {}
473
474impl futures::stream::FusedStream for CurrentLevelRequestStream {
475 fn is_terminated(&self) -> bool {
476 self.is_terminated
477 }
478}
479
480impl fidl::endpoints::RequestStream for CurrentLevelRequestStream {
481 type Protocol = CurrentLevelMarker;
482 type ControlHandle = CurrentLevelControlHandle;
483
484 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
485 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
486 }
487
488 fn control_handle(&self) -> Self::ControlHandle {
489 CurrentLevelControlHandle { inner: self.inner.clone() }
490 }
491
492 fn into_inner(
493 self,
494 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
495 {
496 (self.inner, self.is_terminated)
497 }
498
499 fn from_inner(
500 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
501 is_terminated: bool,
502 ) -> Self {
503 Self { inner, is_terminated }
504 }
505}
506
507impl futures::Stream for CurrentLevelRequestStream {
508 type Item = Result<CurrentLevelRequest, fidl::Error>;
509
510 fn poll_next(
511 mut self: std::pin::Pin<&mut Self>,
512 cx: &mut std::task::Context<'_>,
513 ) -> std::task::Poll<Option<Self::Item>> {
514 let this = &mut *self;
515 if this.inner.check_shutdown(cx) {
516 this.is_terminated = true;
517 return std::task::Poll::Ready(None);
518 }
519 if this.is_terminated {
520 panic!("polled CurrentLevelRequestStream after completion");
521 }
522 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
523 |bytes, handles| {
524 match this.inner.channel().read_etc(cx, bytes, handles) {
525 std::task::Poll::Ready(Ok(())) => {}
526 std::task::Poll::Pending => return std::task::Poll::Pending,
527 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
528 this.is_terminated = true;
529 return std::task::Poll::Ready(None);
530 }
531 std::task::Poll::Ready(Err(e)) => {
532 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
533 e.into(),
534 ))))
535 }
536 }
537
538 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
540
541 std::task::Poll::Ready(Some(match header.ordinal {
542 0x21f34aac488d9486 => {
543 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
544 let mut req = fidl::new_empty!(
545 CurrentLevelUpdateRequest,
546 fidl::encoding::DefaultFuchsiaResourceDialect
547 );
548 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CurrentLevelUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
549 let control_handle =
550 CurrentLevelControlHandle { inner: this.inner.clone() };
551 Ok(CurrentLevelRequest::Update {
552 current_level: req.current_level,
553
554 responder: CurrentLevelUpdateResponder {
555 control_handle: std::mem::ManuallyDrop::new(control_handle),
556 tx_id: header.tx_id,
557 },
558 })
559 }
560 _ if header.tx_id == 0
561 && header
562 .dynamic_flags()
563 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
564 {
565 Ok(CurrentLevelRequest::_UnknownMethod {
566 ordinal: header.ordinal,
567 control_handle: CurrentLevelControlHandle { inner: this.inner.clone() },
568 method_type: fidl::MethodType::OneWay,
569 })
570 }
571 _ if header
572 .dynamic_flags()
573 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
574 {
575 this.inner.send_framework_err(
576 fidl::encoding::FrameworkErr::UnknownMethod,
577 header.tx_id,
578 header.ordinal,
579 header.dynamic_flags(),
580 (bytes, handles),
581 )?;
582 Ok(CurrentLevelRequest::_UnknownMethod {
583 ordinal: header.ordinal,
584 control_handle: CurrentLevelControlHandle { inner: this.inner.clone() },
585 method_type: fidl::MethodType::TwoWay,
586 })
587 }
588 _ => Err(fidl::Error::UnknownOrdinal {
589 ordinal: header.ordinal,
590 protocol_name:
591 <CurrentLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
592 }),
593 }))
594 },
595 )
596 }
597}
598
599#[derive(Debug)]
609pub enum CurrentLevelRequest {
610 Update { current_level: u8, responder: CurrentLevelUpdateResponder },
613 #[non_exhaustive]
615 _UnknownMethod {
616 ordinal: u64,
618 control_handle: CurrentLevelControlHandle,
619 method_type: fidl::MethodType,
620 },
621}
622
623impl CurrentLevelRequest {
624 #[allow(irrefutable_let_patterns)]
625 pub fn into_update(self) -> Option<(u8, CurrentLevelUpdateResponder)> {
626 if let CurrentLevelRequest::Update { current_level, responder } = self {
627 Some((current_level, responder))
628 } else {
629 None
630 }
631 }
632
633 pub fn method_name(&self) -> &'static str {
635 match *self {
636 CurrentLevelRequest::Update { .. } => "update",
637 CurrentLevelRequest::_UnknownMethod {
638 method_type: fidl::MethodType::OneWay, ..
639 } => "unknown one-way method",
640 CurrentLevelRequest::_UnknownMethod {
641 method_type: fidl::MethodType::TwoWay, ..
642 } => "unknown two-way method",
643 }
644 }
645}
646
647#[derive(Debug, Clone)]
648pub struct CurrentLevelControlHandle {
649 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
650}
651
652impl fidl::endpoints::ControlHandle for CurrentLevelControlHandle {
653 fn shutdown(&self) {
654 self.inner.shutdown()
655 }
656 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
657 self.inner.shutdown_with_epitaph(status)
658 }
659
660 fn is_closed(&self) -> bool {
661 self.inner.channel().is_closed()
662 }
663 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
664 self.inner.channel().on_closed()
665 }
666
667 #[cfg(target_os = "fuchsia")]
668 fn signal_peer(
669 &self,
670 clear_mask: zx::Signals,
671 set_mask: zx::Signals,
672 ) -> Result<(), zx_status::Status> {
673 use fidl::Peered;
674 self.inner.channel().signal_peer(clear_mask, set_mask)
675 }
676}
677
678impl CurrentLevelControlHandle {}
679
680#[must_use = "FIDL methods require a response to be sent"]
681#[derive(Debug)]
682pub struct CurrentLevelUpdateResponder {
683 control_handle: std::mem::ManuallyDrop<CurrentLevelControlHandle>,
684 tx_id: u32,
685}
686
687impl std::ops::Drop for CurrentLevelUpdateResponder {
691 fn drop(&mut self) {
692 self.control_handle.shutdown();
693 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
695 }
696}
697
698impl fidl::endpoints::Responder for CurrentLevelUpdateResponder {
699 type ControlHandle = CurrentLevelControlHandle;
700
701 fn control_handle(&self) -> &CurrentLevelControlHandle {
702 &self.control_handle
703 }
704
705 fn drop_without_shutdown(mut self) {
706 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
708 std::mem::forget(self);
710 }
711}
712
713impl CurrentLevelUpdateResponder {
714 pub fn send(self, mut result: Result<(), CurrentLevelError>) -> Result<(), fidl::Error> {
718 let _result = self.send_raw(result);
719 if _result.is_err() {
720 self.control_handle.shutdown();
721 }
722 self.drop_without_shutdown();
723 _result
724 }
725
726 pub fn send_no_shutdown_on_err(
728 self,
729 mut result: Result<(), CurrentLevelError>,
730 ) -> Result<(), fidl::Error> {
731 let _result = self.send_raw(result);
732 self.drop_without_shutdown();
733 _result
734 }
735
736 fn send_raw(&self, mut result: Result<(), CurrentLevelError>) -> Result<(), fidl::Error> {
737 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
738 fidl::encoding::EmptyStruct,
739 CurrentLevelError,
740 >>(
741 fidl::encoding::FlexibleResult::new(result),
742 self.tx_id,
743 0x21f34aac488d9486,
744 fidl::encoding::DynamicFlags::FLEXIBLE,
745 )
746 }
747}
748
749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
750pub struct ElementControlMarker;
751
752impl fidl::endpoints::ProtocolMarker for ElementControlMarker {
753 type Proxy = ElementControlProxy;
754 type RequestStream = ElementControlRequestStream;
755 #[cfg(target_os = "fuchsia")]
756 type SynchronousProxy = ElementControlSynchronousProxy;
757
758 const DEBUG_NAME: &'static str = "(anonymous) ElementControl";
759}
760pub type ElementControlRegisterDependencyTokenResult = Result<(), RegisterDependencyTokenError>;
761pub type ElementControlUnregisterDependencyTokenResult = Result<(), UnregisterDependencyTokenError>;
762
763pub trait ElementControlProxyInterface: Send + Sync {
764 fn r#open_status_channel(
765 &self,
766 status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
767 ) -> Result<(), fidl::Error>;
768 type RegisterDependencyTokenResponseFut: std::future::Future<
769 Output = Result<ElementControlRegisterDependencyTokenResult, fidl::Error>,
770 > + Send;
771 fn r#register_dependency_token(
772 &self,
773 token: fidl::Event,
774 dependency_type: DependencyType,
775 ) -> Self::RegisterDependencyTokenResponseFut;
776 type UnregisterDependencyTokenResponseFut: std::future::Future<
777 Output = Result<ElementControlUnregisterDependencyTokenResult, fidl::Error>,
778 > + Send;
779 fn r#unregister_dependency_token(
780 &self,
781 token: fidl::Event,
782 ) -> Self::UnregisterDependencyTokenResponseFut;
783}
784#[derive(Debug)]
785#[cfg(target_os = "fuchsia")]
786pub struct ElementControlSynchronousProxy {
787 client: fidl::client::sync::Client,
788}
789
790#[cfg(target_os = "fuchsia")]
791impl fidl::endpoints::SynchronousProxy for ElementControlSynchronousProxy {
792 type Proxy = ElementControlProxy;
793 type Protocol = ElementControlMarker;
794
795 fn from_channel(inner: fidl::Channel) -> Self {
796 Self::new(inner)
797 }
798
799 fn into_channel(self) -> fidl::Channel {
800 self.client.into_channel()
801 }
802
803 fn as_channel(&self) -> &fidl::Channel {
804 self.client.as_channel()
805 }
806}
807
808#[cfg(target_os = "fuchsia")]
809impl ElementControlSynchronousProxy {
810 pub fn new(channel: fidl::Channel) -> Self {
811 let protocol_name = <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
812 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
813 }
814
815 pub fn into_channel(self) -> fidl::Channel {
816 self.client.into_channel()
817 }
818
819 pub fn wait_for_event(
822 &self,
823 deadline: zx::MonotonicInstant,
824 ) -> Result<ElementControlEvent, fidl::Error> {
825 ElementControlEvent::decode(self.client.wait_for_event(deadline)?)
826 }
827
828 pub fn r#open_status_channel(
834 &self,
835 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
836 ) -> Result<(), fidl::Error> {
837 self.client.send::<ElementControlOpenStatusChannelRequest>(
838 (status_channel,),
839 0x4d7772e93dba6300,
840 fidl::encoding::DynamicFlags::FLEXIBLE,
841 )
842 }
843
844 pub fn r#register_dependency_token(
848 &self,
849 mut token: fidl::Event,
850 mut dependency_type: DependencyType,
851 ___deadline: zx::MonotonicInstant,
852 ) -> Result<ElementControlRegisterDependencyTokenResult, fidl::Error> {
853 let _response = self.client.send_query::<
854 ElementControlRegisterDependencyTokenRequest,
855 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, RegisterDependencyTokenError>,
856 >(
857 (token, dependency_type,),
858 0x3a5016663d198d61,
859 fidl::encoding::DynamicFlags::FLEXIBLE,
860 ___deadline,
861 )?
862 .into_result::<ElementControlMarker>("register_dependency_token")?;
863 Ok(_response.map(|x| x))
864 }
865
866 pub fn r#unregister_dependency_token(
868 &self,
869 mut token: fidl::Event,
870 ___deadline: zx::MonotonicInstant,
871 ) -> Result<ElementControlUnregisterDependencyTokenResult, fidl::Error> {
872 let _response = self.client.send_query::<
873 ElementControlUnregisterDependencyTokenRequest,
874 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, UnregisterDependencyTokenError>,
875 >(
876 (token,),
877 0x65a31a3661499529,
878 fidl::encoding::DynamicFlags::FLEXIBLE,
879 ___deadline,
880 )?
881 .into_result::<ElementControlMarker>("unregister_dependency_token")?;
882 Ok(_response.map(|x| x))
883 }
884}
885
886#[cfg(target_os = "fuchsia")]
887impl From<ElementControlSynchronousProxy> for zx::Handle {
888 fn from(value: ElementControlSynchronousProxy) -> Self {
889 value.into_channel().into()
890 }
891}
892
893#[cfg(target_os = "fuchsia")]
894impl From<fidl::Channel> for ElementControlSynchronousProxy {
895 fn from(value: fidl::Channel) -> Self {
896 Self::new(value)
897 }
898}
899
900#[cfg(target_os = "fuchsia")]
901impl fidl::endpoints::FromClient for ElementControlSynchronousProxy {
902 type Protocol = ElementControlMarker;
903
904 fn from_client(value: fidl::endpoints::ClientEnd<ElementControlMarker>) -> Self {
905 Self::new(value.into_channel())
906 }
907}
908
909#[derive(Debug, Clone)]
910pub struct ElementControlProxy {
911 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
912}
913
914impl fidl::endpoints::Proxy for ElementControlProxy {
915 type Protocol = ElementControlMarker;
916
917 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
918 Self::new(inner)
919 }
920
921 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
922 self.client.into_channel().map_err(|client| Self { client })
923 }
924
925 fn as_channel(&self) -> &::fidl::AsyncChannel {
926 self.client.as_channel()
927 }
928}
929
930impl ElementControlProxy {
931 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
933 let protocol_name = <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
934 Self { client: fidl::client::Client::new(channel, protocol_name) }
935 }
936
937 pub fn take_event_stream(&self) -> ElementControlEventStream {
943 ElementControlEventStream { event_receiver: self.client.take_event_receiver() }
944 }
945
946 pub fn r#open_status_channel(
952 &self,
953 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
954 ) -> Result<(), fidl::Error> {
955 ElementControlProxyInterface::r#open_status_channel(self, status_channel)
956 }
957
958 pub fn r#register_dependency_token(
962 &self,
963 mut token: fidl::Event,
964 mut dependency_type: DependencyType,
965 ) -> fidl::client::QueryResponseFut<
966 ElementControlRegisterDependencyTokenResult,
967 fidl::encoding::DefaultFuchsiaResourceDialect,
968 > {
969 ElementControlProxyInterface::r#register_dependency_token(self, token, dependency_type)
970 }
971
972 pub fn r#unregister_dependency_token(
974 &self,
975 mut token: fidl::Event,
976 ) -> fidl::client::QueryResponseFut<
977 ElementControlUnregisterDependencyTokenResult,
978 fidl::encoding::DefaultFuchsiaResourceDialect,
979 > {
980 ElementControlProxyInterface::r#unregister_dependency_token(self, token)
981 }
982}
983
984impl ElementControlProxyInterface for ElementControlProxy {
985 fn r#open_status_channel(
986 &self,
987 mut status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
988 ) -> Result<(), fidl::Error> {
989 self.client.send::<ElementControlOpenStatusChannelRequest>(
990 (status_channel,),
991 0x4d7772e93dba6300,
992 fidl::encoding::DynamicFlags::FLEXIBLE,
993 )
994 }
995
996 type RegisterDependencyTokenResponseFut = fidl::client::QueryResponseFut<
997 ElementControlRegisterDependencyTokenResult,
998 fidl::encoding::DefaultFuchsiaResourceDialect,
999 >;
1000 fn r#register_dependency_token(
1001 &self,
1002 mut token: fidl::Event,
1003 mut dependency_type: DependencyType,
1004 ) -> Self::RegisterDependencyTokenResponseFut {
1005 fn _decode(
1006 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1007 ) -> Result<ElementControlRegisterDependencyTokenResult, fidl::Error> {
1008 let _response = fidl::client::decode_transaction_body::<
1009 fidl::encoding::FlexibleResultType<
1010 fidl::encoding::EmptyStruct,
1011 RegisterDependencyTokenError,
1012 >,
1013 fidl::encoding::DefaultFuchsiaResourceDialect,
1014 0x3a5016663d198d61,
1015 >(_buf?)?
1016 .into_result::<ElementControlMarker>("register_dependency_token")?;
1017 Ok(_response.map(|x| x))
1018 }
1019 self.client.send_query_and_decode::<
1020 ElementControlRegisterDependencyTokenRequest,
1021 ElementControlRegisterDependencyTokenResult,
1022 >(
1023 (token, dependency_type,),
1024 0x3a5016663d198d61,
1025 fidl::encoding::DynamicFlags::FLEXIBLE,
1026 _decode,
1027 )
1028 }
1029
1030 type UnregisterDependencyTokenResponseFut = fidl::client::QueryResponseFut<
1031 ElementControlUnregisterDependencyTokenResult,
1032 fidl::encoding::DefaultFuchsiaResourceDialect,
1033 >;
1034 fn r#unregister_dependency_token(
1035 &self,
1036 mut token: fidl::Event,
1037 ) -> Self::UnregisterDependencyTokenResponseFut {
1038 fn _decode(
1039 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1040 ) -> Result<ElementControlUnregisterDependencyTokenResult, fidl::Error> {
1041 let _response = fidl::client::decode_transaction_body::<
1042 fidl::encoding::FlexibleResultType<
1043 fidl::encoding::EmptyStruct,
1044 UnregisterDependencyTokenError,
1045 >,
1046 fidl::encoding::DefaultFuchsiaResourceDialect,
1047 0x65a31a3661499529,
1048 >(_buf?)?
1049 .into_result::<ElementControlMarker>("unregister_dependency_token")?;
1050 Ok(_response.map(|x| x))
1051 }
1052 self.client.send_query_and_decode::<
1053 ElementControlUnregisterDependencyTokenRequest,
1054 ElementControlUnregisterDependencyTokenResult,
1055 >(
1056 (token,),
1057 0x65a31a3661499529,
1058 fidl::encoding::DynamicFlags::FLEXIBLE,
1059 _decode,
1060 )
1061 }
1062}
1063
1064pub struct ElementControlEventStream {
1065 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1066}
1067
1068impl std::marker::Unpin for ElementControlEventStream {}
1069
1070impl futures::stream::FusedStream for ElementControlEventStream {
1071 fn is_terminated(&self) -> bool {
1072 self.event_receiver.is_terminated()
1073 }
1074}
1075
1076impl futures::Stream for ElementControlEventStream {
1077 type Item = Result<ElementControlEvent, fidl::Error>;
1078
1079 fn poll_next(
1080 mut self: std::pin::Pin<&mut Self>,
1081 cx: &mut std::task::Context<'_>,
1082 ) -> std::task::Poll<Option<Self::Item>> {
1083 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1084 &mut self.event_receiver,
1085 cx
1086 )?) {
1087 Some(buf) => std::task::Poll::Ready(Some(ElementControlEvent::decode(buf))),
1088 None => std::task::Poll::Ready(None),
1089 }
1090 }
1091}
1092
1093#[derive(Debug)]
1094pub enum ElementControlEvent {
1095 #[non_exhaustive]
1096 _UnknownEvent {
1097 ordinal: u64,
1099 },
1100}
1101
1102impl ElementControlEvent {
1103 fn decode(
1105 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1106 ) -> Result<ElementControlEvent, fidl::Error> {
1107 let (bytes, _handles) = buf.split_mut();
1108 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1109 debug_assert_eq!(tx_header.tx_id, 0);
1110 match tx_header.ordinal {
1111 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1112 Ok(ElementControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1113 }
1114 _ => Err(fidl::Error::UnknownOrdinal {
1115 ordinal: tx_header.ordinal,
1116 protocol_name:
1117 <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1118 }),
1119 }
1120 }
1121}
1122
1123pub struct ElementControlRequestStream {
1125 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1126 is_terminated: bool,
1127}
1128
1129impl std::marker::Unpin for ElementControlRequestStream {}
1130
1131impl futures::stream::FusedStream for ElementControlRequestStream {
1132 fn is_terminated(&self) -> bool {
1133 self.is_terminated
1134 }
1135}
1136
1137impl fidl::endpoints::RequestStream for ElementControlRequestStream {
1138 type Protocol = ElementControlMarker;
1139 type ControlHandle = ElementControlControlHandle;
1140
1141 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1142 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1143 }
1144
1145 fn control_handle(&self) -> Self::ControlHandle {
1146 ElementControlControlHandle { inner: self.inner.clone() }
1147 }
1148
1149 fn into_inner(
1150 self,
1151 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1152 {
1153 (self.inner, self.is_terminated)
1154 }
1155
1156 fn from_inner(
1157 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1158 is_terminated: bool,
1159 ) -> Self {
1160 Self { inner, is_terminated }
1161 }
1162}
1163
1164impl futures::Stream for ElementControlRequestStream {
1165 type Item = Result<ElementControlRequest, fidl::Error>;
1166
1167 fn poll_next(
1168 mut self: std::pin::Pin<&mut Self>,
1169 cx: &mut std::task::Context<'_>,
1170 ) -> std::task::Poll<Option<Self::Item>> {
1171 let this = &mut *self;
1172 if this.inner.check_shutdown(cx) {
1173 this.is_terminated = true;
1174 return std::task::Poll::Ready(None);
1175 }
1176 if this.is_terminated {
1177 panic!("polled ElementControlRequestStream after completion");
1178 }
1179 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1180 |bytes, handles| {
1181 match this.inner.channel().read_etc(cx, bytes, handles) {
1182 std::task::Poll::Ready(Ok(())) => {}
1183 std::task::Poll::Pending => return std::task::Poll::Pending,
1184 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1185 this.is_terminated = true;
1186 return std::task::Poll::Ready(None);
1187 }
1188 std::task::Poll::Ready(Err(e)) => {
1189 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1190 e.into(),
1191 ))))
1192 }
1193 }
1194
1195 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1197
1198 std::task::Poll::Ready(Some(match header.ordinal {
1199 0x4d7772e93dba6300 => {
1200 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1201 let mut req = fidl::new_empty!(
1202 ElementControlOpenStatusChannelRequest,
1203 fidl::encoding::DefaultFuchsiaResourceDialect
1204 );
1205 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlOpenStatusChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1206 let control_handle =
1207 ElementControlControlHandle { inner: this.inner.clone() };
1208 Ok(ElementControlRequest::OpenStatusChannel {
1209 status_channel: req.status_channel,
1210
1211 control_handle,
1212 })
1213 }
1214 0x3a5016663d198d61 => {
1215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1216 let mut req = fidl::new_empty!(
1217 ElementControlRegisterDependencyTokenRequest,
1218 fidl::encoding::DefaultFuchsiaResourceDialect
1219 );
1220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlRegisterDependencyTokenRequest>(&header, _body_bytes, handles, &mut req)?;
1221 let control_handle =
1222 ElementControlControlHandle { inner: this.inner.clone() };
1223 Ok(ElementControlRequest::RegisterDependencyToken {
1224 token: req.token,
1225 dependency_type: req.dependency_type,
1226
1227 responder: ElementControlRegisterDependencyTokenResponder {
1228 control_handle: std::mem::ManuallyDrop::new(control_handle),
1229 tx_id: header.tx_id,
1230 },
1231 })
1232 }
1233 0x65a31a3661499529 => {
1234 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1235 let mut req = fidl::new_empty!(
1236 ElementControlUnregisterDependencyTokenRequest,
1237 fidl::encoding::DefaultFuchsiaResourceDialect
1238 );
1239 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementControlUnregisterDependencyTokenRequest>(&header, _body_bytes, handles, &mut req)?;
1240 let control_handle =
1241 ElementControlControlHandle { inner: this.inner.clone() };
1242 Ok(ElementControlRequest::UnregisterDependencyToken {
1243 token: req.token,
1244
1245 responder: ElementControlUnregisterDependencyTokenResponder {
1246 control_handle: std::mem::ManuallyDrop::new(control_handle),
1247 tx_id: header.tx_id,
1248 },
1249 })
1250 }
1251 _ if header.tx_id == 0
1252 && header
1253 .dynamic_flags()
1254 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1255 {
1256 Ok(ElementControlRequest::_UnknownMethod {
1257 ordinal: header.ordinal,
1258 control_handle: ElementControlControlHandle {
1259 inner: this.inner.clone(),
1260 },
1261 method_type: fidl::MethodType::OneWay,
1262 })
1263 }
1264 _ if header
1265 .dynamic_flags()
1266 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1267 {
1268 this.inner.send_framework_err(
1269 fidl::encoding::FrameworkErr::UnknownMethod,
1270 header.tx_id,
1271 header.ordinal,
1272 header.dynamic_flags(),
1273 (bytes, handles),
1274 )?;
1275 Ok(ElementControlRequest::_UnknownMethod {
1276 ordinal: header.ordinal,
1277 control_handle: ElementControlControlHandle {
1278 inner: this.inner.clone(),
1279 },
1280 method_type: fidl::MethodType::TwoWay,
1281 })
1282 }
1283 _ => Err(fidl::Error::UnknownOrdinal {
1284 ordinal: header.ordinal,
1285 protocol_name:
1286 <ElementControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1287 }),
1288 }))
1289 },
1290 )
1291 }
1292}
1293
1294#[derive(Debug)]
1297pub enum ElementControlRequest {
1298 OpenStatusChannel {
1304 status_channel: fidl::endpoints::ServerEnd<StatusMarker>,
1305 control_handle: ElementControlControlHandle,
1306 },
1307 RegisterDependencyToken {
1311 token: fidl::Event,
1312 dependency_type: DependencyType,
1313 responder: ElementControlRegisterDependencyTokenResponder,
1314 },
1315 UnregisterDependencyToken {
1317 token: fidl::Event,
1318 responder: ElementControlUnregisterDependencyTokenResponder,
1319 },
1320 #[non_exhaustive]
1322 _UnknownMethod {
1323 ordinal: u64,
1325 control_handle: ElementControlControlHandle,
1326 method_type: fidl::MethodType,
1327 },
1328}
1329
1330impl ElementControlRequest {
1331 #[allow(irrefutable_let_patterns)]
1332 pub fn into_open_status_channel(
1333 self,
1334 ) -> Option<(fidl::endpoints::ServerEnd<StatusMarker>, ElementControlControlHandle)> {
1335 if let ElementControlRequest::OpenStatusChannel { status_channel, control_handle } = self {
1336 Some((status_channel, control_handle))
1337 } else {
1338 None
1339 }
1340 }
1341
1342 #[allow(irrefutable_let_patterns)]
1343 pub fn into_register_dependency_token(
1344 self,
1345 ) -> Option<(fidl::Event, DependencyType, ElementControlRegisterDependencyTokenResponder)> {
1346 if let ElementControlRequest::RegisterDependencyToken {
1347 token,
1348 dependency_type,
1349 responder,
1350 } = self
1351 {
1352 Some((token, dependency_type, responder))
1353 } else {
1354 None
1355 }
1356 }
1357
1358 #[allow(irrefutable_let_patterns)]
1359 pub fn into_unregister_dependency_token(
1360 self,
1361 ) -> Option<(fidl::Event, ElementControlUnregisterDependencyTokenResponder)> {
1362 if let ElementControlRequest::UnregisterDependencyToken { token, responder } = self {
1363 Some((token, responder))
1364 } else {
1365 None
1366 }
1367 }
1368
1369 pub fn method_name(&self) -> &'static str {
1371 match *self {
1372 ElementControlRequest::OpenStatusChannel { .. } => "open_status_channel",
1373 ElementControlRequest::RegisterDependencyToken { .. } => "register_dependency_token",
1374 ElementControlRequest::UnregisterDependencyToken { .. } => {
1375 "unregister_dependency_token"
1376 }
1377 ElementControlRequest::_UnknownMethod {
1378 method_type: fidl::MethodType::OneWay, ..
1379 } => "unknown one-way method",
1380 ElementControlRequest::_UnknownMethod {
1381 method_type: fidl::MethodType::TwoWay, ..
1382 } => "unknown two-way method",
1383 }
1384 }
1385}
1386
1387#[derive(Debug, Clone)]
1388pub struct ElementControlControlHandle {
1389 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1390}
1391
1392impl fidl::endpoints::ControlHandle for ElementControlControlHandle {
1393 fn shutdown(&self) {
1394 self.inner.shutdown()
1395 }
1396 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1397 self.inner.shutdown_with_epitaph(status)
1398 }
1399
1400 fn is_closed(&self) -> bool {
1401 self.inner.channel().is_closed()
1402 }
1403 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1404 self.inner.channel().on_closed()
1405 }
1406
1407 #[cfg(target_os = "fuchsia")]
1408 fn signal_peer(
1409 &self,
1410 clear_mask: zx::Signals,
1411 set_mask: zx::Signals,
1412 ) -> Result<(), zx_status::Status> {
1413 use fidl::Peered;
1414 self.inner.channel().signal_peer(clear_mask, set_mask)
1415 }
1416}
1417
1418impl ElementControlControlHandle {}
1419
1420#[must_use = "FIDL methods require a response to be sent"]
1421#[derive(Debug)]
1422pub struct ElementControlRegisterDependencyTokenResponder {
1423 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
1424 tx_id: u32,
1425}
1426
1427impl std::ops::Drop for ElementControlRegisterDependencyTokenResponder {
1431 fn drop(&mut self) {
1432 self.control_handle.shutdown();
1433 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1435 }
1436}
1437
1438impl fidl::endpoints::Responder for ElementControlRegisterDependencyTokenResponder {
1439 type ControlHandle = ElementControlControlHandle;
1440
1441 fn control_handle(&self) -> &ElementControlControlHandle {
1442 &self.control_handle
1443 }
1444
1445 fn drop_without_shutdown(mut self) {
1446 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1448 std::mem::forget(self);
1450 }
1451}
1452
1453impl ElementControlRegisterDependencyTokenResponder {
1454 pub fn send(
1458 self,
1459 mut result: Result<(), RegisterDependencyTokenError>,
1460 ) -> Result<(), fidl::Error> {
1461 let _result = self.send_raw(result);
1462 if _result.is_err() {
1463 self.control_handle.shutdown();
1464 }
1465 self.drop_without_shutdown();
1466 _result
1467 }
1468
1469 pub fn send_no_shutdown_on_err(
1471 self,
1472 mut result: Result<(), RegisterDependencyTokenError>,
1473 ) -> Result<(), fidl::Error> {
1474 let _result = self.send_raw(result);
1475 self.drop_without_shutdown();
1476 _result
1477 }
1478
1479 fn send_raw(
1480 &self,
1481 mut result: Result<(), RegisterDependencyTokenError>,
1482 ) -> Result<(), fidl::Error> {
1483 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1484 fidl::encoding::EmptyStruct,
1485 RegisterDependencyTokenError,
1486 >>(
1487 fidl::encoding::FlexibleResult::new(result),
1488 self.tx_id,
1489 0x3a5016663d198d61,
1490 fidl::encoding::DynamicFlags::FLEXIBLE,
1491 )
1492 }
1493}
1494
1495#[must_use = "FIDL methods require a response to be sent"]
1496#[derive(Debug)]
1497pub struct ElementControlUnregisterDependencyTokenResponder {
1498 control_handle: std::mem::ManuallyDrop<ElementControlControlHandle>,
1499 tx_id: u32,
1500}
1501
1502impl std::ops::Drop for ElementControlUnregisterDependencyTokenResponder {
1506 fn drop(&mut self) {
1507 self.control_handle.shutdown();
1508 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1510 }
1511}
1512
1513impl fidl::endpoints::Responder for ElementControlUnregisterDependencyTokenResponder {
1514 type ControlHandle = ElementControlControlHandle;
1515
1516 fn control_handle(&self) -> &ElementControlControlHandle {
1517 &self.control_handle
1518 }
1519
1520 fn drop_without_shutdown(mut self) {
1521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1523 std::mem::forget(self);
1525 }
1526}
1527
1528impl ElementControlUnregisterDependencyTokenResponder {
1529 pub fn send(
1533 self,
1534 mut result: Result<(), UnregisterDependencyTokenError>,
1535 ) -> Result<(), fidl::Error> {
1536 let _result = self.send_raw(result);
1537 if _result.is_err() {
1538 self.control_handle.shutdown();
1539 }
1540 self.drop_without_shutdown();
1541 _result
1542 }
1543
1544 pub fn send_no_shutdown_on_err(
1546 self,
1547 mut result: Result<(), UnregisterDependencyTokenError>,
1548 ) -> Result<(), fidl::Error> {
1549 let _result = self.send_raw(result);
1550 self.drop_without_shutdown();
1551 _result
1552 }
1553
1554 fn send_raw(
1555 &self,
1556 mut result: Result<(), UnregisterDependencyTokenError>,
1557 ) -> Result<(), fidl::Error> {
1558 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1559 fidl::encoding::EmptyStruct,
1560 UnregisterDependencyTokenError,
1561 >>(
1562 fidl::encoding::FlexibleResult::new(result),
1563 self.tx_id,
1564 0x65a31a3661499529,
1565 fidl::encoding::DynamicFlags::FLEXIBLE,
1566 )
1567 }
1568}
1569
1570#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1571pub struct ElementInfoProviderMarker;
1572
1573impl fidl::endpoints::ProtocolMarker for ElementInfoProviderMarker {
1574 type Proxy = ElementInfoProviderProxy;
1575 type RequestStream = ElementInfoProviderRequestStream;
1576 #[cfg(target_os = "fuchsia")]
1577 type SynchronousProxy = ElementInfoProviderSynchronousProxy;
1578
1579 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementInfoProvider";
1580}
1581impl fidl::endpoints::DiscoverableProtocolMarker for ElementInfoProviderMarker {}
1582pub type ElementInfoProviderGetElementPowerLevelNamesResult =
1583 Result<Vec<ElementPowerLevelNames>, ElementInfoProviderError>;
1584pub type ElementInfoProviderGetStatusEndpointsResult =
1585 Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>;
1586
1587pub trait ElementInfoProviderProxyInterface: Send + Sync {
1588 type GetElementPowerLevelNamesResponseFut: std::future::Future<
1589 Output = Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error>,
1590 > + Send;
1591 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut;
1592 type GetStatusEndpointsResponseFut: std::future::Future<
1593 Output = Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error>,
1594 > + Send;
1595 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut;
1596}
1597#[derive(Debug)]
1598#[cfg(target_os = "fuchsia")]
1599pub struct ElementInfoProviderSynchronousProxy {
1600 client: fidl::client::sync::Client,
1601}
1602
1603#[cfg(target_os = "fuchsia")]
1604impl fidl::endpoints::SynchronousProxy for ElementInfoProviderSynchronousProxy {
1605 type Proxy = ElementInfoProviderProxy;
1606 type Protocol = ElementInfoProviderMarker;
1607
1608 fn from_channel(inner: fidl::Channel) -> Self {
1609 Self::new(inner)
1610 }
1611
1612 fn into_channel(self) -> fidl::Channel {
1613 self.client.into_channel()
1614 }
1615
1616 fn as_channel(&self) -> &fidl::Channel {
1617 self.client.as_channel()
1618 }
1619}
1620
1621#[cfg(target_os = "fuchsia")]
1622impl ElementInfoProviderSynchronousProxy {
1623 pub fn new(channel: fidl::Channel) -> Self {
1624 let protocol_name =
1625 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1626 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1627 }
1628
1629 pub fn into_channel(self) -> fidl::Channel {
1630 self.client.into_channel()
1631 }
1632
1633 pub fn wait_for_event(
1636 &self,
1637 deadline: zx::MonotonicInstant,
1638 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1639 ElementInfoProviderEvent::decode(self.client.wait_for_event(deadline)?)
1640 }
1641
1642 pub fn r#get_element_power_level_names(
1645 &self,
1646 ___deadline: zx::MonotonicInstant,
1647 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1648 let _response = self
1649 .client
1650 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1651 ElementInfoProviderGetElementPowerLevelNamesResponse,
1652 ElementInfoProviderError,
1653 >>(
1654 (), 0x298f63881fc9ed49, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1655 )?
1656 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1657 Ok(_response.map(|x| x.level_names))
1658 }
1659
1660 pub fn r#get_status_endpoints(
1664 &self,
1665 ___deadline: zx::MonotonicInstant,
1666 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1667 let _response = self
1668 .client
1669 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
1670 ElementInfoProviderGetStatusEndpointsResponse,
1671 ElementInfoProviderError,
1672 >>(
1673 (), 0x456f2b6c5bf0777c, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1674 )?
1675 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1676 Ok(_response.map(|x| x.endpoints))
1677 }
1678}
1679
1680#[cfg(target_os = "fuchsia")]
1681impl From<ElementInfoProviderSynchronousProxy> for zx::Handle {
1682 fn from(value: ElementInfoProviderSynchronousProxy) -> Self {
1683 value.into_channel().into()
1684 }
1685}
1686
1687#[cfg(target_os = "fuchsia")]
1688impl From<fidl::Channel> for ElementInfoProviderSynchronousProxy {
1689 fn from(value: fidl::Channel) -> Self {
1690 Self::new(value)
1691 }
1692}
1693
1694#[cfg(target_os = "fuchsia")]
1695impl fidl::endpoints::FromClient for ElementInfoProviderSynchronousProxy {
1696 type Protocol = ElementInfoProviderMarker;
1697
1698 fn from_client(value: fidl::endpoints::ClientEnd<ElementInfoProviderMarker>) -> Self {
1699 Self::new(value.into_channel())
1700 }
1701}
1702
1703#[derive(Debug, Clone)]
1704pub struct ElementInfoProviderProxy {
1705 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1706}
1707
1708impl fidl::endpoints::Proxy for ElementInfoProviderProxy {
1709 type Protocol = ElementInfoProviderMarker;
1710
1711 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1712 Self::new(inner)
1713 }
1714
1715 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1716 self.client.into_channel().map_err(|client| Self { client })
1717 }
1718
1719 fn as_channel(&self) -> &::fidl::AsyncChannel {
1720 self.client.as_channel()
1721 }
1722}
1723
1724impl ElementInfoProviderProxy {
1725 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1727 let protocol_name =
1728 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1729 Self { client: fidl::client::Client::new(channel, protocol_name) }
1730 }
1731
1732 pub fn take_event_stream(&self) -> ElementInfoProviderEventStream {
1738 ElementInfoProviderEventStream { event_receiver: self.client.take_event_receiver() }
1739 }
1740
1741 pub fn r#get_element_power_level_names(
1744 &self,
1745 ) -> fidl::client::QueryResponseFut<
1746 ElementInfoProviderGetElementPowerLevelNamesResult,
1747 fidl::encoding::DefaultFuchsiaResourceDialect,
1748 > {
1749 ElementInfoProviderProxyInterface::r#get_element_power_level_names(self)
1750 }
1751
1752 pub fn r#get_status_endpoints(
1756 &self,
1757 ) -> fidl::client::QueryResponseFut<
1758 ElementInfoProviderGetStatusEndpointsResult,
1759 fidl::encoding::DefaultFuchsiaResourceDialect,
1760 > {
1761 ElementInfoProviderProxyInterface::r#get_status_endpoints(self)
1762 }
1763}
1764
1765impl ElementInfoProviderProxyInterface for ElementInfoProviderProxy {
1766 type GetElementPowerLevelNamesResponseFut = fidl::client::QueryResponseFut<
1767 ElementInfoProviderGetElementPowerLevelNamesResult,
1768 fidl::encoding::DefaultFuchsiaResourceDialect,
1769 >;
1770 fn r#get_element_power_level_names(&self) -> Self::GetElementPowerLevelNamesResponseFut {
1771 fn _decode(
1772 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1773 ) -> Result<ElementInfoProviderGetElementPowerLevelNamesResult, fidl::Error> {
1774 let _response = fidl::client::decode_transaction_body::<
1775 fidl::encoding::FlexibleResultType<
1776 ElementInfoProviderGetElementPowerLevelNamesResponse,
1777 ElementInfoProviderError,
1778 >,
1779 fidl::encoding::DefaultFuchsiaResourceDialect,
1780 0x298f63881fc9ed49,
1781 >(_buf?)?
1782 .into_result::<ElementInfoProviderMarker>("get_element_power_level_names")?;
1783 Ok(_response.map(|x| x.level_names))
1784 }
1785 self.client.send_query_and_decode::<
1786 fidl::encoding::EmptyPayload,
1787 ElementInfoProviderGetElementPowerLevelNamesResult,
1788 >(
1789 (),
1790 0x298f63881fc9ed49,
1791 fidl::encoding::DynamicFlags::FLEXIBLE,
1792 _decode,
1793 )
1794 }
1795
1796 type GetStatusEndpointsResponseFut = fidl::client::QueryResponseFut<
1797 ElementInfoProviderGetStatusEndpointsResult,
1798 fidl::encoding::DefaultFuchsiaResourceDialect,
1799 >;
1800 fn r#get_status_endpoints(&self) -> Self::GetStatusEndpointsResponseFut {
1801 fn _decode(
1802 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1803 ) -> Result<ElementInfoProviderGetStatusEndpointsResult, fidl::Error> {
1804 let _response = fidl::client::decode_transaction_body::<
1805 fidl::encoding::FlexibleResultType<
1806 ElementInfoProviderGetStatusEndpointsResponse,
1807 ElementInfoProviderError,
1808 >,
1809 fidl::encoding::DefaultFuchsiaResourceDialect,
1810 0x456f2b6c5bf0777c,
1811 >(_buf?)?
1812 .into_result::<ElementInfoProviderMarker>("get_status_endpoints")?;
1813 Ok(_response.map(|x| x.endpoints))
1814 }
1815 self.client.send_query_and_decode::<
1816 fidl::encoding::EmptyPayload,
1817 ElementInfoProviderGetStatusEndpointsResult,
1818 >(
1819 (),
1820 0x456f2b6c5bf0777c,
1821 fidl::encoding::DynamicFlags::FLEXIBLE,
1822 _decode,
1823 )
1824 }
1825}
1826
1827pub struct ElementInfoProviderEventStream {
1828 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1829}
1830
1831impl std::marker::Unpin for ElementInfoProviderEventStream {}
1832
1833impl futures::stream::FusedStream for ElementInfoProviderEventStream {
1834 fn is_terminated(&self) -> bool {
1835 self.event_receiver.is_terminated()
1836 }
1837}
1838
1839impl futures::Stream for ElementInfoProviderEventStream {
1840 type Item = Result<ElementInfoProviderEvent, fidl::Error>;
1841
1842 fn poll_next(
1843 mut self: std::pin::Pin<&mut Self>,
1844 cx: &mut std::task::Context<'_>,
1845 ) -> std::task::Poll<Option<Self::Item>> {
1846 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1847 &mut self.event_receiver,
1848 cx
1849 )?) {
1850 Some(buf) => std::task::Poll::Ready(Some(ElementInfoProviderEvent::decode(buf))),
1851 None => std::task::Poll::Ready(None),
1852 }
1853 }
1854}
1855
1856#[derive(Debug)]
1857pub enum ElementInfoProviderEvent {
1858 #[non_exhaustive]
1859 _UnknownEvent {
1860 ordinal: u64,
1862 },
1863}
1864
1865impl ElementInfoProviderEvent {
1866 fn decode(
1868 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1869 ) -> Result<ElementInfoProviderEvent, fidl::Error> {
1870 let (bytes, _handles) = buf.split_mut();
1871 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1872 debug_assert_eq!(tx_header.tx_id, 0);
1873 match tx_header.ordinal {
1874 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1875 Ok(ElementInfoProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1876 }
1877 _ => Err(fidl::Error::UnknownOrdinal {
1878 ordinal: tx_header.ordinal,
1879 protocol_name:
1880 <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1881 }),
1882 }
1883 }
1884}
1885
1886pub struct ElementInfoProviderRequestStream {
1888 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1889 is_terminated: bool,
1890}
1891
1892impl std::marker::Unpin for ElementInfoProviderRequestStream {}
1893
1894impl futures::stream::FusedStream for ElementInfoProviderRequestStream {
1895 fn is_terminated(&self) -> bool {
1896 self.is_terminated
1897 }
1898}
1899
1900impl fidl::endpoints::RequestStream for ElementInfoProviderRequestStream {
1901 type Protocol = ElementInfoProviderMarker;
1902 type ControlHandle = ElementInfoProviderControlHandle;
1903
1904 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1905 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1906 }
1907
1908 fn control_handle(&self) -> Self::ControlHandle {
1909 ElementInfoProviderControlHandle { inner: self.inner.clone() }
1910 }
1911
1912 fn into_inner(
1913 self,
1914 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1915 {
1916 (self.inner, self.is_terminated)
1917 }
1918
1919 fn from_inner(
1920 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1921 is_terminated: bool,
1922 ) -> Self {
1923 Self { inner, is_terminated }
1924 }
1925}
1926
1927impl futures::Stream for ElementInfoProviderRequestStream {
1928 type Item = Result<ElementInfoProviderRequest, fidl::Error>;
1929
1930 fn poll_next(
1931 mut self: std::pin::Pin<&mut Self>,
1932 cx: &mut std::task::Context<'_>,
1933 ) -> std::task::Poll<Option<Self::Item>> {
1934 let this = &mut *self;
1935 if this.inner.check_shutdown(cx) {
1936 this.is_terminated = true;
1937 return std::task::Poll::Ready(None);
1938 }
1939 if this.is_terminated {
1940 panic!("polled ElementInfoProviderRequestStream after completion");
1941 }
1942 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1943 |bytes, handles| {
1944 match this.inner.channel().read_etc(cx, bytes, handles) {
1945 std::task::Poll::Ready(Ok(())) => {}
1946 std::task::Poll::Pending => return std::task::Poll::Pending,
1947 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1948 this.is_terminated = true;
1949 return std::task::Poll::Ready(None);
1950 }
1951 std::task::Poll::Ready(Err(e)) => {
1952 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1953 e.into(),
1954 ))))
1955 }
1956 }
1957
1958 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1960
1961 std::task::Poll::Ready(Some(match header.ordinal {
1962 0x298f63881fc9ed49 => {
1963 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1964 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1965 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1966 let control_handle = ElementInfoProviderControlHandle {
1967 inner: this.inner.clone(),
1968 };
1969 Ok(ElementInfoProviderRequest::GetElementPowerLevelNames {
1970 responder: ElementInfoProviderGetElementPowerLevelNamesResponder {
1971 control_handle: std::mem::ManuallyDrop::new(control_handle),
1972 tx_id: header.tx_id,
1973 },
1974 })
1975 }
1976 0x456f2b6c5bf0777c => {
1977 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1978 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1979 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1980 let control_handle = ElementInfoProviderControlHandle {
1981 inner: this.inner.clone(),
1982 };
1983 Ok(ElementInfoProviderRequest::GetStatusEndpoints {
1984 responder: ElementInfoProviderGetStatusEndpointsResponder {
1985 control_handle: std::mem::ManuallyDrop::new(control_handle),
1986 tx_id: header.tx_id,
1987 },
1988 })
1989 }
1990 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1991 Ok(ElementInfoProviderRequest::_UnknownMethod {
1992 ordinal: header.ordinal,
1993 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
1994 method_type: fidl::MethodType::OneWay,
1995 })
1996 }
1997 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1998 this.inner.send_framework_err(
1999 fidl::encoding::FrameworkErr::UnknownMethod,
2000 header.tx_id,
2001 header.ordinal,
2002 header.dynamic_flags(),
2003 (bytes, handles),
2004 )?;
2005 Ok(ElementInfoProviderRequest::_UnknownMethod {
2006 ordinal: header.ordinal,
2007 control_handle: ElementInfoProviderControlHandle { inner: this.inner.clone() },
2008 method_type: fidl::MethodType::TwoWay,
2009 })
2010 }
2011 _ => Err(fidl::Error::UnknownOrdinal {
2012 ordinal: header.ordinal,
2013 protocol_name: <ElementInfoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2014 }),
2015 }))
2016 },
2017 )
2018 }
2019}
2020
2021#[derive(Debug)]
2023pub enum ElementInfoProviderRequest {
2024 GetElementPowerLevelNames { responder: ElementInfoProviderGetElementPowerLevelNamesResponder },
2027 GetStatusEndpoints { responder: ElementInfoProviderGetStatusEndpointsResponder },
2031 #[non_exhaustive]
2033 _UnknownMethod {
2034 ordinal: u64,
2036 control_handle: ElementInfoProviderControlHandle,
2037 method_type: fidl::MethodType,
2038 },
2039}
2040
2041impl ElementInfoProviderRequest {
2042 #[allow(irrefutable_let_patterns)]
2043 pub fn into_get_element_power_level_names(
2044 self,
2045 ) -> Option<(ElementInfoProviderGetElementPowerLevelNamesResponder)> {
2046 if let ElementInfoProviderRequest::GetElementPowerLevelNames { responder } = self {
2047 Some((responder))
2048 } else {
2049 None
2050 }
2051 }
2052
2053 #[allow(irrefutable_let_patterns)]
2054 pub fn into_get_status_endpoints(
2055 self,
2056 ) -> Option<(ElementInfoProviderGetStatusEndpointsResponder)> {
2057 if let ElementInfoProviderRequest::GetStatusEndpoints { responder } = self {
2058 Some((responder))
2059 } else {
2060 None
2061 }
2062 }
2063
2064 pub fn method_name(&self) -> &'static str {
2066 match *self {
2067 ElementInfoProviderRequest::GetElementPowerLevelNames { .. } => {
2068 "get_element_power_level_names"
2069 }
2070 ElementInfoProviderRequest::GetStatusEndpoints { .. } => "get_status_endpoints",
2071 ElementInfoProviderRequest::_UnknownMethod {
2072 method_type: fidl::MethodType::OneWay,
2073 ..
2074 } => "unknown one-way method",
2075 ElementInfoProviderRequest::_UnknownMethod {
2076 method_type: fidl::MethodType::TwoWay,
2077 ..
2078 } => "unknown two-way method",
2079 }
2080 }
2081}
2082
2083#[derive(Debug, Clone)]
2084pub struct ElementInfoProviderControlHandle {
2085 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2086}
2087
2088impl fidl::endpoints::ControlHandle for ElementInfoProviderControlHandle {
2089 fn shutdown(&self) {
2090 self.inner.shutdown()
2091 }
2092 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2093 self.inner.shutdown_with_epitaph(status)
2094 }
2095
2096 fn is_closed(&self) -> bool {
2097 self.inner.channel().is_closed()
2098 }
2099 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2100 self.inner.channel().on_closed()
2101 }
2102
2103 #[cfg(target_os = "fuchsia")]
2104 fn signal_peer(
2105 &self,
2106 clear_mask: zx::Signals,
2107 set_mask: zx::Signals,
2108 ) -> Result<(), zx_status::Status> {
2109 use fidl::Peered;
2110 self.inner.channel().signal_peer(clear_mask, set_mask)
2111 }
2112}
2113
2114impl ElementInfoProviderControlHandle {}
2115
2116#[must_use = "FIDL methods require a response to be sent"]
2117#[derive(Debug)]
2118pub struct ElementInfoProviderGetElementPowerLevelNamesResponder {
2119 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
2120 tx_id: u32,
2121}
2122
2123impl std::ops::Drop for ElementInfoProviderGetElementPowerLevelNamesResponder {
2127 fn drop(&mut self) {
2128 self.control_handle.shutdown();
2129 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2131 }
2132}
2133
2134impl fidl::endpoints::Responder for ElementInfoProviderGetElementPowerLevelNamesResponder {
2135 type ControlHandle = ElementInfoProviderControlHandle;
2136
2137 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
2138 &self.control_handle
2139 }
2140
2141 fn drop_without_shutdown(mut self) {
2142 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2144 std::mem::forget(self);
2146 }
2147}
2148
2149impl ElementInfoProviderGetElementPowerLevelNamesResponder {
2150 pub fn send(
2154 self,
2155 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
2156 ) -> Result<(), fidl::Error> {
2157 let _result = self.send_raw(result);
2158 if _result.is_err() {
2159 self.control_handle.shutdown();
2160 }
2161 self.drop_without_shutdown();
2162 _result
2163 }
2164
2165 pub fn send_no_shutdown_on_err(
2167 self,
2168 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
2169 ) -> Result<(), fidl::Error> {
2170 let _result = self.send_raw(result);
2171 self.drop_without_shutdown();
2172 _result
2173 }
2174
2175 fn send_raw(
2176 &self,
2177 mut result: Result<&[ElementPowerLevelNames], ElementInfoProviderError>,
2178 ) -> Result<(), fidl::Error> {
2179 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2180 ElementInfoProviderGetElementPowerLevelNamesResponse,
2181 ElementInfoProviderError,
2182 >>(
2183 fidl::encoding::FlexibleResult::new(result.map(|level_names| (level_names,))),
2184 self.tx_id,
2185 0x298f63881fc9ed49,
2186 fidl::encoding::DynamicFlags::FLEXIBLE,
2187 )
2188 }
2189}
2190
2191#[must_use = "FIDL methods require a response to be sent"]
2192#[derive(Debug)]
2193pub struct ElementInfoProviderGetStatusEndpointsResponder {
2194 control_handle: std::mem::ManuallyDrop<ElementInfoProviderControlHandle>,
2195 tx_id: u32,
2196}
2197
2198impl std::ops::Drop for ElementInfoProviderGetStatusEndpointsResponder {
2202 fn drop(&mut self) {
2203 self.control_handle.shutdown();
2204 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2206 }
2207}
2208
2209impl fidl::endpoints::Responder for ElementInfoProviderGetStatusEndpointsResponder {
2210 type ControlHandle = ElementInfoProviderControlHandle;
2211
2212 fn control_handle(&self) -> &ElementInfoProviderControlHandle {
2213 &self.control_handle
2214 }
2215
2216 fn drop_without_shutdown(mut self) {
2217 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2219 std::mem::forget(self);
2221 }
2222}
2223
2224impl ElementInfoProviderGetStatusEndpointsResponder {
2225 pub fn send(
2229 self,
2230 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
2231 ) -> Result<(), fidl::Error> {
2232 let _result = self.send_raw(result);
2233 if _result.is_err() {
2234 self.control_handle.shutdown();
2235 }
2236 self.drop_without_shutdown();
2237 _result
2238 }
2239
2240 pub fn send_no_shutdown_on_err(
2242 self,
2243 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
2244 ) -> Result<(), fidl::Error> {
2245 let _result = self.send_raw(result);
2246 self.drop_without_shutdown();
2247 _result
2248 }
2249
2250 fn send_raw(
2251 &self,
2252 mut result: Result<Vec<ElementStatusEndpoint>, ElementInfoProviderError>,
2253 ) -> Result<(), fidl::Error> {
2254 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2255 ElementInfoProviderGetStatusEndpointsResponse,
2256 ElementInfoProviderError,
2257 >>(
2258 fidl::encoding::FlexibleResult::new(
2259 result.as_mut().map_err(|e| *e).map(|endpoints| (endpoints.as_mut_slice(),)),
2260 ),
2261 self.tx_id,
2262 0x456f2b6c5bf0777c,
2263 fidl::encoding::DynamicFlags::FLEXIBLE,
2264 )
2265 }
2266}
2267
2268#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2269pub struct ElementRunnerMarker;
2270
2271impl fidl::endpoints::ProtocolMarker for ElementRunnerMarker {
2272 type Proxy = ElementRunnerProxy;
2273 type RequestStream = ElementRunnerRequestStream;
2274 #[cfg(target_os = "fuchsia")]
2275 type SynchronousProxy = ElementRunnerSynchronousProxy;
2276
2277 const DEBUG_NAME: &'static str = "fuchsia.power.broker.ElementRunner";
2278}
2279impl fidl::endpoints::DiscoverableProtocolMarker for ElementRunnerMarker {}
2280
2281pub trait ElementRunnerProxyInterface: Send + Sync {
2282 type SetLevelResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2283 fn r#set_level(&self, level: u8) -> Self::SetLevelResponseFut;
2284}
2285#[derive(Debug)]
2286#[cfg(target_os = "fuchsia")]
2287pub struct ElementRunnerSynchronousProxy {
2288 client: fidl::client::sync::Client,
2289}
2290
2291#[cfg(target_os = "fuchsia")]
2292impl fidl::endpoints::SynchronousProxy for ElementRunnerSynchronousProxy {
2293 type Proxy = ElementRunnerProxy;
2294 type Protocol = ElementRunnerMarker;
2295
2296 fn from_channel(inner: fidl::Channel) -> Self {
2297 Self::new(inner)
2298 }
2299
2300 fn into_channel(self) -> fidl::Channel {
2301 self.client.into_channel()
2302 }
2303
2304 fn as_channel(&self) -> &fidl::Channel {
2305 self.client.as_channel()
2306 }
2307}
2308
2309#[cfg(target_os = "fuchsia")]
2310impl ElementRunnerSynchronousProxy {
2311 pub fn new(channel: fidl::Channel) -> Self {
2312 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2313 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2314 }
2315
2316 pub fn into_channel(self) -> fidl::Channel {
2317 self.client.into_channel()
2318 }
2319
2320 pub fn wait_for_event(
2323 &self,
2324 deadline: zx::MonotonicInstant,
2325 ) -> Result<ElementRunnerEvent, fidl::Error> {
2326 ElementRunnerEvent::decode(self.client.wait_for_event(deadline)?)
2327 }
2328
2329 pub fn r#set_level(
2336 &self,
2337 mut level: u8,
2338 ___deadline: zx::MonotonicInstant,
2339 ) -> Result<(), fidl::Error> {
2340 let _response = self.client.send_query::<
2341 ElementRunnerSetLevelRequest,
2342 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2343 >(
2344 (level,),
2345 0x11a93092b228f0b,
2346 fidl::encoding::DynamicFlags::FLEXIBLE,
2347 ___deadline,
2348 )?
2349 .into_result::<ElementRunnerMarker>("set_level")?;
2350 Ok(_response)
2351 }
2352}
2353
2354#[cfg(target_os = "fuchsia")]
2355impl From<ElementRunnerSynchronousProxy> for zx::Handle {
2356 fn from(value: ElementRunnerSynchronousProxy) -> Self {
2357 value.into_channel().into()
2358 }
2359}
2360
2361#[cfg(target_os = "fuchsia")]
2362impl From<fidl::Channel> for ElementRunnerSynchronousProxy {
2363 fn from(value: fidl::Channel) -> Self {
2364 Self::new(value)
2365 }
2366}
2367
2368#[cfg(target_os = "fuchsia")]
2369impl fidl::endpoints::FromClient for ElementRunnerSynchronousProxy {
2370 type Protocol = ElementRunnerMarker;
2371
2372 fn from_client(value: fidl::endpoints::ClientEnd<ElementRunnerMarker>) -> Self {
2373 Self::new(value.into_channel())
2374 }
2375}
2376
2377#[derive(Debug, Clone)]
2378pub struct ElementRunnerProxy {
2379 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2380}
2381
2382impl fidl::endpoints::Proxy for ElementRunnerProxy {
2383 type Protocol = ElementRunnerMarker;
2384
2385 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2386 Self::new(inner)
2387 }
2388
2389 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2390 self.client.into_channel().map_err(|client| Self { client })
2391 }
2392
2393 fn as_channel(&self) -> &::fidl::AsyncChannel {
2394 self.client.as_channel()
2395 }
2396}
2397
2398impl ElementRunnerProxy {
2399 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2401 let protocol_name = <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2402 Self { client: fidl::client::Client::new(channel, protocol_name) }
2403 }
2404
2405 pub fn take_event_stream(&self) -> ElementRunnerEventStream {
2411 ElementRunnerEventStream { event_receiver: self.client.take_event_receiver() }
2412 }
2413
2414 pub fn r#set_level(
2421 &self,
2422 mut level: u8,
2423 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2424 ElementRunnerProxyInterface::r#set_level(self, level)
2425 }
2426}
2427
2428impl ElementRunnerProxyInterface for ElementRunnerProxy {
2429 type SetLevelResponseFut =
2430 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2431 fn r#set_level(&self, mut level: u8) -> Self::SetLevelResponseFut {
2432 fn _decode(
2433 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2434 ) -> Result<(), fidl::Error> {
2435 let _response = fidl::client::decode_transaction_body::<
2436 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2437 fidl::encoding::DefaultFuchsiaResourceDialect,
2438 0x11a93092b228f0b,
2439 >(_buf?)?
2440 .into_result::<ElementRunnerMarker>("set_level")?;
2441 Ok(_response)
2442 }
2443 self.client.send_query_and_decode::<ElementRunnerSetLevelRequest, ()>(
2444 (level,),
2445 0x11a93092b228f0b,
2446 fidl::encoding::DynamicFlags::FLEXIBLE,
2447 _decode,
2448 )
2449 }
2450}
2451
2452pub struct ElementRunnerEventStream {
2453 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2454}
2455
2456impl std::marker::Unpin for ElementRunnerEventStream {}
2457
2458impl futures::stream::FusedStream for ElementRunnerEventStream {
2459 fn is_terminated(&self) -> bool {
2460 self.event_receiver.is_terminated()
2461 }
2462}
2463
2464impl futures::Stream for ElementRunnerEventStream {
2465 type Item = Result<ElementRunnerEvent, fidl::Error>;
2466
2467 fn poll_next(
2468 mut self: std::pin::Pin<&mut Self>,
2469 cx: &mut std::task::Context<'_>,
2470 ) -> std::task::Poll<Option<Self::Item>> {
2471 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2472 &mut self.event_receiver,
2473 cx
2474 )?) {
2475 Some(buf) => std::task::Poll::Ready(Some(ElementRunnerEvent::decode(buf))),
2476 None => std::task::Poll::Ready(None),
2477 }
2478 }
2479}
2480
2481#[derive(Debug)]
2482pub enum ElementRunnerEvent {
2483 #[non_exhaustive]
2484 _UnknownEvent {
2485 ordinal: u64,
2487 },
2488}
2489
2490impl ElementRunnerEvent {
2491 fn decode(
2493 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2494 ) -> Result<ElementRunnerEvent, fidl::Error> {
2495 let (bytes, _handles) = buf.split_mut();
2496 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2497 debug_assert_eq!(tx_header.tx_id, 0);
2498 match tx_header.ordinal {
2499 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2500 Ok(ElementRunnerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2501 }
2502 _ => Err(fidl::Error::UnknownOrdinal {
2503 ordinal: tx_header.ordinal,
2504 protocol_name: <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2505 }),
2506 }
2507 }
2508}
2509
2510pub struct ElementRunnerRequestStream {
2512 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2513 is_terminated: bool,
2514}
2515
2516impl std::marker::Unpin for ElementRunnerRequestStream {}
2517
2518impl futures::stream::FusedStream for ElementRunnerRequestStream {
2519 fn is_terminated(&self) -> bool {
2520 self.is_terminated
2521 }
2522}
2523
2524impl fidl::endpoints::RequestStream for ElementRunnerRequestStream {
2525 type Protocol = ElementRunnerMarker;
2526 type ControlHandle = ElementRunnerControlHandle;
2527
2528 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2529 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2530 }
2531
2532 fn control_handle(&self) -> Self::ControlHandle {
2533 ElementRunnerControlHandle { inner: self.inner.clone() }
2534 }
2535
2536 fn into_inner(
2537 self,
2538 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2539 {
2540 (self.inner, self.is_terminated)
2541 }
2542
2543 fn from_inner(
2544 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2545 is_terminated: bool,
2546 ) -> Self {
2547 Self { inner, is_terminated }
2548 }
2549}
2550
2551impl futures::Stream for ElementRunnerRequestStream {
2552 type Item = Result<ElementRunnerRequest, fidl::Error>;
2553
2554 fn poll_next(
2555 mut self: std::pin::Pin<&mut Self>,
2556 cx: &mut std::task::Context<'_>,
2557 ) -> std::task::Poll<Option<Self::Item>> {
2558 let this = &mut *self;
2559 if this.inner.check_shutdown(cx) {
2560 this.is_terminated = true;
2561 return std::task::Poll::Ready(None);
2562 }
2563 if this.is_terminated {
2564 panic!("polled ElementRunnerRequestStream after completion");
2565 }
2566 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2567 |bytes, handles| {
2568 match this.inner.channel().read_etc(cx, bytes, handles) {
2569 std::task::Poll::Ready(Ok(())) => {}
2570 std::task::Poll::Pending => return std::task::Poll::Pending,
2571 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2572 this.is_terminated = true;
2573 return std::task::Poll::Ready(None);
2574 }
2575 std::task::Poll::Ready(Err(e)) => {
2576 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2577 e.into(),
2578 ))))
2579 }
2580 }
2581
2582 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2584
2585 std::task::Poll::Ready(Some(match header.ordinal {
2586 0x11a93092b228f0b => {
2587 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2588 let mut req = fidl::new_empty!(
2589 ElementRunnerSetLevelRequest,
2590 fidl::encoding::DefaultFuchsiaResourceDialect
2591 );
2592 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementRunnerSetLevelRequest>(&header, _body_bytes, handles, &mut req)?;
2593 let control_handle =
2594 ElementRunnerControlHandle { inner: this.inner.clone() };
2595 Ok(ElementRunnerRequest::SetLevel {
2596 level: req.level,
2597
2598 responder: ElementRunnerSetLevelResponder {
2599 control_handle: std::mem::ManuallyDrop::new(control_handle),
2600 tx_id: header.tx_id,
2601 },
2602 })
2603 }
2604 _ if header.tx_id == 0
2605 && header
2606 .dynamic_flags()
2607 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2608 {
2609 Ok(ElementRunnerRequest::_UnknownMethod {
2610 ordinal: header.ordinal,
2611 control_handle: ElementRunnerControlHandle {
2612 inner: this.inner.clone(),
2613 },
2614 method_type: fidl::MethodType::OneWay,
2615 })
2616 }
2617 _ if header
2618 .dynamic_flags()
2619 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2620 {
2621 this.inner.send_framework_err(
2622 fidl::encoding::FrameworkErr::UnknownMethod,
2623 header.tx_id,
2624 header.ordinal,
2625 header.dynamic_flags(),
2626 (bytes, handles),
2627 )?;
2628 Ok(ElementRunnerRequest::_UnknownMethod {
2629 ordinal: header.ordinal,
2630 control_handle: ElementRunnerControlHandle {
2631 inner: this.inner.clone(),
2632 },
2633 method_type: fidl::MethodType::TwoWay,
2634 })
2635 }
2636 _ => Err(fidl::Error::UnknownOrdinal {
2637 ordinal: header.ordinal,
2638 protocol_name:
2639 <ElementRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2640 }),
2641 }))
2642 },
2643 )
2644 }
2645}
2646
2647#[derive(Debug)]
2653pub enum ElementRunnerRequest {
2654 SetLevel { level: u8, responder: ElementRunnerSetLevelResponder },
2661 #[non_exhaustive]
2663 _UnknownMethod {
2664 ordinal: u64,
2666 control_handle: ElementRunnerControlHandle,
2667 method_type: fidl::MethodType,
2668 },
2669}
2670
2671impl ElementRunnerRequest {
2672 #[allow(irrefutable_let_patterns)]
2673 pub fn into_set_level(self) -> Option<(u8, ElementRunnerSetLevelResponder)> {
2674 if let ElementRunnerRequest::SetLevel { level, responder } = self {
2675 Some((level, responder))
2676 } else {
2677 None
2678 }
2679 }
2680
2681 pub fn method_name(&self) -> &'static str {
2683 match *self {
2684 ElementRunnerRequest::SetLevel { .. } => "set_level",
2685 ElementRunnerRequest::_UnknownMethod {
2686 method_type: fidl::MethodType::OneWay, ..
2687 } => "unknown one-way method",
2688 ElementRunnerRequest::_UnknownMethod {
2689 method_type: fidl::MethodType::TwoWay, ..
2690 } => "unknown two-way method",
2691 }
2692 }
2693}
2694
2695#[derive(Debug, Clone)]
2696pub struct ElementRunnerControlHandle {
2697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2698}
2699
2700impl fidl::endpoints::ControlHandle for ElementRunnerControlHandle {
2701 fn shutdown(&self) {
2702 self.inner.shutdown()
2703 }
2704 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2705 self.inner.shutdown_with_epitaph(status)
2706 }
2707
2708 fn is_closed(&self) -> bool {
2709 self.inner.channel().is_closed()
2710 }
2711 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2712 self.inner.channel().on_closed()
2713 }
2714
2715 #[cfg(target_os = "fuchsia")]
2716 fn signal_peer(
2717 &self,
2718 clear_mask: zx::Signals,
2719 set_mask: zx::Signals,
2720 ) -> Result<(), zx_status::Status> {
2721 use fidl::Peered;
2722 self.inner.channel().signal_peer(clear_mask, set_mask)
2723 }
2724}
2725
2726impl ElementRunnerControlHandle {}
2727
2728#[must_use = "FIDL methods require a response to be sent"]
2729#[derive(Debug)]
2730pub struct ElementRunnerSetLevelResponder {
2731 control_handle: std::mem::ManuallyDrop<ElementRunnerControlHandle>,
2732 tx_id: u32,
2733}
2734
2735impl std::ops::Drop for ElementRunnerSetLevelResponder {
2739 fn drop(&mut self) {
2740 self.control_handle.shutdown();
2741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2743 }
2744}
2745
2746impl fidl::endpoints::Responder for ElementRunnerSetLevelResponder {
2747 type ControlHandle = ElementRunnerControlHandle;
2748
2749 fn control_handle(&self) -> &ElementRunnerControlHandle {
2750 &self.control_handle
2751 }
2752
2753 fn drop_without_shutdown(mut self) {
2754 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2756 std::mem::forget(self);
2758 }
2759}
2760
2761impl ElementRunnerSetLevelResponder {
2762 pub fn send(self) -> Result<(), fidl::Error> {
2766 let _result = self.send_raw();
2767 if _result.is_err() {
2768 self.control_handle.shutdown();
2769 }
2770 self.drop_without_shutdown();
2771 _result
2772 }
2773
2774 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2776 let _result = self.send_raw();
2777 self.drop_without_shutdown();
2778 _result
2779 }
2780
2781 fn send_raw(&self) -> Result<(), fidl::Error> {
2782 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2783 fidl::encoding::Flexible::new(()),
2784 self.tx_id,
2785 0x11a93092b228f0b,
2786 fidl::encoding::DynamicFlags::FLEXIBLE,
2787 )
2788 }
2789}
2790
2791#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2792pub struct LeaseControlMarker;
2793
2794impl fidl::endpoints::ProtocolMarker for LeaseControlMarker {
2795 type Proxy = LeaseControlProxy;
2796 type RequestStream = LeaseControlRequestStream;
2797 #[cfg(target_os = "fuchsia")]
2798 type SynchronousProxy = LeaseControlSynchronousProxy;
2799
2800 const DEBUG_NAME: &'static str = "(anonymous) LeaseControl";
2801}
2802
2803pub trait LeaseControlProxyInterface: Send + Sync {
2804 type WatchStatusResponseFut: std::future::Future<Output = Result<LeaseStatus, fidl::Error>>
2805 + Send;
2806 fn r#watch_status(&self, last_status: LeaseStatus) -> Self::WatchStatusResponseFut;
2807}
2808#[derive(Debug)]
2809#[cfg(target_os = "fuchsia")]
2810pub struct LeaseControlSynchronousProxy {
2811 client: fidl::client::sync::Client,
2812}
2813
2814#[cfg(target_os = "fuchsia")]
2815impl fidl::endpoints::SynchronousProxy for LeaseControlSynchronousProxy {
2816 type Proxy = LeaseControlProxy;
2817 type Protocol = LeaseControlMarker;
2818
2819 fn from_channel(inner: fidl::Channel) -> Self {
2820 Self::new(inner)
2821 }
2822
2823 fn into_channel(self) -> fidl::Channel {
2824 self.client.into_channel()
2825 }
2826
2827 fn as_channel(&self) -> &fidl::Channel {
2828 self.client.as_channel()
2829 }
2830}
2831
2832#[cfg(target_os = "fuchsia")]
2833impl LeaseControlSynchronousProxy {
2834 pub fn new(channel: fidl::Channel) -> Self {
2835 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2836 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2837 }
2838
2839 pub fn into_channel(self) -> fidl::Channel {
2840 self.client.into_channel()
2841 }
2842
2843 pub fn wait_for_event(
2846 &self,
2847 deadline: zx::MonotonicInstant,
2848 ) -> Result<LeaseControlEvent, fidl::Error> {
2849 LeaseControlEvent::decode(self.client.wait_for_event(deadline)?)
2850 }
2851
2852 pub fn r#watch_status(
2857 &self,
2858 mut last_status: LeaseStatus,
2859 ___deadline: zx::MonotonicInstant,
2860 ) -> Result<LeaseStatus, fidl::Error> {
2861 let _response = self.client.send_query::<
2862 LeaseControlWatchStatusRequest,
2863 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2864 >(
2865 (last_status,),
2866 0x293ab9b0301ca881,
2867 fidl::encoding::DynamicFlags::FLEXIBLE,
2868 ___deadline,
2869 )?
2870 .into_result::<LeaseControlMarker>("watch_status")?;
2871 Ok(_response.status)
2872 }
2873}
2874
2875#[cfg(target_os = "fuchsia")]
2876impl From<LeaseControlSynchronousProxy> for zx::Handle {
2877 fn from(value: LeaseControlSynchronousProxy) -> Self {
2878 value.into_channel().into()
2879 }
2880}
2881
2882#[cfg(target_os = "fuchsia")]
2883impl From<fidl::Channel> for LeaseControlSynchronousProxy {
2884 fn from(value: fidl::Channel) -> Self {
2885 Self::new(value)
2886 }
2887}
2888
2889#[cfg(target_os = "fuchsia")]
2890impl fidl::endpoints::FromClient for LeaseControlSynchronousProxy {
2891 type Protocol = LeaseControlMarker;
2892
2893 fn from_client(value: fidl::endpoints::ClientEnd<LeaseControlMarker>) -> Self {
2894 Self::new(value.into_channel())
2895 }
2896}
2897
2898#[derive(Debug, Clone)]
2899pub struct LeaseControlProxy {
2900 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2901}
2902
2903impl fidl::endpoints::Proxy for LeaseControlProxy {
2904 type Protocol = LeaseControlMarker;
2905
2906 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2907 Self::new(inner)
2908 }
2909
2910 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2911 self.client.into_channel().map_err(|client| Self { client })
2912 }
2913
2914 fn as_channel(&self) -> &::fidl::AsyncChannel {
2915 self.client.as_channel()
2916 }
2917}
2918
2919impl LeaseControlProxy {
2920 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2922 let protocol_name = <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2923 Self { client: fidl::client::Client::new(channel, protocol_name) }
2924 }
2925
2926 pub fn take_event_stream(&self) -> LeaseControlEventStream {
2932 LeaseControlEventStream { event_receiver: self.client.take_event_receiver() }
2933 }
2934
2935 pub fn r#watch_status(
2940 &self,
2941 mut last_status: LeaseStatus,
2942 ) -> fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2943 {
2944 LeaseControlProxyInterface::r#watch_status(self, last_status)
2945 }
2946}
2947
2948impl LeaseControlProxyInterface for LeaseControlProxy {
2949 type WatchStatusResponseFut =
2950 fidl::client::QueryResponseFut<LeaseStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
2951 fn r#watch_status(&self, mut last_status: LeaseStatus) -> Self::WatchStatusResponseFut {
2952 fn _decode(
2953 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2954 ) -> Result<LeaseStatus, fidl::Error> {
2955 let _response = fidl::client::decode_transaction_body::<
2956 fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>,
2957 fidl::encoding::DefaultFuchsiaResourceDialect,
2958 0x293ab9b0301ca881,
2959 >(_buf?)?
2960 .into_result::<LeaseControlMarker>("watch_status")?;
2961 Ok(_response.status)
2962 }
2963 self.client.send_query_and_decode::<LeaseControlWatchStatusRequest, LeaseStatus>(
2964 (last_status,),
2965 0x293ab9b0301ca881,
2966 fidl::encoding::DynamicFlags::FLEXIBLE,
2967 _decode,
2968 )
2969 }
2970}
2971
2972pub struct LeaseControlEventStream {
2973 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2974}
2975
2976impl std::marker::Unpin for LeaseControlEventStream {}
2977
2978impl futures::stream::FusedStream for LeaseControlEventStream {
2979 fn is_terminated(&self) -> bool {
2980 self.event_receiver.is_terminated()
2981 }
2982}
2983
2984impl futures::Stream for LeaseControlEventStream {
2985 type Item = Result<LeaseControlEvent, fidl::Error>;
2986
2987 fn poll_next(
2988 mut self: std::pin::Pin<&mut Self>,
2989 cx: &mut std::task::Context<'_>,
2990 ) -> std::task::Poll<Option<Self::Item>> {
2991 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2992 &mut self.event_receiver,
2993 cx
2994 )?) {
2995 Some(buf) => std::task::Poll::Ready(Some(LeaseControlEvent::decode(buf))),
2996 None => std::task::Poll::Ready(None),
2997 }
2998 }
2999}
3000
3001#[derive(Debug)]
3002pub enum LeaseControlEvent {
3003 #[non_exhaustive]
3004 _UnknownEvent {
3005 ordinal: u64,
3007 },
3008}
3009
3010impl LeaseControlEvent {
3011 fn decode(
3013 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3014 ) -> Result<LeaseControlEvent, fidl::Error> {
3015 let (bytes, _handles) = buf.split_mut();
3016 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3017 debug_assert_eq!(tx_header.tx_id, 0);
3018 match tx_header.ordinal {
3019 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3020 Ok(LeaseControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3021 }
3022 _ => Err(fidl::Error::UnknownOrdinal {
3023 ordinal: tx_header.ordinal,
3024 protocol_name: <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3025 }),
3026 }
3027 }
3028}
3029
3030pub struct LeaseControlRequestStream {
3032 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3033 is_terminated: bool,
3034}
3035
3036impl std::marker::Unpin for LeaseControlRequestStream {}
3037
3038impl futures::stream::FusedStream for LeaseControlRequestStream {
3039 fn is_terminated(&self) -> bool {
3040 self.is_terminated
3041 }
3042}
3043
3044impl fidl::endpoints::RequestStream for LeaseControlRequestStream {
3045 type Protocol = LeaseControlMarker;
3046 type ControlHandle = LeaseControlControlHandle;
3047
3048 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3049 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3050 }
3051
3052 fn control_handle(&self) -> Self::ControlHandle {
3053 LeaseControlControlHandle { inner: self.inner.clone() }
3054 }
3055
3056 fn into_inner(
3057 self,
3058 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3059 {
3060 (self.inner, self.is_terminated)
3061 }
3062
3063 fn from_inner(
3064 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3065 is_terminated: bool,
3066 ) -> Self {
3067 Self { inner, is_terminated }
3068 }
3069}
3070
3071impl futures::Stream for LeaseControlRequestStream {
3072 type Item = Result<LeaseControlRequest, fidl::Error>;
3073
3074 fn poll_next(
3075 mut self: std::pin::Pin<&mut Self>,
3076 cx: &mut std::task::Context<'_>,
3077 ) -> std::task::Poll<Option<Self::Item>> {
3078 let this = &mut *self;
3079 if this.inner.check_shutdown(cx) {
3080 this.is_terminated = true;
3081 return std::task::Poll::Ready(None);
3082 }
3083 if this.is_terminated {
3084 panic!("polled LeaseControlRequestStream after completion");
3085 }
3086 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3087 |bytes, handles| {
3088 match this.inner.channel().read_etc(cx, bytes, handles) {
3089 std::task::Poll::Ready(Ok(())) => {}
3090 std::task::Poll::Pending => return std::task::Poll::Pending,
3091 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3092 this.is_terminated = true;
3093 return std::task::Poll::Ready(None);
3094 }
3095 std::task::Poll::Ready(Err(e)) => {
3096 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3097 e.into(),
3098 ))))
3099 }
3100 }
3101
3102 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3104
3105 std::task::Poll::Ready(Some(match header.ordinal {
3106 0x293ab9b0301ca881 => {
3107 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3108 let mut req = fidl::new_empty!(
3109 LeaseControlWatchStatusRequest,
3110 fidl::encoding::DefaultFuchsiaResourceDialect
3111 );
3112 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LeaseControlWatchStatusRequest>(&header, _body_bytes, handles, &mut req)?;
3113 let control_handle =
3114 LeaseControlControlHandle { inner: this.inner.clone() };
3115 Ok(LeaseControlRequest::WatchStatus {
3116 last_status: req.last_status,
3117
3118 responder: LeaseControlWatchStatusResponder {
3119 control_handle: std::mem::ManuallyDrop::new(control_handle),
3120 tx_id: header.tx_id,
3121 },
3122 })
3123 }
3124 _ if header.tx_id == 0
3125 && header
3126 .dynamic_flags()
3127 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3128 {
3129 Ok(LeaseControlRequest::_UnknownMethod {
3130 ordinal: header.ordinal,
3131 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
3132 method_type: fidl::MethodType::OneWay,
3133 })
3134 }
3135 _ if header
3136 .dynamic_flags()
3137 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3138 {
3139 this.inner.send_framework_err(
3140 fidl::encoding::FrameworkErr::UnknownMethod,
3141 header.tx_id,
3142 header.ordinal,
3143 header.dynamic_flags(),
3144 (bytes, handles),
3145 )?;
3146 Ok(LeaseControlRequest::_UnknownMethod {
3147 ordinal: header.ordinal,
3148 control_handle: LeaseControlControlHandle { inner: this.inner.clone() },
3149 method_type: fidl::MethodType::TwoWay,
3150 })
3151 }
3152 _ => Err(fidl::Error::UnknownOrdinal {
3153 ordinal: header.ordinal,
3154 protocol_name:
3155 <LeaseControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3156 }),
3157 }))
3158 },
3159 )
3160 }
3161}
3162
3163#[derive(Debug)]
3168pub enum LeaseControlRequest {
3169 WatchStatus { last_status: LeaseStatus, responder: LeaseControlWatchStatusResponder },
3174 #[non_exhaustive]
3176 _UnknownMethod {
3177 ordinal: u64,
3179 control_handle: LeaseControlControlHandle,
3180 method_type: fidl::MethodType,
3181 },
3182}
3183
3184impl LeaseControlRequest {
3185 #[allow(irrefutable_let_patterns)]
3186 pub fn into_watch_status(self) -> Option<(LeaseStatus, LeaseControlWatchStatusResponder)> {
3187 if let LeaseControlRequest::WatchStatus { last_status, responder } = self {
3188 Some((last_status, responder))
3189 } else {
3190 None
3191 }
3192 }
3193
3194 pub fn method_name(&self) -> &'static str {
3196 match *self {
3197 LeaseControlRequest::WatchStatus { .. } => "watch_status",
3198 LeaseControlRequest::_UnknownMethod {
3199 method_type: fidl::MethodType::OneWay, ..
3200 } => "unknown one-way method",
3201 LeaseControlRequest::_UnknownMethod {
3202 method_type: fidl::MethodType::TwoWay, ..
3203 } => "unknown two-way method",
3204 }
3205 }
3206}
3207
3208#[derive(Debug, Clone)]
3209pub struct LeaseControlControlHandle {
3210 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3211}
3212
3213impl fidl::endpoints::ControlHandle for LeaseControlControlHandle {
3214 fn shutdown(&self) {
3215 self.inner.shutdown()
3216 }
3217 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3218 self.inner.shutdown_with_epitaph(status)
3219 }
3220
3221 fn is_closed(&self) -> bool {
3222 self.inner.channel().is_closed()
3223 }
3224 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3225 self.inner.channel().on_closed()
3226 }
3227
3228 #[cfg(target_os = "fuchsia")]
3229 fn signal_peer(
3230 &self,
3231 clear_mask: zx::Signals,
3232 set_mask: zx::Signals,
3233 ) -> Result<(), zx_status::Status> {
3234 use fidl::Peered;
3235 self.inner.channel().signal_peer(clear_mask, set_mask)
3236 }
3237}
3238
3239impl LeaseControlControlHandle {}
3240
3241#[must_use = "FIDL methods require a response to be sent"]
3242#[derive(Debug)]
3243pub struct LeaseControlWatchStatusResponder {
3244 control_handle: std::mem::ManuallyDrop<LeaseControlControlHandle>,
3245 tx_id: u32,
3246}
3247
3248impl std::ops::Drop for LeaseControlWatchStatusResponder {
3252 fn drop(&mut self) {
3253 self.control_handle.shutdown();
3254 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3256 }
3257}
3258
3259impl fidl::endpoints::Responder for LeaseControlWatchStatusResponder {
3260 type ControlHandle = LeaseControlControlHandle;
3261
3262 fn control_handle(&self) -> &LeaseControlControlHandle {
3263 &self.control_handle
3264 }
3265
3266 fn drop_without_shutdown(mut self) {
3267 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3269 std::mem::forget(self);
3271 }
3272}
3273
3274impl LeaseControlWatchStatusResponder {
3275 pub fn send(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
3279 let _result = self.send_raw(status);
3280 if _result.is_err() {
3281 self.control_handle.shutdown();
3282 }
3283 self.drop_without_shutdown();
3284 _result
3285 }
3286
3287 pub fn send_no_shutdown_on_err(self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
3289 let _result = self.send_raw(status);
3290 self.drop_without_shutdown();
3291 _result
3292 }
3293
3294 fn send_raw(&self, mut status: LeaseStatus) -> Result<(), fidl::Error> {
3295 self.control_handle
3296 .inner
3297 .send::<fidl::encoding::FlexibleType<LeaseControlWatchStatusResponse>>(
3298 fidl::encoding::Flexible::new((status,)),
3299 self.tx_id,
3300 0x293ab9b0301ca881,
3301 fidl::encoding::DynamicFlags::FLEXIBLE,
3302 )
3303 }
3304}
3305
3306#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3307pub struct LessorMarker;
3308
3309impl fidl::endpoints::ProtocolMarker for LessorMarker {
3310 type Proxy = LessorProxy;
3311 type RequestStream = LessorRequestStream;
3312 #[cfg(target_os = "fuchsia")]
3313 type SynchronousProxy = LessorSynchronousProxy;
3314
3315 const DEBUG_NAME: &'static str = "(anonymous) Lessor";
3316}
3317pub type LessorLeaseResult = Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>;
3318
3319pub trait LessorProxyInterface: Send + Sync {
3320 type LeaseResponseFut: std::future::Future<Output = Result<LessorLeaseResult, fidl::Error>>
3321 + Send;
3322 fn r#lease(&self, level: u8) -> Self::LeaseResponseFut;
3323}
3324#[derive(Debug)]
3325#[cfg(target_os = "fuchsia")]
3326pub struct LessorSynchronousProxy {
3327 client: fidl::client::sync::Client,
3328}
3329
3330#[cfg(target_os = "fuchsia")]
3331impl fidl::endpoints::SynchronousProxy for LessorSynchronousProxy {
3332 type Proxy = LessorProxy;
3333 type Protocol = LessorMarker;
3334
3335 fn from_channel(inner: fidl::Channel) -> Self {
3336 Self::new(inner)
3337 }
3338
3339 fn into_channel(self) -> fidl::Channel {
3340 self.client.into_channel()
3341 }
3342
3343 fn as_channel(&self) -> &fidl::Channel {
3344 self.client.as_channel()
3345 }
3346}
3347
3348#[cfg(target_os = "fuchsia")]
3349impl LessorSynchronousProxy {
3350 pub fn new(channel: fidl::Channel) -> Self {
3351 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3352 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3353 }
3354
3355 pub fn into_channel(self) -> fidl::Channel {
3356 self.client.into_channel()
3357 }
3358
3359 pub fn wait_for_event(
3362 &self,
3363 deadline: zx::MonotonicInstant,
3364 ) -> Result<LessorEvent, fidl::Error> {
3365 LessorEvent::decode(self.client.wait_for_event(deadline)?)
3366 }
3367
3368 pub fn r#lease(
3377 &self,
3378 mut level: u8,
3379 ___deadline: zx::MonotonicInstant,
3380 ) -> Result<LessorLeaseResult, fidl::Error> {
3381 let _response = self.client.send_query::<
3382 LessorLeaseRequest,
3383 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
3384 >(
3385 (level,),
3386 0x38999f84b2f1f9ad,
3387 fidl::encoding::DynamicFlags::FLEXIBLE,
3388 ___deadline,
3389 )?
3390 .into_result::<LessorMarker>("lease")?;
3391 Ok(_response.map(|x| x.lease_control))
3392 }
3393}
3394
3395#[cfg(target_os = "fuchsia")]
3396impl From<LessorSynchronousProxy> for zx::Handle {
3397 fn from(value: LessorSynchronousProxy) -> Self {
3398 value.into_channel().into()
3399 }
3400}
3401
3402#[cfg(target_os = "fuchsia")]
3403impl From<fidl::Channel> for LessorSynchronousProxy {
3404 fn from(value: fidl::Channel) -> Self {
3405 Self::new(value)
3406 }
3407}
3408
3409#[cfg(target_os = "fuchsia")]
3410impl fidl::endpoints::FromClient for LessorSynchronousProxy {
3411 type Protocol = LessorMarker;
3412
3413 fn from_client(value: fidl::endpoints::ClientEnd<LessorMarker>) -> Self {
3414 Self::new(value.into_channel())
3415 }
3416}
3417
3418#[derive(Debug, Clone)]
3419pub struct LessorProxy {
3420 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3421}
3422
3423impl fidl::endpoints::Proxy for LessorProxy {
3424 type Protocol = LessorMarker;
3425
3426 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3427 Self::new(inner)
3428 }
3429
3430 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3431 self.client.into_channel().map_err(|client| Self { client })
3432 }
3433
3434 fn as_channel(&self) -> &::fidl::AsyncChannel {
3435 self.client.as_channel()
3436 }
3437}
3438
3439impl LessorProxy {
3440 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3442 let protocol_name = <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3443 Self { client: fidl::client::Client::new(channel, protocol_name) }
3444 }
3445
3446 pub fn take_event_stream(&self) -> LessorEventStream {
3452 LessorEventStream { event_receiver: self.client.take_event_receiver() }
3453 }
3454
3455 pub fn r#lease(
3464 &self,
3465 mut level: u8,
3466 ) -> fidl::client::QueryResponseFut<
3467 LessorLeaseResult,
3468 fidl::encoding::DefaultFuchsiaResourceDialect,
3469 > {
3470 LessorProxyInterface::r#lease(self, level)
3471 }
3472}
3473
3474impl LessorProxyInterface for LessorProxy {
3475 type LeaseResponseFut = fidl::client::QueryResponseFut<
3476 LessorLeaseResult,
3477 fidl::encoding::DefaultFuchsiaResourceDialect,
3478 >;
3479 fn r#lease(&self, mut level: u8) -> Self::LeaseResponseFut {
3480 fn _decode(
3481 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3482 ) -> Result<LessorLeaseResult, fidl::Error> {
3483 let _response = fidl::client::decode_transaction_body::<
3484 fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>,
3485 fidl::encoding::DefaultFuchsiaResourceDialect,
3486 0x38999f84b2f1f9ad,
3487 >(_buf?)?
3488 .into_result::<LessorMarker>("lease")?;
3489 Ok(_response.map(|x| x.lease_control))
3490 }
3491 self.client.send_query_and_decode::<LessorLeaseRequest, LessorLeaseResult>(
3492 (level,),
3493 0x38999f84b2f1f9ad,
3494 fidl::encoding::DynamicFlags::FLEXIBLE,
3495 _decode,
3496 )
3497 }
3498}
3499
3500pub struct LessorEventStream {
3501 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3502}
3503
3504impl std::marker::Unpin for LessorEventStream {}
3505
3506impl futures::stream::FusedStream for LessorEventStream {
3507 fn is_terminated(&self) -> bool {
3508 self.event_receiver.is_terminated()
3509 }
3510}
3511
3512impl futures::Stream for LessorEventStream {
3513 type Item = Result<LessorEvent, fidl::Error>;
3514
3515 fn poll_next(
3516 mut self: std::pin::Pin<&mut Self>,
3517 cx: &mut std::task::Context<'_>,
3518 ) -> std::task::Poll<Option<Self::Item>> {
3519 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3520 &mut self.event_receiver,
3521 cx
3522 )?) {
3523 Some(buf) => std::task::Poll::Ready(Some(LessorEvent::decode(buf))),
3524 None => std::task::Poll::Ready(None),
3525 }
3526 }
3527}
3528
3529#[derive(Debug)]
3530pub enum LessorEvent {
3531 #[non_exhaustive]
3532 _UnknownEvent {
3533 ordinal: u64,
3535 },
3536}
3537
3538impl LessorEvent {
3539 fn decode(
3541 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3542 ) -> Result<LessorEvent, fidl::Error> {
3543 let (bytes, _handles) = buf.split_mut();
3544 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3545 debug_assert_eq!(tx_header.tx_id, 0);
3546 match tx_header.ordinal {
3547 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3548 Ok(LessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3549 }
3550 _ => Err(fidl::Error::UnknownOrdinal {
3551 ordinal: tx_header.ordinal,
3552 protocol_name: <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3553 }),
3554 }
3555 }
3556}
3557
3558pub struct LessorRequestStream {
3560 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3561 is_terminated: bool,
3562}
3563
3564impl std::marker::Unpin for LessorRequestStream {}
3565
3566impl futures::stream::FusedStream for LessorRequestStream {
3567 fn is_terminated(&self) -> bool {
3568 self.is_terminated
3569 }
3570}
3571
3572impl fidl::endpoints::RequestStream for LessorRequestStream {
3573 type Protocol = LessorMarker;
3574 type ControlHandle = LessorControlHandle;
3575
3576 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3577 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3578 }
3579
3580 fn control_handle(&self) -> Self::ControlHandle {
3581 LessorControlHandle { inner: self.inner.clone() }
3582 }
3583
3584 fn into_inner(
3585 self,
3586 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3587 {
3588 (self.inner, self.is_terminated)
3589 }
3590
3591 fn from_inner(
3592 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3593 is_terminated: bool,
3594 ) -> Self {
3595 Self { inner, is_terminated }
3596 }
3597}
3598
3599impl futures::Stream for LessorRequestStream {
3600 type Item = Result<LessorRequest, fidl::Error>;
3601
3602 fn poll_next(
3603 mut self: std::pin::Pin<&mut Self>,
3604 cx: &mut std::task::Context<'_>,
3605 ) -> std::task::Poll<Option<Self::Item>> {
3606 let this = &mut *self;
3607 if this.inner.check_shutdown(cx) {
3608 this.is_terminated = true;
3609 return std::task::Poll::Ready(None);
3610 }
3611 if this.is_terminated {
3612 panic!("polled LessorRequestStream after completion");
3613 }
3614 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3615 |bytes, handles| {
3616 match this.inner.channel().read_etc(cx, bytes, handles) {
3617 std::task::Poll::Ready(Ok(())) => {}
3618 std::task::Poll::Pending => return std::task::Poll::Pending,
3619 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3620 this.is_terminated = true;
3621 return std::task::Poll::Ready(None);
3622 }
3623 std::task::Poll::Ready(Err(e)) => {
3624 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3625 e.into(),
3626 ))))
3627 }
3628 }
3629
3630 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3632
3633 std::task::Poll::Ready(Some(match header.ordinal {
3634 0x38999f84b2f1f9ad => {
3635 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3636 let mut req = fidl::new_empty!(
3637 LessorLeaseRequest,
3638 fidl::encoding::DefaultFuchsiaResourceDialect
3639 );
3640 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LessorLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
3641 let control_handle = LessorControlHandle { inner: this.inner.clone() };
3642 Ok(LessorRequest::Lease {
3643 level: req.level,
3644
3645 responder: LessorLeaseResponder {
3646 control_handle: std::mem::ManuallyDrop::new(control_handle),
3647 tx_id: header.tx_id,
3648 },
3649 })
3650 }
3651 _ if header.tx_id == 0
3652 && header
3653 .dynamic_flags()
3654 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3655 {
3656 Ok(LessorRequest::_UnknownMethod {
3657 ordinal: header.ordinal,
3658 control_handle: LessorControlHandle { inner: this.inner.clone() },
3659 method_type: fidl::MethodType::OneWay,
3660 })
3661 }
3662 _ if header
3663 .dynamic_flags()
3664 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3665 {
3666 this.inner.send_framework_err(
3667 fidl::encoding::FrameworkErr::UnknownMethod,
3668 header.tx_id,
3669 header.ordinal,
3670 header.dynamic_flags(),
3671 (bytes, handles),
3672 )?;
3673 Ok(LessorRequest::_UnknownMethod {
3674 ordinal: header.ordinal,
3675 control_handle: LessorControlHandle { inner: this.inner.clone() },
3676 method_type: fidl::MethodType::TwoWay,
3677 })
3678 }
3679 _ => Err(fidl::Error::UnknownOrdinal {
3680 ordinal: header.ordinal,
3681 protocol_name:
3682 <LessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3683 }),
3684 }))
3685 },
3686 )
3687 }
3688}
3689
3690#[derive(Debug)]
3693pub enum LessorRequest {
3694 Lease { level: u8, responder: LessorLeaseResponder },
3703 #[non_exhaustive]
3705 _UnknownMethod {
3706 ordinal: u64,
3708 control_handle: LessorControlHandle,
3709 method_type: fidl::MethodType,
3710 },
3711}
3712
3713impl LessorRequest {
3714 #[allow(irrefutable_let_patterns)]
3715 pub fn into_lease(self) -> Option<(u8, LessorLeaseResponder)> {
3716 if let LessorRequest::Lease { level, responder } = self {
3717 Some((level, responder))
3718 } else {
3719 None
3720 }
3721 }
3722
3723 pub fn method_name(&self) -> &'static str {
3725 match *self {
3726 LessorRequest::Lease { .. } => "lease",
3727 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3728 "unknown one-way method"
3729 }
3730 LessorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3731 "unknown two-way method"
3732 }
3733 }
3734 }
3735}
3736
3737#[derive(Debug, Clone)]
3738pub struct LessorControlHandle {
3739 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3740}
3741
3742impl fidl::endpoints::ControlHandle for LessorControlHandle {
3743 fn shutdown(&self) {
3744 self.inner.shutdown()
3745 }
3746 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3747 self.inner.shutdown_with_epitaph(status)
3748 }
3749
3750 fn is_closed(&self) -> bool {
3751 self.inner.channel().is_closed()
3752 }
3753 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3754 self.inner.channel().on_closed()
3755 }
3756
3757 #[cfg(target_os = "fuchsia")]
3758 fn signal_peer(
3759 &self,
3760 clear_mask: zx::Signals,
3761 set_mask: zx::Signals,
3762 ) -> Result<(), zx_status::Status> {
3763 use fidl::Peered;
3764 self.inner.channel().signal_peer(clear_mask, set_mask)
3765 }
3766}
3767
3768impl LessorControlHandle {}
3769
3770#[must_use = "FIDL methods require a response to be sent"]
3771#[derive(Debug)]
3772pub struct LessorLeaseResponder {
3773 control_handle: std::mem::ManuallyDrop<LessorControlHandle>,
3774 tx_id: u32,
3775}
3776
3777impl std::ops::Drop for LessorLeaseResponder {
3781 fn drop(&mut self) {
3782 self.control_handle.shutdown();
3783 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3785 }
3786}
3787
3788impl fidl::endpoints::Responder for LessorLeaseResponder {
3789 type ControlHandle = LessorControlHandle;
3790
3791 fn control_handle(&self) -> &LessorControlHandle {
3792 &self.control_handle
3793 }
3794
3795 fn drop_without_shutdown(mut self) {
3796 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3798 std::mem::forget(self);
3800 }
3801}
3802
3803impl LessorLeaseResponder {
3804 pub fn send(
3808 self,
3809 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3810 ) -> Result<(), fidl::Error> {
3811 let _result = self.send_raw(result);
3812 if _result.is_err() {
3813 self.control_handle.shutdown();
3814 }
3815 self.drop_without_shutdown();
3816 _result
3817 }
3818
3819 pub fn send_no_shutdown_on_err(
3821 self,
3822 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3823 ) -> Result<(), fidl::Error> {
3824 let _result = self.send_raw(result);
3825 self.drop_without_shutdown();
3826 _result
3827 }
3828
3829 fn send_raw(
3830 &self,
3831 mut result: Result<fidl::endpoints::ClientEnd<LeaseControlMarker>, LeaseError>,
3832 ) -> Result<(), fidl::Error> {
3833 self.control_handle
3834 .inner
3835 .send::<fidl::encoding::FlexibleResultType<LessorLeaseResponse, LeaseError>>(
3836 fidl::encoding::FlexibleResult::new(result.map(|lease_control| (lease_control,))),
3837 self.tx_id,
3838 0x38999f84b2f1f9ad,
3839 fidl::encoding::DynamicFlags::FLEXIBLE,
3840 )
3841 }
3842}
3843
3844#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3845pub struct RequiredLevelMarker;
3846
3847impl fidl::endpoints::ProtocolMarker for RequiredLevelMarker {
3848 type Proxy = RequiredLevelProxy;
3849 type RequestStream = RequiredLevelRequestStream;
3850 #[cfg(target_os = "fuchsia")]
3851 type SynchronousProxy = RequiredLevelSynchronousProxy;
3852
3853 const DEBUG_NAME: &'static str = "(anonymous) RequiredLevel";
3854}
3855pub type RequiredLevelWatchResult = Result<u8, RequiredLevelError>;
3856
3857pub trait RequiredLevelProxyInterface: Send + Sync {
3858 type WatchResponseFut: std::future::Future<Output = Result<RequiredLevelWatchResult, fidl::Error>>
3859 + Send;
3860 fn r#watch(&self) -> Self::WatchResponseFut;
3861}
3862#[derive(Debug)]
3863#[cfg(target_os = "fuchsia")]
3864pub struct RequiredLevelSynchronousProxy {
3865 client: fidl::client::sync::Client,
3866}
3867
3868#[cfg(target_os = "fuchsia")]
3869impl fidl::endpoints::SynchronousProxy for RequiredLevelSynchronousProxy {
3870 type Proxy = RequiredLevelProxy;
3871 type Protocol = RequiredLevelMarker;
3872
3873 fn from_channel(inner: fidl::Channel) -> Self {
3874 Self::new(inner)
3875 }
3876
3877 fn into_channel(self) -> fidl::Channel {
3878 self.client.into_channel()
3879 }
3880
3881 fn as_channel(&self) -> &fidl::Channel {
3882 self.client.as_channel()
3883 }
3884}
3885
3886#[cfg(target_os = "fuchsia")]
3887impl RequiredLevelSynchronousProxy {
3888 pub fn new(channel: fidl::Channel) -> Self {
3889 let protocol_name = <RequiredLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3890 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3891 }
3892
3893 pub fn into_channel(self) -> fidl::Channel {
3894 self.client.into_channel()
3895 }
3896
3897 pub fn wait_for_event(
3900 &self,
3901 deadline: zx::MonotonicInstant,
3902 ) -> Result<RequiredLevelEvent, fidl::Error> {
3903 RequiredLevelEvent::decode(self.client.wait_for_event(deadline)?)
3904 }
3905
3906 pub fn r#watch(
3910 &self,
3911 ___deadline: zx::MonotonicInstant,
3912 ) -> Result<RequiredLevelWatchResult, fidl::Error> {
3913 let _response = self.client.send_query::<
3914 fidl::encoding::EmptyPayload,
3915 fidl::encoding::FlexibleResultType<RequiredLevelWatchResponse, RequiredLevelError>,
3916 >(
3917 (),
3918 0x20e85a63450e0d7b,
3919 fidl::encoding::DynamicFlags::FLEXIBLE,
3920 ___deadline,
3921 )?
3922 .into_result::<RequiredLevelMarker>("watch")?;
3923 Ok(_response.map(|x| x.required_level))
3924 }
3925}
3926
3927#[cfg(target_os = "fuchsia")]
3928impl From<RequiredLevelSynchronousProxy> for zx::Handle {
3929 fn from(value: RequiredLevelSynchronousProxy) -> Self {
3930 value.into_channel().into()
3931 }
3932}
3933
3934#[cfg(target_os = "fuchsia")]
3935impl From<fidl::Channel> for RequiredLevelSynchronousProxy {
3936 fn from(value: fidl::Channel) -> Self {
3937 Self::new(value)
3938 }
3939}
3940
3941#[cfg(target_os = "fuchsia")]
3942impl fidl::endpoints::FromClient for RequiredLevelSynchronousProxy {
3943 type Protocol = RequiredLevelMarker;
3944
3945 fn from_client(value: fidl::endpoints::ClientEnd<RequiredLevelMarker>) -> Self {
3946 Self::new(value.into_channel())
3947 }
3948}
3949
3950#[derive(Debug, Clone)]
3951pub struct RequiredLevelProxy {
3952 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3953}
3954
3955impl fidl::endpoints::Proxy for RequiredLevelProxy {
3956 type Protocol = RequiredLevelMarker;
3957
3958 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3959 Self::new(inner)
3960 }
3961
3962 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3963 self.client.into_channel().map_err(|client| Self { client })
3964 }
3965
3966 fn as_channel(&self) -> &::fidl::AsyncChannel {
3967 self.client.as_channel()
3968 }
3969}
3970
3971impl RequiredLevelProxy {
3972 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3974 let protocol_name = <RequiredLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3975 Self { client: fidl::client::Client::new(channel, protocol_name) }
3976 }
3977
3978 pub fn take_event_stream(&self) -> RequiredLevelEventStream {
3984 RequiredLevelEventStream { event_receiver: self.client.take_event_receiver() }
3985 }
3986
3987 pub fn r#watch(
3991 &self,
3992 ) -> fidl::client::QueryResponseFut<
3993 RequiredLevelWatchResult,
3994 fidl::encoding::DefaultFuchsiaResourceDialect,
3995 > {
3996 RequiredLevelProxyInterface::r#watch(self)
3997 }
3998}
3999
4000impl RequiredLevelProxyInterface for RequiredLevelProxy {
4001 type WatchResponseFut = fidl::client::QueryResponseFut<
4002 RequiredLevelWatchResult,
4003 fidl::encoding::DefaultFuchsiaResourceDialect,
4004 >;
4005 fn r#watch(&self) -> Self::WatchResponseFut {
4006 fn _decode(
4007 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4008 ) -> Result<RequiredLevelWatchResult, fidl::Error> {
4009 let _response = fidl::client::decode_transaction_body::<
4010 fidl::encoding::FlexibleResultType<RequiredLevelWatchResponse, RequiredLevelError>,
4011 fidl::encoding::DefaultFuchsiaResourceDialect,
4012 0x20e85a63450e0d7b,
4013 >(_buf?)?
4014 .into_result::<RequiredLevelMarker>("watch")?;
4015 Ok(_response.map(|x| x.required_level))
4016 }
4017 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RequiredLevelWatchResult>(
4018 (),
4019 0x20e85a63450e0d7b,
4020 fidl::encoding::DynamicFlags::FLEXIBLE,
4021 _decode,
4022 )
4023 }
4024}
4025
4026pub struct RequiredLevelEventStream {
4027 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4028}
4029
4030impl std::marker::Unpin for RequiredLevelEventStream {}
4031
4032impl futures::stream::FusedStream for RequiredLevelEventStream {
4033 fn is_terminated(&self) -> bool {
4034 self.event_receiver.is_terminated()
4035 }
4036}
4037
4038impl futures::Stream for RequiredLevelEventStream {
4039 type Item = Result<RequiredLevelEvent, fidl::Error>;
4040
4041 fn poll_next(
4042 mut self: std::pin::Pin<&mut Self>,
4043 cx: &mut std::task::Context<'_>,
4044 ) -> std::task::Poll<Option<Self::Item>> {
4045 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4046 &mut self.event_receiver,
4047 cx
4048 )?) {
4049 Some(buf) => std::task::Poll::Ready(Some(RequiredLevelEvent::decode(buf))),
4050 None => std::task::Poll::Ready(None),
4051 }
4052 }
4053}
4054
4055#[derive(Debug)]
4056pub enum RequiredLevelEvent {
4057 #[non_exhaustive]
4058 _UnknownEvent {
4059 ordinal: u64,
4061 },
4062}
4063
4064impl RequiredLevelEvent {
4065 fn decode(
4067 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4068 ) -> Result<RequiredLevelEvent, fidl::Error> {
4069 let (bytes, _handles) = buf.split_mut();
4070 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4071 debug_assert_eq!(tx_header.tx_id, 0);
4072 match tx_header.ordinal {
4073 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4074 Ok(RequiredLevelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4075 }
4076 _ => Err(fidl::Error::UnknownOrdinal {
4077 ordinal: tx_header.ordinal,
4078 protocol_name: <RequiredLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4079 }),
4080 }
4081 }
4082}
4083
4084pub struct RequiredLevelRequestStream {
4086 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4087 is_terminated: bool,
4088}
4089
4090impl std::marker::Unpin for RequiredLevelRequestStream {}
4091
4092impl futures::stream::FusedStream for RequiredLevelRequestStream {
4093 fn is_terminated(&self) -> bool {
4094 self.is_terminated
4095 }
4096}
4097
4098impl fidl::endpoints::RequestStream for RequiredLevelRequestStream {
4099 type Protocol = RequiredLevelMarker;
4100 type ControlHandle = RequiredLevelControlHandle;
4101
4102 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4103 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4104 }
4105
4106 fn control_handle(&self) -> Self::ControlHandle {
4107 RequiredLevelControlHandle { inner: self.inner.clone() }
4108 }
4109
4110 fn into_inner(
4111 self,
4112 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4113 {
4114 (self.inner, self.is_terminated)
4115 }
4116
4117 fn from_inner(
4118 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4119 is_terminated: bool,
4120 ) -> Self {
4121 Self { inner, is_terminated }
4122 }
4123}
4124
4125impl futures::Stream for RequiredLevelRequestStream {
4126 type Item = Result<RequiredLevelRequest, fidl::Error>;
4127
4128 fn poll_next(
4129 mut self: std::pin::Pin<&mut Self>,
4130 cx: &mut std::task::Context<'_>,
4131 ) -> std::task::Poll<Option<Self::Item>> {
4132 let this = &mut *self;
4133 if this.inner.check_shutdown(cx) {
4134 this.is_terminated = true;
4135 return std::task::Poll::Ready(None);
4136 }
4137 if this.is_terminated {
4138 panic!("polled RequiredLevelRequestStream after completion");
4139 }
4140 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4141 |bytes, handles| {
4142 match this.inner.channel().read_etc(cx, bytes, handles) {
4143 std::task::Poll::Ready(Ok(())) => {}
4144 std::task::Poll::Pending => return std::task::Poll::Pending,
4145 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4146 this.is_terminated = true;
4147 return std::task::Poll::Ready(None);
4148 }
4149 std::task::Poll::Ready(Err(e)) => {
4150 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4151 e.into(),
4152 ))))
4153 }
4154 }
4155
4156 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4158
4159 std::task::Poll::Ready(Some(match header.ordinal {
4160 0x20e85a63450e0d7b => {
4161 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4162 let mut req = fidl::new_empty!(
4163 fidl::encoding::EmptyPayload,
4164 fidl::encoding::DefaultFuchsiaResourceDialect
4165 );
4166 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4167 let control_handle =
4168 RequiredLevelControlHandle { inner: this.inner.clone() };
4169 Ok(RequiredLevelRequest::Watch {
4170 responder: RequiredLevelWatchResponder {
4171 control_handle: std::mem::ManuallyDrop::new(control_handle),
4172 tx_id: header.tx_id,
4173 },
4174 })
4175 }
4176 _ if header.tx_id == 0
4177 && header
4178 .dynamic_flags()
4179 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4180 {
4181 Ok(RequiredLevelRequest::_UnknownMethod {
4182 ordinal: header.ordinal,
4183 control_handle: RequiredLevelControlHandle {
4184 inner: this.inner.clone(),
4185 },
4186 method_type: fidl::MethodType::OneWay,
4187 })
4188 }
4189 _ if header
4190 .dynamic_flags()
4191 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4192 {
4193 this.inner.send_framework_err(
4194 fidl::encoding::FrameworkErr::UnknownMethod,
4195 header.tx_id,
4196 header.ordinal,
4197 header.dynamic_flags(),
4198 (bytes, handles),
4199 )?;
4200 Ok(RequiredLevelRequest::_UnknownMethod {
4201 ordinal: header.ordinal,
4202 control_handle: RequiredLevelControlHandle {
4203 inner: this.inner.clone(),
4204 },
4205 method_type: fidl::MethodType::TwoWay,
4206 })
4207 }
4208 _ => Err(fidl::Error::UnknownOrdinal {
4209 ordinal: header.ordinal,
4210 protocol_name:
4211 <RequiredLevelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4212 }),
4213 }))
4214 },
4215 )
4216 }
4217}
4218
4219#[derive(Debug)]
4223pub enum RequiredLevelRequest {
4224 Watch { responder: RequiredLevelWatchResponder },
4228 #[non_exhaustive]
4230 _UnknownMethod {
4231 ordinal: u64,
4233 control_handle: RequiredLevelControlHandle,
4234 method_type: fidl::MethodType,
4235 },
4236}
4237
4238impl RequiredLevelRequest {
4239 #[allow(irrefutable_let_patterns)]
4240 pub fn into_watch(self) -> Option<(RequiredLevelWatchResponder)> {
4241 if let RequiredLevelRequest::Watch { responder } = self {
4242 Some((responder))
4243 } else {
4244 None
4245 }
4246 }
4247
4248 pub fn method_name(&self) -> &'static str {
4250 match *self {
4251 RequiredLevelRequest::Watch { .. } => "watch",
4252 RequiredLevelRequest::_UnknownMethod {
4253 method_type: fidl::MethodType::OneWay, ..
4254 } => "unknown one-way method",
4255 RequiredLevelRequest::_UnknownMethod {
4256 method_type: fidl::MethodType::TwoWay, ..
4257 } => "unknown two-way method",
4258 }
4259 }
4260}
4261
4262#[derive(Debug, Clone)]
4263pub struct RequiredLevelControlHandle {
4264 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4265}
4266
4267impl fidl::endpoints::ControlHandle for RequiredLevelControlHandle {
4268 fn shutdown(&self) {
4269 self.inner.shutdown()
4270 }
4271 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4272 self.inner.shutdown_with_epitaph(status)
4273 }
4274
4275 fn is_closed(&self) -> bool {
4276 self.inner.channel().is_closed()
4277 }
4278 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4279 self.inner.channel().on_closed()
4280 }
4281
4282 #[cfg(target_os = "fuchsia")]
4283 fn signal_peer(
4284 &self,
4285 clear_mask: zx::Signals,
4286 set_mask: zx::Signals,
4287 ) -> Result<(), zx_status::Status> {
4288 use fidl::Peered;
4289 self.inner.channel().signal_peer(clear_mask, set_mask)
4290 }
4291}
4292
4293impl RequiredLevelControlHandle {}
4294
4295#[must_use = "FIDL methods require a response to be sent"]
4296#[derive(Debug)]
4297pub struct RequiredLevelWatchResponder {
4298 control_handle: std::mem::ManuallyDrop<RequiredLevelControlHandle>,
4299 tx_id: u32,
4300}
4301
4302impl std::ops::Drop for RequiredLevelWatchResponder {
4306 fn drop(&mut self) {
4307 self.control_handle.shutdown();
4308 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4310 }
4311}
4312
4313impl fidl::endpoints::Responder for RequiredLevelWatchResponder {
4314 type ControlHandle = RequiredLevelControlHandle;
4315
4316 fn control_handle(&self) -> &RequiredLevelControlHandle {
4317 &self.control_handle
4318 }
4319
4320 fn drop_without_shutdown(mut self) {
4321 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4323 std::mem::forget(self);
4325 }
4326}
4327
4328impl RequiredLevelWatchResponder {
4329 pub fn send(self, mut result: Result<u8, RequiredLevelError>) -> Result<(), fidl::Error> {
4333 let _result = self.send_raw(result);
4334 if _result.is_err() {
4335 self.control_handle.shutdown();
4336 }
4337 self.drop_without_shutdown();
4338 _result
4339 }
4340
4341 pub fn send_no_shutdown_on_err(
4343 self,
4344 mut result: Result<u8, RequiredLevelError>,
4345 ) -> Result<(), fidl::Error> {
4346 let _result = self.send_raw(result);
4347 self.drop_without_shutdown();
4348 _result
4349 }
4350
4351 fn send_raw(&self, mut result: Result<u8, RequiredLevelError>) -> Result<(), fidl::Error> {
4352 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4353 RequiredLevelWatchResponse,
4354 RequiredLevelError,
4355 >>(
4356 fidl::encoding::FlexibleResult::new(result.map(|required_level| (required_level,))),
4357 self.tx_id,
4358 0x20e85a63450e0d7b,
4359 fidl::encoding::DynamicFlags::FLEXIBLE,
4360 )
4361 }
4362}
4363
4364#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4365pub struct StatusMarker;
4366
4367impl fidl::endpoints::ProtocolMarker for StatusMarker {
4368 type Proxy = StatusProxy;
4369 type RequestStream = StatusRequestStream;
4370 #[cfg(target_os = "fuchsia")]
4371 type SynchronousProxy = StatusSynchronousProxy;
4372
4373 const DEBUG_NAME: &'static str = "(anonymous) Status";
4374}
4375pub type StatusWatchPowerLevelResult = Result<u8, StatusError>;
4376
4377pub trait StatusProxyInterface: Send + Sync {
4378 type WatchPowerLevelResponseFut: std::future::Future<Output = Result<StatusWatchPowerLevelResult, fidl::Error>>
4379 + Send;
4380 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut;
4381}
4382#[derive(Debug)]
4383#[cfg(target_os = "fuchsia")]
4384pub struct StatusSynchronousProxy {
4385 client: fidl::client::sync::Client,
4386}
4387
4388#[cfg(target_os = "fuchsia")]
4389impl fidl::endpoints::SynchronousProxy for StatusSynchronousProxy {
4390 type Proxy = StatusProxy;
4391 type Protocol = StatusMarker;
4392
4393 fn from_channel(inner: fidl::Channel) -> Self {
4394 Self::new(inner)
4395 }
4396
4397 fn into_channel(self) -> fidl::Channel {
4398 self.client.into_channel()
4399 }
4400
4401 fn as_channel(&self) -> &fidl::Channel {
4402 self.client.as_channel()
4403 }
4404}
4405
4406#[cfg(target_os = "fuchsia")]
4407impl StatusSynchronousProxy {
4408 pub fn new(channel: fidl::Channel) -> Self {
4409 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4410 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4411 }
4412
4413 pub fn into_channel(self) -> fidl::Channel {
4414 self.client.into_channel()
4415 }
4416
4417 pub fn wait_for_event(
4420 &self,
4421 deadline: zx::MonotonicInstant,
4422 ) -> Result<StatusEvent, fidl::Error> {
4423 StatusEvent::decode(self.client.wait_for_event(deadline)?)
4424 }
4425
4426 pub fn r#watch_power_level(
4430 &self,
4431 ___deadline: zx::MonotonicInstant,
4432 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
4433 let _response = self.client.send_query::<
4434 fidl::encoding::EmptyPayload,
4435 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
4436 >(
4437 (),
4438 0x2f11ba8df9b5614e,
4439 fidl::encoding::DynamicFlags::FLEXIBLE,
4440 ___deadline,
4441 )?
4442 .into_result::<StatusMarker>("watch_power_level")?;
4443 Ok(_response.map(|x| x.current_level))
4444 }
4445}
4446
4447#[cfg(target_os = "fuchsia")]
4448impl From<StatusSynchronousProxy> for zx::Handle {
4449 fn from(value: StatusSynchronousProxy) -> Self {
4450 value.into_channel().into()
4451 }
4452}
4453
4454#[cfg(target_os = "fuchsia")]
4455impl From<fidl::Channel> for StatusSynchronousProxy {
4456 fn from(value: fidl::Channel) -> Self {
4457 Self::new(value)
4458 }
4459}
4460
4461#[cfg(target_os = "fuchsia")]
4462impl fidl::endpoints::FromClient for StatusSynchronousProxy {
4463 type Protocol = StatusMarker;
4464
4465 fn from_client(value: fidl::endpoints::ClientEnd<StatusMarker>) -> Self {
4466 Self::new(value.into_channel())
4467 }
4468}
4469
4470#[derive(Debug, Clone)]
4471pub struct StatusProxy {
4472 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4473}
4474
4475impl fidl::endpoints::Proxy for StatusProxy {
4476 type Protocol = StatusMarker;
4477
4478 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4479 Self::new(inner)
4480 }
4481
4482 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4483 self.client.into_channel().map_err(|client| Self { client })
4484 }
4485
4486 fn as_channel(&self) -> &::fidl::AsyncChannel {
4487 self.client.as_channel()
4488 }
4489}
4490
4491impl StatusProxy {
4492 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4494 let protocol_name = <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4495 Self { client: fidl::client::Client::new(channel, protocol_name) }
4496 }
4497
4498 pub fn take_event_stream(&self) -> StatusEventStream {
4504 StatusEventStream { event_receiver: self.client.take_event_receiver() }
4505 }
4506
4507 pub fn r#watch_power_level(
4511 &self,
4512 ) -> fidl::client::QueryResponseFut<
4513 StatusWatchPowerLevelResult,
4514 fidl::encoding::DefaultFuchsiaResourceDialect,
4515 > {
4516 StatusProxyInterface::r#watch_power_level(self)
4517 }
4518}
4519
4520impl StatusProxyInterface for StatusProxy {
4521 type WatchPowerLevelResponseFut = fidl::client::QueryResponseFut<
4522 StatusWatchPowerLevelResult,
4523 fidl::encoding::DefaultFuchsiaResourceDialect,
4524 >;
4525 fn r#watch_power_level(&self) -> Self::WatchPowerLevelResponseFut {
4526 fn _decode(
4527 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4528 ) -> Result<StatusWatchPowerLevelResult, fidl::Error> {
4529 let _response = fidl::client::decode_transaction_body::<
4530 fidl::encoding::FlexibleResultType<StatusWatchPowerLevelResponse, StatusError>,
4531 fidl::encoding::DefaultFuchsiaResourceDialect,
4532 0x2f11ba8df9b5614e,
4533 >(_buf?)?
4534 .into_result::<StatusMarker>("watch_power_level")?;
4535 Ok(_response.map(|x| x.current_level))
4536 }
4537 self.client
4538 .send_query_and_decode::<fidl::encoding::EmptyPayload, StatusWatchPowerLevelResult>(
4539 (),
4540 0x2f11ba8df9b5614e,
4541 fidl::encoding::DynamicFlags::FLEXIBLE,
4542 _decode,
4543 )
4544 }
4545}
4546
4547pub struct StatusEventStream {
4548 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4549}
4550
4551impl std::marker::Unpin for StatusEventStream {}
4552
4553impl futures::stream::FusedStream for StatusEventStream {
4554 fn is_terminated(&self) -> bool {
4555 self.event_receiver.is_terminated()
4556 }
4557}
4558
4559impl futures::Stream for StatusEventStream {
4560 type Item = Result<StatusEvent, fidl::Error>;
4561
4562 fn poll_next(
4563 mut self: std::pin::Pin<&mut Self>,
4564 cx: &mut std::task::Context<'_>,
4565 ) -> std::task::Poll<Option<Self::Item>> {
4566 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4567 &mut self.event_receiver,
4568 cx
4569 )?) {
4570 Some(buf) => std::task::Poll::Ready(Some(StatusEvent::decode(buf))),
4571 None => std::task::Poll::Ready(None),
4572 }
4573 }
4574}
4575
4576#[derive(Debug)]
4577pub enum StatusEvent {
4578 #[non_exhaustive]
4579 _UnknownEvent {
4580 ordinal: u64,
4582 },
4583}
4584
4585impl StatusEvent {
4586 fn decode(
4588 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4589 ) -> Result<StatusEvent, fidl::Error> {
4590 let (bytes, _handles) = buf.split_mut();
4591 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4592 debug_assert_eq!(tx_header.tx_id, 0);
4593 match tx_header.ordinal {
4594 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4595 Ok(StatusEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4596 }
4597 _ => Err(fidl::Error::UnknownOrdinal {
4598 ordinal: tx_header.ordinal,
4599 protocol_name: <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4600 }),
4601 }
4602 }
4603}
4604
4605pub struct StatusRequestStream {
4607 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4608 is_terminated: bool,
4609}
4610
4611impl std::marker::Unpin for StatusRequestStream {}
4612
4613impl futures::stream::FusedStream for StatusRequestStream {
4614 fn is_terminated(&self) -> bool {
4615 self.is_terminated
4616 }
4617}
4618
4619impl fidl::endpoints::RequestStream for StatusRequestStream {
4620 type Protocol = StatusMarker;
4621 type ControlHandle = StatusControlHandle;
4622
4623 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4624 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4625 }
4626
4627 fn control_handle(&self) -> Self::ControlHandle {
4628 StatusControlHandle { inner: self.inner.clone() }
4629 }
4630
4631 fn into_inner(
4632 self,
4633 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4634 {
4635 (self.inner, self.is_terminated)
4636 }
4637
4638 fn from_inner(
4639 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4640 is_terminated: bool,
4641 ) -> Self {
4642 Self { inner, is_terminated }
4643 }
4644}
4645
4646impl futures::Stream for StatusRequestStream {
4647 type Item = Result<StatusRequest, fidl::Error>;
4648
4649 fn poll_next(
4650 mut self: std::pin::Pin<&mut Self>,
4651 cx: &mut std::task::Context<'_>,
4652 ) -> std::task::Poll<Option<Self::Item>> {
4653 let this = &mut *self;
4654 if this.inner.check_shutdown(cx) {
4655 this.is_terminated = true;
4656 return std::task::Poll::Ready(None);
4657 }
4658 if this.is_terminated {
4659 panic!("polled StatusRequestStream after completion");
4660 }
4661 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4662 |bytes, handles| {
4663 match this.inner.channel().read_etc(cx, bytes, handles) {
4664 std::task::Poll::Ready(Ok(())) => {}
4665 std::task::Poll::Pending => return std::task::Poll::Pending,
4666 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4667 this.is_terminated = true;
4668 return std::task::Poll::Ready(None);
4669 }
4670 std::task::Poll::Ready(Err(e)) => {
4671 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4672 e.into(),
4673 ))))
4674 }
4675 }
4676
4677 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4679
4680 std::task::Poll::Ready(Some(match header.ordinal {
4681 0x2f11ba8df9b5614e => {
4682 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4683 let mut req = fidl::new_empty!(
4684 fidl::encoding::EmptyPayload,
4685 fidl::encoding::DefaultFuchsiaResourceDialect
4686 );
4687 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4688 let control_handle = StatusControlHandle { inner: this.inner.clone() };
4689 Ok(StatusRequest::WatchPowerLevel {
4690 responder: StatusWatchPowerLevelResponder {
4691 control_handle: std::mem::ManuallyDrop::new(control_handle),
4692 tx_id: header.tx_id,
4693 },
4694 })
4695 }
4696 _ if header.tx_id == 0
4697 && header
4698 .dynamic_flags()
4699 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4700 {
4701 Ok(StatusRequest::_UnknownMethod {
4702 ordinal: header.ordinal,
4703 control_handle: StatusControlHandle { inner: this.inner.clone() },
4704 method_type: fidl::MethodType::OneWay,
4705 })
4706 }
4707 _ if header
4708 .dynamic_flags()
4709 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4710 {
4711 this.inner.send_framework_err(
4712 fidl::encoding::FrameworkErr::UnknownMethod,
4713 header.tx_id,
4714 header.ordinal,
4715 header.dynamic_flags(),
4716 (bytes, handles),
4717 )?;
4718 Ok(StatusRequest::_UnknownMethod {
4719 ordinal: header.ordinal,
4720 control_handle: StatusControlHandle { inner: this.inner.clone() },
4721 method_type: fidl::MethodType::TwoWay,
4722 })
4723 }
4724 _ => Err(fidl::Error::UnknownOrdinal {
4725 ordinal: header.ordinal,
4726 protocol_name:
4727 <StatusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4728 }),
4729 }))
4730 },
4731 )
4732 }
4733}
4734
4735#[derive(Debug)]
4741pub enum StatusRequest {
4742 WatchPowerLevel { responder: StatusWatchPowerLevelResponder },
4746 #[non_exhaustive]
4748 _UnknownMethod {
4749 ordinal: u64,
4751 control_handle: StatusControlHandle,
4752 method_type: fidl::MethodType,
4753 },
4754}
4755
4756impl StatusRequest {
4757 #[allow(irrefutable_let_patterns)]
4758 pub fn into_watch_power_level(self) -> Option<(StatusWatchPowerLevelResponder)> {
4759 if let StatusRequest::WatchPowerLevel { responder } = self {
4760 Some((responder))
4761 } else {
4762 None
4763 }
4764 }
4765
4766 pub fn method_name(&self) -> &'static str {
4768 match *self {
4769 StatusRequest::WatchPowerLevel { .. } => "watch_power_level",
4770 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4771 "unknown one-way method"
4772 }
4773 StatusRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4774 "unknown two-way method"
4775 }
4776 }
4777 }
4778}
4779
4780#[derive(Debug, Clone)]
4781pub struct StatusControlHandle {
4782 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4783}
4784
4785impl fidl::endpoints::ControlHandle for StatusControlHandle {
4786 fn shutdown(&self) {
4787 self.inner.shutdown()
4788 }
4789 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4790 self.inner.shutdown_with_epitaph(status)
4791 }
4792
4793 fn is_closed(&self) -> bool {
4794 self.inner.channel().is_closed()
4795 }
4796 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4797 self.inner.channel().on_closed()
4798 }
4799
4800 #[cfg(target_os = "fuchsia")]
4801 fn signal_peer(
4802 &self,
4803 clear_mask: zx::Signals,
4804 set_mask: zx::Signals,
4805 ) -> Result<(), zx_status::Status> {
4806 use fidl::Peered;
4807 self.inner.channel().signal_peer(clear_mask, set_mask)
4808 }
4809}
4810
4811impl StatusControlHandle {}
4812
4813#[must_use = "FIDL methods require a response to be sent"]
4814#[derive(Debug)]
4815pub struct StatusWatchPowerLevelResponder {
4816 control_handle: std::mem::ManuallyDrop<StatusControlHandle>,
4817 tx_id: u32,
4818}
4819
4820impl std::ops::Drop for StatusWatchPowerLevelResponder {
4824 fn drop(&mut self) {
4825 self.control_handle.shutdown();
4826 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4828 }
4829}
4830
4831impl fidl::endpoints::Responder for StatusWatchPowerLevelResponder {
4832 type ControlHandle = StatusControlHandle;
4833
4834 fn control_handle(&self) -> &StatusControlHandle {
4835 &self.control_handle
4836 }
4837
4838 fn drop_without_shutdown(mut self) {
4839 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4841 std::mem::forget(self);
4843 }
4844}
4845
4846impl StatusWatchPowerLevelResponder {
4847 pub fn send(self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
4851 let _result = self.send_raw(result);
4852 if _result.is_err() {
4853 self.control_handle.shutdown();
4854 }
4855 self.drop_without_shutdown();
4856 _result
4857 }
4858
4859 pub fn send_no_shutdown_on_err(
4861 self,
4862 mut result: Result<u8, StatusError>,
4863 ) -> Result<(), fidl::Error> {
4864 let _result = self.send_raw(result);
4865 self.drop_without_shutdown();
4866 _result
4867 }
4868
4869 fn send_raw(&self, mut result: Result<u8, StatusError>) -> Result<(), fidl::Error> {
4870 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4871 StatusWatchPowerLevelResponse,
4872 StatusError,
4873 >>(
4874 fidl::encoding::FlexibleResult::new(result.map(|current_level| (current_level,))),
4875 self.tx_id,
4876 0x2f11ba8df9b5614e,
4877 fidl::encoding::DynamicFlags::FLEXIBLE,
4878 )
4879 }
4880}
4881
4882#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4883pub struct TopologyMarker;
4884
4885impl fidl::endpoints::ProtocolMarker for TopologyMarker {
4886 type Proxy = TopologyProxy;
4887 type RequestStream = TopologyRequestStream;
4888 #[cfg(target_os = "fuchsia")]
4889 type SynchronousProxy = TopologySynchronousProxy;
4890
4891 const DEBUG_NAME: &'static str = "fuchsia.power.broker.Topology";
4892}
4893impl fidl::endpoints::DiscoverableProtocolMarker for TopologyMarker {}
4894pub type TopologyAddElementResult = Result<(), AddElementError>;
4895
4896pub trait TopologyProxyInterface: Send + Sync {
4897 type AddElementResponseFut: std::future::Future<Output = Result<TopologyAddElementResult, fidl::Error>>
4898 + Send;
4899 fn r#add_element(&self, payload: ElementSchema) -> Self::AddElementResponseFut;
4900}
4901#[derive(Debug)]
4902#[cfg(target_os = "fuchsia")]
4903pub struct TopologySynchronousProxy {
4904 client: fidl::client::sync::Client,
4905}
4906
4907#[cfg(target_os = "fuchsia")]
4908impl fidl::endpoints::SynchronousProxy for TopologySynchronousProxy {
4909 type Proxy = TopologyProxy;
4910 type Protocol = TopologyMarker;
4911
4912 fn from_channel(inner: fidl::Channel) -> Self {
4913 Self::new(inner)
4914 }
4915
4916 fn into_channel(self) -> fidl::Channel {
4917 self.client.into_channel()
4918 }
4919
4920 fn as_channel(&self) -> &fidl::Channel {
4921 self.client.as_channel()
4922 }
4923}
4924
4925#[cfg(target_os = "fuchsia")]
4926impl TopologySynchronousProxy {
4927 pub fn new(channel: fidl::Channel) -> Self {
4928 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4929 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4930 }
4931
4932 pub fn into_channel(self) -> fidl::Channel {
4933 self.client.into_channel()
4934 }
4935
4936 pub fn wait_for_event(
4939 &self,
4940 deadline: zx::MonotonicInstant,
4941 ) -> Result<TopologyEvent, fidl::Error> {
4942 TopologyEvent::decode(self.client.wait_for_event(deadline)?)
4943 }
4944
4945 pub fn r#add_element(
4948 &self,
4949 mut payload: ElementSchema,
4950 ___deadline: zx::MonotonicInstant,
4951 ) -> Result<TopologyAddElementResult, fidl::Error> {
4952 let _response = self.client.send_query::<
4953 ElementSchema,
4954 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
4955 >(
4956 &mut payload,
4957 0x269ed93c9e87fa03,
4958 fidl::encoding::DynamicFlags::FLEXIBLE,
4959 ___deadline,
4960 )?
4961 .into_result::<TopologyMarker>("add_element")?;
4962 Ok(_response.map(|x| x))
4963 }
4964}
4965
4966#[cfg(target_os = "fuchsia")]
4967impl From<TopologySynchronousProxy> for zx::Handle {
4968 fn from(value: TopologySynchronousProxy) -> Self {
4969 value.into_channel().into()
4970 }
4971}
4972
4973#[cfg(target_os = "fuchsia")]
4974impl From<fidl::Channel> for TopologySynchronousProxy {
4975 fn from(value: fidl::Channel) -> Self {
4976 Self::new(value)
4977 }
4978}
4979
4980#[cfg(target_os = "fuchsia")]
4981impl fidl::endpoints::FromClient for TopologySynchronousProxy {
4982 type Protocol = TopologyMarker;
4983
4984 fn from_client(value: fidl::endpoints::ClientEnd<TopologyMarker>) -> Self {
4985 Self::new(value.into_channel())
4986 }
4987}
4988
4989#[derive(Debug, Clone)]
4990pub struct TopologyProxy {
4991 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4992}
4993
4994impl fidl::endpoints::Proxy for TopologyProxy {
4995 type Protocol = TopologyMarker;
4996
4997 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4998 Self::new(inner)
4999 }
5000
5001 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5002 self.client.into_channel().map_err(|client| Self { client })
5003 }
5004
5005 fn as_channel(&self) -> &::fidl::AsyncChannel {
5006 self.client.as_channel()
5007 }
5008}
5009
5010impl TopologyProxy {
5011 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5013 let protocol_name = <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5014 Self { client: fidl::client::Client::new(channel, protocol_name) }
5015 }
5016
5017 pub fn take_event_stream(&self) -> TopologyEventStream {
5023 TopologyEventStream { event_receiver: self.client.take_event_receiver() }
5024 }
5025
5026 pub fn r#add_element(
5029 &self,
5030 mut payload: ElementSchema,
5031 ) -> fidl::client::QueryResponseFut<
5032 TopologyAddElementResult,
5033 fidl::encoding::DefaultFuchsiaResourceDialect,
5034 > {
5035 TopologyProxyInterface::r#add_element(self, payload)
5036 }
5037}
5038
5039impl TopologyProxyInterface for TopologyProxy {
5040 type AddElementResponseFut = fidl::client::QueryResponseFut<
5041 TopologyAddElementResult,
5042 fidl::encoding::DefaultFuchsiaResourceDialect,
5043 >;
5044 fn r#add_element(&self, mut payload: ElementSchema) -> Self::AddElementResponseFut {
5045 fn _decode(
5046 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5047 ) -> Result<TopologyAddElementResult, fidl::Error> {
5048 let _response = fidl::client::decode_transaction_body::<
5049 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, AddElementError>,
5050 fidl::encoding::DefaultFuchsiaResourceDialect,
5051 0x269ed93c9e87fa03,
5052 >(_buf?)?
5053 .into_result::<TopologyMarker>("add_element")?;
5054 Ok(_response.map(|x| x))
5055 }
5056 self.client.send_query_and_decode::<ElementSchema, TopologyAddElementResult>(
5057 &mut payload,
5058 0x269ed93c9e87fa03,
5059 fidl::encoding::DynamicFlags::FLEXIBLE,
5060 _decode,
5061 )
5062 }
5063}
5064
5065pub struct TopologyEventStream {
5066 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5067}
5068
5069impl std::marker::Unpin for TopologyEventStream {}
5070
5071impl futures::stream::FusedStream for TopologyEventStream {
5072 fn is_terminated(&self) -> bool {
5073 self.event_receiver.is_terminated()
5074 }
5075}
5076
5077impl futures::Stream for TopologyEventStream {
5078 type Item = Result<TopologyEvent, fidl::Error>;
5079
5080 fn poll_next(
5081 mut self: std::pin::Pin<&mut Self>,
5082 cx: &mut std::task::Context<'_>,
5083 ) -> std::task::Poll<Option<Self::Item>> {
5084 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5085 &mut self.event_receiver,
5086 cx
5087 )?) {
5088 Some(buf) => std::task::Poll::Ready(Some(TopologyEvent::decode(buf))),
5089 None => std::task::Poll::Ready(None),
5090 }
5091 }
5092}
5093
5094#[derive(Debug)]
5095pub enum TopologyEvent {
5096 #[non_exhaustive]
5097 _UnknownEvent {
5098 ordinal: u64,
5100 },
5101}
5102
5103impl TopologyEvent {
5104 fn decode(
5106 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5107 ) -> Result<TopologyEvent, fidl::Error> {
5108 let (bytes, _handles) = buf.split_mut();
5109 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5110 debug_assert_eq!(tx_header.tx_id, 0);
5111 match tx_header.ordinal {
5112 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5113 Ok(TopologyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5114 }
5115 _ => Err(fidl::Error::UnknownOrdinal {
5116 ordinal: tx_header.ordinal,
5117 protocol_name: <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5118 }),
5119 }
5120 }
5121}
5122
5123pub struct TopologyRequestStream {
5125 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5126 is_terminated: bool,
5127}
5128
5129impl std::marker::Unpin for TopologyRequestStream {}
5130
5131impl futures::stream::FusedStream for TopologyRequestStream {
5132 fn is_terminated(&self) -> bool {
5133 self.is_terminated
5134 }
5135}
5136
5137impl fidl::endpoints::RequestStream for TopologyRequestStream {
5138 type Protocol = TopologyMarker;
5139 type ControlHandle = TopologyControlHandle;
5140
5141 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5142 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5143 }
5144
5145 fn control_handle(&self) -> Self::ControlHandle {
5146 TopologyControlHandle { inner: self.inner.clone() }
5147 }
5148
5149 fn into_inner(
5150 self,
5151 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5152 {
5153 (self.inner, self.is_terminated)
5154 }
5155
5156 fn from_inner(
5157 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5158 is_terminated: bool,
5159 ) -> Self {
5160 Self { inner, is_terminated }
5161 }
5162}
5163
5164impl futures::Stream for TopologyRequestStream {
5165 type Item = Result<TopologyRequest, fidl::Error>;
5166
5167 fn poll_next(
5168 mut self: std::pin::Pin<&mut Self>,
5169 cx: &mut std::task::Context<'_>,
5170 ) -> std::task::Poll<Option<Self::Item>> {
5171 let this = &mut *self;
5172 if this.inner.check_shutdown(cx) {
5173 this.is_terminated = true;
5174 return std::task::Poll::Ready(None);
5175 }
5176 if this.is_terminated {
5177 panic!("polled TopologyRequestStream after completion");
5178 }
5179 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5180 |bytes, handles| {
5181 match this.inner.channel().read_etc(cx, bytes, handles) {
5182 std::task::Poll::Ready(Ok(())) => {}
5183 std::task::Poll::Pending => return std::task::Poll::Pending,
5184 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5185 this.is_terminated = true;
5186 return std::task::Poll::Ready(None);
5187 }
5188 std::task::Poll::Ready(Err(e)) => {
5189 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5190 e.into(),
5191 ))))
5192 }
5193 }
5194
5195 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5197
5198 std::task::Poll::Ready(Some(match header.ordinal {
5199 0x269ed93c9e87fa03 => {
5200 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5201 let mut req = fidl::new_empty!(
5202 ElementSchema,
5203 fidl::encoding::DefaultFuchsiaResourceDialect
5204 );
5205 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ElementSchema>(&header, _body_bytes, handles, &mut req)?;
5206 let control_handle = TopologyControlHandle { inner: this.inner.clone() };
5207 Ok(TopologyRequest::AddElement {
5208 payload: req,
5209 responder: TopologyAddElementResponder {
5210 control_handle: std::mem::ManuallyDrop::new(control_handle),
5211 tx_id: header.tx_id,
5212 },
5213 })
5214 }
5215 _ if header.tx_id == 0
5216 && header
5217 .dynamic_flags()
5218 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5219 {
5220 Ok(TopologyRequest::_UnknownMethod {
5221 ordinal: header.ordinal,
5222 control_handle: TopologyControlHandle { inner: this.inner.clone() },
5223 method_type: fidl::MethodType::OneWay,
5224 })
5225 }
5226 _ if header
5227 .dynamic_flags()
5228 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5229 {
5230 this.inner.send_framework_err(
5231 fidl::encoding::FrameworkErr::UnknownMethod,
5232 header.tx_id,
5233 header.ordinal,
5234 header.dynamic_flags(),
5235 (bytes, handles),
5236 )?;
5237 Ok(TopologyRequest::_UnknownMethod {
5238 ordinal: header.ordinal,
5239 control_handle: TopologyControlHandle { inner: this.inner.clone() },
5240 method_type: fidl::MethodType::TwoWay,
5241 })
5242 }
5243 _ => Err(fidl::Error::UnknownOrdinal {
5244 ordinal: header.ordinal,
5245 protocol_name:
5246 <TopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5247 }),
5248 }))
5249 },
5250 )
5251 }
5252}
5253
5254#[derive(Debug)]
5260pub enum TopologyRequest {
5261 AddElement { payload: ElementSchema, responder: TopologyAddElementResponder },
5264 #[non_exhaustive]
5266 _UnknownMethod {
5267 ordinal: u64,
5269 control_handle: TopologyControlHandle,
5270 method_type: fidl::MethodType,
5271 },
5272}
5273
5274impl TopologyRequest {
5275 #[allow(irrefutable_let_patterns)]
5276 pub fn into_add_element(self) -> Option<(ElementSchema, TopologyAddElementResponder)> {
5277 if let TopologyRequest::AddElement { payload, responder } = self {
5278 Some((payload, responder))
5279 } else {
5280 None
5281 }
5282 }
5283
5284 pub fn method_name(&self) -> &'static str {
5286 match *self {
5287 TopologyRequest::AddElement { .. } => "add_element",
5288 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5289 "unknown one-way method"
5290 }
5291 TopologyRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5292 "unknown two-way method"
5293 }
5294 }
5295 }
5296}
5297
5298#[derive(Debug, Clone)]
5299pub struct TopologyControlHandle {
5300 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5301}
5302
5303impl fidl::endpoints::ControlHandle for TopologyControlHandle {
5304 fn shutdown(&self) {
5305 self.inner.shutdown()
5306 }
5307 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5308 self.inner.shutdown_with_epitaph(status)
5309 }
5310
5311 fn is_closed(&self) -> bool {
5312 self.inner.channel().is_closed()
5313 }
5314 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5315 self.inner.channel().on_closed()
5316 }
5317
5318 #[cfg(target_os = "fuchsia")]
5319 fn signal_peer(
5320 &self,
5321 clear_mask: zx::Signals,
5322 set_mask: zx::Signals,
5323 ) -> Result<(), zx_status::Status> {
5324 use fidl::Peered;
5325 self.inner.channel().signal_peer(clear_mask, set_mask)
5326 }
5327}
5328
5329impl TopologyControlHandle {}
5330
5331#[must_use = "FIDL methods require a response to be sent"]
5332#[derive(Debug)]
5333pub struct TopologyAddElementResponder {
5334 control_handle: std::mem::ManuallyDrop<TopologyControlHandle>,
5335 tx_id: u32,
5336}
5337
5338impl std::ops::Drop for TopologyAddElementResponder {
5342 fn drop(&mut self) {
5343 self.control_handle.shutdown();
5344 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5346 }
5347}
5348
5349impl fidl::endpoints::Responder for TopologyAddElementResponder {
5350 type ControlHandle = TopologyControlHandle;
5351
5352 fn control_handle(&self) -> &TopologyControlHandle {
5353 &self.control_handle
5354 }
5355
5356 fn drop_without_shutdown(mut self) {
5357 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5359 std::mem::forget(self);
5361 }
5362}
5363
5364impl TopologyAddElementResponder {
5365 pub fn send(self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
5369 let _result = self.send_raw(result);
5370 if _result.is_err() {
5371 self.control_handle.shutdown();
5372 }
5373 self.drop_without_shutdown();
5374 _result
5375 }
5376
5377 pub fn send_no_shutdown_on_err(
5379 self,
5380 mut result: Result<(), AddElementError>,
5381 ) -> Result<(), fidl::Error> {
5382 let _result = self.send_raw(result);
5383 self.drop_without_shutdown();
5384 _result
5385 }
5386
5387 fn send_raw(&self, mut result: Result<(), AddElementError>) -> Result<(), fidl::Error> {
5388 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5389 fidl::encoding::EmptyStruct,
5390 AddElementError,
5391 >>(
5392 fidl::encoding::FlexibleResult::new(result),
5393 self.tx_id,
5394 0x269ed93c9e87fa03,
5395 fidl::encoding::DynamicFlags::FLEXIBLE,
5396 )
5397 }
5398}
5399
5400#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5401pub struct ElementInfoProviderServiceMarker;
5402
5403#[cfg(target_os = "fuchsia")]
5404impl fidl::endpoints::ServiceMarker for ElementInfoProviderServiceMarker {
5405 type Proxy = ElementInfoProviderServiceProxy;
5406 type Request = ElementInfoProviderServiceRequest;
5407 const SERVICE_NAME: &'static str = "fuchsia.power.broker.ElementInfoProviderService";
5408}
5409
5410#[cfg(target_os = "fuchsia")]
5413pub enum ElementInfoProviderServiceRequest {
5414 StatusProvider(ElementInfoProviderRequestStream),
5415}
5416
5417#[cfg(target_os = "fuchsia")]
5418impl fidl::endpoints::ServiceRequest for ElementInfoProviderServiceRequest {
5419 type Service = ElementInfoProviderServiceMarker;
5420
5421 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
5422 match name {
5423 "status_provider" => Self::StatusProvider(
5424 <ElementInfoProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
5425 _channel,
5426 ),
5427 ),
5428 _ => panic!("no such member protocol name for service ElementInfoProviderService"),
5429 }
5430 }
5431
5432 fn member_names() -> &'static [&'static str] {
5433 &["status_provider"]
5434 }
5435}
5436#[cfg(target_os = "fuchsia")]
5437pub struct ElementInfoProviderServiceProxy(
5438 #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
5439);
5440
5441#[cfg(target_os = "fuchsia")]
5442impl fidl::endpoints::ServiceProxy for ElementInfoProviderServiceProxy {
5443 type Service = ElementInfoProviderServiceMarker;
5444
5445 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
5446 Self(opener)
5447 }
5448}
5449
5450#[cfg(target_os = "fuchsia")]
5451impl ElementInfoProviderServiceProxy {
5452 pub fn connect_to_status_provider(&self) -> Result<ElementInfoProviderProxy, fidl::Error> {
5453 let (proxy, server_end) = fidl::endpoints::create_proxy::<ElementInfoProviderMarker>();
5454 self.connect_channel_to_status_provider(server_end)?;
5455 Ok(proxy)
5456 }
5457
5458 pub fn connect_to_status_provider_sync(
5461 &self,
5462 ) -> Result<ElementInfoProviderSynchronousProxy, fidl::Error> {
5463 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ElementInfoProviderMarker>();
5464 self.connect_channel_to_status_provider(server_end)?;
5465 Ok(proxy)
5466 }
5467
5468 pub fn connect_channel_to_status_provider(
5471 &self,
5472 server_end: fidl::endpoints::ServerEnd<ElementInfoProviderMarker>,
5473 ) -> Result<(), fidl::Error> {
5474 self.0.open_member("status_provider", server_end.into_channel())
5475 }
5476
5477 pub fn instance_name(&self) -> &str {
5478 self.0.instance_name()
5479 }
5480}
5481
5482mod internal {
5483 use super::*;
5484
5485 impl fidl::encoding::ResourceTypeMarker for CurrentLevelUpdateRequest {
5486 type Borrowed<'a> = &'a mut Self;
5487 fn take_or_borrow<'a>(
5488 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5489 ) -> Self::Borrowed<'a> {
5490 value
5491 }
5492 }
5493
5494 unsafe impl fidl::encoding::TypeMarker for CurrentLevelUpdateRequest {
5495 type Owned = Self;
5496
5497 #[inline(always)]
5498 fn inline_align(_context: fidl::encoding::Context) -> usize {
5499 1
5500 }
5501
5502 #[inline(always)]
5503 fn inline_size(_context: fidl::encoding::Context) -> usize {
5504 1
5505 }
5506 #[inline(always)]
5507 fn encode_is_copy() -> bool {
5508 true
5509 }
5510
5511 #[inline(always)]
5512 fn decode_is_copy() -> bool {
5513 true
5514 }
5515 }
5516
5517 unsafe impl
5518 fidl::encoding::Encode<
5519 CurrentLevelUpdateRequest,
5520 fidl::encoding::DefaultFuchsiaResourceDialect,
5521 > for &mut CurrentLevelUpdateRequest
5522 {
5523 #[inline]
5524 unsafe fn encode(
5525 self,
5526 encoder: &mut fidl::encoding::Encoder<
5527 '_,
5528 fidl::encoding::DefaultFuchsiaResourceDialect,
5529 >,
5530 offset: usize,
5531 _depth: fidl::encoding::Depth,
5532 ) -> fidl::Result<()> {
5533 encoder.debug_check_bounds::<CurrentLevelUpdateRequest>(offset);
5534 unsafe {
5535 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5537 (buf_ptr as *mut CurrentLevelUpdateRequest)
5538 .write_unaligned((self as *const CurrentLevelUpdateRequest).read());
5539 }
5542 Ok(())
5543 }
5544 }
5545 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
5546 fidl::encoding::Encode<
5547 CurrentLevelUpdateRequest,
5548 fidl::encoding::DefaultFuchsiaResourceDialect,
5549 > for (T0,)
5550 {
5551 #[inline]
5552 unsafe fn encode(
5553 self,
5554 encoder: &mut fidl::encoding::Encoder<
5555 '_,
5556 fidl::encoding::DefaultFuchsiaResourceDialect,
5557 >,
5558 offset: usize,
5559 depth: fidl::encoding::Depth,
5560 ) -> fidl::Result<()> {
5561 encoder.debug_check_bounds::<CurrentLevelUpdateRequest>(offset);
5562 self.0.encode(encoder, offset + 0, depth)?;
5566 Ok(())
5567 }
5568 }
5569
5570 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5571 for CurrentLevelUpdateRequest
5572 {
5573 #[inline(always)]
5574 fn new_empty() -> Self {
5575 Self {
5576 current_level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
5577 }
5578 }
5579
5580 #[inline]
5581 unsafe fn decode(
5582 &mut self,
5583 decoder: &mut fidl::encoding::Decoder<
5584 '_,
5585 fidl::encoding::DefaultFuchsiaResourceDialect,
5586 >,
5587 offset: usize,
5588 _depth: fidl::encoding::Depth,
5589 ) -> fidl::Result<()> {
5590 decoder.debug_check_bounds::<Self>(offset);
5591 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5592 unsafe {
5595 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
5596 }
5597 Ok(())
5598 }
5599 }
5600
5601 impl fidl::encoding::ResourceTypeMarker for ElementControlOpenStatusChannelRequest {
5602 type Borrowed<'a> = &'a mut Self;
5603 fn take_or_borrow<'a>(
5604 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5605 ) -> Self::Borrowed<'a> {
5606 value
5607 }
5608 }
5609
5610 unsafe impl fidl::encoding::TypeMarker for ElementControlOpenStatusChannelRequest {
5611 type Owned = Self;
5612
5613 #[inline(always)]
5614 fn inline_align(_context: fidl::encoding::Context) -> usize {
5615 4
5616 }
5617
5618 #[inline(always)]
5619 fn inline_size(_context: fidl::encoding::Context) -> usize {
5620 4
5621 }
5622 }
5623
5624 unsafe impl
5625 fidl::encoding::Encode<
5626 ElementControlOpenStatusChannelRequest,
5627 fidl::encoding::DefaultFuchsiaResourceDialect,
5628 > for &mut ElementControlOpenStatusChannelRequest
5629 {
5630 #[inline]
5631 unsafe fn encode(
5632 self,
5633 encoder: &mut fidl::encoding::Encoder<
5634 '_,
5635 fidl::encoding::DefaultFuchsiaResourceDialect,
5636 >,
5637 offset: usize,
5638 _depth: fidl::encoding::Depth,
5639 ) -> fidl::Result<()> {
5640 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
5641 fidl::encoding::Encode::<ElementControlOpenStatusChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5643 (
5644 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.status_channel),
5645 ),
5646 encoder, offset, _depth
5647 )
5648 }
5649 }
5650 unsafe impl<
5651 T0: fidl::encoding::Encode<
5652 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
5653 fidl::encoding::DefaultFuchsiaResourceDialect,
5654 >,
5655 >
5656 fidl::encoding::Encode<
5657 ElementControlOpenStatusChannelRequest,
5658 fidl::encoding::DefaultFuchsiaResourceDialect,
5659 > for (T0,)
5660 {
5661 #[inline]
5662 unsafe fn encode(
5663 self,
5664 encoder: &mut fidl::encoding::Encoder<
5665 '_,
5666 fidl::encoding::DefaultFuchsiaResourceDialect,
5667 >,
5668 offset: usize,
5669 depth: fidl::encoding::Depth,
5670 ) -> fidl::Result<()> {
5671 encoder.debug_check_bounds::<ElementControlOpenStatusChannelRequest>(offset);
5672 self.0.encode(encoder, offset + 0, depth)?;
5676 Ok(())
5677 }
5678 }
5679
5680 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5681 for ElementControlOpenStatusChannelRequest
5682 {
5683 #[inline(always)]
5684 fn new_empty() -> Self {
5685 Self {
5686 status_channel: fidl::new_empty!(
5687 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
5688 fidl::encoding::DefaultFuchsiaResourceDialect
5689 ),
5690 }
5691 }
5692
5693 #[inline]
5694 unsafe fn decode(
5695 &mut self,
5696 decoder: &mut fidl::encoding::Decoder<
5697 '_,
5698 fidl::encoding::DefaultFuchsiaResourceDialect,
5699 >,
5700 offset: usize,
5701 _depth: fidl::encoding::Depth,
5702 ) -> fidl::Result<()> {
5703 decoder.debug_check_bounds::<Self>(offset);
5704 fidl::decode!(
5706 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StatusMarker>>,
5707 fidl::encoding::DefaultFuchsiaResourceDialect,
5708 &mut self.status_channel,
5709 decoder,
5710 offset + 0,
5711 _depth
5712 )?;
5713 Ok(())
5714 }
5715 }
5716
5717 impl fidl::encoding::ResourceTypeMarker for ElementControlRegisterDependencyTokenRequest {
5718 type Borrowed<'a> = &'a mut Self;
5719 fn take_or_borrow<'a>(
5720 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5721 ) -> Self::Borrowed<'a> {
5722 value
5723 }
5724 }
5725
5726 unsafe impl fidl::encoding::TypeMarker for ElementControlRegisterDependencyTokenRequest {
5727 type Owned = Self;
5728
5729 #[inline(always)]
5730 fn inline_align(_context: fidl::encoding::Context) -> usize {
5731 4
5732 }
5733
5734 #[inline(always)]
5735 fn inline_size(_context: fidl::encoding::Context) -> usize {
5736 8
5737 }
5738 }
5739
5740 unsafe impl
5741 fidl::encoding::Encode<
5742 ElementControlRegisterDependencyTokenRequest,
5743 fidl::encoding::DefaultFuchsiaResourceDialect,
5744 > for &mut ElementControlRegisterDependencyTokenRequest
5745 {
5746 #[inline]
5747 unsafe fn encode(
5748 self,
5749 encoder: &mut fidl::encoding::Encoder<
5750 '_,
5751 fidl::encoding::DefaultFuchsiaResourceDialect,
5752 >,
5753 offset: usize,
5754 _depth: fidl::encoding::Depth,
5755 ) -> fidl::Result<()> {
5756 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
5757 fidl::encoding::Encode::<
5759 ElementControlRegisterDependencyTokenRequest,
5760 fidl::encoding::DefaultFuchsiaResourceDialect,
5761 >::encode(
5762 (
5763 <fidl::encoding::HandleType<
5764 fidl::Event,
5765 { fidl::ObjectType::EVENT.into_raw() },
5766 2147483648,
5767 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5768 &mut self.token
5769 ),
5770 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(
5771 &self.dependency_type,
5772 ),
5773 ),
5774 encoder,
5775 offset,
5776 _depth,
5777 )
5778 }
5779 }
5780 unsafe impl<
5781 T0: fidl::encoding::Encode<
5782 fidl::encoding::HandleType<
5783 fidl::Event,
5784 { fidl::ObjectType::EVENT.into_raw() },
5785 2147483648,
5786 >,
5787 fidl::encoding::DefaultFuchsiaResourceDialect,
5788 >,
5789 T1: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
5790 >
5791 fidl::encoding::Encode<
5792 ElementControlRegisterDependencyTokenRequest,
5793 fidl::encoding::DefaultFuchsiaResourceDialect,
5794 > for (T0, T1)
5795 {
5796 #[inline]
5797 unsafe fn encode(
5798 self,
5799 encoder: &mut fidl::encoding::Encoder<
5800 '_,
5801 fidl::encoding::DefaultFuchsiaResourceDialect,
5802 >,
5803 offset: usize,
5804 depth: fidl::encoding::Depth,
5805 ) -> fidl::Result<()> {
5806 encoder.debug_check_bounds::<ElementControlRegisterDependencyTokenRequest>(offset);
5807 self.0.encode(encoder, offset + 0, depth)?;
5811 self.1.encode(encoder, offset + 4, depth)?;
5812 Ok(())
5813 }
5814 }
5815
5816 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5817 for ElementControlRegisterDependencyTokenRequest
5818 {
5819 #[inline(always)]
5820 fn new_empty() -> Self {
5821 Self {
5822 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5823 dependency_type: fidl::new_empty!(
5824 DependencyType,
5825 fidl::encoding::DefaultFuchsiaResourceDialect
5826 ),
5827 }
5828 }
5829
5830 #[inline]
5831 unsafe fn decode(
5832 &mut self,
5833 decoder: &mut fidl::encoding::Decoder<
5834 '_,
5835 fidl::encoding::DefaultFuchsiaResourceDialect,
5836 >,
5837 offset: usize,
5838 _depth: fidl::encoding::Depth,
5839 ) -> fidl::Result<()> {
5840 decoder.debug_check_bounds::<Self>(offset);
5841 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
5843 fidl::decode!(
5844 DependencyType,
5845 fidl::encoding::DefaultFuchsiaResourceDialect,
5846 &mut self.dependency_type,
5847 decoder,
5848 offset + 4,
5849 _depth
5850 )?;
5851 Ok(())
5852 }
5853 }
5854
5855 impl fidl::encoding::ResourceTypeMarker for ElementControlUnregisterDependencyTokenRequest {
5856 type Borrowed<'a> = &'a mut Self;
5857 fn take_or_borrow<'a>(
5858 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5859 ) -> Self::Borrowed<'a> {
5860 value
5861 }
5862 }
5863
5864 unsafe impl fidl::encoding::TypeMarker for ElementControlUnregisterDependencyTokenRequest {
5865 type Owned = Self;
5866
5867 #[inline(always)]
5868 fn inline_align(_context: fidl::encoding::Context) -> usize {
5869 4
5870 }
5871
5872 #[inline(always)]
5873 fn inline_size(_context: fidl::encoding::Context) -> usize {
5874 4
5875 }
5876 }
5877
5878 unsafe impl
5879 fidl::encoding::Encode<
5880 ElementControlUnregisterDependencyTokenRequest,
5881 fidl::encoding::DefaultFuchsiaResourceDialect,
5882 > for &mut ElementControlUnregisterDependencyTokenRequest
5883 {
5884 #[inline]
5885 unsafe fn encode(
5886 self,
5887 encoder: &mut fidl::encoding::Encoder<
5888 '_,
5889 fidl::encoding::DefaultFuchsiaResourceDialect,
5890 >,
5891 offset: usize,
5892 _depth: fidl::encoding::Depth,
5893 ) -> fidl::Result<()> {
5894 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
5895 fidl::encoding::Encode::<
5897 ElementControlUnregisterDependencyTokenRequest,
5898 fidl::encoding::DefaultFuchsiaResourceDialect,
5899 >::encode(
5900 (<fidl::encoding::HandleType<
5901 fidl::Event,
5902 { fidl::ObjectType::EVENT.into_raw() },
5903 2147483648,
5904 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5905 &mut self.token
5906 ),),
5907 encoder,
5908 offset,
5909 _depth,
5910 )
5911 }
5912 }
5913 unsafe impl<
5914 T0: fidl::encoding::Encode<
5915 fidl::encoding::HandleType<
5916 fidl::Event,
5917 { fidl::ObjectType::EVENT.into_raw() },
5918 2147483648,
5919 >,
5920 fidl::encoding::DefaultFuchsiaResourceDialect,
5921 >,
5922 >
5923 fidl::encoding::Encode<
5924 ElementControlUnregisterDependencyTokenRequest,
5925 fidl::encoding::DefaultFuchsiaResourceDialect,
5926 > for (T0,)
5927 {
5928 #[inline]
5929 unsafe fn encode(
5930 self,
5931 encoder: &mut fidl::encoding::Encoder<
5932 '_,
5933 fidl::encoding::DefaultFuchsiaResourceDialect,
5934 >,
5935 offset: usize,
5936 depth: fidl::encoding::Depth,
5937 ) -> fidl::Result<()> {
5938 encoder.debug_check_bounds::<ElementControlUnregisterDependencyTokenRequest>(offset);
5939 self.0.encode(encoder, offset + 0, depth)?;
5943 Ok(())
5944 }
5945 }
5946
5947 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5948 for ElementControlUnregisterDependencyTokenRequest
5949 {
5950 #[inline(always)]
5951 fn new_empty() -> Self {
5952 Self {
5953 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5954 }
5955 }
5956
5957 #[inline]
5958 unsafe fn decode(
5959 &mut self,
5960 decoder: &mut fidl::encoding::Decoder<
5961 '_,
5962 fidl::encoding::DefaultFuchsiaResourceDialect,
5963 >,
5964 offset: usize,
5965 _depth: fidl::encoding::Depth,
5966 ) -> fidl::Result<()> {
5967 decoder.debug_check_bounds::<Self>(offset);
5968 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
5970 Ok(())
5971 }
5972 }
5973
5974 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
5975 type Borrowed<'a> = &'a mut Self;
5976 fn take_or_borrow<'a>(
5977 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5978 ) -> Self::Borrowed<'a> {
5979 value
5980 }
5981 }
5982
5983 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetElementPowerLevelNamesResponse {
5984 type Owned = Self;
5985
5986 #[inline(always)]
5987 fn inline_align(_context: fidl::encoding::Context) -> usize {
5988 8
5989 }
5990
5991 #[inline(always)]
5992 fn inline_size(_context: fidl::encoding::Context) -> usize {
5993 16
5994 }
5995 }
5996
5997 unsafe impl
5998 fidl::encoding::Encode<
5999 ElementInfoProviderGetElementPowerLevelNamesResponse,
6000 fidl::encoding::DefaultFuchsiaResourceDialect,
6001 > for &mut ElementInfoProviderGetElementPowerLevelNamesResponse
6002 {
6003 #[inline]
6004 unsafe fn encode(
6005 self,
6006 encoder: &mut fidl::encoding::Encoder<
6007 '_,
6008 fidl::encoding::DefaultFuchsiaResourceDialect,
6009 >,
6010 offset: usize,
6011 _depth: fidl::encoding::Depth,
6012 ) -> fidl::Result<()> {
6013 encoder
6014 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
6015 fidl::encoding::Encode::<ElementInfoProviderGetElementPowerLevelNamesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6017 (
6018 <fidl::encoding::UnboundedVector<ElementPowerLevelNames> as fidl::encoding::ValueTypeMarker>::borrow(&self.level_names),
6019 ),
6020 encoder, offset, _depth
6021 )
6022 }
6023 }
6024 unsafe impl<
6025 T0: fidl::encoding::Encode<
6026 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
6027 fidl::encoding::DefaultFuchsiaResourceDialect,
6028 >,
6029 >
6030 fidl::encoding::Encode<
6031 ElementInfoProviderGetElementPowerLevelNamesResponse,
6032 fidl::encoding::DefaultFuchsiaResourceDialect,
6033 > for (T0,)
6034 {
6035 #[inline]
6036 unsafe fn encode(
6037 self,
6038 encoder: &mut fidl::encoding::Encoder<
6039 '_,
6040 fidl::encoding::DefaultFuchsiaResourceDialect,
6041 >,
6042 offset: usize,
6043 depth: fidl::encoding::Depth,
6044 ) -> fidl::Result<()> {
6045 encoder
6046 .debug_check_bounds::<ElementInfoProviderGetElementPowerLevelNamesResponse>(offset);
6047 self.0.encode(encoder, offset + 0, depth)?;
6051 Ok(())
6052 }
6053 }
6054
6055 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6056 for ElementInfoProviderGetElementPowerLevelNamesResponse
6057 {
6058 #[inline(always)]
6059 fn new_empty() -> Self {
6060 Self {
6061 level_names: fidl::new_empty!(
6062 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
6063 fidl::encoding::DefaultFuchsiaResourceDialect
6064 ),
6065 }
6066 }
6067
6068 #[inline]
6069 unsafe fn decode(
6070 &mut self,
6071 decoder: &mut fidl::encoding::Decoder<
6072 '_,
6073 fidl::encoding::DefaultFuchsiaResourceDialect,
6074 >,
6075 offset: usize,
6076 _depth: fidl::encoding::Depth,
6077 ) -> fidl::Result<()> {
6078 decoder.debug_check_bounds::<Self>(offset);
6079 fidl::decode!(
6081 fidl::encoding::UnboundedVector<ElementPowerLevelNames>,
6082 fidl::encoding::DefaultFuchsiaResourceDialect,
6083 &mut self.level_names,
6084 decoder,
6085 offset + 0,
6086 _depth
6087 )?;
6088 Ok(())
6089 }
6090 }
6091
6092 impl fidl::encoding::ResourceTypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
6093 type Borrowed<'a> = &'a mut Self;
6094 fn take_or_borrow<'a>(
6095 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6096 ) -> Self::Borrowed<'a> {
6097 value
6098 }
6099 }
6100
6101 unsafe impl fidl::encoding::TypeMarker for ElementInfoProviderGetStatusEndpointsResponse {
6102 type Owned = Self;
6103
6104 #[inline(always)]
6105 fn inline_align(_context: fidl::encoding::Context) -> usize {
6106 8
6107 }
6108
6109 #[inline(always)]
6110 fn inline_size(_context: fidl::encoding::Context) -> usize {
6111 16
6112 }
6113 }
6114
6115 unsafe impl
6116 fidl::encoding::Encode<
6117 ElementInfoProviderGetStatusEndpointsResponse,
6118 fidl::encoding::DefaultFuchsiaResourceDialect,
6119 > for &mut ElementInfoProviderGetStatusEndpointsResponse
6120 {
6121 #[inline]
6122 unsafe fn encode(
6123 self,
6124 encoder: &mut fidl::encoding::Encoder<
6125 '_,
6126 fidl::encoding::DefaultFuchsiaResourceDialect,
6127 >,
6128 offset: usize,
6129 _depth: fidl::encoding::Depth,
6130 ) -> fidl::Result<()> {
6131 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
6132 fidl::encoding::Encode::<ElementInfoProviderGetStatusEndpointsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6134 (
6135 <fidl::encoding::UnboundedVector<ElementStatusEndpoint> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoints),
6136 ),
6137 encoder, offset, _depth
6138 )
6139 }
6140 }
6141 unsafe impl<
6142 T0: fidl::encoding::Encode<
6143 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
6144 fidl::encoding::DefaultFuchsiaResourceDialect,
6145 >,
6146 >
6147 fidl::encoding::Encode<
6148 ElementInfoProviderGetStatusEndpointsResponse,
6149 fidl::encoding::DefaultFuchsiaResourceDialect,
6150 > for (T0,)
6151 {
6152 #[inline]
6153 unsafe fn encode(
6154 self,
6155 encoder: &mut fidl::encoding::Encoder<
6156 '_,
6157 fidl::encoding::DefaultFuchsiaResourceDialect,
6158 >,
6159 offset: usize,
6160 depth: fidl::encoding::Depth,
6161 ) -> fidl::Result<()> {
6162 encoder.debug_check_bounds::<ElementInfoProviderGetStatusEndpointsResponse>(offset);
6163 self.0.encode(encoder, offset + 0, depth)?;
6167 Ok(())
6168 }
6169 }
6170
6171 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6172 for ElementInfoProviderGetStatusEndpointsResponse
6173 {
6174 #[inline(always)]
6175 fn new_empty() -> Self {
6176 Self {
6177 endpoints: fidl::new_empty!(
6178 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
6179 fidl::encoding::DefaultFuchsiaResourceDialect
6180 ),
6181 }
6182 }
6183
6184 #[inline]
6185 unsafe fn decode(
6186 &mut self,
6187 decoder: &mut fidl::encoding::Decoder<
6188 '_,
6189 fidl::encoding::DefaultFuchsiaResourceDialect,
6190 >,
6191 offset: usize,
6192 _depth: fidl::encoding::Depth,
6193 ) -> fidl::Result<()> {
6194 decoder.debug_check_bounds::<Self>(offset);
6195 fidl::decode!(
6197 fidl::encoding::UnboundedVector<ElementStatusEndpoint>,
6198 fidl::encoding::DefaultFuchsiaResourceDialect,
6199 &mut self.endpoints,
6200 decoder,
6201 offset + 0,
6202 _depth
6203 )?;
6204 Ok(())
6205 }
6206 }
6207
6208 impl fidl::encoding::ResourceTypeMarker for LessorLeaseRequest {
6209 type Borrowed<'a> = &'a mut Self;
6210 fn take_or_borrow<'a>(
6211 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6212 ) -> Self::Borrowed<'a> {
6213 value
6214 }
6215 }
6216
6217 unsafe impl fidl::encoding::TypeMarker for LessorLeaseRequest {
6218 type Owned = Self;
6219
6220 #[inline(always)]
6221 fn inline_align(_context: fidl::encoding::Context) -> usize {
6222 1
6223 }
6224
6225 #[inline(always)]
6226 fn inline_size(_context: fidl::encoding::Context) -> usize {
6227 1
6228 }
6229 #[inline(always)]
6230 fn encode_is_copy() -> bool {
6231 true
6232 }
6233
6234 #[inline(always)]
6235 fn decode_is_copy() -> bool {
6236 true
6237 }
6238 }
6239
6240 unsafe impl
6241 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6242 for &mut LessorLeaseRequest
6243 {
6244 #[inline]
6245 unsafe fn encode(
6246 self,
6247 encoder: &mut fidl::encoding::Encoder<
6248 '_,
6249 fidl::encoding::DefaultFuchsiaResourceDialect,
6250 >,
6251 offset: usize,
6252 _depth: fidl::encoding::Depth,
6253 ) -> fidl::Result<()> {
6254 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
6255 unsafe {
6256 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6258 (buf_ptr as *mut LessorLeaseRequest)
6259 .write_unaligned((self as *const LessorLeaseRequest).read());
6260 }
6263 Ok(())
6264 }
6265 }
6266 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
6267 fidl::encoding::Encode<LessorLeaseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6268 for (T0,)
6269 {
6270 #[inline]
6271 unsafe fn encode(
6272 self,
6273 encoder: &mut fidl::encoding::Encoder<
6274 '_,
6275 fidl::encoding::DefaultFuchsiaResourceDialect,
6276 >,
6277 offset: usize,
6278 depth: fidl::encoding::Depth,
6279 ) -> fidl::Result<()> {
6280 encoder.debug_check_bounds::<LessorLeaseRequest>(offset);
6281 self.0.encode(encoder, offset + 0, depth)?;
6285 Ok(())
6286 }
6287 }
6288
6289 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6290 for LessorLeaseRequest
6291 {
6292 #[inline(always)]
6293 fn new_empty() -> Self {
6294 Self { level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect) }
6295 }
6296
6297 #[inline]
6298 unsafe fn decode(
6299 &mut self,
6300 decoder: &mut fidl::encoding::Decoder<
6301 '_,
6302 fidl::encoding::DefaultFuchsiaResourceDialect,
6303 >,
6304 offset: usize,
6305 _depth: fidl::encoding::Depth,
6306 ) -> fidl::Result<()> {
6307 decoder.debug_check_bounds::<Self>(offset);
6308 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6309 unsafe {
6312 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
6313 }
6314 Ok(())
6315 }
6316 }
6317
6318 impl fidl::encoding::ResourceTypeMarker for LessorLeaseResponse {
6319 type Borrowed<'a> = &'a mut Self;
6320 fn take_or_borrow<'a>(
6321 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6322 ) -> Self::Borrowed<'a> {
6323 value
6324 }
6325 }
6326
6327 unsafe impl fidl::encoding::TypeMarker for LessorLeaseResponse {
6328 type Owned = Self;
6329
6330 #[inline(always)]
6331 fn inline_align(_context: fidl::encoding::Context) -> usize {
6332 4
6333 }
6334
6335 #[inline(always)]
6336 fn inline_size(_context: fidl::encoding::Context) -> usize {
6337 4
6338 }
6339 }
6340
6341 unsafe impl
6342 fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
6343 for &mut LessorLeaseResponse
6344 {
6345 #[inline]
6346 unsafe fn encode(
6347 self,
6348 encoder: &mut fidl::encoding::Encoder<
6349 '_,
6350 fidl::encoding::DefaultFuchsiaResourceDialect,
6351 >,
6352 offset: usize,
6353 _depth: fidl::encoding::Depth,
6354 ) -> fidl::Result<()> {
6355 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
6356 fidl::encoding::Encode::<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6358 (
6359 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lease_control),
6360 ),
6361 encoder, offset, _depth
6362 )
6363 }
6364 }
6365 unsafe impl<
6366 T0: fidl::encoding::Encode<
6367 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
6368 fidl::encoding::DefaultFuchsiaResourceDialect,
6369 >,
6370 >
6371 fidl::encoding::Encode<LessorLeaseResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
6372 for (T0,)
6373 {
6374 #[inline]
6375 unsafe fn encode(
6376 self,
6377 encoder: &mut fidl::encoding::Encoder<
6378 '_,
6379 fidl::encoding::DefaultFuchsiaResourceDialect,
6380 >,
6381 offset: usize,
6382 depth: fidl::encoding::Depth,
6383 ) -> fidl::Result<()> {
6384 encoder.debug_check_bounds::<LessorLeaseResponse>(offset);
6385 self.0.encode(encoder, offset + 0, depth)?;
6389 Ok(())
6390 }
6391 }
6392
6393 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6394 for LessorLeaseResponse
6395 {
6396 #[inline(always)]
6397 fn new_empty() -> Self {
6398 Self {
6399 lease_control: fidl::new_empty!(
6400 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
6401 fidl::encoding::DefaultFuchsiaResourceDialect
6402 ),
6403 }
6404 }
6405
6406 #[inline]
6407 unsafe fn decode(
6408 &mut self,
6409 decoder: &mut fidl::encoding::Decoder<
6410 '_,
6411 fidl::encoding::DefaultFuchsiaResourceDialect,
6412 >,
6413 offset: usize,
6414 _depth: fidl::encoding::Depth,
6415 ) -> fidl::Result<()> {
6416 decoder.debug_check_bounds::<Self>(offset);
6417 fidl::decode!(
6419 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LeaseControlMarker>>,
6420 fidl::encoding::DefaultFuchsiaResourceDialect,
6421 &mut self.lease_control,
6422 decoder,
6423 offset + 0,
6424 _depth
6425 )?;
6426 Ok(())
6427 }
6428 }
6429
6430 impl fidl::encoding::ResourceTypeMarker for LevelControlChannels {
6431 type Borrowed<'a> = &'a mut Self;
6432 fn take_or_borrow<'a>(
6433 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6434 ) -> Self::Borrowed<'a> {
6435 value
6436 }
6437 }
6438
6439 unsafe impl fidl::encoding::TypeMarker for LevelControlChannels {
6440 type Owned = Self;
6441
6442 #[inline(always)]
6443 fn inline_align(_context: fidl::encoding::Context) -> usize {
6444 4
6445 }
6446
6447 #[inline(always)]
6448 fn inline_size(_context: fidl::encoding::Context) -> usize {
6449 8
6450 }
6451 }
6452
6453 unsafe impl
6454 fidl::encoding::Encode<LevelControlChannels, fidl::encoding::DefaultFuchsiaResourceDialect>
6455 for &mut LevelControlChannels
6456 {
6457 #[inline]
6458 unsafe fn encode(
6459 self,
6460 encoder: &mut fidl::encoding::Encoder<
6461 '_,
6462 fidl::encoding::DefaultFuchsiaResourceDialect,
6463 >,
6464 offset: usize,
6465 _depth: fidl::encoding::Depth,
6466 ) -> fidl::Result<()> {
6467 encoder.debug_check_bounds::<LevelControlChannels>(offset);
6468 fidl::encoding::Encode::<LevelControlChannels, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6470 (
6471 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CurrentLevelMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.current),
6472 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RequiredLevelMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.required),
6473 ),
6474 encoder, offset, _depth
6475 )
6476 }
6477 }
6478 unsafe impl<
6479 T0: fidl::encoding::Encode<
6480 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CurrentLevelMarker>>,
6481 fidl::encoding::DefaultFuchsiaResourceDialect,
6482 >,
6483 T1: fidl::encoding::Encode<
6484 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RequiredLevelMarker>>,
6485 fidl::encoding::DefaultFuchsiaResourceDialect,
6486 >,
6487 >
6488 fidl::encoding::Encode<LevelControlChannels, fidl::encoding::DefaultFuchsiaResourceDialect>
6489 for (T0, T1)
6490 {
6491 #[inline]
6492 unsafe fn encode(
6493 self,
6494 encoder: &mut fidl::encoding::Encoder<
6495 '_,
6496 fidl::encoding::DefaultFuchsiaResourceDialect,
6497 >,
6498 offset: usize,
6499 depth: fidl::encoding::Depth,
6500 ) -> fidl::Result<()> {
6501 encoder.debug_check_bounds::<LevelControlChannels>(offset);
6502 self.0.encode(encoder, offset + 0, depth)?;
6506 self.1.encode(encoder, offset + 4, depth)?;
6507 Ok(())
6508 }
6509 }
6510
6511 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6512 for LevelControlChannels
6513 {
6514 #[inline(always)]
6515 fn new_empty() -> Self {
6516 Self {
6517 current: fidl::new_empty!(
6518 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CurrentLevelMarker>>,
6519 fidl::encoding::DefaultFuchsiaResourceDialect
6520 ),
6521 required: fidl::new_empty!(
6522 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RequiredLevelMarker>>,
6523 fidl::encoding::DefaultFuchsiaResourceDialect
6524 ),
6525 }
6526 }
6527
6528 #[inline]
6529 unsafe fn decode(
6530 &mut self,
6531 decoder: &mut fidl::encoding::Decoder<
6532 '_,
6533 fidl::encoding::DefaultFuchsiaResourceDialect,
6534 >,
6535 offset: usize,
6536 _depth: fidl::encoding::Depth,
6537 ) -> fidl::Result<()> {
6538 decoder.debug_check_bounds::<Self>(offset);
6539 fidl::decode!(
6541 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CurrentLevelMarker>>,
6542 fidl::encoding::DefaultFuchsiaResourceDialect,
6543 &mut self.current,
6544 decoder,
6545 offset + 0,
6546 _depth
6547 )?;
6548 fidl::decode!(
6549 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RequiredLevelMarker>>,
6550 fidl::encoding::DefaultFuchsiaResourceDialect,
6551 &mut self.required,
6552 decoder,
6553 offset + 4,
6554 _depth
6555 )?;
6556 Ok(())
6557 }
6558 }
6559
6560 impl fidl::encoding::ResourceTypeMarker for LevelDependency {
6561 type Borrowed<'a> = &'a mut Self;
6562 fn take_or_borrow<'a>(
6563 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6564 ) -> Self::Borrowed<'a> {
6565 value
6566 }
6567 }
6568
6569 unsafe impl fidl::encoding::TypeMarker for LevelDependency {
6570 type Owned = Self;
6571
6572 #[inline(always)]
6573 fn inline_align(_context: fidl::encoding::Context) -> usize {
6574 8
6575 }
6576
6577 #[inline(always)]
6578 fn inline_size(_context: fidl::encoding::Context) -> usize {
6579 32
6580 }
6581 }
6582
6583 unsafe impl
6584 fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
6585 for &mut LevelDependency
6586 {
6587 #[inline]
6588 unsafe fn encode(
6589 self,
6590 encoder: &mut fidl::encoding::Encoder<
6591 '_,
6592 fidl::encoding::DefaultFuchsiaResourceDialect,
6593 >,
6594 offset: usize,
6595 _depth: fidl::encoding::Depth,
6596 ) -> fidl::Result<()> {
6597 encoder.debug_check_bounds::<LevelDependency>(offset);
6598 fidl::encoding::Encode::<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6600 (
6601 <DependencyType as fidl::encoding::ValueTypeMarker>::borrow(&self.dependency_type),
6602 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
6603 <fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.requires_token),
6604 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level_by_preference),
6605 ),
6606 encoder, offset, _depth
6607 )
6608 }
6609 }
6610 unsafe impl<
6611 T0: fidl::encoding::Encode<DependencyType, fidl::encoding::DefaultFuchsiaResourceDialect>,
6612 T1: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
6613 T2: fidl::encoding::Encode<
6614 fidl::encoding::HandleType<
6615 fidl::Event,
6616 { fidl::ObjectType::EVENT.into_raw() },
6617 2147483648,
6618 >,
6619 fidl::encoding::DefaultFuchsiaResourceDialect,
6620 >,
6621 T3: fidl::encoding::Encode<
6622 fidl::encoding::Vector<u8, 256>,
6623 fidl::encoding::DefaultFuchsiaResourceDialect,
6624 >,
6625 > fidl::encoding::Encode<LevelDependency, fidl::encoding::DefaultFuchsiaResourceDialect>
6626 for (T0, T1, T2, T3)
6627 {
6628 #[inline]
6629 unsafe fn encode(
6630 self,
6631 encoder: &mut fidl::encoding::Encoder<
6632 '_,
6633 fidl::encoding::DefaultFuchsiaResourceDialect,
6634 >,
6635 offset: usize,
6636 depth: fidl::encoding::Depth,
6637 ) -> fidl::Result<()> {
6638 encoder.debug_check_bounds::<LevelDependency>(offset);
6639 unsafe {
6642 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6643 (ptr as *mut u64).write_unaligned(0);
6644 }
6645 unsafe {
6646 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
6647 (ptr as *mut u64).write_unaligned(0);
6648 }
6649 self.0.encode(encoder, offset + 0, depth)?;
6651 self.1.encode(encoder, offset + 4, depth)?;
6652 self.2.encode(encoder, offset + 8, depth)?;
6653 self.3.encode(encoder, offset + 16, depth)?;
6654 Ok(())
6655 }
6656 }
6657
6658 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6659 for LevelDependency
6660 {
6661 #[inline(always)]
6662 fn new_empty() -> Self {
6663 Self {
6664 dependency_type: fidl::new_empty!(
6665 DependencyType,
6666 fidl::encoding::DefaultFuchsiaResourceDialect
6667 ),
6668 dependent_level: fidl::new_empty!(
6669 u8,
6670 fidl::encoding::DefaultFuchsiaResourceDialect
6671 ),
6672 requires_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6673 requires_level_by_preference: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
6674 }
6675 }
6676
6677 #[inline]
6678 unsafe fn decode(
6679 &mut self,
6680 decoder: &mut fidl::encoding::Decoder<
6681 '_,
6682 fidl::encoding::DefaultFuchsiaResourceDialect,
6683 >,
6684 offset: usize,
6685 _depth: fidl::encoding::Depth,
6686 ) -> fidl::Result<()> {
6687 decoder.debug_check_bounds::<Self>(offset);
6688 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6690 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6691 let mask = 0xffffff0000000000u64;
6692 let maskedval = padval & mask;
6693 if maskedval != 0 {
6694 return Err(fidl::Error::NonZeroPadding {
6695 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6696 });
6697 }
6698 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
6699 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6700 let mask = 0xffffffff00000000u64;
6701 let maskedval = padval & mask;
6702 if maskedval != 0 {
6703 return Err(fidl::Error::NonZeroPadding {
6704 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
6705 });
6706 }
6707 fidl::decode!(
6708 DependencyType,
6709 fidl::encoding::DefaultFuchsiaResourceDialect,
6710 &mut self.dependency_type,
6711 decoder,
6712 offset + 0,
6713 _depth
6714 )?;
6715 fidl::decode!(
6716 u8,
6717 fidl::encoding::DefaultFuchsiaResourceDialect,
6718 &mut self.dependent_level,
6719 decoder,
6720 offset + 4,
6721 _depth
6722 )?;
6723 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_token, decoder, offset + 8, _depth)?;
6724 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.requires_level_by_preference, decoder, offset + 16, _depth)?;
6725 Ok(())
6726 }
6727 }
6728
6729 impl fidl::encoding::ResourceTypeMarker for RequiredLevelWatchResponse {
6730 type Borrowed<'a> = &'a mut Self;
6731 fn take_or_borrow<'a>(
6732 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6733 ) -> Self::Borrowed<'a> {
6734 value
6735 }
6736 }
6737
6738 unsafe impl fidl::encoding::TypeMarker for RequiredLevelWatchResponse {
6739 type Owned = Self;
6740
6741 #[inline(always)]
6742 fn inline_align(_context: fidl::encoding::Context) -> usize {
6743 1
6744 }
6745
6746 #[inline(always)]
6747 fn inline_size(_context: fidl::encoding::Context) -> usize {
6748 1
6749 }
6750 #[inline(always)]
6751 fn encode_is_copy() -> bool {
6752 true
6753 }
6754
6755 #[inline(always)]
6756 fn decode_is_copy() -> bool {
6757 true
6758 }
6759 }
6760
6761 unsafe impl
6762 fidl::encoding::Encode<
6763 RequiredLevelWatchResponse,
6764 fidl::encoding::DefaultFuchsiaResourceDialect,
6765 > for &mut RequiredLevelWatchResponse
6766 {
6767 #[inline]
6768 unsafe fn encode(
6769 self,
6770 encoder: &mut fidl::encoding::Encoder<
6771 '_,
6772 fidl::encoding::DefaultFuchsiaResourceDialect,
6773 >,
6774 offset: usize,
6775 _depth: fidl::encoding::Depth,
6776 ) -> fidl::Result<()> {
6777 encoder.debug_check_bounds::<RequiredLevelWatchResponse>(offset);
6778 unsafe {
6779 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6781 (buf_ptr as *mut RequiredLevelWatchResponse)
6782 .write_unaligned((self as *const RequiredLevelWatchResponse).read());
6783 }
6786 Ok(())
6787 }
6788 }
6789 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
6790 fidl::encoding::Encode<
6791 RequiredLevelWatchResponse,
6792 fidl::encoding::DefaultFuchsiaResourceDialect,
6793 > for (T0,)
6794 {
6795 #[inline]
6796 unsafe fn encode(
6797 self,
6798 encoder: &mut fidl::encoding::Encoder<
6799 '_,
6800 fidl::encoding::DefaultFuchsiaResourceDialect,
6801 >,
6802 offset: usize,
6803 depth: fidl::encoding::Depth,
6804 ) -> fidl::Result<()> {
6805 encoder.debug_check_bounds::<RequiredLevelWatchResponse>(offset);
6806 self.0.encode(encoder, offset + 0, depth)?;
6810 Ok(())
6811 }
6812 }
6813
6814 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6815 for RequiredLevelWatchResponse
6816 {
6817 #[inline(always)]
6818 fn new_empty() -> Self {
6819 Self {
6820 required_level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
6821 }
6822 }
6823
6824 #[inline]
6825 unsafe fn decode(
6826 &mut self,
6827 decoder: &mut fidl::encoding::Decoder<
6828 '_,
6829 fidl::encoding::DefaultFuchsiaResourceDialect,
6830 >,
6831 offset: usize,
6832 _depth: fidl::encoding::Depth,
6833 ) -> fidl::Result<()> {
6834 decoder.debug_check_bounds::<Self>(offset);
6835 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6836 unsafe {
6839 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
6840 }
6841 Ok(())
6842 }
6843 }
6844
6845 impl fidl::encoding::ResourceTypeMarker for StatusWatchPowerLevelResponse {
6846 type Borrowed<'a> = &'a mut Self;
6847 fn take_or_borrow<'a>(
6848 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6849 ) -> Self::Borrowed<'a> {
6850 value
6851 }
6852 }
6853
6854 unsafe impl fidl::encoding::TypeMarker for StatusWatchPowerLevelResponse {
6855 type Owned = Self;
6856
6857 #[inline(always)]
6858 fn inline_align(_context: fidl::encoding::Context) -> usize {
6859 1
6860 }
6861
6862 #[inline(always)]
6863 fn inline_size(_context: fidl::encoding::Context) -> usize {
6864 1
6865 }
6866 #[inline(always)]
6867 fn encode_is_copy() -> bool {
6868 true
6869 }
6870
6871 #[inline(always)]
6872 fn decode_is_copy() -> bool {
6873 true
6874 }
6875 }
6876
6877 unsafe impl
6878 fidl::encoding::Encode<
6879 StatusWatchPowerLevelResponse,
6880 fidl::encoding::DefaultFuchsiaResourceDialect,
6881 > for &mut StatusWatchPowerLevelResponse
6882 {
6883 #[inline]
6884 unsafe fn encode(
6885 self,
6886 encoder: &mut fidl::encoding::Encoder<
6887 '_,
6888 fidl::encoding::DefaultFuchsiaResourceDialect,
6889 >,
6890 offset: usize,
6891 _depth: fidl::encoding::Depth,
6892 ) -> fidl::Result<()> {
6893 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
6894 unsafe {
6895 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6897 (buf_ptr as *mut StatusWatchPowerLevelResponse)
6898 .write_unaligned((self as *const StatusWatchPowerLevelResponse).read());
6899 }
6902 Ok(())
6903 }
6904 }
6905 unsafe impl<T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>>
6906 fidl::encoding::Encode<
6907 StatusWatchPowerLevelResponse,
6908 fidl::encoding::DefaultFuchsiaResourceDialect,
6909 > for (T0,)
6910 {
6911 #[inline]
6912 unsafe fn encode(
6913 self,
6914 encoder: &mut fidl::encoding::Encoder<
6915 '_,
6916 fidl::encoding::DefaultFuchsiaResourceDialect,
6917 >,
6918 offset: usize,
6919 depth: fidl::encoding::Depth,
6920 ) -> fidl::Result<()> {
6921 encoder.debug_check_bounds::<StatusWatchPowerLevelResponse>(offset);
6922 self.0.encode(encoder, offset + 0, depth)?;
6926 Ok(())
6927 }
6928 }
6929
6930 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6931 for StatusWatchPowerLevelResponse
6932 {
6933 #[inline(always)]
6934 fn new_empty() -> Self {
6935 Self {
6936 current_level: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
6937 }
6938 }
6939
6940 #[inline]
6941 unsafe fn decode(
6942 &mut self,
6943 decoder: &mut fidl::encoding::Decoder<
6944 '_,
6945 fidl::encoding::DefaultFuchsiaResourceDialect,
6946 >,
6947 offset: usize,
6948 _depth: fidl::encoding::Depth,
6949 ) -> fidl::Result<()> {
6950 decoder.debug_check_bounds::<Self>(offset);
6951 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6952 unsafe {
6955 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
6956 }
6957 Ok(())
6958 }
6959 }
6960
6961 impl ElementSchema {
6962 #[inline(always)]
6963 fn max_ordinal_present(&self) -> u64 {
6964 if let Some(_) = self.element_runner {
6965 return 10;
6966 }
6967 if let Some(_) = self.element_control {
6968 return 9;
6969 }
6970 if let Some(_) = self.lessor_channel {
6971 return 8;
6972 }
6973 if let Some(_) = self.level_control_channels {
6974 return 7;
6975 }
6976 if let Some(_) = self.dependencies {
6977 return 4;
6978 }
6979 if let Some(_) = self.valid_levels {
6980 return 3;
6981 }
6982 if let Some(_) = self.initial_current_level {
6983 return 2;
6984 }
6985 if let Some(_) = self.element_name {
6986 return 1;
6987 }
6988 0
6989 }
6990 }
6991
6992 impl fidl::encoding::ResourceTypeMarker for ElementSchema {
6993 type Borrowed<'a> = &'a mut Self;
6994 fn take_or_borrow<'a>(
6995 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6996 ) -> Self::Borrowed<'a> {
6997 value
6998 }
6999 }
7000
7001 unsafe impl fidl::encoding::TypeMarker for ElementSchema {
7002 type Owned = Self;
7003
7004 #[inline(always)]
7005 fn inline_align(_context: fidl::encoding::Context) -> usize {
7006 8
7007 }
7008
7009 #[inline(always)]
7010 fn inline_size(_context: fidl::encoding::Context) -> usize {
7011 16
7012 }
7013 }
7014
7015 unsafe impl fidl::encoding::Encode<ElementSchema, fidl::encoding::DefaultFuchsiaResourceDialect>
7016 for &mut ElementSchema
7017 {
7018 unsafe fn encode(
7019 self,
7020 encoder: &mut fidl::encoding::Encoder<
7021 '_,
7022 fidl::encoding::DefaultFuchsiaResourceDialect,
7023 >,
7024 offset: usize,
7025 mut depth: fidl::encoding::Depth,
7026 ) -> fidl::Result<()> {
7027 encoder.debug_check_bounds::<ElementSchema>(offset);
7028 let max_ordinal: u64 = self.max_ordinal_present();
7030 encoder.write_num(max_ordinal, offset);
7031 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7032 if max_ordinal == 0 {
7034 return Ok(());
7035 }
7036 depth.increment()?;
7037 let envelope_size = 8;
7038 let bytes_len = max_ordinal as usize * envelope_size;
7039 #[allow(unused_variables)]
7040 let offset = encoder.out_of_line_offset(bytes_len);
7041 let mut _prev_end_offset: usize = 0;
7042 if 1 > max_ordinal {
7043 return Ok(());
7044 }
7045
7046 let cur_offset: usize = (1 - 1) * envelope_size;
7049
7050 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7052
7053 fidl::encoding::encode_in_envelope_optional::<
7058 fidl::encoding::BoundedString<64>,
7059 fidl::encoding::DefaultFuchsiaResourceDialect,
7060 >(
7061 self.element_name.as_ref().map(
7062 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
7063 ),
7064 encoder,
7065 offset + cur_offset,
7066 depth,
7067 )?;
7068
7069 _prev_end_offset = cur_offset + envelope_size;
7070 if 2 > max_ordinal {
7071 return Ok(());
7072 }
7073
7074 let cur_offset: usize = (2 - 1) * envelope_size;
7077
7078 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7080
7081 fidl::encoding::encode_in_envelope_optional::<
7086 u8,
7087 fidl::encoding::DefaultFuchsiaResourceDialect,
7088 >(
7089 self.initial_current_level
7090 .as_ref()
7091 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
7092 encoder,
7093 offset + cur_offset,
7094 depth,
7095 )?;
7096
7097 _prev_end_offset = cur_offset + envelope_size;
7098 if 3 > max_ordinal {
7099 return Ok(());
7100 }
7101
7102 let cur_offset: usize = (3 - 1) * envelope_size;
7105
7106 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7108
7109 fidl::encoding::encode_in_envelope_optional::<
7114 fidl::encoding::Vector<u8, 256>,
7115 fidl::encoding::DefaultFuchsiaResourceDialect,
7116 >(
7117 self.valid_levels.as_ref().map(
7118 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow,
7119 ),
7120 encoder,
7121 offset + cur_offset,
7122 depth,
7123 )?;
7124
7125 _prev_end_offset = cur_offset + envelope_size;
7126 if 4 > max_ordinal {
7127 return Ok(());
7128 }
7129
7130 let cur_offset: usize = (4 - 1) * envelope_size;
7133
7134 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7136
7137 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7142 self.dependencies.as_mut().map(<fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7143 encoder, offset + cur_offset, depth
7144 )?;
7145
7146 _prev_end_offset = cur_offset + envelope_size;
7147 if 7 > max_ordinal {
7148 return Ok(());
7149 }
7150
7151 let cur_offset: usize = (7 - 1) * envelope_size;
7154
7155 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7157
7158 fidl::encoding::encode_in_envelope_optional::<
7163 LevelControlChannels,
7164 fidl::encoding::DefaultFuchsiaResourceDialect,
7165 >(
7166 self.level_control_channels.as_mut().map(
7167 <LevelControlChannels as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7168 ),
7169 encoder,
7170 offset + cur_offset,
7171 depth,
7172 )?;
7173
7174 _prev_end_offset = cur_offset + envelope_size;
7175 if 8 > max_ordinal {
7176 return Ok(());
7177 }
7178
7179 let cur_offset: usize = (8 - 1) * envelope_size;
7182
7183 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7185
7186 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7191 self.lessor_channel.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7192 encoder, offset + cur_offset, depth
7193 )?;
7194
7195 _prev_end_offset = cur_offset + envelope_size;
7196 if 9 > max_ordinal {
7197 return Ok(());
7198 }
7199
7200 let cur_offset: usize = (9 - 1) * envelope_size;
7203
7204 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7206
7207 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7212 self.element_control.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7213 encoder, offset + cur_offset, depth
7214 )?;
7215
7216 _prev_end_offset = cur_offset + envelope_size;
7217 if 10 > max_ordinal {
7218 return Ok(());
7219 }
7220
7221 let cur_offset: usize = (10 - 1) * envelope_size;
7224
7225 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7227
7228 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7233 self.element_runner.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7234 encoder, offset + cur_offset, depth
7235 )?;
7236
7237 _prev_end_offset = cur_offset + envelope_size;
7238
7239 Ok(())
7240 }
7241 }
7242
7243 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ElementSchema {
7244 #[inline(always)]
7245 fn new_empty() -> Self {
7246 Self::default()
7247 }
7248
7249 unsafe fn decode(
7250 &mut self,
7251 decoder: &mut fidl::encoding::Decoder<
7252 '_,
7253 fidl::encoding::DefaultFuchsiaResourceDialect,
7254 >,
7255 offset: usize,
7256 mut depth: fidl::encoding::Depth,
7257 ) -> fidl::Result<()> {
7258 decoder.debug_check_bounds::<Self>(offset);
7259 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7260 None => return Err(fidl::Error::NotNullable),
7261 Some(len) => len,
7262 };
7263 if len == 0 {
7265 return Ok(());
7266 };
7267 depth.increment()?;
7268 let envelope_size = 8;
7269 let bytes_len = len * envelope_size;
7270 let offset = decoder.out_of_line_offset(bytes_len)?;
7271 let mut _next_ordinal_to_read = 0;
7273 let mut next_offset = offset;
7274 let end_offset = offset + bytes_len;
7275 _next_ordinal_to_read += 1;
7276 if next_offset >= end_offset {
7277 return Ok(());
7278 }
7279
7280 while _next_ordinal_to_read < 1 {
7282 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7283 _next_ordinal_to_read += 1;
7284 next_offset += envelope_size;
7285 }
7286
7287 let next_out_of_line = decoder.next_out_of_line();
7288 let handles_before = decoder.remaining_handles();
7289 if let Some((inlined, num_bytes, num_handles)) =
7290 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7291 {
7292 let member_inline_size =
7293 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
7294 decoder.context,
7295 );
7296 if inlined != (member_inline_size <= 4) {
7297 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7298 }
7299 let inner_offset;
7300 let mut inner_depth = depth.clone();
7301 if inlined {
7302 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7303 inner_offset = next_offset;
7304 } else {
7305 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7306 inner_depth.increment()?;
7307 }
7308 let val_ref = self.element_name.get_or_insert_with(|| {
7309 fidl::new_empty!(
7310 fidl::encoding::BoundedString<64>,
7311 fidl::encoding::DefaultFuchsiaResourceDialect
7312 )
7313 });
7314 fidl::decode!(
7315 fidl::encoding::BoundedString<64>,
7316 fidl::encoding::DefaultFuchsiaResourceDialect,
7317 val_ref,
7318 decoder,
7319 inner_offset,
7320 inner_depth
7321 )?;
7322 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7323 {
7324 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7325 }
7326 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7327 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7328 }
7329 }
7330
7331 next_offset += envelope_size;
7332 _next_ordinal_to_read += 1;
7333 if next_offset >= end_offset {
7334 return Ok(());
7335 }
7336
7337 while _next_ordinal_to_read < 2 {
7339 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7340 _next_ordinal_to_read += 1;
7341 next_offset += envelope_size;
7342 }
7343
7344 let next_out_of_line = decoder.next_out_of_line();
7345 let handles_before = decoder.remaining_handles();
7346 if let Some((inlined, num_bytes, num_handles)) =
7347 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7348 {
7349 let member_inline_size =
7350 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7351 if inlined != (member_inline_size <= 4) {
7352 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7353 }
7354 let inner_offset;
7355 let mut inner_depth = depth.clone();
7356 if inlined {
7357 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7358 inner_offset = next_offset;
7359 } else {
7360 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7361 inner_depth.increment()?;
7362 }
7363 let val_ref = self.initial_current_level.get_or_insert_with(|| {
7364 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
7365 });
7366 fidl::decode!(
7367 u8,
7368 fidl::encoding::DefaultFuchsiaResourceDialect,
7369 val_ref,
7370 decoder,
7371 inner_offset,
7372 inner_depth
7373 )?;
7374 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7375 {
7376 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7377 }
7378 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7379 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7380 }
7381 }
7382
7383 next_offset += envelope_size;
7384 _next_ordinal_to_read += 1;
7385 if next_offset >= end_offset {
7386 return Ok(());
7387 }
7388
7389 while _next_ordinal_to_read < 3 {
7391 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7392 _next_ordinal_to_read += 1;
7393 next_offset += envelope_size;
7394 }
7395
7396 let next_out_of_line = decoder.next_out_of_line();
7397 let handles_before = decoder.remaining_handles();
7398 if let Some((inlined, num_bytes, num_handles)) =
7399 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7400 {
7401 let member_inline_size =
7402 <fidl::encoding::Vector<u8, 256> as fidl::encoding::TypeMarker>::inline_size(
7403 decoder.context,
7404 );
7405 if inlined != (member_inline_size <= 4) {
7406 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7407 }
7408 let inner_offset;
7409 let mut inner_depth = depth.clone();
7410 if inlined {
7411 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7412 inner_offset = next_offset;
7413 } else {
7414 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7415 inner_depth.increment()?;
7416 }
7417 let val_ref =
7418 self.valid_levels.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
7419 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7420 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7421 {
7422 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7423 }
7424 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7425 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7426 }
7427 }
7428
7429 next_offset += envelope_size;
7430 _next_ordinal_to_read += 1;
7431 if next_offset >= end_offset {
7432 return Ok(());
7433 }
7434
7435 while _next_ordinal_to_read < 4 {
7437 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7438 _next_ordinal_to_read += 1;
7439 next_offset += envelope_size;
7440 }
7441
7442 let next_out_of_line = decoder.next_out_of_line();
7443 let handles_before = decoder.remaining_handles();
7444 if let Some((inlined, num_bytes, num_handles)) =
7445 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7446 {
7447 let member_inline_size = <fidl::encoding::Vector<LevelDependency, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7448 if inlined != (member_inline_size <= 4) {
7449 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7450 }
7451 let inner_offset;
7452 let mut inner_depth = depth.clone();
7453 if inlined {
7454 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7455 inner_offset = next_offset;
7456 } else {
7457 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7458 inner_depth.increment()?;
7459 }
7460 let val_ref =
7461 self.dependencies.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
7462 fidl::decode!(fidl::encoding::Vector<LevelDependency, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7463 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7464 {
7465 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7466 }
7467 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7468 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7469 }
7470 }
7471
7472 next_offset += envelope_size;
7473 _next_ordinal_to_read += 1;
7474 if next_offset >= end_offset {
7475 return Ok(());
7476 }
7477
7478 while _next_ordinal_to_read < 7 {
7480 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7481 _next_ordinal_to_read += 1;
7482 next_offset += envelope_size;
7483 }
7484
7485 let next_out_of_line = decoder.next_out_of_line();
7486 let handles_before = decoder.remaining_handles();
7487 if let Some((inlined, num_bytes, num_handles)) =
7488 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7489 {
7490 let member_inline_size =
7491 <LevelControlChannels as fidl::encoding::TypeMarker>::inline_size(
7492 decoder.context,
7493 );
7494 if inlined != (member_inline_size <= 4) {
7495 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7496 }
7497 let inner_offset;
7498 let mut inner_depth = depth.clone();
7499 if inlined {
7500 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7501 inner_offset = next_offset;
7502 } else {
7503 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7504 inner_depth.increment()?;
7505 }
7506 let val_ref = self.level_control_channels.get_or_insert_with(|| {
7507 fidl::new_empty!(
7508 LevelControlChannels,
7509 fidl::encoding::DefaultFuchsiaResourceDialect
7510 )
7511 });
7512 fidl::decode!(
7513 LevelControlChannels,
7514 fidl::encoding::DefaultFuchsiaResourceDialect,
7515 val_ref,
7516 decoder,
7517 inner_offset,
7518 inner_depth
7519 )?;
7520 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7521 {
7522 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7523 }
7524 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7525 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7526 }
7527 }
7528
7529 next_offset += envelope_size;
7530 _next_ordinal_to_read += 1;
7531 if next_offset >= end_offset {
7532 return Ok(());
7533 }
7534
7535 while _next_ordinal_to_read < 8 {
7537 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7538 _next_ordinal_to_read += 1;
7539 next_offset += envelope_size;
7540 }
7541
7542 let next_out_of_line = decoder.next_out_of_line();
7543 let handles_before = decoder.remaining_handles();
7544 if let Some((inlined, num_bytes, num_handles)) =
7545 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7546 {
7547 let member_inline_size = <fidl::encoding::Endpoint<
7548 fidl::endpoints::ServerEnd<LessorMarker>,
7549 > as fidl::encoding::TypeMarker>::inline_size(
7550 decoder.context
7551 );
7552 if inlined != (member_inline_size <= 4) {
7553 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7554 }
7555 let inner_offset;
7556 let mut inner_depth = depth.clone();
7557 if inlined {
7558 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7559 inner_offset = next_offset;
7560 } else {
7561 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7562 inner_depth.increment()?;
7563 }
7564 let val_ref = self.lessor_channel.get_or_insert_with(|| {
7565 fidl::new_empty!(
7566 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
7567 fidl::encoding::DefaultFuchsiaResourceDialect
7568 )
7569 });
7570 fidl::decode!(
7571 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LessorMarker>>,
7572 fidl::encoding::DefaultFuchsiaResourceDialect,
7573 val_ref,
7574 decoder,
7575 inner_offset,
7576 inner_depth
7577 )?;
7578 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7579 {
7580 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7581 }
7582 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7583 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7584 }
7585 }
7586
7587 next_offset += envelope_size;
7588 _next_ordinal_to_read += 1;
7589 if next_offset >= end_offset {
7590 return Ok(());
7591 }
7592
7593 while _next_ordinal_to_read < 9 {
7595 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7596 _next_ordinal_to_read += 1;
7597 next_offset += envelope_size;
7598 }
7599
7600 let next_out_of_line = decoder.next_out_of_line();
7601 let handles_before = decoder.remaining_handles();
7602 if let Some((inlined, num_bytes, num_handles)) =
7603 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7604 {
7605 let member_inline_size = <fidl::encoding::Endpoint<
7606 fidl::endpoints::ServerEnd<ElementControlMarker>,
7607 > as fidl::encoding::TypeMarker>::inline_size(
7608 decoder.context
7609 );
7610 if inlined != (member_inline_size <= 4) {
7611 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7612 }
7613 let inner_offset;
7614 let mut inner_depth = depth.clone();
7615 if inlined {
7616 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7617 inner_offset = next_offset;
7618 } else {
7619 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7620 inner_depth.increment()?;
7621 }
7622 let val_ref = self.element_control.get_or_insert_with(|| {
7623 fidl::new_empty!(
7624 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
7625 fidl::encoding::DefaultFuchsiaResourceDialect
7626 )
7627 });
7628 fidl::decode!(
7629 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ElementControlMarker>>,
7630 fidl::encoding::DefaultFuchsiaResourceDialect,
7631 val_ref,
7632 decoder,
7633 inner_offset,
7634 inner_depth
7635 )?;
7636 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7637 {
7638 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7639 }
7640 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7641 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7642 }
7643 }
7644
7645 next_offset += envelope_size;
7646 _next_ordinal_to_read += 1;
7647 if next_offset >= end_offset {
7648 return Ok(());
7649 }
7650
7651 while _next_ordinal_to_read < 10 {
7653 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7654 _next_ordinal_to_read += 1;
7655 next_offset += envelope_size;
7656 }
7657
7658 let next_out_of_line = decoder.next_out_of_line();
7659 let handles_before = decoder.remaining_handles();
7660 if let Some((inlined, num_bytes, num_handles)) =
7661 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7662 {
7663 let member_inline_size = <fidl::encoding::Endpoint<
7664 fidl::endpoints::ClientEnd<ElementRunnerMarker>,
7665 > as fidl::encoding::TypeMarker>::inline_size(
7666 decoder.context
7667 );
7668 if inlined != (member_inline_size <= 4) {
7669 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7670 }
7671 let inner_offset;
7672 let mut inner_depth = depth.clone();
7673 if inlined {
7674 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7675 inner_offset = next_offset;
7676 } else {
7677 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7678 inner_depth.increment()?;
7679 }
7680 let val_ref = self.element_runner.get_or_insert_with(|| {
7681 fidl::new_empty!(
7682 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
7683 fidl::encoding::DefaultFuchsiaResourceDialect
7684 )
7685 });
7686 fidl::decode!(
7687 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ElementRunnerMarker>>,
7688 fidl::encoding::DefaultFuchsiaResourceDialect,
7689 val_ref,
7690 decoder,
7691 inner_offset,
7692 inner_depth
7693 )?;
7694 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7695 {
7696 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7697 }
7698 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7699 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7700 }
7701 }
7702
7703 next_offset += envelope_size;
7704
7705 while next_offset < end_offset {
7707 _next_ordinal_to_read += 1;
7708 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7709 next_offset += envelope_size;
7710 }
7711
7712 Ok(())
7713 }
7714 }
7715
7716 impl ElementStatusEndpoint {
7717 #[inline(always)]
7718 fn max_ordinal_present(&self) -> u64 {
7719 if let Some(_) = self.status {
7720 return 2;
7721 }
7722 if let Some(_) = self.identifier {
7723 return 1;
7724 }
7725 0
7726 }
7727 }
7728
7729 impl fidl::encoding::ResourceTypeMarker for ElementStatusEndpoint {
7730 type Borrowed<'a> = &'a mut Self;
7731 fn take_or_borrow<'a>(
7732 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7733 ) -> Self::Borrowed<'a> {
7734 value
7735 }
7736 }
7737
7738 unsafe impl fidl::encoding::TypeMarker for ElementStatusEndpoint {
7739 type Owned = Self;
7740
7741 #[inline(always)]
7742 fn inline_align(_context: fidl::encoding::Context) -> usize {
7743 8
7744 }
7745
7746 #[inline(always)]
7747 fn inline_size(_context: fidl::encoding::Context) -> usize {
7748 16
7749 }
7750 }
7751
7752 unsafe impl
7753 fidl::encoding::Encode<ElementStatusEndpoint, fidl::encoding::DefaultFuchsiaResourceDialect>
7754 for &mut ElementStatusEndpoint
7755 {
7756 unsafe fn encode(
7757 self,
7758 encoder: &mut fidl::encoding::Encoder<
7759 '_,
7760 fidl::encoding::DefaultFuchsiaResourceDialect,
7761 >,
7762 offset: usize,
7763 mut depth: fidl::encoding::Depth,
7764 ) -> fidl::Result<()> {
7765 encoder.debug_check_bounds::<ElementStatusEndpoint>(offset);
7766 let max_ordinal: u64 = self.max_ordinal_present();
7768 encoder.write_num(max_ordinal, offset);
7769 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7770 if max_ordinal == 0 {
7772 return Ok(());
7773 }
7774 depth.increment()?;
7775 let envelope_size = 8;
7776 let bytes_len = max_ordinal as usize * envelope_size;
7777 #[allow(unused_variables)]
7778 let offset = encoder.out_of_line_offset(bytes_len);
7779 let mut _prev_end_offset: usize = 0;
7780 if 1 > max_ordinal {
7781 return Ok(());
7782 }
7783
7784 let cur_offset: usize = (1 - 1) * envelope_size;
7787
7788 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7790
7791 fidl::encoding::encode_in_envelope_optional::<
7796 fidl::encoding::BoundedString<64>,
7797 fidl::encoding::DefaultFuchsiaResourceDialect,
7798 >(
7799 self.identifier.as_ref().map(
7800 <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
7801 ),
7802 encoder,
7803 offset + cur_offset,
7804 depth,
7805 )?;
7806
7807 _prev_end_offset = cur_offset + envelope_size;
7808 if 2 > max_ordinal {
7809 return Ok(());
7810 }
7811
7812 let cur_offset: usize = (2 - 1) * envelope_size;
7815
7816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7818
7819 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7824 self.status.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7825 encoder, offset + cur_offset, depth
7826 )?;
7827
7828 _prev_end_offset = cur_offset + envelope_size;
7829
7830 Ok(())
7831 }
7832 }
7833
7834 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7835 for ElementStatusEndpoint
7836 {
7837 #[inline(always)]
7838 fn new_empty() -> Self {
7839 Self::default()
7840 }
7841
7842 unsafe fn decode(
7843 &mut self,
7844 decoder: &mut fidl::encoding::Decoder<
7845 '_,
7846 fidl::encoding::DefaultFuchsiaResourceDialect,
7847 >,
7848 offset: usize,
7849 mut depth: fidl::encoding::Depth,
7850 ) -> fidl::Result<()> {
7851 decoder.debug_check_bounds::<Self>(offset);
7852 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7853 None => return Err(fidl::Error::NotNullable),
7854 Some(len) => len,
7855 };
7856 if len == 0 {
7858 return Ok(());
7859 };
7860 depth.increment()?;
7861 let envelope_size = 8;
7862 let bytes_len = len * envelope_size;
7863 let offset = decoder.out_of_line_offset(bytes_len)?;
7864 let mut _next_ordinal_to_read = 0;
7866 let mut next_offset = offset;
7867 let end_offset = offset + bytes_len;
7868 _next_ordinal_to_read += 1;
7869 if next_offset >= end_offset {
7870 return Ok(());
7871 }
7872
7873 while _next_ordinal_to_read < 1 {
7875 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7876 _next_ordinal_to_read += 1;
7877 next_offset += envelope_size;
7878 }
7879
7880 let next_out_of_line = decoder.next_out_of_line();
7881 let handles_before = decoder.remaining_handles();
7882 if let Some((inlined, num_bytes, num_handles)) =
7883 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7884 {
7885 let member_inline_size =
7886 <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
7887 decoder.context,
7888 );
7889 if inlined != (member_inline_size <= 4) {
7890 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7891 }
7892 let inner_offset;
7893 let mut inner_depth = depth.clone();
7894 if inlined {
7895 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7896 inner_offset = next_offset;
7897 } else {
7898 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7899 inner_depth.increment()?;
7900 }
7901 let val_ref = self.identifier.get_or_insert_with(|| {
7902 fidl::new_empty!(
7903 fidl::encoding::BoundedString<64>,
7904 fidl::encoding::DefaultFuchsiaResourceDialect
7905 )
7906 });
7907 fidl::decode!(
7908 fidl::encoding::BoundedString<64>,
7909 fidl::encoding::DefaultFuchsiaResourceDialect,
7910 val_ref,
7911 decoder,
7912 inner_offset,
7913 inner_depth
7914 )?;
7915 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7916 {
7917 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7918 }
7919 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7920 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7921 }
7922 }
7923
7924 next_offset += envelope_size;
7925 _next_ordinal_to_read += 1;
7926 if next_offset >= end_offset {
7927 return Ok(());
7928 }
7929
7930 while _next_ordinal_to_read < 2 {
7932 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7933 _next_ordinal_to_read += 1;
7934 next_offset += envelope_size;
7935 }
7936
7937 let next_out_of_line = decoder.next_out_of_line();
7938 let handles_before = decoder.remaining_handles();
7939 if let Some((inlined, num_bytes, num_handles)) =
7940 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7941 {
7942 let member_inline_size = <fidl::encoding::Endpoint<
7943 fidl::endpoints::ClientEnd<StatusMarker>,
7944 > as fidl::encoding::TypeMarker>::inline_size(
7945 decoder.context
7946 );
7947 if inlined != (member_inline_size <= 4) {
7948 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7949 }
7950 let inner_offset;
7951 let mut inner_depth = depth.clone();
7952 if inlined {
7953 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7954 inner_offset = next_offset;
7955 } else {
7956 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7957 inner_depth.increment()?;
7958 }
7959 let val_ref = self.status.get_or_insert_with(|| {
7960 fidl::new_empty!(
7961 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
7962 fidl::encoding::DefaultFuchsiaResourceDialect
7963 )
7964 });
7965 fidl::decode!(
7966 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StatusMarker>>,
7967 fidl::encoding::DefaultFuchsiaResourceDialect,
7968 val_ref,
7969 decoder,
7970 inner_offset,
7971 inner_depth
7972 )?;
7973 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7974 {
7975 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7976 }
7977 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7978 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7979 }
7980 }
7981
7982 next_offset += envelope_size;
7983
7984 while next_offset < end_offset {
7986 _next_ordinal_to_read += 1;
7987 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7988 next_offset += envelope_size;
7989 }
7990
7991 Ok(())
7992 }
7993 }
7994}