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