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