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