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::Handle {
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#[derive(Debug, Clone)]
202pub struct UtilProxy {
203 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl fidl::endpoints::Proxy for UtilProxy {
207 type Protocol = UtilMarker;
208
209 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
210 Self::new(inner)
211 }
212
213 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
214 self.client.into_channel().map_err(|client| Self { client })
215 }
216
217 fn as_channel(&self) -> &::fidl::AsyncChannel {
218 self.client.as_channel()
219 }
220}
221
222impl UtilProxy {
223 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
225 let protocol_name = <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
226 Self { client: fidl::client::Client::new(channel, protocol_name) }
227 }
228
229 pub fn take_event_stream(&self) -> UtilEventStream {
235 UtilEventStream { event_receiver: self.client.take_event_receiver() }
236 }
237
238 pub fn r#get_arguments(
239 &self,
240 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
241 {
242 UtilProxyInterface::r#get_arguments(self)
243 }
244
245 pub fn r#get_argument_count(
246 &self,
247 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
248 UtilProxyInterface::r#get_argument_count(self)
249 }
250
251 pub fn r#get_environment(
252 &self,
253 ) -> fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>
254 {
255 UtilProxyInterface::r#get_environment(self)
256 }
257
258 pub fn r#get_environment_count(
259 &self,
260 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
261 UtilProxyInterface::r#get_environment_count(self)
262 }
263
264 pub fn r#dump_namespace(
265 &self,
266 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
267 UtilProxyInterface::r#dump_namespace(self)
268 }
269
270 pub fn r#read_file(
271 &self,
272 mut path: &str,
273 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
274 UtilProxyInterface::r#read_file(self, path)
275 }
276
277 pub fn r#get_lifecycle_koid(
278 &self,
279 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
280 UtilProxyInterface::r#get_lifecycle_koid(self)
281 }
282}
283
284impl UtilProxyInterface for UtilProxy {
285 type GetArgumentsResponseFut =
286 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
287 fn r#get_arguments(&self) -> Self::GetArgumentsResponseFut {
288 fn _decode(
289 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
290 ) -> Result<Vec<String>, fidl::Error> {
291 let _response = fidl::client::decode_transaction_body::<
292 UtilGetArgumentsResponse,
293 fidl::encoding::DefaultFuchsiaResourceDialect,
294 0x50ff7f790c425519,
295 >(_buf?)?;
296 Ok(_response.args)
297 }
298 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
299 (),
300 0x50ff7f790c425519,
301 fidl::encoding::DynamicFlags::empty(),
302 _decode,
303 )
304 }
305
306 type GetArgumentCountResponseFut =
307 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
308 fn r#get_argument_count(&self) -> Self::GetArgumentCountResponseFut {
309 fn _decode(
310 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
311 ) -> Result<u64, fidl::Error> {
312 let _response = fidl::client::decode_transaction_body::<
313 UtilGetArgumentCountResponse,
314 fidl::encoding::DefaultFuchsiaResourceDialect,
315 0x41ef27d234ed7098,
316 >(_buf?)?;
317 Ok(_response.count)
318 }
319 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
320 (),
321 0x41ef27d234ed7098,
322 fidl::encoding::DynamicFlags::empty(),
323 _decode,
324 )
325 }
326
327 type GetEnvironmentResponseFut =
328 fidl::client::QueryResponseFut<Vec<EnvVar>, fidl::encoding::DefaultFuchsiaResourceDialect>;
329 fn r#get_environment(&self) -> Self::GetEnvironmentResponseFut {
330 fn _decode(
331 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
332 ) -> Result<Vec<EnvVar>, fidl::Error> {
333 let _response = fidl::client::decode_transaction_body::<
334 UtilGetEnvironmentResponse,
335 fidl::encoding::DefaultFuchsiaResourceDialect,
336 0x451e633adf04ec23,
337 >(_buf?)?;
338 Ok(_response.vars)
339 }
340 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EnvVar>>(
341 (),
342 0x451e633adf04ec23,
343 fidl::encoding::DynamicFlags::empty(),
344 _decode,
345 )
346 }
347
348 type GetEnvironmentCountResponseFut =
349 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
350 fn r#get_environment_count(&self) -> Self::GetEnvironmentCountResponseFut {
351 fn _decode(
352 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
353 ) -> Result<u64, fidl::Error> {
354 let _response = fidl::client::decode_transaction_body::<
355 UtilGetEnvironmentCountResponse,
356 fidl::encoding::DefaultFuchsiaResourceDialect,
357 0xe01fe768fb1be1a,
358 >(_buf?)?;
359 Ok(_response.count)
360 }
361 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
362 (),
363 0xe01fe768fb1be1a,
364 fidl::encoding::DynamicFlags::empty(),
365 _decode,
366 )
367 }
368
369 type DumpNamespaceResponseFut =
370 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
371 fn r#dump_namespace(&self) -> Self::DumpNamespaceResponseFut {
372 fn _decode(
373 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
374 ) -> Result<String, fidl::Error> {
375 let _response = fidl::client::decode_transaction_body::<
376 UtilDumpNamespaceResponse,
377 fidl::encoding::DefaultFuchsiaResourceDialect,
378 0x73826cecc1a7f3a4,
379 >(_buf?)?;
380 Ok(_response.contents)
381 }
382 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
383 (),
384 0x73826cecc1a7f3a4,
385 fidl::encoding::DynamicFlags::empty(),
386 _decode,
387 )
388 }
389
390 type ReadFileResponseFut =
391 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
392 fn r#read_file(&self, mut path: &str) -> Self::ReadFileResponseFut {
393 fn _decode(
394 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
395 ) -> Result<String, fidl::Error> {
396 let _response = fidl::client::decode_transaction_body::<
397 UtilReadFileResponse,
398 fidl::encoding::DefaultFuchsiaResourceDialect,
399 0x2ea8e2e4b427a391,
400 >(_buf?)?;
401 Ok(_response.contents)
402 }
403 self.client.send_query_and_decode::<UtilReadFileRequest, String>(
404 (path,),
405 0x2ea8e2e4b427a391,
406 fidl::encoding::DynamicFlags::empty(),
407 _decode,
408 )
409 }
410
411 type GetLifecycleKoidResponseFut =
412 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
413 fn r#get_lifecycle_koid(&self) -> Self::GetLifecycleKoidResponseFut {
414 fn _decode(
415 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
416 ) -> Result<u64, fidl::Error> {
417 let _response = fidl::client::decode_transaction_body::<
418 UtilGetLifecycleKoidResponse,
419 fidl::encoding::DefaultFuchsiaResourceDialect,
420 0xdaecfc0fe4c8f60,
421 >(_buf?)?;
422 Ok(_response.koid)
423 }
424 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
425 (),
426 0xdaecfc0fe4c8f60,
427 fidl::encoding::DynamicFlags::empty(),
428 _decode,
429 )
430 }
431}
432
433pub struct UtilEventStream {
434 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
435}
436
437impl std::marker::Unpin for UtilEventStream {}
438
439impl futures::stream::FusedStream for UtilEventStream {
440 fn is_terminated(&self) -> bool {
441 self.event_receiver.is_terminated()
442 }
443}
444
445impl futures::Stream for UtilEventStream {
446 type Item = Result<UtilEvent, fidl::Error>;
447
448 fn poll_next(
449 mut self: std::pin::Pin<&mut Self>,
450 cx: &mut std::task::Context<'_>,
451 ) -> std::task::Poll<Option<Self::Item>> {
452 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
453 &mut self.event_receiver,
454 cx
455 )?) {
456 Some(buf) => std::task::Poll::Ready(Some(UtilEvent::decode(buf))),
457 None => std::task::Poll::Ready(None),
458 }
459 }
460}
461
462#[derive(Debug)]
463pub enum UtilEvent {}
464
465impl UtilEvent {
466 fn decode(
468 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
469 ) -> Result<UtilEvent, fidl::Error> {
470 let (bytes, _handles) = buf.split_mut();
471 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
472 debug_assert_eq!(tx_header.tx_id, 0);
473 match tx_header.ordinal {
474 _ => Err(fidl::Error::UnknownOrdinal {
475 ordinal: tx_header.ordinal,
476 protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
477 }),
478 }
479 }
480}
481
482pub struct UtilRequestStream {
484 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
485 is_terminated: bool,
486}
487
488impl std::marker::Unpin for UtilRequestStream {}
489
490impl futures::stream::FusedStream for UtilRequestStream {
491 fn is_terminated(&self) -> bool {
492 self.is_terminated
493 }
494}
495
496impl fidl::endpoints::RequestStream for UtilRequestStream {
497 type Protocol = UtilMarker;
498 type ControlHandle = UtilControlHandle;
499
500 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
501 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
502 }
503
504 fn control_handle(&self) -> Self::ControlHandle {
505 UtilControlHandle { inner: self.inner.clone() }
506 }
507
508 fn into_inner(
509 self,
510 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
511 {
512 (self.inner, self.is_terminated)
513 }
514
515 fn from_inner(
516 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
517 is_terminated: bool,
518 ) -> Self {
519 Self { inner, is_terminated }
520 }
521}
522
523impl futures::Stream for UtilRequestStream {
524 type Item = Result<UtilRequest, fidl::Error>;
525
526 fn poll_next(
527 mut self: std::pin::Pin<&mut Self>,
528 cx: &mut std::task::Context<'_>,
529 ) -> std::task::Poll<Option<Self::Item>> {
530 let this = &mut *self;
531 if this.inner.check_shutdown(cx) {
532 this.is_terminated = true;
533 return std::task::Poll::Ready(None);
534 }
535 if this.is_terminated {
536 panic!("polled UtilRequestStream after completion");
537 }
538 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
539 |bytes, handles| {
540 match this.inner.channel().read_etc(cx, bytes, handles) {
541 std::task::Poll::Ready(Ok(())) => {}
542 std::task::Poll::Pending => return std::task::Poll::Pending,
543 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
544 this.is_terminated = true;
545 return std::task::Poll::Ready(None);
546 }
547 std::task::Poll::Ready(Err(e)) => {
548 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
549 e.into(),
550 ))))
551 }
552 }
553
554 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
556
557 std::task::Poll::Ready(Some(match header.ordinal {
558 0x50ff7f790c425519 => {
559 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
560 let mut req = fidl::new_empty!(
561 fidl::encoding::EmptyPayload,
562 fidl::encoding::DefaultFuchsiaResourceDialect
563 );
564 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
565 let control_handle = UtilControlHandle { inner: this.inner.clone() };
566 Ok(UtilRequest::GetArguments {
567 responder: UtilGetArgumentsResponder {
568 control_handle: std::mem::ManuallyDrop::new(control_handle),
569 tx_id: header.tx_id,
570 },
571 })
572 }
573 0x41ef27d234ed7098 => {
574 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
575 let mut req = fidl::new_empty!(
576 fidl::encoding::EmptyPayload,
577 fidl::encoding::DefaultFuchsiaResourceDialect
578 );
579 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
580 let control_handle = UtilControlHandle { inner: this.inner.clone() };
581 Ok(UtilRequest::GetArgumentCount {
582 responder: UtilGetArgumentCountResponder {
583 control_handle: std::mem::ManuallyDrop::new(control_handle),
584 tx_id: header.tx_id,
585 },
586 })
587 }
588 0x451e633adf04ec23 => {
589 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
590 let mut req = fidl::new_empty!(
591 fidl::encoding::EmptyPayload,
592 fidl::encoding::DefaultFuchsiaResourceDialect
593 );
594 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
595 let control_handle = UtilControlHandle { inner: this.inner.clone() };
596 Ok(UtilRequest::GetEnvironment {
597 responder: UtilGetEnvironmentResponder {
598 control_handle: std::mem::ManuallyDrop::new(control_handle),
599 tx_id: header.tx_id,
600 },
601 })
602 }
603 0xe01fe768fb1be1a => {
604 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
605 let mut req = fidl::new_empty!(
606 fidl::encoding::EmptyPayload,
607 fidl::encoding::DefaultFuchsiaResourceDialect
608 );
609 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
610 let control_handle = UtilControlHandle { inner: this.inner.clone() };
611 Ok(UtilRequest::GetEnvironmentCount {
612 responder: UtilGetEnvironmentCountResponder {
613 control_handle: std::mem::ManuallyDrop::new(control_handle),
614 tx_id: header.tx_id,
615 },
616 })
617 }
618 0x73826cecc1a7f3a4 => {
619 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
620 let mut req = fidl::new_empty!(
621 fidl::encoding::EmptyPayload,
622 fidl::encoding::DefaultFuchsiaResourceDialect
623 );
624 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
625 let control_handle = UtilControlHandle { inner: this.inner.clone() };
626 Ok(UtilRequest::DumpNamespace {
627 responder: UtilDumpNamespaceResponder {
628 control_handle: std::mem::ManuallyDrop::new(control_handle),
629 tx_id: header.tx_id,
630 },
631 })
632 }
633 0x2ea8e2e4b427a391 => {
634 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
635 let mut req = fidl::new_empty!(
636 UtilReadFileRequest,
637 fidl::encoding::DefaultFuchsiaResourceDialect
638 );
639 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UtilReadFileRequest>(&header, _body_bytes, handles, &mut req)?;
640 let control_handle = UtilControlHandle { inner: this.inner.clone() };
641 Ok(UtilRequest::ReadFile {
642 path: req.path,
643
644 responder: UtilReadFileResponder {
645 control_handle: std::mem::ManuallyDrop::new(control_handle),
646 tx_id: header.tx_id,
647 },
648 })
649 }
650 0xdaecfc0fe4c8f60 => {
651 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
652 let mut req = fidl::new_empty!(
653 fidl::encoding::EmptyPayload,
654 fidl::encoding::DefaultFuchsiaResourceDialect
655 );
656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
657 let control_handle = UtilControlHandle { inner: this.inner.clone() };
658 Ok(UtilRequest::GetLifecycleKoid {
659 responder: UtilGetLifecycleKoidResponder {
660 control_handle: std::mem::ManuallyDrop::new(control_handle),
661 tx_id: header.tx_id,
662 },
663 })
664 }
665 _ => Err(fidl::Error::UnknownOrdinal {
666 ordinal: header.ordinal,
667 protocol_name: <UtilMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
668 }),
669 }))
670 },
671 )
672 }
673}
674
675#[derive(Debug)]
676pub enum UtilRequest {
677 GetArguments { responder: UtilGetArgumentsResponder },
678 GetArgumentCount { responder: UtilGetArgumentCountResponder },
679 GetEnvironment { responder: UtilGetEnvironmentResponder },
680 GetEnvironmentCount { responder: UtilGetEnvironmentCountResponder },
681 DumpNamespace { responder: UtilDumpNamespaceResponder },
682 ReadFile { path: String, responder: UtilReadFileResponder },
683 GetLifecycleKoid { responder: UtilGetLifecycleKoidResponder },
684}
685
686impl UtilRequest {
687 #[allow(irrefutable_let_patterns)]
688 pub fn into_get_arguments(self) -> Option<(UtilGetArgumentsResponder)> {
689 if let UtilRequest::GetArguments { responder } = self {
690 Some((responder))
691 } else {
692 None
693 }
694 }
695
696 #[allow(irrefutable_let_patterns)]
697 pub fn into_get_argument_count(self) -> Option<(UtilGetArgumentCountResponder)> {
698 if let UtilRequest::GetArgumentCount { responder } = self {
699 Some((responder))
700 } else {
701 None
702 }
703 }
704
705 #[allow(irrefutable_let_patterns)]
706 pub fn into_get_environment(self) -> Option<(UtilGetEnvironmentResponder)> {
707 if let UtilRequest::GetEnvironment { responder } = self {
708 Some((responder))
709 } else {
710 None
711 }
712 }
713
714 #[allow(irrefutable_let_patterns)]
715 pub fn into_get_environment_count(self) -> Option<(UtilGetEnvironmentCountResponder)> {
716 if let UtilRequest::GetEnvironmentCount { responder } = self {
717 Some((responder))
718 } else {
719 None
720 }
721 }
722
723 #[allow(irrefutable_let_patterns)]
724 pub fn into_dump_namespace(self) -> Option<(UtilDumpNamespaceResponder)> {
725 if let UtilRequest::DumpNamespace { responder } = self {
726 Some((responder))
727 } else {
728 None
729 }
730 }
731
732 #[allow(irrefutable_let_patterns)]
733 pub fn into_read_file(self) -> Option<(String, UtilReadFileResponder)> {
734 if let UtilRequest::ReadFile { path, responder } = self {
735 Some((path, responder))
736 } else {
737 None
738 }
739 }
740
741 #[allow(irrefutable_let_patterns)]
742 pub fn into_get_lifecycle_koid(self) -> Option<(UtilGetLifecycleKoidResponder)> {
743 if let UtilRequest::GetLifecycleKoid { responder } = self {
744 Some((responder))
745 } else {
746 None
747 }
748 }
749
750 pub fn method_name(&self) -> &'static str {
752 match *self {
753 UtilRequest::GetArguments { .. } => "get_arguments",
754 UtilRequest::GetArgumentCount { .. } => "get_argument_count",
755 UtilRequest::GetEnvironment { .. } => "get_environment",
756 UtilRequest::GetEnvironmentCount { .. } => "get_environment_count",
757 UtilRequest::DumpNamespace { .. } => "dump_namespace",
758 UtilRequest::ReadFile { .. } => "read_file",
759 UtilRequest::GetLifecycleKoid { .. } => "get_lifecycle_koid",
760 }
761 }
762}
763
764#[derive(Debug, Clone)]
765pub struct UtilControlHandle {
766 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
767}
768
769impl fidl::endpoints::ControlHandle for UtilControlHandle {
770 fn shutdown(&self) {
771 self.inner.shutdown()
772 }
773 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
774 self.inner.shutdown_with_epitaph(status)
775 }
776
777 fn is_closed(&self) -> bool {
778 self.inner.channel().is_closed()
779 }
780 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
781 self.inner.channel().on_closed()
782 }
783
784 #[cfg(target_os = "fuchsia")]
785 fn signal_peer(
786 &self,
787 clear_mask: zx::Signals,
788 set_mask: zx::Signals,
789 ) -> Result<(), zx_status::Status> {
790 use fidl::Peered;
791 self.inner.channel().signal_peer(clear_mask, set_mask)
792 }
793}
794
795impl UtilControlHandle {}
796
797#[must_use = "FIDL methods require a response to be sent"]
798#[derive(Debug)]
799pub struct UtilGetArgumentsResponder {
800 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
801 tx_id: u32,
802}
803
804impl std::ops::Drop for UtilGetArgumentsResponder {
808 fn drop(&mut self) {
809 self.control_handle.shutdown();
810 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
812 }
813}
814
815impl fidl::endpoints::Responder for UtilGetArgumentsResponder {
816 type ControlHandle = UtilControlHandle;
817
818 fn control_handle(&self) -> &UtilControlHandle {
819 &self.control_handle
820 }
821
822 fn drop_without_shutdown(mut self) {
823 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
825 std::mem::forget(self);
827 }
828}
829
830impl UtilGetArgumentsResponder {
831 pub fn send(self, mut args: &[String]) -> Result<(), fidl::Error> {
835 let _result = self.send_raw(args);
836 if _result.is_err() {
837 self.control_handle.shutdown();
838 }
839 self.drop_without_shutdown();
840 _result
841 }
842
843 pub fn send_no_shutdown_on_err(self, mut args: &[String]) -> Result<(), fidl::Error> {
845 let _result = self.send_raw(args);
846 self.drop_without_shutdown();
847 _result
848 }
849
850 fn send_raw(&self, mut args: &[String]) -> Result<(), fidl::Error> {
851 self.control_handle.inner.send::<UtilGetArgumentsResponse>(
852 (args,),
853 self.tx_id,
854 0x50ff7f790c425519,
855 fidl::encoding::DynamicFlags::empty(),
856 )
857 }
858}
859
860#[must_use = "FIDL methods require a response to be sent"]
861#[derive(Debug)]
862pub struct UtilGetArgumentCountResponder {
863 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
864 tx_id: u32,
865}
866
867impl std::ops::Drop for UtilGetArgumentCountResponder {
871 fn drop(&mut self) {
872 self.control_handle.shutdown();
873 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
875 }
876}
877
878impl fidl::endpoints::Responder for UtilGetArgumentCountResponder {
879 type ControlHandle = UtilControlHandle;
880
881 fn control_handle(&self) -> &UtilControlHandle {
882 &self.control_handle
883 }
884
885 fn drop_without_shutdown(mut self) {
886 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
888 std::mem::forget(self);
890 }
891}
892
893impl UtilGetArgumentCountResponder {
894 pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
898 let _result = self.send_raw(count);
899 if _result.is_err() {
900 self.control_handle.shutdown();
901 }
902 self.drop_without_shutdown();
903 _result
904 }
905
906 pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
908 let _result = self.send_raw(count);
909 self.drop_without_shutdown();
910 _result
911 }
912
913 fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
914 self.control_handle.inner.send::<UtilGetArgumentCountResponse>(
915 (count,),
916 self.tx_id,
917 0x41ef27d234ed7098,
918 fidl::encoding::DynamicFlags::empty(),
919 )
920 }
921}
922
923#[must_use = "FIDL methods require a response to be sent"]
924#[derive(Debug)]
925pub struct UtilGetEnvironmentResponder {
926 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
927 tx_id: u32,
928}
929
930impl std::ops::Drop for UtilGetEnvironmentResponder {
934 fn drop(&mut self) {
935 self.control_handle.shutdown();
936 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
938 }
939}
940
941impl fidl::endpoints::Responder for UtilGetEnvironmentResponder {
942 type ControlHandle = UtilControlHandle;
943
944 fn control_handle(&self) -> &UtilControlHandle {
945 &self.control_handle
946 }
947
948 fn drop_without_shutdown(mut self) {
949 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
951 std::mem::forget(self);
953 }
954}
955
956impl UtilGetEnvironmentResponder {
957 pub fn send(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
961 let _result = self.send_raw(vars);
962 if _result.is_err() {
963 self.control_handle.shutdown();
964 }
965 self.drop_without_shutdown();
966 _result
967 }
968
969 pub fn send_no_shutdown_on_err(self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
971 let _result = self.send_raw(vars);
972 self.drop_without_shutdown();
973 _result
974 }
975
976 fn send_raw(&self, mut vars: &[EnvVar]) -> Result<(), fidl::Error> {
977 self.control_handle.inner.send::<UtilGetEnvironmentResponse>(
978 (vars,),
979 self.tx_id,
980 0x451e633adf04ec23,
981 fidl::encoding::DynamicFlags::empty(),
982 )
983 }
984}
985
986#[must_use = "FIDL methods require a response to be sent"]
987#[derive(Debug)]
988pub struct UtilGetEnvironmentCountResponder {
989 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
990 tx_id: u32,
991}
992
993impl std::ops::Drop for UtilGetEnvironmentCountResponder {
997 fn drop(&mut self) {
998 self.control_handle.shutdown();
999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1001 }
1002}
1003
1004impl fidl::endpoints::Responder for UtilGetEnvironmentCountResponder {
1005 type ControlHandle = UtilControlHandle;
1006
1007 fn control_handle(&self) -> &UtilControlHandle {
1008 &self.control_handle
1009 }
1010
1011 fn drop_without_shutdown(mut self) {
1012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1014 std::mem::forget(self);
1016 }
1017}
1018
1019impl UtilGetEnvironmentCountResponder {
1020 pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
1024 let _result = self.send_raw(count);
1025 if _result.is_err() {
1026 self.control_handle.shutdown();
1027 }
1028 self.drop_without_shutdown();
1029 _result
1030 }
1031
1032 pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
1034 let _result = self.send_raw(count);
1035 self.drop_without_shutdown();
1036 _result
1037 }
1038
1039 fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
1040 self.control_handle.inner.send::<UtilGetEnvironmentCountResponse>(
1041 (count,),
1042 self.tx_id,
1043 0xe01fe768fb1be1a,
1044 fidl::encoding::DynamicFlags::empty(),
1045 )
1046 }
1047}
1048
1049#[must_use = "FIDL methods require a response to be sent"]
1050#[derive(Debug)]
1051pub struct UtilDumpNamespaceResponder {
1052 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1053 tx_id: u32,
1054}
1055
1056impl std::ops::Drop for UtilDumpNamespaceResponder {
1060 fn drop(&mut self) {
1061 self.control_handle.shutdown();
1062 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1064 }
1065}
1066
1067impl fidl::endpoints::Responder for UtilDumpNamespaceResponder {
1068 type ControlHandle = UtilControlHandle;
1069
1070 fn control_handle(&self) -> &UtilControlHandle {
1071 &self.control_handle
1072 }
1073
1074 fn drop_without_shutdown(mut self) {
1075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1077 std::mem::forget(self);
1079 }
1080}
1081
1082impl UtilDumpNamespaceResponder {
1083 pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1087 let _result = self.send_raw(contents);
1088 if _result.is_err() {
1089 self.control_handle.shutdown();
1090 }
1091 self.drop_without_shutdown();
1092 _result
1093 }
1094
1095 pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1097 let _result = self.send_raw(contents);
1098 self.drop_without_shutdown();
1099 _result
1100 }
1101
1102 fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1103 self.control_handle.inner.send::<UtilDumpNamespaceResponse>(
1104 (contents,),
1105 self.tx_id,
1106 0x73826cecc1a7f3a4,
1107 fidl::encoding::DynamicFlags::empty(),
1108 )
1109 }
1110}
1111
1112#[must_use = "FIDL methods require a response to be sent"]
1113#[derive(Debug)]
1114pub struct UtilReadFileResponder {
1115 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1116 tx_id: u32,
1117}
1118
1119impl std::ops::Drop for UtilReadFileResponder {
1123 fn drop(&mut self) {
1124 self.control_handle.shutdown();
1125 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1127 }
1128}
1129
1130impl fidl::endpoints::Responder for UtilReadFileResponder {
1131 type ControlHandle = UtilControlHandle;
1132
1133 fn control_handle(&self) -> &UtilControlHandle {
1134 &self.control_handle
1135 }
1136
1137 fn drop_without_shutdown(mut self) {
1138 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1140 std::mem::forget(self);
1142 }
1143}
1144
1145impl UtilReadFileResponder {
1146 pub fn send(self, mut contents: &str) -> Result<(), fidl::Error> {
1150 let _result = self.send_raw(contents);
1151 if _result.is_err() {
1152 self.control_handle.shutdown();
1153 }
1154 self.drop_without_shutdown();
1155 _result
1156 }
1157
1158 pub fn send_no_shutdown_on_err(self, mut contents: &str) -> Result<(), fidl::Error> {
1160 let _result = self.send_raw(contents);
1161 self.drop_without_shutdown();
1162 _result
1163 }
1164
1165 fn send_raw(&self, mut contents: &str) -> Result<(), fidl::Error> {
1166 self.control_handle.inner.send::<UtilReadFileResponse>(
1167 (contents,),
1168 self.tx_id,
1169 0x2ea8e2e4b427a391,
1170 fidl::encoding::DynamicFlags::empty(),
1171 )
1172 }
1173}
1174
1175#[must_use = "FIDL methods require a response to be sent"]
1176#[derive(Debug)]
1177pub struct UtilGetLifecycleKoidResponder {
1178 control_handle: std::mem::ManuallyDrop<UtilControlHandle>,
1179 tx_id: u32,
1180}
1181
1182impl std::ops::Drop for UtilGetLifecycleKoidResponder {
1186 fn drop(&mut self) {
1187 self.control_handle.shutdown();
1188 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1190 }
1191}
1192
1193impl fidl::endpoints::Responder for UtilGetLifecycleKoidResponder {
1194 type ControlHandle = UtilControlHandle;
1195
1196 fn control_handle(&self) -> &UtilControlHandle {
1197 &self.control_handle
1198 }
1199
1200 fn drop_without_shutdown(mut self) {
1201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1203 std::mem::forget(self);
1205 }
1206}
1207
1208impl UtilGetLifecycleKoidResponder {
1209 pub fn send(self, mut koid: u64) -> Result<(), fidl::Error> {
1213 let _result = self.send_raw(koid);
1214 if _result.is_err() {
1215 self.control_handle.shutdown();
1216 }
1217 self.drop_without_shutdown();
1218 _result
1219 }
1220
1221 pub fn send_no_shutdown_on_err(self, mut koid: u64) -> Result<(), fidl::Error> {
1223 let _result = self.send_raw(koid);
1224 self.drop_without_shutdown();
1225 _result
1226 }
1227
1228 fn send_raw(&self, mut koid: u64) -> Result<(), fidl::Error> {
1229 self.control_handle.inner.send::<UtilGetLifecycleKoidResponse>(
1230 (koid,),
1231 self.tx_id,
1232 0xdaecfc0fe4c8f60,
1233 fidl::encoding::DynamicFlags::empty(),
1234 )
1235 }
1236}
1237
1238mod internal {
1239 use super::*;
1240}