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