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#[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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
374 self.inner.shutdown_with_epitaph(status)
375 }
376
377 fn is_closed(&self) -> bool {
378 self.inner.channel().is_closed()
379 }
380 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
381 self.inner.channel().on_closed()
382 }
383
384 #[cfg(target_os = "fuchsia")]
385 fn signal_peer(
386 &self,
387 clear_mask: zx::Signals,
388 set_mask: zx::Signals,
389 ) -> Result<(), zx_status::Status> {
390 use fidl::Peered;
391 self.inner.channel().signal_peer(clear_mask, set_mask)
392 }
393}
394
395impl ComponentOtaHealthCheckControlHandle {}
396
397#[must_use = "FIDL methods require a response to be sent"]
398#[derive(Debug)]
399pub struct ComponentOtaHealthCheckGetHealthStatusResponder {
400 control_handle: std::mem::ManuallyDrop<ComponentOtaHealthCheckControlHandle>,
401 tx_id: u32,
402}
403
404impl std::ops::Drop for ComponentOtaHealthCheckGetHealthStatusResponder {
408 fn drop(&mut self) {
409 self.control_handle.shutdown();
410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
412 }
413}
414
415impl fidl::endpoints::Responder for ComponentOtaHealthCheckGetHealthStatusResponder {
416 type ControlHandle = ComponentOtaHealthCheckControlHandle;
417
418 fn control_handle(&self) -> &ComponentOtaHealthCheckControlHandle {
419 &self.control_handle
420 }
421
422 fn drop_without_shutdown(mut self) {
423 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
425 std::mem::forget(self);
427 }
428}
429
430impl ComponentOtaHealthCheckGetHealthStatusResponder {
431 pub fn send(self, mut health_status: HealthStatus) -> Result<(), fidl::Error> {
435 let _result = self.send_raw(health_status);
436 if _result.is_err() {
437 self.control_handle.shutdown();
438 }
439 self.drop_without_shutdown();
440 _result
441 }
442
443 pub fn send_no_shutdown_on_err(
445 self,
446 mut health_status: HealthStatus,
447 ) -> Result<(), fidl::Error> {
448 let _result = self.send_raw(health_status);
449 self.drop_without_shutdown();
450 _result
451 }
452
453 fn send_raw(&self, mut health_status: HealthStatus) -> Result<(), fidl::Error> {
454 self.control_handle.inner.send::<ComponentOtaHealthCheckGetHealthStatusResponse>(
455 (health_status,),
456 self.tx_id,
457 0x4a0bab1f2132f9ee,
458 fidl::encoding::DynamicFlags::empty(),
459 )
460 }
461}
462
463#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
464pub struct HealthVerificationMarker;
465
466impl fidl::endpoints::ProtocolMarker for HealthVerificationMarker {
467 type Proxy = HealthVerificationProxy;
468 type RequestStream = HealthVerificationRequestStream;
469 #[cfg(target_os = "fuchsia")]
470 type SynchronousProxy = HealthVerificationSynchronousProxy;
471
472 const DEBUG_NAME: &'static str = "fuchsia.update.verify.HealthVerification";
473}
474impl fidl::endpoints::DiscoverableProtocolMarker for HealthVerificationMarker {}
475
476pub trait HealthVerificationProxyInterface: Send + Sync {
477 type QueryHealthChecksResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
478 fn r#query_health_checks(&self) -> Self::QueryHealthChecksResponseFut;
479}
480#[derive(Debug)]
481#[cfg(target_os = "fuchsia")]
482pub struct HealthVerificationSynchronousProxy {
483 client: fidl::client::sync::Client,
484}
485
486#[cfg(target_os = "fuchsia")]
487impl fidl::endpoints::SynchronousProxy for HealthVerificationSynchronousProxy {
488 type Proxy = HealthVerificationProxy;
489 type Protocol = HealthVerificationMarker;
490
491 fn from_channel(inner: fidl::Channel) -> Self {
492 Self::new(inner)
493 }
494
495 fn into_channel(self) -> fidl::Channel {
496 self.client.into_channel()
497 }
498
499 fn as_channel(&self) -> &fidl::Channel {
500 self.client.as_channel()
501 }
502}
503
504#[cfg(target_os = "fuchsia")]
505impl HealthVerificationSynchronousProxy {
506 pub fn new(channel: fidl::Channel) -> Self {
507 let protocol_name =
508 <HealthVerificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
509 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
510 }
511
512 pub fn into_channel(self) -> fidl::Channel {
513 self.client.into_channel()
514 }
515
516 pub fn wait_for_event(
519 &self,
520 deadline: zx::MonotonicInstant,
521 ) -> Result<HealthVerificationEvent, fidl::Error> {
522 HealthVerificationEvent::decode(self.client.wait_for_event(deadline)?)
523 }
524
525 pub fn r#query_health_checks(
529 &self,
530 ___deadline: zx::MonotonicInstant,
531 ) -> Result<i32, fidl::Error> {
532 let _response = self.client.send_query::<
533 fidl::encoding::EmptyPayload,
534 HealthVerificationQueryHealthChecksResponse,
535 >(
536 (),
537 0x372e04d635be9532,
538 fidl::encoding::DynamicFlags::empty(),
539 ___deadline,
540 )?;
541 Ok(_response.status)
542 }
543}
544
545#[cfg(target_os = "fuchsia")]
546impl From<HealthVerificationSynchronousProxy> for zx::Handle {
547 fn from(value: HealthVerificationSynchronousProxy) -> Self {
548 value.into_channel().into()
549 }
550}
551
552#[cfg(target_os = "fuchsia")]
553impl From<fidl::Channel> for HealthVerificationSynchronousProxy {
554 fn from(value: fidl::Channel) -> Self {
555 Self::new(value)
556 }
557}
558
559#[cfg(target_os = "fuchsia")]
560impl fidl::endpoints::FromClient for HealthVerificationSynchronousProxy {
561 type Protocol = HealthVerificationMarker;
562
563 fn from_client(value: fidl::endpoints::ClientEnd<HealthVerificationMarker>) -> Self {
564 Self::new(value.into_channel())
565 }
566}
567
568#[derive(Debug, Clone)]
569pub struct HealthVerificationProxy {
570 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
571}
572
573impl fidl::endpoints::Proxy for HealthVerificationProxy {
574 type Protocol = HealthVerificationMarker;
575
576 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
577 Self::new(inner)
578 }
579
580 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
581 self.client.into_channel().map_err(|client| Self { client })
582 }
583
584 fn as_channel(&self) -> &::fidl::AsyncChannel {
585 self.client.as_channel()
586 }
587}
588
589impl HealthVerificationProxy {
590 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
592 let protocol_name =
593 <HealthVerificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
594 Self { client: fidl::client::Client::new(channel, protocol_name) }
595 }
596
597 pub fn take_event_stream(&self) -> HealthVerificationEventStream {
603 HealthVerificationEventStream { event_receiver: self.client.take_event_receiver() }
604 }
605
606 pub fn r#query_health_checks(
610 &self,
611 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
612 HealthVerificationProxyInterface::r#query_health_checks(self)
613 }
614}
615
616impl HealthVerificationProxyInterface for HealthVerificationProxy {
617 type QueryHealthChecksResponseFut =
618 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
619 fn r#query_health_checks(&self) -> Self::QueryHealthChecksResponseFut {
620 fn _decode(
621 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
622 ) -> Result<i32, fidl::Error> {
623 let _response = fidl::client::decode_transaction_body::<
624 HealthVerificationQueryHealthChecksResponse,
625 fidl::encoding::DefaultFuchsiaResourceDialect,
626 0x372e04d635be9532,
627 >(_buf?)?;
628 Ok(_response.status)
629 }
630 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
631 (),
632 0x372e04d635be9532,
633 fidl::encoding::DynamicFlags::empty(),
634 _decode,
635 )
636 }
637}
638
639pub struct HealthVerificationEventStream {
640 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
641}
642
643impl std::marker::Unpin for HealthVerificationEventStream {}
644
645impl futures::stream::FusedStream for HealthVerificationEventStream {
646 fn is_terminated(&self) -> bool {
647 self.event_receiver.is_terminated()
648 }
649}
650
651impl futures::Stream for HealthVerificationEventStream {
652 type Item = Result<HealthVerificationEvent, fidl::Error>;
653
654 fn poll_next(
655 mut self: std::pin::Pin<&mut Self>,
656 cx: &mut std::task::Context<'_>,
657 ) -> std::task::Poll<Option<Self::Item>> {
658 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
659 &mut self.event_receiver,
660 cx
661 )?) {
662 Some(buf) => std::task::Poll::Ready(Some(HealthVerificationEvent::decode(buf))),
663 None => std::task::Poll::Ready(None),
664 }
665 }
666}
667
668#[derive(Debug)]
669pub enum HealthVerificationEvent {}
670
671impl HealthVerificationEvent {
672 fn decode(
674 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
675 ) -> Result<HealthVerificationEvent, fidl::Error> {
676 let (bytes, _handles) = buf.split_mut();
677 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
678 debug_assert_eq!(tx_header.tx_id, 0);
679 match tx_header.ordinal {
680 _ => Err(fidl::Error::UnknownOrdinal {
681 ordinal: tx_header.ordinal,
682 protocol_name:
683 <HealthVerificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
684 }),
685 }
686 }
687}
688
689pub struct HealthVerificationRequestStream {
691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
692 is_terminated: bool,
693}
694
695impl std::marker::Unpin for HealthVerificationRequestStream {}
696
697impl futures::stream::FusedStream for HealthVerificationRequestStream {
698 fn is_terminated(&self) -> bool {
699 self.is_terminated
700 }
701}
702
703impl fidl::endpoints::RequestStream for HealthVerificationRequestStream {
704 type Protocol = HealthVerificationMarker;
705 type ControlHandle = HealthVerificationControlHandle;
706
707 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
708 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
709 }
710
711 fn control_handle(&self) -> Self::ControlHandle {
712 HealthVerificationControlHandle { inner: self.inner.clone() }
713 }
714
715 fn into_inner(
716 self,
717 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
718 {
719 (self.inner, self.is_terminated)
720 }
721
722 fn from_inner(
723 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
724 is_terminated: bool,
725 ) -> Self {
726 Self { inner, is_terminated }
727 }
728}
729
730impl futures::Stream for HealthVerificationRequestStream {
731 type Item = Result<HealthVerificationRequest, fidl::Error>;
732
733 fn poll_next(
734 mut self: std::pin::Pin<&mut Self>,
735 cx: &mut std::task::Context<'_>,
736 ) -> std::task::Poll<Option<Self::Item>> {
737 let this = &mut *self;
738 if this.inner.check_shutdown(cx) {
739 this.is_terminated = true;
740 return std::task::Poll::Ready(None);
741 }
742 if this.is_terminated {
743 panic!("polled HealthVerificationRequestStream after completion");
744 }
745 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
746 |bytes, handles| {
747 match this.inner.channel().read_etc(cx, bytes, handles) {
748 std::task::Poll::Ready(Ok(())) => {}
749 std::task::Poll::Pending => return std::task::Poll::Pending,
750 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
751 this.is_terminated = true;
752 return std::task::Poll::Ready(None);
753 }
754 std::task::Poll::Ready(Err(e)) => {
755 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
756 e.into(),
757 ))))
758 }
759 }
760
761 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
763
764 std::task::Poll::Ready(Some(match header.ordinal {
765 0x372e04d635be9532 => {
766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
767 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
768 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
769 let control_handle = HealthVerificationControlHandle {
770 inner: this.inner.clone(),
771 };
772 Ok(HealthVerificationRequest::QueryHealthChecks {
773 responder: HealthVerificationQueryHealthChecksResponder {
774 control_handle: std::mem::ManuallyDrop::new(control_handle),
775 tx_id: header.tx_id,
776 },
777 })
778 }
779 _ => Err(fidl::Error::UnknownOrdinal {
780 ordinal: header.ordinal,
781 protocol_name: <HealthVerificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
782 }),
783 }))
784 },
785 )
786 }
787}
788
789#[derive(Debug)]
791pub enum HealthVerificationRequest {
792 QueryHealthChecks { responder: HealthVerificationQueryHealthChecksResponder },
796}
797
798impl HealthVerificationRequest {
799 #[allow(irrefutable_let_patterns)]
800 pub fn into_query_health_checks(
801 self,
802 ) -> Option<(HealthVerificationQueryHealthChecksResponder)> {
803 if let HealthVerificationRequest::QueryHealthChecks { responder } = self {
804 Some((responder))
805 } else {
806 None
807 }
808 }
809
810 pub fn method_name(&self) -> &'static str {
812 match *self {
813 HealthVerificationRequest::QueryHealthChecks { .. } => "query_health_checks",
814 }
815 }
816}
817
818#[derive(Debug, Clone)]
819pub struct HealthVerificationControlHandle {
820 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
821}
822
823impl fidl::endpoints::ControlHandle for HealthVerificationControlHandle {
824 fn shutdown(&self) {
825 self.inner.shutdown()
826 }
827 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
828 self.inner.shutdown_with_epitaph(status)
829 }
830
831 fn is_closed(&self) -> bool {
832 self.inner.channel().is_closed()
833 }
834 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
835 self.inner.channel().on_closed()
836 }
837
838 #[cfg(target_os = "fuchsia")]
839 fn signal_peer(
840 &self,
841 clear_mask: zx::Signals,
842 set_mask: zx::Signals,
843 ) -> Result<(), zx_status::Status> {
844 use fidl::Peered;
845 self.inner.channel().signal_peer(clear_mask, set_mask)
846 }
847}
848
849impl HealthVerificationControlHandle {}
850
851#[must_use = "FIDL methods require a response to be sent"]
852#[derive(Debug)]
853pub struct HealthVerificationQueryHealthChecksResponder {
854 control_handle: std::mem::ManuallyDrop<HealthVerificationControlHandle>,
855 tx_id: u32,
856}
857
858impl std::ops::Drop for HealthVerificationQueryHealthChecksResponder {
862 fn drop(&mut self) {
863 self.control_handle.shutdown();
864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
866 }
867}
868
869impl fidl::endpoints::Responder for HealthVerificationQueryHealthChecksResponder {
870 type ControlHandle = HealthVerificationControlHandle;
871
872 fn control_handle(&self) -> &HealthVerificationControlHandle {
873 &self.control_handle
874 }
875
876 fn drop_without_shutdown(mut self) {
877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
879 std::mem::forget(self);
881 }
882}
883
884impl HealthVerificationQueryHealthChecksResponder {
885 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
889 let _result = self.send_raw(status);
890 if _result.is_err() {
891 self.control_handle.shutdown();
892 }
893 self.drop_without_shutdown();
894 _result
895 }
896
897 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
899 let _result = self.send_raw(status);
900 self.drop_without_shutdown();
901 _result
902 }
903
904 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
905 self.control_handle.inner.send::<HealthVerificationQueryHealthChecksResponse>(
906 (status,),
907 self.tx_id,
908 0x372e04d635be9532,
909 fidl::encoding::DynamicFlags::empty(),
910 )
911 }
912}
913
914mod internal {
915 use super::*;
916}