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