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