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::NullableHandle {
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
357 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
358 self.inner.shutdown_with_epitaph(status)
359 }
360
361 fn is_closed(&self) -> bool {
362 self.inner.channel().is_closed()
363 }
364 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
365 self.inner.channel().on_closed()
366 }
367
368 #[cfg(target_os = "fuchsia")]
369 fn signal_peer(
370 &self,
371 clear_mask: zx::Signals,
372 set_mask: zx::Signals,
373 ) -> Result<(), zx_status::Status> {
374 use fidl::Peered;
375 self.inner.channel().signal_peer(clear_mask, set_mask)
376 }
377}
378
379impl DeviceControlHandle {}
380
381#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
382pub struct FactoryResetMarker;
383
384impl fidl::endpoints::ProtocolMarker for FactoryResetMarker {
385 type Proxy = FactoryResetProxy;
386 type RequestStream = FactoryResetRequestStream;
387 #[cfg(target_os = "fuchsia")]
388 type SynchronousProxy = FactoryResetSynchronousProxy;
389
390 const DEBUG_NAME: &'static str = "fuchsia.recovery.policy.FactoryReset";
391}
392impl fidl::endpoints::DiscoverableProtocolMarker for FactoryResetMarker {}
393
394pub trait FactoryResetProxyInterface: Send + Sync {
395 type GetEnabledResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
396 fn r#get_enabled(&self) -> Self::GetEnabledResponseFut;
397}
398#[derive(Debug)]
399#[cfg(target_os = "fuchsia")]
400pub struct FactoryResetSynchronousProxy {
401 client: fidl::client::sync::Client,
402}
403
404#[cfg(target_os = "fuchsia")]
405impl fidl::endpoints::SynchronousProxy for FactoryResetSynchronousProxy {
406 type Proxy = FactoryResetProxy;
407 type Protocol = FactoryResetMarker;
408
409 fn from_channel(inner: fidl::Channel) -> Self {
410 Self::new(inner)
411 }
412
413 fn into_channel(self) -> fidl::Channel {
414 self.client.into_channel()
415 }
416
417 fn as_channel(&self) -> &fidl::Channel {
418 self.client.as_channel()
419 }
420}
421
422#[cfg(target_os = "fuchsia")]
423impl FactoryResetSynchronousProxy {
424 pub fn new(channel: fidl::Channel) -> Self {
425 let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
426 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
427 }
428
429 pub fn into_channel(self) -> fidl::Channel {
430 self.client.into_channel()
431 }
432
433 pub fn wait_for_event(
436 &self,
437 deadline: zx::MonotonicInstant,
438 ) -> Result<FactoryResetEvent, fidl::Error> {
439 FactoryResetEvent::decode(self.client.wait_for_event(deadline)?)
440 }
441
442 pub fn r#get_enabled(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
445 let _response = self
446 .client
447 .send_query::<fidl::encoding::EmptyPayload, FactoryResetGetEnabledResponse>(
448 (),
449 0x46b4c73b3d6be123,
450 fidl::encoding::DynamicFlags::empty(),
451 ___deadline,
452 )?;
453 Ok(_response.fdr_enabled)
454 }
455}
456
457#[cfg(target_os = "fuchsia")]
458impl From<FactoryResetSynchronousProxy> for zx::NullableHandle {
459 fn from(value: FactoryResetSynchronousProxy) -> Self {
460 value.into_channel().into()
461 }
462}
463
464#[cfg(target_os = "fuchsia")]
465impl From<fidl::Channel> for FactoryResetSynchronousProxy {
466 fn from(value: fidl::Channel) -> Self {
467 Self::new(value)
468 }
469}
470
471#[cfg(target_os = "fuchsia")]
472impl fidl::endpoints::FromClient for FactoryResetSynchronousProxy {
473 type Protocol = FactoryResetMarker;
474
475 fn from_client(value: fidl::endpoints::ClientEnd<FactoryResetMarker>) -> Self {
476 Self::new(value.into_channel())
477 }
478}
479
480#[derive(Debug, Clone)]
481pub struct FactoryResetProxy {
482 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl fidl::endpoints::Proxy for FactoryResetProxy {
486 type Protocol = FactoryResetMarker;
487
488 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
489 Self::new(inner)
490 }
491
492 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
493 self.client.into_channel().map_err(|client| Self { client })
494 }
495
496 fn as_channel(&self) -> &::fidl::AsyncChannel {
497 self.client.as_channel()
498 }
499}
500
501impl FactoryResetProxy {
502 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
504 let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
505 Self { client: fidl::client::Client::new(channel, protocol_name) }
506 }
507
508 pub fn take_event_stream(&self) -> FactoryResetEventStream {
514 FactoryResetEventStream { event_receiver: self.client.take_event_receiver() }
515 }
516
517 pub fn r#get_enabled(
520 &self,
521 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
522 FactoryResetProxyInterface::r#get_enabled(self)
523 }
524}
525
526impl FactoryResetProxyInterface for FactoryResetProxy {
527 type GetEnabledResponseFut =
528 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
529 fn r#get_enabled(&self) -> Self::GetEnabledResponseFut {
530 fn _decode(
531 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
532 ) -> Result<bool, fidl::Error> {
533 let _response = fidl::client::decode_transaction_body::<
534 FactoryResetGetEnabledResponse,
535 fidl::encoding::DefaultFuchsiaResourceDialect,
536 0x46b4c73b3d6be123,
537 >(_buf?)?;
538 Ok(_response.fdr_enabled)
539 }
540 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
541 (),
542 0x46b4c73b3d6be123,
543 fidl::encoding::DynamicFlags::empty(),
544 _decode,
545 )
546 }
547}
548
549pub struct FactoryResetEventStream {
550 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
551}
552
553impl std::marker::Unpin for FactoryResetEventStream {}
554
555impl futures::stream::FusedStream for FactoryResetEventStream {
556 fn is_terminated(&self) -> bool {
557 self.event_receiver.is_terminated()
558 }
559}
560
561impl futures::Stream for FactoryResetEventStream {
562 type Item = Result<FactoryResetEvent, fidl::Error>;
563
564 fn poll_next(
565 mut self: std::pin::Pin<&mut Self>,
566 cx: &mut std::task::Context<'_>,
567 ) -> std::task::Poll<Option<Self::Item>> {
568 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
569 &mut self.event_receiver,
570 cx
571 )?) {
572 Some(buf) => std::task::Poll::Ready(Some(FactoryResetEvent::decode(buf))),
573 None => std::task::Poll::Ready(None),
574 }
575 }
576}
577
578#[derive(Debug)]
579pub enum FactoryResetEvent {}
580
581impl FactoryResetEvent {
582 fn decode(
584 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
585 ) -> Result<FactoryResetEvent, fidl::Error> {
586 let (bytes, _handles) = buf.split_mut();
587 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
588 debug_assert_eq!(tx_header.tx_id, 0);
589 match tx_header.ordinal {
590 _ => Err(fidl::Error::UnknownOrdinal {
591 ordinal: tx_header.ordinal,
592 protocol_name: <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
593 }),
594 }
595 }
596}
597
598pub struct FactoryResetRequestStream {
600 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
601 is_terminated: bool,
602}
603
604impl std::marker::Unpin for FactoryResetRequestStream {}
605
606impl futures::stream::FusedStream for FactoryResetRequestStream {
607 fn is_terminated(&self) -> bool {
608 self.is_terminated
609 }
610}
611
612impl fidl::endpoints::RequestStream for FactoryResetRequestStream {
613 type Protocol = FactoryResetMarker;
614 type ControlHandle = FactoryResetControlHandle;
615
616 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
617 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
618 }
619
620 fn control_handle(&self) -> Self::ControlHandle {
621 FactoryResetControlHandle { inner: self.inner.clone() }
622 }
623
624 fn into_inner(
625 self,
626 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
627 {
628 (self.inner, self.is_terminated)
629 }
630
631 fn from_inner(
632 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
633 is_terminated: bool,
634 ) -> Self {
635 Self { inner, is_terminated }
636 }
637}
638
639impl futures::Stream for FactoryResetRequestStream {
640 type Item = Result<FactoryResetRequest, fidl::Error>;
641
642 fn poll_next(
643 mut self: std::pin::Pin<&mut Self>,
644 cx: &mut std::task::Context<'_>,
645 ) -> std::task::Poll<Option<Self::Item>> {
646 let this = &mut *self;
647 if this.inner.check_shutdown(cx) {
648 this.is_terminated = true;
649 return std::task::Poll::Ready(None);
650 }
651 if this.is_terminated {
652 panic!("polled FactoryResetRequestStream after completion");
653 }
654 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
655 |bytes, handles| {
656 match this.inner.channel().read_etc(cx, bytes, handles) {
657 std::task::Poll::Ready(Ok(())) => {}
658 std::task::Poll::Pending => return std::task::Poll::Pending,
659 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
660 this.is_terminated = true;
661 return std::task::Poll::Ready(None);
662 }
663 std::task::Poll::Ready(Err(e)) => {
664 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
665 e.into(),
666 ))));
667 }
668 }
669
670 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
672
673 std::task::Poll::Ready(Some(match header.ordinal {
674 0x46b4c73b3d6be123 => {
675 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
676 let mut req = fidl::new_empty!(
677 fidl::encoding::EmptyPayload,
678 fidl::encoding::DefaultFuchsiaResourceDialect
679 );
680 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
681 let control_handle =
682 FactoryResetControlHandle { inner: this.inner.clone() };
683 Ok(FactoryResetRequest::GetEnabled {
684 responder: FactoryResetGetEnabledResponder {
685 control_handle: std::mem::ManuallyDrop::new(control_handle),
686 tx_id: header.tx_id,
687 },
688 })
689 }
690 _ => Err(fidl::Error::UnknownOrdinal {
691 ordinal: header.ordinal,
692 protocol_name:
693 <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
694 }),
695 }))
696 },
697 )
698 }
699}
700
701#[derive(Debug)]
703pub enum FactoryResetRequest {
704 GetEnabled { responder: FactoryResetGetEnabledResponder },
707}
708
709impl FactoryResetRequest {
710 #[allow(irrefutable_let_patterns)]
711 pub fn into_get_enabled(self) -> Option<(FactoryResetGetEnabledResponder)> {
712 if let FactoryResetRequest::GetEnabled { responder } = self {
713 Some((responder))
714 } else {
715 None
716 }
717 }
718
719 pub fn method_name(&self) -> &'static str {
721 match *self {
722 FactoryResetRequest::GetEnabled { .. } => "get_enabled",
723 }
724 }
725}
726
727#[derive(Debug, Clone)]
728pub struct FactoryResetControlHandle {
729 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
730}
731
732impl fidl::endpoints::ControlHandle for FactoryResetControlHandle {
733 fn shutdown(&self) {
734 self.inner.shutdown()
735 }
736
737 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
738 self.inner.shutdown_with_epitaph(status)
739 }
740
741 fn is_closed(&self) -> bool {
742 self.inner.channel().is_closed()
743 }
744 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
745 self.inner.channel().on_closed()
746 }
747
748 #[cfg(target_os = "fuchsia")]
749 fn signal_peer(
750 &self,
751 clear_mask: zx::Signals,
752 set_mask: zx::Signals,
753 ) -> Result<(), zx_status::Status> {
754 use fidl::Peered;
755 self.inner.channel().signal_peer(clear_mask, set_mask)
756 }
757}
758
759impl FactoryResetControlHandle {}
760
761#[must_use = "FIDL methods require a response to be sent"]
762#[derive(Debug)]
763pub struct FactoryResetGetEnabledResponder {
764 control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
765 tx_id: u32,
766}
767
768impl std::ops::Drop for FactoryResetGetEnabledResponder {
772 fn drop(&mut self) {
773 self.control_handle.shutdown();
774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
776 }
777}
778
779impl fidl::endpoints::Responder for FactoryResetGetEnabledResponder {
780 type ControlHandle = FactoryResetControlHandle;
781
782 fn control_handle(&self) -> &FactoryResetControlHandle {
783 &self.control_handle
784 }
785
786 fn drop_without_shutdown(mut self) {
787 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
789 std::mem::forget(self);
791 }
792}
793
794impl FactoryResetGetEnabledResponder {
795 pub fn send(self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
799 let _result = self.send_raw(fdr_enabled);
800 if _result.is_err() {
801 self.control_handle.shutdown();
802 }
803 self.drop_without_shutdown();
804 _result
805 }
806
807 pub fn send_no_shutdown_on_err(self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
809 let _result = self.send_raw(fdr_enabled);
810 self.drop_without_shutdown();
811 _result
812 }
813
814 fn send_raw(&self, mut fdr_enabled: bool) -> Result<(), fidl::Error> {
815 self.control_handle.inner.send::<FactoryResetGetEnabledResponse>(
816 (fdr_enabled,),
817 self.tx_id,
818 0x46b4c73b3d6be123,
819 fidl::encoding::DynamicFlags::empty(),
820 )
821 }
822}
823
824mod internal {
825 use super::*;
826}