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_test_processbuilder__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct UtilMarker;
16
17impl fidl::endpoints::ProtocolMarker for UtilMarker {
18 type Proxy = UtilProxy;
19 type RequestStream = UtilRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = UtilSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "test.processbuilder.Util";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for UtilMarker {}
26
27pub trait UtilProxyInterface: Send + Sync {
28 type GetArgumentsResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
29 + Send;
30 fn r#get_arguments(&self) -> Self::GetArgumentsResponseFut;
31 type GetArgumentCountResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
32 fn r#get_argument_count(&self) -> Self::GetArgumentCountResponseFut;
33 type GetEnvironmentResponseFut: std::future::Future<Output = Result<Vec<EnvVar>, fidl::Error>>
34 + Send;
35 fn r#get_environment(&self) -> Self::GetEnvironmentResponseFut;
36 type GetEnvironmentCountResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
37 + Send;
38 fn r#get_environment_count(&self) -> Self::GetEnvironmentCountResponseFut;
39 type DumpNamespaceResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
40 fn r#dump_namespace(&self) -> Self::DumpNamespaceResponseFut;
41 type ReadFileResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
42 fn r#read_file(&self, path: &str) -> Self::ReadFileResponseFut;
43 type GetLifecycleKoidResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
44 fn r#get_lifecycle_koid(&self) -> Self::GetLifecycleKoidResponseFut;
45}
46#[derive(Debug)]
47#[cfg(target_os = "fuchsia")]
48pub struct UtilSynchronousProxy {
49 client: fidl::client::sync::Client,
50}
51
52#[cfg(target_os = "fuchsia")]
53impl fidl::endpoints::SynchronousProxy for UtilSynchronousProxy {
54 type Proxy = UtilProxy;
55 type Protocol = UtilMarker;
56
57 fn from_channel(inner: fidl::Channel) -> Self {
58 Self::new(inner)
59 }
60
61 fn into_channel(self) -> fidl::Channel {
62 self.client.into_channel()
63 }
64
65 fn as_channel(&self) -> &fidl::Channel {
66 self.client.as_channel()
67 }
68}
69
70#[cfg(target_os = "fuchsia")]
71impl UtilSynchronousProxy {
72 pub fn new(channel: fidl::Channel) -> Self {
73 let protocol_name = <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
74 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
75 }
76
77 pub fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<UtilEvent, fidl::Error> {
84 UtilEvent::decode(self.client.wait_for_event(deadline)?)
85 }
86
87 pub fn r#get_arguments(
88 &self,
89 ___deadline: zx::MonotonicInstant,
90 ) -> Result<Vec<String>, fidl::Error> {
91 let _response =
92 self.client.send_query::<fidl::encoding::EmptyPayload, UtilGetArgumentsResponse>(
93 (),
94 0x50ff7f790c425519,
95 fidl::encoding::DynamicFlags::empty(),
96 ___deadline,
97 )?;
98 Ok(_response.args)
99 }
100
101 pub fn r#get_argument_count(
102 &self,
103 ___deadline: zx::MonotonicInstant,
104 ) -> Result<u64, fidl::Error> {
105 let _response =
106 self.client.send_query::<fidl::encoding::EmptyPayload, UtilGetArgumentCountResponse>(
107 (),
108 0x41ef27d234ed7098,
109 fidl::encoding::DynamicFlags::empty(),
110 ___deadline,
111 )?;
112 Ok(_response.count)
113 }
114
115 pub fn r#get_environment(
116 &self,
117 ___deadline: zx::MonotonicInstant,
118 ) -> Result<Vec<EnvVar>, fidl::Error> {
119 let _response =
120 self.client.send_query::<fidl::encoding::EmptyPayload, UtilGetEnvironmentResponse>(
121 (),
122 0x451e633adf04ec23,
123 fidl::encoding::DynamicFlags::empty(),
124 ___deadline,
125 )?;
126 Ok(_response.vars)
127 }
128
129 pub fn r#get_environment_count(
130 &self,
131 ___deadline: zx::MonotonicInstant,
132 ) -> Result<u64, fidl::Error> {
133 let _response = self
134 .client
135 .send_query::<fidl::encoding::EmptyPayload, UtilGetEnvironmentCountResponse>(
136 (),
137 0xe01fe768fb1be1a,
138 fidl::encoding::DynamicFlags::empty(),
139 ___deadline,
140 )?;
141 Ok(_response.count)
142 }
143
144 pub fn r#dump_namespace(
145 &self,
146 ___deadline: zx::MonotonicInstant,
147 ) -> Result<String, fidl::Error> {
148 let _response =
149 self.client.send_query::<fidl::encoding::EmptyPayload, UtilDumpNamespaceResponse>(
150 (),
151 0x73826cecc1a7f3a4,
152 fidl::encoding::DynamicFlags::empty(),
153 ___deadline,
154 )?;
155 Ok(_response.contents)
156 }
157
158 pub fn r#read_file(
159 &self,
160 mut path: &str,
161 ___deadline: zx::MonotonicInstant,
162 ) -> Result<String, fidl::Error> {
163 let _response = self.client.send_query::<UtilReadFileRequest, UtilReadFileResponse>(
164 (path,),
165 0x2ea8e2e4b427a391,
166 fidl::encoding::DynamicFlags::empty(),
167 ___deadline,
168 )?;
169 Ok(_response.contents)
170 }
171
172 pub fn r#get_lifecycle_koid(
173 &self,
174 ___deadline: zx::MonotonicInstant,
175 ) -> Result<u64, fidl::Error> {
176 let _response =
177 self.client.send_query::<fidl::encoding::EmptyPayload, UtilGetLifecycleKoidResponse>(
178 (),
179 0xdaecfc0fe4c8f60,
180 fidl::encoding::DynamicFlags::empty(),
181 ___deadline,
182 )?;
183 Ok(_response.koid)
184 }
185}
186
187#[cfg(target_os = "fuchsia")]
188impl From<UtilSynchronousProxy> for zx::NullableHandle {
189 fn from(value: UtilSynchronousProxy) -> Self {
190 value.into_channel().into()
191 }
192}
193
194#[cfg(target_os = "fuchsia")]
195impl From<fidl::Channel> for UtilSynchronousProxy {
196 fn from(value: fidl::Channel) -> Self {
197 Self::new(value)
198 }
199}
200
201#[cfg(target_os = "fuchsia")]
202impl fidl::endpoints::FromClient for UtilSynchronousProxy {
203 type Protocol = UtilMarker;
204
205 fn from_client(value: fidl::endpoints::ClientEnd<UtilMarker>) -> Self {
206 Self::new(value.into_channel())
207 }
208}
209
210#[derive(Debug, Clone)]
211pub struct UtilProxy {
212 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
213}
214
215impl fidl::endpoints::Proxy for UtilProxy {
216 type Protocol = UtilMarker;
217
218 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
219 Self::new(inner)
220 }
221
222 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
223 self.client.into_channel().map_err(|client| Self { client })
224 }
225
226 fn as_channel(&self) -> &::fidl::AsyncChannel {
227 self.client.as_channel()
228 }
229}
230
231impl UtilProxy {
232 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
234 let protocol_name = <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
235 Self { client: fidl::client::Client::new(channel, protocol_name) }
236 }
237
238 pub fn take_event_stream(&self) -> UtilEventStream {
244 UtilEventStream { event_receiver: self.client.take_event_receiver() }
245 }
246
247 pub fn r#get_arguments(
248 &self,
249 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
250 {
251 UtilProxyInterface::r#get_arguments(self)
252 }
253
254 pub fn r#get_argument_count(
255 &self,
256 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
257 UtilProxyInterface::r#get_argument_count(self)
258 }
259
260 pub fn r#get_environment(
261 &self,
262 ) -> fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>
263 {
264 UtilProxyInterface::r#get_environment(self)
265 }
266
267 pub fn r#get_environment_count(
268 &self,
269 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
270 UtilProxyInterface::r#get_environment_count(self)
271 }
272
273 pub fn r#dump_namespace(
274 &self,
275 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
276 UtilProxyInterface::r#dump_namespace(self)
277 }
278
279 pub fn r#read_file(
280 &self,
281 mut path: &str,
282 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
283 UtilProxyInterface::r#read_file(self, path)
284 }
285
286 pub fn r#get_lifecycle_koid(
287 &self,
288 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
289 UtilProxyInterface::r#get_lifecycle_koid(self)
290 }
291}
292
293impl UtilProxyInterface for UtilProxy {
294 type GetArgumentsResponseFut =
295 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
296 fn r#get_arguments(&self) -> Self::GetArgumentsResponseFut {
297 fn _decode(
298 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
299 ) -> Result<Vec<String>, fidl::Error> {
300 let _response = fidl::client::decode_transaction_body::<
301 UtilGetArgumentsResponse,
302 fidl::encoding::DefaultFuchsiaResourceDialect,
303 0x50ff7f790c425519,
304 >(_buf?)?;
305 Ok(_response.args)
306 }
307 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
308 (),
309 0x50ff7f790c425519,
310 fidl::encoding::DynamicFlags::empty(),
311 _decode,
312 )
313 }
314
315 type GetArgumentCountResponseFut =
316 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
317 fn r#get_argument_count(&self) -> Self::GetArgumentCountResponseFut {
318 fn _decode(
319 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
320 ) -> Result<u64, fidl::Error> {
321 let _response = fidl::client::decode_transaction_body::<
322 UtilGetArgumentCountResponse,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 0x41ef27d234ed7098,
325 >(_buf?)?;
326 Ok(_response.count)
327 }
328 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
329 (),
330 0x41ef27d234ed7098,
331 fidl::encoding::DynamicFlags::empty(),
332 _decode,
333 )
334 }
335
336 type GetEnvironmentResponseFut =
337 fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>;
338 fn r#get_environment(&self) -> Self::GetEnvironmentResponseFut {
339 fn _decode(
340 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
341 ) -> Result<Vec<EnvVar>, fidl::Error> {
342 let _response = fidl::client::decode_transaction_body::<
343 UtilGetEnvironmentResponse,
344 fidl::encoding::DefaultFuchsiaResourceDialect,
345 0x451e633adf04ec23,
346 >(_buf?)?;
347 Ok(_response.vars)
348 }
349 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EnvVar>>(
350 (),
351 0x451e633adf04ec23,
352 fidl::encoding::DynamicFlags::empty(),
353 _decode,
354 )
355 }
356
357 type GetEnvironmentCountResponseFut =
358 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
359 fn r#get_environment_count(&self) -> Self::GetEnvironmentCountResponseFut {
360 fn _decode(
361 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
362 ) -> Result<u64, fidl::Error> {
363 let _response = fidl::client::decode_transaction_body::<
364 UtilGetEnvironmentCountResponse,
365 fidl::encoding::DefaultFuchsiaResourceDialect,
366 0xe01fe768fb1be1a,
367 >(_buf?)?;
368 Ok(_response.count)
369 }
370 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
371 (),
372 0xe01fe768fb1be1a,
373 fidl::encoding::DynamicFlags::empty(),
374 _decode,
375 )
376 }
377
378 type DumpNamespaceResponseFut =
379 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
380 fn r#dump_namespace(&self) -> Self::DumpNamespaceResponseFut {
381 fn _decode(
382 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
383 ) -> Result<String, fidl::Error> {
384 let _response = fidl::client::decode_transaction_body::<
385 UtilDumpNamespaceResponse,
386 fidl::encoding::DefaultFuchsiaResourceDialect,
387 0x73826cecc1a7f3a4,
388 >(_buf?)?;
389 Ok(_response.contents)
390 }
391 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
392 (),
393 0x73826cecc1a7f3a4,
394 fidl::encoding::DynamicFlags::empty(),
395 _decode,
396 )
397 }
398
399 type ReadFileResponseFut =
400 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
401 fn r#read_file(&self, mut path: &str) -> Self::ReadFileResponseFut {
402 fn _decode(
403 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
404 ) -> Result<String, fidl::Error> {
405 let _response = fidl::client::decode_transaction_body::<
406 UtilReadFileResponse,
407 fidl::encoding::DefaultFuchsiaResourceDialect,
408 0x2ea8e2e4b427a391,
409 >(_buf?)?;
410 Ok(_response.contents)
411 }
412 self.client.send_query_and_decode::<UtilReadFileRequest, String>(
413 (path,),
414 0x2ea8e2e4b427a391,
415 fidl::encoding::DynamicFlags::empty(),
416 _decode,
417 )
418 }
419
420 type GetLifecycleKoidResponseFut =
421 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
422 fn r#get_lifecycle_koid(&self) -> Self::GetLifecycleKoidResponseFut {
423 fn _decode(
424 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
425 ) -> Result<u64, fidl::Error> {
426 let _response = fidl::client::decode_transaction_body::<
427 UtilGetLifecycleKoidResponse,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 0xdaecfc0fe4c8f60,
430 >(_buf?)?;
431 Ok(_response.koid)
432 }
433 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
434 (),
435 0xdaecfc0fe4c8f60,
436 fidl::encoding::DynamicFlags::empty(),
437 _decode,
438 )
439 }
440}
441
442pub struct UtilEventStream {
443 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
444}
445
446impl std::marker::Unpin for UtilEventStream {}
447
448impl futures::stream::FusedStream for UtilEventStream {
449 fn is_terminated(&self) -> bool {
450 self.event_receiver.is_terminated()
451 }
452}
453
454impl futures::Stream for UtilEventStream {
455 type Item = Result<UtilEvent, fidl::Error>;
456
457 fn poll_next(
458 mut self: std::pin::Pin<&mut Self>,
459 cx: &mut std::task::Context<'_>,
460 ) -> std::task::Poll<Option<Self::Item>> {
461 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
462 &mut self.event_receiver,
463 cx
464 )?) {
465 Some(buf) => std::task::Poll::Ready(Some(UtilEvent::decode(buf))),
466 None => std::task::Poll::Ready(None),
467 }
468 }
469}
470
471#[derive(Debug)]
472pub enum UtilEvent {}
473
474impl UtilEvent {
475 fn decode(
477 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
478 ) -> Result<UtilEvent, fidl::Error> {
479 let (bytes, _handles) = buf.split_mut();
480 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
481 debug_assert_eq!(tx_header.tx_id, 0);
482 match tx_header.ordinal {
483 _ => Err(fidl::Error::UnknownOrdinal {
484 ordinal: tx_header.ordinal,
485 protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
486 }),
487 }
488 }
489}
490
491pub struct UtilRequestStream {
493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
494 is_terminated: bool,
495}
496
497impl std::marker::Unpin for UtilRequestStream {}
498
499impl futures::stream::FusedStream for UtilRequestStream {
500 fn is_terminated(&self) -> bool {
501 self.is_terminated
502 }
503}
504
505impl fidl::endpoints::RequestStream for UtilRequestStream {
506 type Protocol = UtilMarker;
507 type ControlHandle = UtilControlHandle;
508
509 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
510 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
511 }
512
513 fn control_handle(&self) -> Self::ControlHandle {
514 UtilControlHandle { inner: self.inner.clone() }
515 }
516
517 fn into_inner(
518 self,
519 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
520 {
521 (self.inner, self.is_terminated)
522 }
523
524 fn from_inner(
525 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
526 is_terminated: bool,
527 ) -> Self {
528 Self { inner, is_terminated }
529 }
530}
531
532impl futures::Stream for UtilRequestStream {
533 type Item = Result<UtilRequest, fidl::Error>;
534
535 fn poll_next(
536 mut self: std::pin::Pin<&mut Self>,
537 cx: &mut std::task::Context<'_>,
538 ) -> std::task::Poll<Option<Self::Item>> {
539 let this = &mut *self;
540 if this.inner.check_shutdown(cx) {
541 this.is_terminated = true;
542 return std::task::Poll::Ready(None);
543 }
544 if this.is_terminated {
545 panic!("polled UtilRequestStream after completion");
546 }
547 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
548 |bytes, handles| {
549 match this.inner.channel().read_etc(cx, bytes, handles) {
550 std::task::Poll::Ready(Ok(())) => {}
551 std::task::Poll::Pending => return std::task::Poll::Pending,
552 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
553 this.is_terminated = true;
554 return std::task::Poll::Ready(None);
555 }
556 std::task::Poll::Ready(Err(e)) => {
557 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
558 e.into(),
559 ))));
560 }
561 }
562
563 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
565
566 std::task::Poll::Ready(Some(match header.ordinal {
567 0x50ff7f790c425519 => {
568 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
569 let mut req = fidl::new_empty!(
570 fidl::encoding::EmptyPayload,
571 fidl::encoding::DefaultFuchsiaResourceDialect
572 );
573 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
574 let control_handle = UtilControlHandle { inner: this.inner.clone() };
575 Ok(UtilRequest::GetArguments {
576 responder: UtilGetArgumentsResponder {
577 control_handle: std::mem::ManuallyDrop::new(control_handle),
578 tx_id: header.tx_id,
579 },
580 })
581 }
582 0x41ef27d234ed7098 => {
583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
584 let mut req = fidl::new_empty!(
585 fidl::encoding::EmptyPayload,
586 fidl::encoding::DefaultFuchsiaResourceDialect
587 );
588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
589 let control_handle = UtilControlHandle { inner: this.inner.clone() };
590 Ok(UtilRequest::GetArgumentCount {
591 responder: UtilGetArgumentCountResponder {
592 control_handle: std::mem::ManuallyDrop::new(control_handle),
593 tx_id: header.tx_id,
594 },
595 })
596 }
597 0x451e633adf04ec23 => {
598 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
599 let mut req = fidl::new_empty!(
600 fidl::encoding::EmptyPayload,
601 fidl::encoding::DefaultFuchsiaResourceDialect
602 );
603 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
604 let control_handle = UtilControlHandle { inner: this.inner.clone() };
605 Ok(UtilRequest::GetEnvironment {
606 responder: UtilGetEnvironmentResponder {
607 control_handle: std::mem::ManuallyDrop::new(control_handle),
608 tx_id: header.tx_id,
609 },
610 })
611 }
612 0xe01fe768fb1be1a => {
613 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
614 let mut req = fidl::new_empty!(
615 fidl::encoding::EmptyPayload,
616 fidl::encoding::DefaultFuchsiaResourceDialect
617 );
618 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
619 let control_handle = UtilControlHandle { inner: this.inner.clone() };
620 Ok(UtilRequest::GetEnvironmentCount {
621 responder: UtilGetEnvironmentCountResponder {
622 control_handle: std::mem::ManuallyDrop::new(control_handle),
623 tx_id: header.tx_id,
624 },
625 })
626 }
627 0x73826cecc1a7f3a4 => {
628 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
629 let mut req = fidl::new_empty!(
630 fidl::encoding::EmptyPayload,
631 fidl::encoding::DefaultFuchsiaResourceDialect
632 );
633 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
634 let control_handle = UtilControlHandle { inner: this.inner.clone() };
635 Ok(UtilRequest::DumpNamespace {
636 responder: UtilDumpNamespaceResponder {
637 control_handle: std::mem::ManuallyDrop::new(control_handle),
638 tx_id: header.tx_id,
639 },
640 })
641 }
642 0x2ea8e2e4b427a391 => {
643 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
644 let mut req = fidl::new_empty!(
645 UtilReadFileRequest,
646 fidl::encoding::DefaultFuchsiaResourceDialect
647 );
648 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UtilReadFileRequest>(&header, _body_bytes, handles, &mut req)?;
649 let control_handle = UtilControlHandle { inner: this.inner.clone() };
650 Ok(UtilRequest::ReadFile {
651 path: req.path,
652
653 responder: UtilReadFileResponder {
654 control_handle: std::mem::ManuallyDrop::new(control_handle),
655 tx_id: header.tx_id,
656 },
657 })
658 }
659 0xdaecfc0fe4c8f60 => {
660 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
661 let mut req = fidl::new_empty!(
662 fidl::encoding::EmptyPayload,
663 fidl::encoding::DefaultFuchsiaResourceDialect
664 );
665 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
666 let control_handle = UtilControlHandle { inner: this.inner.clone() };
667 Ok(UtilRequest::GetLifecycleKoid {
668 responder: UtilGetLifecycleKoidResponder {
669 control_handle: std::mem::ManuallyDrop::new(control_handle),
670 tx_id: header.tx_id,
671 },
672 })
673 }
674 _ => Err(fidl::Error::UnknownOrdinal {
675 ordinal: header.ordinal,
676 protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
677 }),
678 }))
679 },
680 )
681 }
682}
683
684#[derive(Debug)]
685pub enum UtilRequest {
686 GetArguments { responder: UtilGetArgumentsResponder },
687 GetArgumentCount { responder: UtilGetArgumentCountResponder },
688 GetEnvironment { responder: UtilGetEnvironmentResponder },
689 GetEnvironmentCount { responder: UtilGetEnvironmentCountResponder },
690 DumpNamespace { responder: UtilDumpNamespaceResponder },
691 ReadFile { path: String, responder: UtilReadFileResponder },
692 GetLifecycleKoid { responder: UtilGetLifecycleKoidResponder },
693}
694
695impl UtilRequest {
696 #[allow(irrefutable_let_patterns)]
697 pub fn into_get_arguments(self) -> Option<(UtilGetArgumentsResponder)> {
698 if let UtilRequest::GetArguments { responder } = self { Some((responder)) } else { None }
699 }
700
701 #[allow(irrefutable_let_patterns)]
702 pub fn into_get_argument_count(self) -> Option<(UtilGetArgumentCountResponder)> {
703 if let UtilRequest::GetArgumentCount { responder } = self {
704 Some((responder))
705 } else {
706 None
707 }
708 }
709
710 #[allow(irrefutable_let_patterns)]
711 pub fn into_get_environment(self) -> Option<(UtilGetEnvironmentResponder)> {
712 if let UtilRequest::GetEnvironment { responder } = self { Some((responder)) } else { None }
713 }
714
715 #[allow(irrefutable_let_patterns)]
716 pub fn into_get_environment_count(self) -> Option<(UtilGetEnvironmentCountResponder)> {
717 if let UtilRequest::GetEnvironmentCount { responder } = self {
718 Some((responder))
719 } else {
720 None
721 }
722 }
723
724 #[allow(irrefutable_let_patterns)]
725 pub fn into_dump_namespace(self) -> Option<(UtilDumpNamespaceResponder)> {
726 if let UtilRequest::DumpNamespace { responder } = self { Some((responder)) } else { None }
727 }
728
729 #[allow(irrefutable_let_patterns)]
730 pub fn into_read_file(self) -> Option<(String, UtilReadFileResponder)> {
731 if let UtilRequest::ReadFile { path, responder } = self {
732 Some((path, responder))
733 } else {
734 None
735 }
736 }
737
738 #[allow(irrefutable_let_patterns)]
739 pub fn into_get_lifecycle_koid(self) -> Option<(UtilGetLifecycleKoidResponder)> {
740 if let UtilRequest::GetLifecycleKoid { responder } = self {
741 Some((responder))
742 } else {
743 None
744 }
745 }
746
747 pub fn method_name(&self) -> &'static str {
749 match *self {
750 UtilRequest::GetArguments { .. } => "get_arguments",
751 UtilRequest::GetArgumentCount { .. } => "get_argument_count",
752 UtilRequest::GetEnvironment { .. } => "get_environment",
753 UtilRequest::GetEnvironmentCount { .. } => "get_environment_count",
754 UtilRequest::DumpNamespace { .. } => "dump_namespace",
755 UtilRequest::ReadFile { .. } => "read_file",
756 UtilRequest::GetLifecycleKoid { .. } => "get_lifecycle_koid",
757 }
758 }
759}
760
761#[derive(Debug, Clone)]
762pub struct UtilControlHandle {
763 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
764}
765
766impl fidl::endpoints::ControlHandle for UtilControlHandle {
767 fn shutdown(&self) {
768 self.inner.shutdown()
769 }
770
771 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
772 self.inner.shutdown_with_epitaph(status)
773 }
774
775 fn is_closed(&self) -> bool {
776 self.inner.channel().is_closed()
777 }
778 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
779 self.inner.channel().on_closed()
780 }
781
782 #[cfg(target_os = "fuchsia")]
783 fn signal_peer(
784 &self,
785 clear_mask: zx::Signals,
786 set_mask: zx::Signals,
787 ) -> Result<(), zx_status::Status> {
788 use fidl::Peered;
789 self.inner.channel().signal_peer(clear_mask, set_mask)
790 }
791}
792
793impl UtilControlHandle {}
794
795#[must_use = "FIDL methods require a response to be sent"]
796#[derive(Debug)]
797pub struct UtilGetArgumentsResponder {
798 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
799 tx_id: u32,
800}
801
802impl std::ops::Drop for UtilGetArgumentsResponder {
806 fn drop(&mut self) {
807 self.control_handle.shutdown();
808 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
810 }
811}
812
813impl fidl::endpoints::Responder for UtilGetArgumentsResponder {
814 type ControlHandle = UtilControlHandle;
815
816 fn control_handle(&self) -> &UtilControlHandle {
817 &self.control_handle
818 }
819
820 fn drop_without_shutdown(mut self) {
821 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
823 std::mem::forget(self);
825 }
826}
827
828impl UtilGetArgumentsResponder {
829 pub fn send(self, mut args: &[String]) -> Result<(), fidl::Error> {
833 let _result = self.send_raw(args);
834 if _result.is_err() {
835 self.control_handle.shutdown();
836 }
837 self.drop_without_shutdown();
838 _result
839 }
840
841 pub fn send_no_shutdown_on_err(self, mut args: &[String]) -> Result<(), fidl::Error> {
843 let _result = self.send_raw(args);
844 self.drop_without_shutdown();
845 _result
846 }
847
848 fn send_raw(&self, mut args: &[String]) -> Result<(), fidl::Error> {
849 self.control_handle.inner.send::<UtilGetArgumentsResponse>(
850 (args,),
851 self.tx_id,
852 0x50ff7f790c425519,
853 fidl::encoding::DynamicFlags::empty(),
854 )
855 }
856}
857
858#[must_use = "FIDL methods require a response to be sent"]
859#[derive(Debug)]
860pub struct UtilGetArgumentCountResponder {
861 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
862 tx_id: u32,
863}
864
865impl std::ops::Drop for UtilGetArgumentCountResponder {
869 fn drop(&mut self) {
870 self.control_handle.shutdown();
871 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
873 }
874}
875
876impl fidl::endpoints::Responder for UtilGetArgumentCountResponder {
877 type ControlHandle = UtilControlHandle;
878
879 fn control_handle(&self) -> &UtilControlHandle {
880 &self.control_handle
881 }
882
883 fn drop_without_shutdown(mut self) {
884 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
886 std::mem::forget(self);
888 }
889}
890
891impl UtilGetArgumentCountResponder {
892 pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
896 let _result = self.send_raw(count);
897 if _result.is_err() {
898 self.control_handle.shutdown();
899 }
900 self.drop_without_shutdown();
901 _result
902 }
903
904 pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
906 let _result = self.send_raw(count);
907 self.drop_without_shutdown();
908 _result
909 }
910
911 fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
912 self.control_handle.inner.send::<UtilGetArgumentCountResponse>(
913 (count,),
914 self.tx_id,
915 0x41ef27d234ed7098,
916 fidl::encoding::DynamicFlags::empty(),
917 )
918 }
919}
920
921#[must_use = "FIDL methods require a response to be sent"]
922#[derive(Debug)]
923pub struct UtilGetEnvironmentResponder {
924 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
925 tx_id: u32,
926}
927
928impl std::ops::Drop for UtilGetEnvironmentResponder {
932 fn drop(&mut self) {
933 self.control_handle.shutdown();
934 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
936 }
937}
938
939impl fidl::endpoints::Responder for UtilGetEnvironmentResponder {
940 type ControlHandle = UtilControlHandle;
941
942 fn control_handle(&self) -> &UtilControlHandle {
943 &self.control_handle
944 }
945
946 fn drop_without_shutdown(mut self) {
947 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
949 std::mem::forget(self);
951 }
952}
953
954impl UtilGetEnvironmentResponder {
955 pub fn send(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
959 let _result = self.send_raw(vars);
960 if _result.is_err() {
961 self.control_handle.shutdown();
962 }
963 self.drop_without_shutdown();
964 _result
965 }
966
967 pub fn send_no_shutdown_on_err(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
969 let _result = self.send_raw(vars);
970 self.drop_without_shutdown();
971 _result
972 }
973
974 fn send_raw(&self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
975 self.control_handle.inner.send::<UtilGetEnvironmentResponse>(
976 (vars,),
977 self.tx_id,
978 0x451e633adf04ec23,
979 fidl::encoding::DynamicFlags::empty(),
980 )
981 }
982}
983
984#[must_use = "FIDL methods require a response to be sent"]
985#[derive(Debug)]
986pub struct UtilGetEnvironmentCountResponder {
987 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
988 tx_id: u32,
989}
990
991impl std::ops::Drop for UtilGetEnvironmentCountResponder {
995 fn drop(&mut self) {
996 self.control_handle.shutdown();
997 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999 }
1000}
1001
1002impl fidl::endpoints::Responder for UtilGetEnvironmentCountResponder {
1003 type ControlHandle = UtilControlHandle;
1004
1005 fn control_handle(&self) -> &UtilControlHandle {
1006 &self.control_handle
1007 }
1008
1009 fn drop_without_shutdown(mut self) {
1010 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012 std::mem::forget(self);
1014 }
1015}
1016
1017impl UtilGetEnvironmentCountResponder {
1018 pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
1022 let _result = self.send_raw(count);
1023 if _result.is_err() {
1024 self.control_handle.shutdown();
1025 }
1026 self.drop_without_shutdown();
1027 _result
1028 }
1029
1030 pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
1032 let _result = self.send_raw(count);
1033 self.drop_without_shutdown();
1034 _result
1035 }
1036
1037 fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
1038 self.control_handle.inner.send::<UtilGetEnvironmentCountResponse>(
1039 (count,),
1040 self.tx_id,
1041 0xe01fe768fb1be1a,
1042 fidl::encoding::DynamicFlags::empty(),
1043 )
1044 }
1045}
1046
1047#[must_use = "FIDL methods require a response to be sent"]
1048#[derive(Debug)]
1049pub struct UtilDumpNamespaceResponder {
1050 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1051 tx_id: u32,
1052}
1053
1054impl std::ops::Drop for UtilDumpNamespaceResponder {
1058 fn drop(&mut self) {
1059 self.control_handle.shutdown();
1060 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1062 }
1063}
1064
1065impl fidl::endpoints::Responder for UtilDumpNamespaceResponder {
1066 type ControlHandle = UtilControlHandle;
1067
1068 fn control_handle(&self) -> &UtilControlHandle {
1069 &self.control_handle
1070 }
1071
1072 fn drop_without_shutdown(mut self) {
1073 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1075 std::mem::forget(self);
1077 }
1078}
1079
1080impl UtilDumpNamespaceResponder {
1081 pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1085 let _result = self.send_raw(contents);
1086 if _result.is_err() {
1087 self.control_handle.shutdown();
1088 }
1089 self.drop_without_shutdown();
1090 _result
1091 }
1092
1093 pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1095 let _result = self.send_raw(contents);
1096 self.drop_without_shutdown();
1097 _result
1098 }
1099
1100 fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1101 self.control_handle.inner.send::<UtilDumpNamespaceResponse>(
1102 (contents,),
1103 self.tx_id,
1104 0x73826cecc1a7f3a4,
1105 fidl::encoding::DynamicFlags::empty(),
1106 )
1107 }
1108}
1109
1110#[must_use = "FIDL methods require a response to be sent"]
1111#[derive(Debug)]
1112pub struct UtilReadFileResponder {
1113 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1114 tx_id: u32,
1115}
1116
1117impl std::ops::Drop for UtilReadFileResponder {
1121 fn drop(&mut self) {
1122 self.control_handle.shutdown();
1123 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1125 }
1126}
1127
1128impl fidl::endpoints::Responder for UtilReadFileResponder {
1129 type ControlHandle = UtilControlHandle;
1130
1131 fn control_handle(&self) -> &UtilControlHandle {
1132 &self.control_handle
1133 }
1134
1135 fn drop_without_shutdown(mut self) {
1136 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1138 std::mem::forget(self);
1140 }
1141}
1142
1143impl UtilReadFileResponder {
1144 pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1148 let _result = self.send_raw(contents);
1149 if _result.is_err() {
1150 self.control_handle.shutdown();
1151 }
1152 self.drop_without_shutdown();
1153 _result
1154 }
1155
1156 pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1158 let _result = self.send_raw(contents);
1159 self.drop_without_shutdown();
1160 _result
1161 }
1162
1163 fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1164 self.control_handle.inner.send::<UtilReadFileResponse>(
1165 (contents,),
1166 self.tx_id,
1167 0x2ea8e2e4b427a391,
1168 fidl::encoding::DynamicFlags::empty(),
1169 )
1170 }
1171}
1172
1173#[must_use = "FIDL methods require a response to be sent"]
1174#[derive(Debug)]
1175pub struct UtilGetLifecycleKoidResponder {
1176 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1177 tx_id: u32,
1178}
1179
1180impl std::ops::Drop for UtilGetLifecycleKoidResponder {
1184 fn drop(&mut self) {
1185 self.control_handle.shutdown();
1186 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188 }
1189}
1190
1191impl fidl::endpoints::Responder for UtilGetLifecycleKoidResponder {
1192 type ControlHandle = UtilControlHandle;
1193
1194 fn control_handle(&self) -> &UtilControlHandle {
1195 &self.control_handle
1196 }
1197
1198 fn drop_without_shutdown(mut self) {
1199 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1201 std::mem::forget(self);
1203 }
1204}
1205
1206impl UtilGetLifecycleKoidResponder {
1207 pub fn send(self, mut koid: u64) -> Result<(), fidl::Error> {
1211 let _result = self.send_raw(koid);
1212 if _result.is_err() {
1213 self.control_handle.shutdown();
1214 }
1215 self.drop_without_shutdown();
1216 _result
1217 }
1218
1219 pub fn send_no_shutdown_on_err(self, mut koid: u64) -> Result<(), fidl::Error> {
1221 let _result = self.send_raw(koid);
1222 self.drop_without_shutdown();
1223 _result
1224 }
1225
1226 fn send_raw(&self, mut koid: u64) -> Result<(), fidl::Error> {
1227 self.control_handle.inner.send::<UtilGetLifecycleKoidResponse>(
1228 (koid,),
1229 self.tx_id,
1230 0xdaecfc0fe4c8f60,
1231 fidl::encoding::DynamicFlags::empty(),
1232 )
1233 }
1234}
1235
1236mod internal {
1237 use super::*;
1238}