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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct CheckerSentinelFileContentsResponse {
15 pub contents: String,
16}
17
18impl fidl::Persistable for CheckerSentinelFileContentsResponse {}
19
20#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
21pub struct CheckerMarker;
22
23impl fidl::endpoints::ProtocolMarker for CheckerMarker {
24 type Proxy = CheckerProxy;
25 type RequestStream = CheckerRequestStream;
26 #[cfg(target_os = "fuchsia")]
27 type SynchronousProxy = CheckerSynchronousProxy;
28
29 const DEBUG_NAME: &'static str = "test.checker.Checker";
30}
31impl fidl::endpoints::DiscoverableProtocolMarker for CheckerMarker {}
32
33pub trait CheckerProxyInterface: Send + Sync {
34 type SentinelFileContentsResponseFut: std::future::Future<Output = Result<String, fidl::Error>>
35 + Send;
36 fn r#sentinel_file_contents(&self) -> Self::SentinelFileContentsResponseFut;
37}
38#[derive(Debug)]
39#[cfg(target_os = "fuchsia")]
40pub struct CheckerSynchronousProxy {
41 client: fidl::client::sync::Client,
42}
43
44#[cfg(target_os = "fuchsia")]
45impl fidl::endpoints::SynchronousProxy for CheckerSynchronousProxy {
46 type Proxy = CheckerProxy;
47 type Protocol = CheckerMarker;
48
49 fn from_channel(inner: fidl::Channel) -> Self {
50 Self::new(inner)
51 }
52
53 fn into_channel(self) -> fidl::Channel {
54 self.client.into_channel()
55 }
56
57 fn as_channel(&self) -> &fidl::Channel {
58 self.client.as_channel()
59 }
60}
61
62#[cfg(target_os = "fuchsia")]
63impl CheckerSynchronousProxy {
64 pub fn new(channel: fidl::Channel) -> Self {
65 let protocol_name = <CheckerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
66 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
67 }
68
69 pub fn into_channel(self) -> fidl::Channel {
70 self.client.into_channel()
71 }
72
73 pub fn wait_for_event(
76 &self,
77 deadline: zx::MonotonicInstant,
78 ) -> Result<CheckerEvent, fidl::Error> {
79 CheckerEvent::decode(self.client.wait_for_event(deadline)?)
80 }
81
82 pub fn r#sentinel_file_contents(
86 &self,
87 ___deadline: zx::MonotonicInstant,
88 ) -> Result<String, fidl::Error> {
89 let _response = self
90 .client
91 .send_query::<fidl::encoding::EmptyPayload, CheckerSentinelFileContentsResponse>(
92 (),
93 0x4733f9bf9988f3d9,
94 fidl::encoding::DynamicFlags::empty(),
95 ___deadline,
96 )?;
97 Ok(_response.contents)
98 }
99}
100
101#[derive(Debug, Clone)]
102pub struct CheckerProxy {
103 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
104}
105
106impl fidl::endpoints::Proxy for CheckerProxy {
107 type Protocol = CheckerMarker;
108
109 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
110 Self::new(inner)
111 }
112
113 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
114 self.client.into_channel().map_err(|client| Self { client })
115 }
116
117 fn as_channel(&self) -> &::fidl::AsyncChannel {
118 self.client.as_channel()
119 }
120}
121
122impl CheckerProxy {
123 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
125 let protocol_name = <CheckerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
126 Self { client: fidl::client::Client::new(channel, protocol_name) }
127 }
128
129 pub fn take_event_stream(&self) -> CheckerEventStream {
135 CheckerEventStream { event_receiver: self.client.take_event_receiver() }
136 }
137
138 pub fn r#sentinel_file_contents(
142 &self,
143 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
144 CheckerProxyInterface::r#sentinel_file_contents(self)
145 }
146}
147
148impl CheckerProxyInterface for CheckerProxy {
149 type SentinelFileContentsResponseFut =
150 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
151 fn r#sentinel_file_contents(&self) -> Self::SentinelFileContentsResponseFut {
152 fn _decode(
153 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
154 ) -> Result<String, fidl::Error> {
155 let _response = fidl::client::decode_transaction_body::<
156 CheckerSentinelFileContentsResponse,
157 fidl::encoding::DefaultFuchsiaResourceDialect,
158 0x4733f9bf9988f3d9,
159 >(_buf?)?;
160 Ok(_response.contents)
161 }
162 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
163 (),
164 0x4733f9bf9988f3d9,
165 fidl::encoding::DynamicFlags::empty(),
166 _decode,
167 )
168 }
169}
170
171pub struct CheckerEventStream {
172 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
173}
174
175impl std::marker::Unpin for CheckerEventStream {}
176
177impl futures::stream::FusedStream for CheckerEventStream {
178 fn is_terminated(&self) -> bool {
179 self.event_receiver.is_terminated()
180 }
181}
182
183impl futures::Stream for CheckerEventStream {
184 type Item = Result<CheckerEvent, fidl::Error>;
185
186 fn poll_next(
187 mut self: std::pin::Pin<&mut Self>,
188 cx: &mut std::task::Context<'_>,
189 ) -> std::task::Poll<Option<Self::Item>> {
190 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
191 &mut self.event_receiver,
192 cx
193 )?) {
194 Some(buf) => std::task::Poll::Ready(Some(CheckerEvent::decode(buf))),
195 None => std::task::Poll::Ready(None),
196 }
197 }
198}
199
200#[derive(Debug)]
201pub enum CheckerEvent {}
202
203impl CheckerEvent {
204 fn decode(
206 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
207 ) -> Result<CheckerEvent, fidl::Error> {
208 let (bytes, _handles) = buf.split_mut();
209 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
210 debug_assert_eq!(tx_header.tx_id, 0);
211 match tx_header.ordinal {
212 _ => Err(fidl::Error::UnknownOrdinal {
213 ordinal: tx_header.ordinal,
214 protocol_name: <CheckerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
215 }),
216 }
217 }
218}
219
220pub struct CheckerRequestStream {
222 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
223 is_terminated: bool,
224}
225
226impl std::marker::Unpin for CheckerRequestStream {}
227
228impl futures::stream::FusedStream for CheckerRequestStream {
229 fn is_terminated(&self) -> bool {
230 self.is_terminated
231 }
232}
233
234impl fidl::endpoints::RequestStream for CheckerRequestStream {
235 type Protocol = CheckerMarker;
236 type ControlHandle = CheckerControlHandle;
237
238 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
239 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
240 }
241
242 fn control_handle(&self) -> Self::ControlHandle {
243 CheckerControlHandle { inner: self.inner.clone() }
244 }
245
246 fn into_inner(
247 self,
248 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
249 {
250 (self.inner, self.is_terminated)
251 }
252
253 fn from_inner(
254 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
255 is_terminated: bool,
256 ) -> Self {
257 Self { inner, is_terminated }
258 }
259}
260
261impl futures::Stream for CheckerRequestStream {
262 type Item = Result<CheckerRequest, fidl::Error>;
263
264 fn poll_next(
265 mut self: std::pin::Pin<&mut Self>,
266 cx: &mut std::task::Context<'_>,
267 ) -> std::task::Poll<Option<Self::Item>> {
268 let this = &mut *self;
269 if this.inner.check_shutdown(cx) {
270 this.is_terminated = true;
271 return std::task::Poll::Ready(None);
272 }
273 if this.is_terminated {
274 panic!("polled CheckerRequestStream after completion");
275 }
276 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
277 |bytes, handles| {
278 match this.inner.channel().read_etc(cx, bytes, handles) {
279 std::task::Poll::Ready(Ok(())) => {}
280 std::task::Poll::Pending => return std::task::Poll::Pending,
281 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
282 this.is_terminated = true;
283 return std::task::Poll::Ready(None);
284 }
285 std::task::Poll::Ready(Err(e)) => {
286 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
287 e.into(),
288 ))))
289 }
290 }
291
292 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
294
295 std::task::Poll::Ready(Some(match header.ordinal {
296 0x4733f9bf9988f3d9 => {
297 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
298 let mut req = fidl::new_empty!(
299 fidl::encoding::EmptyPayload,
300 fidl::encoding::DefaultFuchsiaResourceDialect
301 );
302 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
303 let control_handle = CheckerControlHandle { inner: this.inner.clone() };
304 Ok(CheckerRequest::SentinelFileContents {
305 responder: CheckerSentinelFileContentsResponder {
306 control_handle: std::mem::ManuallyDrop::new(control_handle),
307 tx_id: header.tx_id,
308 },
309 })
310 }
311 _ => Err(fidl::Error::UnknownOrdinal {
312 ordinal: header.ordinal,
313 protocol_name:
314 <CheckerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
315 }),
316 }))
317 },
318 )
319 }
320}
321
322#[derive(Debug)]
323pub enum CheckerRequest {
324 SentinelFileContents { responder: CheckerSentinelFileContentsResponder },
328}
329
330impl CheckerRequest {
331 #[allow(irrefutable_let_patterns)]
332 pub fn into_sentinel_file_contents(self) -> Option<(CheckerSentinelFileContentsResponder)> {
333 if let CheckerRequest::SentinelFileContents { responder } = self {
334 Some((responder))
335 } else {
336 None
337 }
338 }
339
340 pub fn method_name(&self) -> &'static str {
342 match *self {
343 CheckerRequest::SentinelFileContents { .. } => "sentinel_file_contents",
344 }
345 }
346}
347
348#[derive(Debug, Clone)]
349pub struct CheckerControlHandle {
350 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
351}
352
353impl fidl::endpoints::ControlHandle for CheckerControlHandle {
354 fn shutdown(&self) {
355 self.inner.shutdown()
356 }
357 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
358 self.inner.shutdown_with_epitaph(status)
359 }
360
361 fn is_closed(&self) -> bool {
362 self.inner.channel().is_closed()
363 }
364 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
365 self.inner.channel().on_closed()
366 }
367
368 #[cfg(target_os = "fuchsia")]
369 fn signal_peer(
370 &self,
371 clear_mask: zx::Signals,
372 set_mask: zx::Signals,
373 ) -> Result<(), zx_status::Status> {
374 use fidl::Peered;
375 self.inner.channel().signal_peer(clear_mask, set_mask)
376 }
377}
378
379impl CheckerControlHandle {}
380
381#[must_use = "FIDL methods require a response to be sent"]
382#[derive(Debug)]
383pub struct CheckerSentinelFileContentsResponder {
384 control_handle: std::mem::ManuallyDrop<CheckerControlHandle>,
385 tx_id: u32,
386}
387
388impl std::ops::Drop for CheckerSentinelFileContentsResponder {
392 fn drop(&mut self) {
393 self.control_handle.shutdown();
394 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
396 }
397}
398
399impl fidl::endpoints::Responder for CheckerSentinelFileContentsResponder {
400 type ControlHandle = CheckerControlHandle;
401
402 fn control_handle(&self) -> &CheckerControlHandle {
403 &self.control_handle
404 }
405
406 fn drop_without_shutdown(mut self) {
407 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
409 std::mem::forget(self);
411 }
412}
413
414impl CheckerSentinelFileContentsResponder {
415 pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
419 let _result = self.send_raw(contents);
420 if _result.is_err() {
421 self.control_handle.shutdown();
422 }
423 self.drop_without_shutdown();
424 _result
425 }
426
427 pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
429 let _result = self.send_raw(contents);
430 self.drop_without_shutdown();
431 _result
432 }
433
434 fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
435 self.control_handle.inner.send::<CheckerSentinelFileContentsResponse>(
436 (contents,),
437 self.tx_id,
438 0x4733f9bf9988f3d9,
439 fidl::encoding::DynamicFlags::empty(),
440 )
441 }
442}
443
444mod internal {
445 use super::*;
446
447 impl fidl::encoding::ValueTypeMarker for CheckerSentinelFileContentsResponse {
448 type Borrowed<'a> = &'a Self;
449 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
450 value
451 }
452 }
453
454 unsafe impl fidl::encoding::TypeMarker for CheckerSentinelFileContentsResponse {
455 type Owned = Self;
456
457 #[inline(always)]
458 fn inline_align(_context: fidl::encoding::Context) -> usize {
459 8
460 }
461
462 #[inline(always)]
463 fn inline_size(_context: fidl::encoding::Context) -> usize {
464 16
465 }
466 }
467
468 unsafe impl<D: fidl::encoding::ResourceDialect>
469 fidl::encoding::Encode<CheckerSentinelFileContentsResponse, D>
470 for &CheckerSentinelFileContentsResponse
471 {
472 #[inline]
473 unsafe fn encode(
474 self,
475 encoder: &mut fidl::encoding::Encoder<'_, D>,
476 offset: usize,
477 _depth: fidl::encoding::Depth,
478 ) -> fidl::Result<()> {
479 encoder.debug_check_bounds::<CheckerSentinelFileContentsResponse>(offset);
480 fidl::encoding::Encode::<CheckerSentinelFileContentsResponse, D>::encode(
482 (<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow(
483 &self.contents,
484 ),),
485 encoder,
486 offset,
487 _depth,
488 )
489 }
490 }
491 unsafe impl<
492 D: fidl::encoding::ResourceDialect,
493 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1000>, D>,
494 > fidl::encoding::Encode<CheckerSentinelFileContentsResponse, D> for (T0,)
495 {
496 #[inline]
497 unsafe fn encode(
498 self,
499 encoder: &mut fidl::encoding::Encoder<'_, D>,
500 offset: usize,
501 depth: fidl::encoding::Depth,
502 ) -> fidl::Result<()> {
503 encoder.debug_check_bounds::<CheckerSentinelFileContentsResponse>(offset);
504 self.0.encode(encoder, offset + 0, depth)?;
508 Ok(())
509 }
510 }
511
512 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
513 for CheckerSentinelFileContentsResponse
514 {
515 #[inline(always)]
516 fn new_empty() -> Self {
517 Self { contents: fidl::new_empty!(fidl::encoding::BoundedString<1000>, D) }
518 }
519
520 #[inline]
521 unsafe fn decode(
522 &mut self,
523 decoder: &mut fidl::encoding::Decoder<'_, D>,
524 offset: usize,
525 _depth: fidl::encoding::Depth,
526 ) -> fidl::Result<()> {
527 decoder.debug_check_bounds::<Self>(offset);
528 fidl::decode!(
530 fidl::encoding::BoundedString<1000>,
531 D,
532 &mut self.contents,
533 decoder,
534 offset + 0,
535 _depth
536 )?;
537 Ok(())
538 }
539 }
540}