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_recovery_policy__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.recovery.policy.Device";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
26
27pub trait DeviceProxyInterface: Send + Sync {
28 fn r#set_is_local_reset_allowed(&self, allowed: bool) -> Result<(), fidl::Error>;
29}
30#[derive(Debug)]
31#[cfg(target_os = "fuchsia")]
32pub struct DeviceSynchronousProxy {
33 client: fidl::client::sync::Client,
34}
35
36#[cfg(target_os = "fuchsia")]
37impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
38 type Proxy = DeviceProxy;
39 type Protocol = DeviceMarker;
40
41 fn from_channel(inner: fidl::Channel) -> Self {
42 Self::new(inner)
43 }
44
45 fn into_channel(self) -> fidl::Channel {
46 self.client.into_channel()
47 }
48
49 fn as_channel(&self) -> &fidl::Channel {
50 self.client.as_channel()
51 }
52}
53
54#[cfg(target_os = "fuchsia")]
55impl DeviceSynchronousProxy {
56 pub fn new(channel: fidl::Channel) -> Self {
57 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
58 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
59 }
60
61 pub fn into_channel(self) -> fidl::Channel {
62 self.client.into_channel()
63 }
64
65 pub fn wait_for_event(
68 &self,
69 deadline: zx::MonotonicInstant,
70 ) -> Result<DeviceEvent, fidl::Error> {
71 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
72 }
73
74 pub fn r#set_is_local_reset_allowed(&self, mut allowed: bool) -> Result<(), fidl::Error> {
79 self.client.send::<DeviceSetIsLocalResetAllowedRequest>(
80 (allowed,),
81 0x7a0343d0fccb7ac7,
82 fidl::encoding::DynamicFlags::empty(),
83 )
84 }
85}
86
87#[cfg(target_os = "fuchsia")]
88impl From<DeviceSynchronousProxy> for zx::Handle {
89 fn from(value: DeviceSynchronousProxy) -> Self {
90 value.into_channel().into()
91 }
92}
93
94#[cfg(target_os = "fuchsia")]
95impl From<fidl::Channel> for DeviceSynchronousProxy {
96 fn from(value: fidl::Channel) -> Self {
97 Self::new(value)
98 }
99}
100
101#[cfg(target_os = "fuchsia")]
102impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
103 type Protocol = DeviceMarker;
104
105 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
106 Self::new(value.into_channel())
107 }
108}
109
110#[derive(Debug, Clone)]
111pub struct DeviceProxy {
112 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
113}
114
115impl fidl::endpoints::Proxy for DeviceProxy {
116 type Protocol = DeviceMarker;
117
118 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
119 Self::new(inner)
120 }
121
122 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
123 self.client.into_channel().map_err(|client| Self { client })
124 }
125
126 fn as_channel(&self) -> &::fidl::AsyncChannel {
127 self.client.as_channel()
128 }
129}
130
131impl DeviceProxy {
132 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
134 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
135 Self { client: fidl::client::Client::new(channel, protocol_name) }
136 }
137
138 pub fn take_event_stream(&self) -> DeviceEventStream {
144 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
145 }
146
147 pub fn r#set_is_local_reset_allowed(&self, mut allowed: bool) -> Result<(), fidl::Error> {
152 DeviceProxyInterface::r#set_is_local_reset_allowed(self, allowed)
153 }
154}
155
156impl DeviceProxyInterface for DeviceProxy {
157 fn r#set_is_local_reset_allowed(&self, mut allowed: bool) -> Result<(), fidl::Error> {
158 self.client.send::<DeviceSetIsLocalResetAllowedRequest>(
159 (allowed,),
160 0x7a0343d0fccb7ac7,
161 fidl::encoding::DynamicFlags::empty(),
162 )
163 }
164}
165
166pub struct DeviceEventStream {
167 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
168}
169
170impl std::marker::Unpin for DeviceEventStream {}
171
172impl futures::stream::FusedStream for DeviceEventStream {
173 fn is_terminated(&self) -> bool {
174 self.event_receiver.is_terminated()
175 }
176}
177
178impl futures::Stream for DeviceEventStream {
179 type Item = Result<DeviceEvent, fidl::Error>;
180
181 fn poll_next(
182 mut self: std::pin::Pin<&mut Self>,
183 cx: &mut std::task::Context<'_>,
184 ) -> std::task::Poll<Option<Self::Item>> {
185 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
186 &mut self.event_receiver,
187 cx
188 )?) {
189 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
190 None => std::task::Poll::Ready(None),
191 }
192 }
193}
194
195#[derive(Debug)]
196pub enum DeviceEvent {}
197
198impl DeviceEvent {
199 fn decode(
201 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
202 ) -> Result<DeviceEvent, fidl::Error> {
203 let (bytes, _handles) = buf.split_mut();
204 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
205 debug_assert_eq!(tx_header.tx_id, 0);
206 match tx_header.ordinal {
207 _ => Err(fidl::Error::UnknownOrdinal {
208 ordinal: tx_header.ordinal,
209 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
210 }),
211 }
212 }
213}
214
215pub struct DeviceRequestStream {
217 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
218 is_terminated: bool,
219}
220
221impl std::marker::Unpin for DeviceRequestStream {}
222
223impl futures::stream::FusedStream for DeviceRequestStream {
224 fn is_terminated(&self) -> bool {
225 self.is_terminated
226 }
227}
228
229impl fidl::endpoints::RequestStream for DeviceRequestStream {
230 type Protocol = DeviceMarker;
231 type ControlHandle = DeviceControlHandle;
232
233 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
234 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
235 }
236
237 fn control_handle(&self) -> Self::ControlHandle {
238 DeviceControlHandle { inner: self.inner.clone() }
239 }
240
241 fn into_inner(
242 self,
243 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
244 {
245 (self.inner, self.is_terminated)
246 }
247
248 fn from_inner(
249 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
250 is_terminated: bool,
251 ) -> Self {
252 Self { inner, is_terminated }
253 }
254}
255
256impl futures::Stream for DeviceRequestStream {
257 type Item = Result<DeviceRequest, fidl::Error>;
258
259 fn poll_next(
260 mut self: std::pin::Pin<&mut Self>,
261 cx: &mut std::task::Context<'_>,
262 ) -> std::task::Poll<Option<Self::Item>> {
263 let this = &mut *self;
264 if this.inner.check_shutdown(cx) {
265 this.is_terminated = true;
266 return std::task::Poll::Ready(None);
267 }
268 if this.is_terminated {
269 panic!("polled DeviceRequestStream after completion");
270 }
271 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
272 |bytes, handles| {
273 match this.inner.channel().read_etc(cx, bytes, handles) {
274 std::task::Poll::Ready(Ok(())) => {}
275 std::task::Poll::Pending => return std::task::Poll::Pending,
276 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
277 this.is_terminated = true;
278 return std::task::Poll::Ready(None);
279 }
280 std::task::Poll::Ready(Err(e)) => {
281 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
282 e.into(),
283 ))))
284 }
285 }
286
287 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
289
290 std::task::Poll::Ready(Some(match header.ordinal {
291 0x7a0343d0fccb7ac7 => {
292 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
293 let mut req = fidl::new_empty!(
294 DeviceSetIsLocalResetAllowedRequest,
295 fidl::encoding::DefaultFuchsiaResourceDialect
296 );
297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetIsLocalResetAllowedRequest>(&header, _body_bytes, handles, &mut req)?;
298 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
299 Ok(DeviceRequest::SetIsLocalResetAllowed {
300 allowed: req.allowed,
301
302 control_handle,
303 })
304 }
305 _ => Err(fidl::Error::UnknownOrdinal {
306 ordinal: header.ordinal,
307 protocol_name:
308 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
309 }),
310 }))
311 },
312 )
313 }
314}
315
316#[derive(Debug)]
321pub enum DeviceRequest {
322 SetIsLocalResetAllowed { allowed: bool, control_handle: DeviceControlHandle },
327}
328
329impl DeviceRequest {
330 #[allow(irrefutable_let_patterns)]
331 pub fn into_set_is_local_reset_allowed(self) -> Option<(bool, DeviceControlHandle)> {
332 if let DeviceRequest::SetIsLocalResetAllowed { allowed, control_handle } = self {
333 Some((allowed, control_handle))
334 } else {
335 None
336 }
337 }
338
339 pub fn method_name(&self) -> &'static str {
341 match *self {
342 DeviceRequest::SetIsLocalResetAllowed { .. } => "set_is_local_reset_allowed",
343 }
344 }
345}
346
347#[derive(Debug, Clone)]
348pub struct DeviceControlHandle {
349 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
350}
351
352impl fidl::endpoints::ControlHandle for DeviceControlHandle {
353 fn shutdown(&self) {
354 self.inner.shutdown()
355 }
356 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
357 self.inner.shutdown_with_epitaph(status)
358 }
359
360 fn is_closed(&self) -> bool {
361 self.inner.channel().is_closed()
362 }
363 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
364 self.inner.channel().on_closed()
365 }
366
367 #[cfg(target_os = "fuchsia")]
368 fn signal_peer(
369 &self,
370 clear_mask: zx::Signals,
371 set_mask: zx::Signals,
372 ) -> Result<(), zx_status::Status> {
373 use fidl::Peered;
374 self.inner.channel().signal_peer(clear_mask, set_mask)
375 }
376}
377
378impl DeviceControlHandle {}
379
380#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
381pub struct FactoryResetMarker;
382
383impl fidl::endpoints::ProtocolMarker for FactoryResetMarker {
384 type Proxy = FactoryResetProxy;
385 type RequestStream = FactoryResetRequestStream;
386 #[cfg(target_os = "fuchsia")]
387 type SynchronousProxy = FactoryResetSynchronousProxy;
388
389 const DEBUG_NAME: &'static str = "fuchsia.recovery.policy.FactoryReset";
390}
391impl fidl::endpoints::DiscoverableProtocolMarker for FactoryResetMarker {}
392
393pub trait FactoryResetProxyInterface: Send + Sync {
394 type GetEnabledResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
395 fn r#get_enabled(&self) -> Self::GetEnabledResponseFut;
396}
397#[derive(Debug)]
398#[cfg(target_os = "fuchsia")]
399pub struct FactoryResetSynchronousProxy {
400 client: fidl::client::sync::Client,
401}
402
403#[cfg(target_os = "fuchsia")]
404impl fidl::endpoints::SynchronousProxy for FactoryResetSynchronousProxy {
405 type Proxy = FactoryResetProxy;
406 type Protocol = FactoryResetMarker;
407
408 fn from_channel(inner: fidl::Channel) -> Self {
409 Self::new(inner)
410 }
411
412 fn into_channel(self) -> fidl::Channel {
413 self.client.into_channel()
414 }
415
416 fn as_channel(&self) -> &fidl::Channel {
417 self.client.as_channel()
418 }
419}
420
421#[cfg(target_os = "fuchsia")]
422impl FactoryResetSynchronousProxy {
423 pub fn new(channel: fidl::Channel) -> Self {
424 let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
425 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
426 }
427
428 pub fn into_channel(self) -> fidl::Channel {
429 self.client.into_channel()
430 }
431
432 pub fn wait_for_event(
435 &self,
436 deadline: zx::MonotonicInstant,
437 ) -> Result<FactoryResetEvent, fidl::Error> {
438 FactoryResetEvent::decode(self.client.wait_for_event(deadline)?)
439 }
440
441 pub fn r#get_enabled(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
444 let _response = self
445 .client
446 .send_query::<fidl::encoding::EmptyPayload, FactoryResetGetEnabledResponse>(
447 (),
448 0x46b4c73b3d6be123,
449 fidl::encoding::DynamicFlags::empty(),
450 ___deadline,
451 )?;
452 Ok(_response.fdr_enabled)
453 }
454}
455
456#[cfg(target_os = "fuchsia")]
457impl From<FactoryResetSynchronousProxy> for zx::Handle {
458 fn from(value: FactoryResetSynchronousProxy) -> Self {
459 value.into_channel().into()
460 }
461}
462
463#[cfg(target_os = "fuchsia")]
464impl From<fidl::Channel> for FactoryResetSynchronousProxy {
465 fn from(value: fidl::Channel) -> Self {
466 Self::new(value)
467 }
468}
469
470#[cfg(target_os = "fuchsia")]
471impl fidl::endpoints::FromClient for FactoryResetSynchronousProxy {
472 type Protocol = FactoryResetMarker;
473
474 fn from_client(value: fidl::endpoints::ClientEnd<FactoryResetMarker>) -> Self {
475 Self::new(value.into_channel())
476 }
477}
478
479#[derive(Debug, Clone)]
480pub struct FactoryResetProxy {
481 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
482}
483
484impl fidl::endpoints::Proxy for FactoryResetProxy {
485 type Protocol = FactoryResetMarker;
486
487 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
488 Self::new(inner)
489 }
490
491 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
492 self.client.into_channel().map_err(|client| Self { client })
493 }
494
495 fn as_channel(&self) -> &::fidl::AsyncChannel {
496 self.client.as_channel()
497 }
498}
499
500impl FactoryResetProxy {
501 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
503 let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
504 Self { client: fidl::client::Client::new(channel, protocol_name) }
505 }
506
507 pub fn take_event_stream(&self) -> FactoryResetEventStream {
513 FactoryResetEventStream { event_receiver: self.client.take_event_receiver() }
514 }
515
516 pub fn r#get_enabled(
519 &self,
520 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
521 FactoryResetProxyInterface::r#get_enabled(self)
522 }
523}
524
525impl FactoryResetProxyInterface for FactoryResetProxy {
526 type GetEnabledResponseFut =
527 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
528 fn r#get_enabled(&self) -> Self::GetEnabledResponseFut {
529 fn _decode(
530 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
531 ) -> Result<bool, fidl::Error> {
532 let _response = fidl::client::decode_transaction_body::<
533 FactoryResetGetEnabledResponse,
534 fidl::encoding::DefaultFuchsiaResourceDialect,
535 0x46b4c73b3d6be123,
536 >(_buf?)?;
537 Ok(_response.fdr_enabled)
538 }
539 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
540 (),
541 0x46b4c73b3d6be123,
542 fidl::encoding::DynamicFlags::empty(),
543 _decode,
544 )
545 }
546}
547
548pub struct FactoryResetEventStream {
549 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
550}
551
552impl std::marker::Unpin for FactoryResetEventStream {}
553
554impl futures::stream::FusedStream for FactoryResetEventStream {
555 fn is_terminated(&self) -> bool {
556 self.event_receiver.is_terminated()
557 }
558}
559
560impl futures::Stream for FactoryResetEventStream {
561 type Item = Result<FactoryResetEvent, fidl::Error>;
562
563 fn poll_next(
564 mut self: std::pin::Pin<&mut Self>,
565 cx: &mut std::task::Context<'_>,
566 ) -> std::task::Poll<Option<Self::Item>> {
567 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
568 &mut self.event_receiver,
569 cx
570 )?) {
571 Some(buf) => std::task::Poll::Ready(Some(FactoryResetEvent::decode(buf))),
572 None => std::task::Poll::Ready(None),
573 }
574 }
575}
576
577#[derive(Debug)]
578pub enum FactoryResetEvent {}
579
580impl FactoryResetEvent {
581 fn decode(
583 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
584 ) -> Result<FactoryResetEvent, fidl::Error> {
585 let (bytes, _handles) = buf.split_mut();
586 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
587 debug_assert_eq!(tx_header.tx_id, 0);
588 match tx_header.ordinal {
589 _ => Err(fidl::Error::UnknownOrdinal {
590 ordinal: tx_header.ordinal,
591 protocol_name: <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
592 }),
593 }
594 }
595}
596
597pub struct FactoryResetRequestStream {
599 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
600 is_terminated: bool,
601}
602
603impl std::marker::Unpin for FactoryResetRequestStream {}
604
605impl futures::stream::FusedStream for FactoryResetRequestStream {
606 fn is_terminated(&self) -> bool {
607 self.is_terminated
608 }
609}
610
611impl fidl::endpoints::RequestStream for FactoryResetRequestStream {
612 type Protocol = FactoryResetMarker;
613 type ControlHandle = FactoryResetControlHandle;
614
615 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
616 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
617 }
618
619 fn control_handle(&self) -> Self::ControlHandle {
620 FactoryResetControlHandle { inner: self.inner.clone() }
621 }
622
623 fn into_inner(
624 self,
625 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
626 {
627 (self.inner, self.is_terminated)
628 }
629
630 fn from_inner(
631 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
632 is_terminated: bool,
633 ) -> Self {
634 Self { inner, is_terminated }
635 }
636}
637
638impl futures::Stream for FactoryResetRequestStream {
639 type Item = Result<FactoryResetRequest, fidl::Error>;
640
641 fn poll_next(
642 mut self: std::pin::Pin<&mut Self>,
643 cx: &mut std::task::Context<'_>,
644 ) -> std::task::Poll<Option<Self::Item>> {
645 let this = &mut *self;
646 if this.inner.check_shutdown(cx) {
647 this.is_terminated = true;
648 return std::task::Poll::Ready(None);
649 }
650 if this.is_terminated {
651 panic!("polled FactoryResetRequestStream after completion");
652 }
653 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
654 |bytes, handles| {
655 match this.inner.channel().read_etc(cx, bytes, handles) {
656 std::task::Poll::Ready(Ok(())) => {}
657 std::task::Poll::Pending => return std::task::Poll::Pending,
658 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
659 this.is_terminated = true;
660 return std::task::Poll::Ready(None);
661 }
662 std::task::Poll::Ready(Err(e)) => {
663 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
664 e.into(),
665 ))))
666 }
667 }
668
669 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
671
672 std::task::Poll::Ready(Some(match header.ordinal {
673 0x46b4c73b3d6be123 => {
674 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
675 let mut req = fidl::new_empty!(
676 fidl::encoding::EmptyPayload,
677 fidl::encoding::DefaultFuchsiaResourceDialect
678 );
679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
680 let control_handle =
681 FactoryResetControlHandle { inner: this.inner.clone() };
682 Ok(FactoryResetRequest::GetEnabled {
683 responder: FactoryResetGetEnabledResponder {
684 control_handle: std::mem::ManuallyDrop::new(control_handle),
685 tx_id: header.tx_id,
686 },
687 })
688 }
689 _ => Err(fidl::Error::UnknownOrdinal {
690 ordinal: header.ordinal,
691 protocol_name:
692 <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
693 }),
694 }))
695 },
696 )
697 }
698}
699
700#[derive(Debug)]
702pub enum FactoryResetRequest {
703 GetEnabled { responder: FactoryResetGetEnabledResponder },
706}
707
708impl FactoryResetRequest {
709 #[allow(irrefutable_let_patterns)]
710 pub fn into_get_enabled(self) -> Option<(FactoryResetGetEnabledResponder)> {
711 if let FactoryResetRequest::GetEnabled { responder } = self {
712 Some((responder))
713 } else {
714 None
715 }
716 }
717
718 pub fn method_name(&self) -> &'static str {
720 match *self {
721 FactoryResetRequest::GetEnabled { .. } => "get_enabled",
722 }
723 }
724}
725
726#[derive(Debug, Clone)]
727pub struct FactoryResetControlHandle {
728 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
729}
730
731impl fidl::endpoints::ControlHandle for FactoryResetControlHandle {
732 fn shutdown(&self) {
733 self.inner.shutdown()
734 }
735 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
736 self.inner.shutdown_with_epitaph(status)
737 }
738
739 fn is_closed(&self) -> bool {
740 self.inner.channel().is_closed()
741 }
742 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
743 self.inner.channel().on_closed()
744 }
745
746 #[cfg(target_os = "fuchsia")]
747 fn signal_peer(
748 &self,
749 clear_mask: zx::Signals,
750 set_mask: zx::Signals,
751 ) -> Result<(), zx_status::Status> {
752 use fidl::Peered;
753 self.inner.channel().signal_peer(clear_mask, set_mask)
754 }
755}
756
757impl FactoryResetControlHandle {}
758
759#[must_use = "FIDL methods require a response to be sent"]
760#[derive(Debug)]
761pub struct FactoryResetGetEnabledResponder {
762 control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
763 tx_id: u32,
764}
765
766impl std::ops::Drop for FactoryResetGetEnabledResponder {
770 fn drop(&mut self) {
771 self.control_handle.shutdown();
772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
774 }
775}
776
777impl fidl::endpoints::Responder for FactoryResetGetEnabledResponder {
778 type ControlHandle = FactoryResetControlHandle;
779
780 fn control_handle(&self) -> &FactoryResetControlHandle {
781 &self.control_handle
782 }
783
784 fn drop_without_shutdown(mut self) {
785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
787 std::mem::forget(self);
789 }
790}
791
792impl FactoryResetGetEnabledResponder {
793 pub fn send(self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
797 let _result = self.send_raw(fdr_enabled);
798 if _result.is_err() {
799 self.control_handle.shutdown();
800 }
801 self.drop_without_shutdown();
802 _result
803 }
804
805 pub fn send_no_shutdown_on_err(self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
807 let _result = self.send_raw(fdr_enabled);
808 self.drop_without_shutdown();
809 _result
810 }
811
812 fn send_raw(&self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
813 self.control_handle.inner.send::<FactoryResetGetEnabledResponse>(
814 (fdr_enabled,),
815 self.tx_id,
816 0x46b4c73b3d6be123,
817 fidl::encoding::DynamicFlags::empty(),
818 )
819 }
820}
821
822mod internal {
823 use super::*;
824}