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