1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_starnix_container_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct ControllerSpawnConsoleRequest {
16 pub console_in: Option<fidl::Socket>,
17 pub console_out: Option<fidl::Socket>,
18 pub binary_path: Option<String>,
19 pub argv: Option<Vec<String>>,
20 pub environ: Option<Vec<String>>,
21 pub window_size: Option<ConsoleWindowSize>,
22 #[doc(hidden)]
23 pub __source_breaking: fidl::marker::SourceBreaking,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
27 for ControllerSpawnConsoleRequest
28{
29}
30
31#[derive(Debug, Default, PartialEq)]
32pub struct ControllerVsockConnectRequest {
33 pub port: Option<u32>,
34 pub bridge_socket: Option<fidl::Socket>,
35 #[doc(hidden)]
36 pub __source_breaking: fidl::marker::SourceBreaking,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for ControllerVsockConnectRequest
41{
42}
43
44#[derive(Debug, Default, PartialEq)]
45pub struct ControllerGetJobHandleResponse {
46 pub job: Option<fidl::Job>,
47 #[doc(hidden)]
48 pub __source_breaking: fidl::marker::SourceBreaking,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52 for ControllerGetJobHandleResponse
53{
54}
55
56#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
57pub struct ControllerMarker;
58
59impl fidl::endpoints::ProtocolMarker for ControllerMarker {
60 type Proxy = ControllerProxy;
61 type RequestStream = ControllerRequestStream;
62 #[cfg(target_os = "fuchsia")]
63 type SynchronousProxy = ControllerSynchronousProxy;
64
65 const DEBUG_NAME: &'static str = "fuchsia.starnix.container.Controller";
66}
67impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
68pub type ControllerSpawnConsoleResult = Result<u8, SpawnConsoleError>;
69pub type ControllerSendSignalResult = Result<(), SignalError>;
70pub type ControllerSetSyscallLogFilterResult = Result<(), SetSyscallLogFilterError>;
71
72pub trait ControllerProxyInterface: Send + Sync {
73 fn r#vsock_connect(&self, payload: ControllerVsockConnectRequest) -> Result<(), fidl::Error>;
74 type SpawnConsoleResponseFut: std::future::Future<Output = Result<ControllerSpawnConsoleResult, fidl::Error>>
75 + Send;
76 fn r#spawn_console(
77 &self,
78 payload: ControllerSpawnConsoleRequest,
79 ) -> Self::SpawnConsoleResponseFut;
80 type GetVmoReferencesResponseFut: std::future::Future<Output = Result<ControllerGetVmoReferencesResponse, fidl::Error>>
81 + Send;
82 fn r#get_vmo_references(
83 &self,
84 payload: &ControllerGetVmoReferencesRequest,
85 ) -> Self::GetVmoReferencesResponseFut;
86 type GetJobHandleResponseFut: std::future::Future<Output = Result<ControllerGetJobHandleResponse, fidl::Error>>
87 + Send;
88 fn r#get_job_handle(&self) -> Self::GetJobHandleResponseFut;
89 type SendSignalResponseFut: std::future::Future<Output = Result<ControllerSendSignalResult, fidl::Error>>
90 + Send;
91 fn r#send_signal(&self, payload: &ControllerSendSignalRequest) -> Self::SendSignalResponseFut;
92 type SetSyscallLogFilterResponseFut: std::future::Future<Output = Result<ControllerSetSyscallLogFilterResult, fidl::Error>>
93 + Send;
94 fn r#set_syscall_log_filter(
95 &self,
96 payload: &ControllerSetSyscallLogFilterRequest,
97 ) -> Self::SetSyscallLogFilterResponseFut;
98 type ClearSyscallLogFiltersResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
99 + Send;
100 fn r#clear_syscall_log_filters(&self) -> Self::ClearSyscallLogFiltersResponseFut;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct ControllerSynchronousProxy {
105 client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
110 type Proxy = ControllerProxy;
111 type Protocol = ControllerMarker;
112
113 fn from_channel(inner: fidl::Channel) -> Self {
114 Self::new(inner)
115 }
116
117 fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 fn as_channel(&self) -> &fidl::Channel {
122 self.client.as_channel()
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl ControllerSynchronousProxy {
128 pub fn new(channel: fidl::Channel) -> Self {
129 Self { client: fidl::client::sync::Client::new(channel) }
130 }
131
132 pub fn into_channel(self) -> fidl::Channel {
133 self.client.into_channel()
134 }
135
136 pub fn wait_for_event(
139 &self,
140 deadline: zx::MonotonicInstant,
141 ) -> Result<ControllerEvent, fidl::Error> {
142 ControllerEvent::decode(self.client.wait_for_event::<ControllerMarker>(deadline)?)
143 }
144
145 pub fn r#vsock_connect(
147 &self,
148 mut payload: ControllerVsockConnectRequest,
149 ) -> Result<(), fidl::Error> {
150 self.client.send::<ControllerVsockConnectRequest>(
151 &mut payload,
152 0x494a469a8943213b,
153 fidl::encoding::DynamicFlags::FLEXIBLE,
154 )
155 }
156
157 pub fn r#spawn_console(
162 &self,
163 mut payload: ControllerSpawnConsoleRequest,
164 ___deadline: zx::MonotonicInstant,
165 ) -> Result<ControllerSpawnConsoleResult, fidl::Error> {
166 let _response =
167 self.client
168 .send_query::<ControllerSpawnConsoleRequest, fidl::encoding::FlexibleResultType<
169 ControllerSpawnConsoleResponse,
170 SpawnConsoleError,
171 >, ControllerMarker>(
172 &mut payload,
173 0x76eb46fdc63aa8b8,
174 fidl::encoding::DynamicFlags::FLEXIBLE,
175 ___deadline,
176 )?
177 .into_result::<ControllerMarker>("spawn_console")?;
178 Ok(_response.map(|x| x.exit_code))
179 }
180
181 pub fn r#get_vmo_references(
183 &self,
184 mut payload: &ControllerGetVmoReferencesRequest,
185 ___deadline: zx::MonotonicInstant,
186 ) -> Result<ControllerGetVmoReferencesResponse, fidl::Error> {
187 let _response = self.client.send_query::<
188 ControllerGetVmoReferencesRequest,
189 fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>,
190 ControllerMarker,
191 >(
192 payload,
193 0x47a7f039bb97f173,
194 fidl::encoding::DynamicFlags::FLEXIBLE,
195 ___deadline,
196 )?
197 .into_result::<ControllerMarker>("get_vmo_references")?;
198 Ok(_response)
199 }
200
201 pub fn r#get_job_handle(
203 &self,
204 ___deadline: zx::MonotonicInstant,
205 ) -> Result<ControllerGetJobHandleResponse, fidl::Error> {
206 let _response = self.client.send_query::<
207 fidl::encoding::EmptyPayload,
208 fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>,
209 ControllerMarker,
210 >(
211 (),
212 0x60a31a248576ffea,
213 fidl::encoding::DynamicFlags::FLEXIBLE,
214 ___deadline,
215 )?
216 .into_result::<ControllerMarker>("get_job_handle")?;
217 Ok(_response)
218 }
219
220 pub fn r#send_signal(
222 &self,
223 mut payload: &ControllerSendSignalRequest,
224 ___deadline: zx::MonotonicInstant,
225 ) -> Result<ControllerSendSignalResult, fidl::Error> {
226 let _response = self.client.send_query::<
227 ControllerSendSignalRequest,
228 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SignalError>,
229 ControllerMarker,
230 >(
231 payload,
232 0x253b1a0d3b9639e3,
233 fidl::encoding::DynamicFlags::FLEXIBLE,
234 ___deadline,
235 )?
236 .into_result::<ControllerMarker>("send_signal")?;
237 Ok(_response.map(|x| x))
238 }
239
240 pub fn r#set_syscall_log_filter(
242 &self,
243 mut payload: &ControllerSetSyscallLogFilterRequest,
244 ___deadline: zx::MonotonicInstant,
245 ) -> Result<ControllerSetSyscallLogFilterResult, fidl::Error> {
246 let _response = self
247 .client
248 .send_query::<ControllerSetSyscallLogFilterRequest, fidl::encoding::FlexibleResultType<
249 fidl::encoding::EmptyStruct,
250 SetSyscallLogFilterError,
251 >, ControllerMarker>(
252 payload,
253 0x2d2a49963abdee9b,
254 fidl::encoding::DynamicFlags::FLEXIBLE,
255 ___deadline,
256 )?
257 .into_result::<ControllerMarker>("set_syscall_log_filter")?;
258 Ok(_response.map(|x| x))
259 }
260
261 pub fn r#clear_syscall_log_filters(
263 &self,
264 ___deadline: zx::MonotonicInstant,
265 ) -> Result<(), fidl::Error> {
266 let _response = self.client.send_query::<
267 fidl::encoding::EmptyPayload,
268 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
269 ControllerMarker,
270 >(
271 (),
272 0xd3ee36073fdfdf0,
273 fidl::encoding::DynamicFlags::FLEXIBLE,
274 ___deadline,
275 )?
276 .into_result::<ControllerMarker>("clear_syscall_log_filters")?;
277 Ok(_response)
278 }
279}
280
281#[cfg(target_os = "fuchsia")]
282impl From<ControllerSynchronousProxy> for zx::NullableHandle {
283 fn from(value: ControllerSynchronousProxy) -> Self {
284 value.into_channel().into()
285 }
286}
287
288#[cfg(target_os = "fuchsia")]
289impl From<fidl::Channel> for ControllerSynchronousProxy {
290 fn from(value: fidl::Channel) -> Self {
291 Self::new(value)
292 }
293}
294
295#[cfg(target_os = "fuchsia")]
296impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
297 type Protocol = ControllerMarker;
298
299 fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
300 Self::new(value.into_channel())
301 }
302}
303
304#[derive(Debug, Clone)]
305pub struct ControllerProxy {
306 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
307}
308
309impl fidl::endpoints::Proxy for ControllerProxy {
310 type Protocol = ControllerMarker;
311
312 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
313 Self::new(inner)
314 }
315
316 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
317 self.client.into_channel().map_err(|client| Self { client })
318 }
319
320 fn as_channel(&self) -> &::fidl::AsyncChannel {
321 self.client.as_channel()
322 }
323}
324
325impl ControllerProxy {
326 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
328 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
329 Self { client: fidl::client::Client::new(channel, protocol_name) }
330 }
331
332 pub fn take_event_stream(&self) -> ControllerEventStream {
338 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
339 }
340
341 pub fn r#vsock_connect(
343 &self,
344 mut payload: ControllerVsockConnectRequest,
345 ) -> Result<(), fidl::Error> {
346 ControllerProxyInterface::r#vsock_connect(self, payload)
347 }
348
349 pub fn r#spawn_console(
354 &self,
355 mut payload: ControllerSpawnConsoleRequest,
356 ) -> fidl::client::QueryResponseFut<
357 ControllerSpawnConsoleResult,
358 fidl::encoding::DefaultFuchsiaResourceDialect,
359 > {
360 ControllerProxyInterface::r#spawn_console(self, payload)
361 }
362
363 pub fn r#get_vmo_references(
365 &self,
366 mut payload: &ControllerGetVmoReferencesRequest,
367 ) -> fidl::client::QueryResponseFut<
368 ControllerGetVmoReferencesResponse,
369 fidl::encoding::DefaultFuchsiaResourceDialect,
370 > {
371 ControllerProxyInterface::r#get_vmo_references(self, payload)
372 }
373
374 pub fn r#get_job_handle(
376 &self,
377 ) -> fidl::client::QueryResponseFut<
378 ControllerGetJobHandleResponse,
379 fidl::encoding::DefaultFuchsiaResourceDialect,
380 > {
381 ControllerProxyInterface::r#get_job_handle(self)
382 }
383
384 pub fn r#send_signal(
386 &self,
387 mut payload: &ControllerSendSignalRequest,
388 ) -> fidl::client::QueryResponseFut<
389 ControllerSendSignalResult,
390 fidl::encoding::DefaultFuchsiaResourceDialect,
391 > {
392 ControllerProxyInterface::r#send_signal(self, payload)
393 }
394
395 pub fn r#set_syscall_log_filter(
397 &self,
398 mut payload: &ControllerSetSyscallLogFilterRequest,
399 ) -> fidl::client::QueryResponseFut<
400 ControllerSetSyscallLogFilterResult,
401 fidl::encoding::DefaultFuchsiaResourceDialect,
402 > {
403 ControllerProxyInterface::r#set_syscall_log_filter(self, payload)
404 }
405
406 pub fn r#clear_syscall_log_filters(
408 &self,
409 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
410 ControllerProxyInterface::r#clear_syscall_log_filters(self)
411 }
412}
413
414impl ControllerProxyInterface for ControllerProxy {
415 fn r#vsock_connect(
416 &self,
417 mut payload: ControllerVsockConnectRequest,
418 ) -> Result<(), fidl::Error> {
419 self.client.send::<ControllerVsockConnectRequest>(
420 &mut payload,
421 0x494a469a8943213b,
422 fidl::encoding::DynamicFlags::FLEXIBLE,
423 )
424 }
425
426 type SpawnConsoleResponseFut = fidl::client::QueryResponseFut<
427 ControllerSpawnConsoleResult,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 >;
430 fn r#spawn_console(
431 &self,
432 mut payload: ControllerSpawnConsoleRequest,
433 ) -> Self::SpawnConsoleResponseFut {
434 fn _decode(
435 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
436 ) -> Result<ControllerSpawnConsoleResult, fidl::Error> {
437 let _response = fidl::client::decode_transaction_body::<
438 fidl::encoding::FlexibleResultType<
439 ControllerSpawnConsoleResponse,
440 SpawnConsoleError,
441 >,
442 fidl::encoding::DefaultFuchsiaResourceDialect,
443 0x76eb46fdc63aa8b8,
444 >(_buf?)?
445 .into_result::<ControllerMarker>("spawn_console")?;
446 Ok(_response.map(|x| x.exit_code))
447 }
448 self.client
449 .send_query_and_decode::<ControllerSpawnConsoleRequest, ControllerSpawnConsoleResult>(
450 &mut payload,
451 0x76eb46fdc63aa8b8,
452 fidl::encoding::DynamicFlags::FLEXIBLE,
453 _decode,
454 )
455 }
456
457 type GetVmoReferencesResponseFut = fidl::client::QueryResponseFut<
458 ControllerGetVmoReferencesResponse,
459 fidl::encoding::DefaultFuchsiaResourceDialect,
460 >;
461 fn r#get_vmo_references(
462 &self,
463 mut payload: &ControllerGetVmoReferencesRequest,
464 ) -> Self::GetVmoReferencesResponseFut {
465 fn _decode(
466 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
467 ) -> Result<ControllerGetVmoReferencesResponse, fidl::Error> {
468 let _response = fidl::client::decode_transaction_body::<
469 fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>,
470 fidl::encoding::DefaultFuchsiaResourceDialect,
471 0x47a7f039bb97f173,
472 >(_buf?)?
473 .into_result::<ControllerMarker>("get_vmo_references")?;
474 Ok(_response)
475 }
476 self.client.send_query_and_decode::<
477 ControllerGetVmoReferencesRequest,
478 ControllerGetVmoReferencesResponse,
479 >(
480 payload,
481 0x47a7f039bb97f173,
482 fidl::encoding::DynamicFlags::FLEXIBLE,
483 _decode,
484 )
485 }
486
487 type GetJobHandleResponseFut = fidl::client::QueryResponseFut<
488 ControllerGetJobHandleResponse,
489 fidl::encoding::DefaultFuchsiaResourceDialect,
490 >;
491 fn r#get_job_handle(&self) -> Self::GetJobHandleResponseFut {
492 fn _decode(
493 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
494 ) -> Result<ControllerGetJobHandleResponse, fidl::Error> {
495 let _response = fidl::client::decode_transaction_body::<
496 fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 0x60a31a248576ffea,
499 >(_buf?)?
500 .into_result::<ControllerMarker>("get_job_handle")?;
501 Ok(_response)
502 }
503 self.client
504 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerGetJobHandleResponse>(
505 (),
506 0x60a31a248576ffea,
507 fidl::encoding::DynamicFlags::FLEXIBLE,
508 _decode,
509 )
510 }
511
512 type SendSignalResponseFut = fidl::client::QueryResponseFut<
513 ControllerSendSignalResult,
514 fidl::encoding::DefaultFuchsiaResourceDialect,
515 >;
516 fn r#send_signal(
517 &self,
518 mut payload: &ControllerSendSignalRequest,
519 ) -> Self::SendSignalResponseFut {
520 fn _decode(
521 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
522 ) -> Result<ControllerSendSignalResult, fidl::Error> {
523 let _response = fidl::client::decode_transaction_body::<
524 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SignalError>,
525 fidl::encoding::DefaultFuchsiaResourceDialect,
526 0x253b1a0d3b9639e3,
527 >(_buf?)?
528 .into_result::<ControllerMarker>("send_signal")?;
529 Ok(_response.map(|x| x))
530 }
531 self.client
532 .send_query_and_decode::<ControllerSendSignalRequest, ControllerSendSignalResult>(
533 payload,
534 0x253b1a0d3b9639e3,
535 fidl::encoding::DynamicFlags::FLEXIBLE,
536 _decode,
537 )
538 }
539
540 type SetSyscallLogFilterResponseFut = fidl::client::QueryResponseFut<
541 ControllerSetSyscallLogFilterResult,
542 fidl::encoding::DefaultFuchsiaResourceDialect,
543 >;
544 fn r#set_syscall_log_filter(
545 &self,
546 mut payload: &ControllerSetSyscallLogFilterRequest,
547 ) -> Self::SetSyscallLogFilterResponseFut {
548 fn _decode(
549 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
550 ) -> Result<ControllerSetSyscallLogFilterResult, fidl::Error> {
551 let _response = fidl::client::decode_transaction_body::<
552 fidl::encoding::FlexibleResultType<
553 fidl::encoding::EmptyStruct,
554 SetSyscallLogFilterError,
555 >,
556 fidl::encoding::DefaultFuchsiaResourceDialect,
557 0x2d2a49963abdee9b,
558 >(_buf?)?
559 .into_result::<ControllerMarker>("set_syscall_log_filter")?;
560 Ok(_response.map(|x| x))
561 }
562 self.client.send_query_and_decode::<
563 ControllerSetSyscallLogFilterRequest,
564 ControllerSetSyscallLogFilterResult,
565 >(
566 payload,
567 0x2d2a49963abdee9b,
568 fidl::encoding::DynamicFlags::FLEXIBLE,
569 _decode,
570 )
571 }
572
573 type ClearSyscallLogFiltersResponseFut =
574 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
575 fn r#clear_syscall_log_filters(&self) -> Self::ClearSyscallLogFiltersResponseFut {
576 fn _decode(
577 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
578 ) -> Result<(), fidl::Error> {
579 let _response = fidl::client::decode_transaction_body::<
580 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
581 fidl::encoding::DefaultFuchsiaResourceDialect,
582 0xd3ee36073fdfdf0,
583 >(_buf?)?
584 .into_result::<ControllerMarker>("clear_syscall_log_filters")?;
585 Ok(_response)
586 }
587 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
588 (),
589 0xd3ee36073fdfdf0,
590 fidl::encoding::DynamicFlags::FLEXIBLE,
591 _decode,
592 )
593 }
594}
595
596pub struct ControllerEventStream {
597 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
598}
599
600impl std::marker::Unpin for ControllerEventStream {}
601
602impl futures::stream::FusedStream for ControllerEventStream {
603 fn is_terminated(&self) -> bool {
604 self.event_receiver.is_terminated()
605 }
606}
607
608impl futures::Stream for ControllerEventStream {
609 type Item = Result<ControllerEvent, fidl::Error>;
610
611 fn poll_next(
612 mut self: std::pin::Pin<&mut Self>,
613 cx: &mut std::task::Context<'_>,
614 ) -> std::task::Poll<Option<Self::Item>> {
615 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
616 &mut self.event_receiver,
617 cx
618 )?) {
619 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
620 None => std::task::Poll::Ready(None),
621 }
622 }
623}
624
625#[derive(Debug)]
626pub enum ControllerEvent {
627 #[non_exhaustive]
628 _UnknownEvent {
629 ordinal: u64,
631 },
632}
633
634impl ControllerEvent {
635 fn decode(
637 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
638 ) -> Result<ControllerEvent, fidl::Error> {
639 let (bytes, _handles) = buf.split_mut();
640 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
641 debug_assert_eq!(tx_header.tx_id, 0);
642 match tx_header.ordinal {
643 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
644 Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
645 }
646 _ => Err(fidl::Error::UnknownOrdinal {
647 ordinal: tx_header.ordinal,
648 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
649 }),
650 }
651 }
652}
653
654pub struct ControllerRequestStream {
656 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
657 is_terminated: bool,
658}
659
660impl std::marker::Unpin for ControllerRequestStream {}
661
662impl futures::stream::FusedStream for ControllerRequestStream {
663 fn is_terminated(&self) -> bool {
664 self.is_terminated
665 }
666}
667
668impl fidl::endpoints::RequestStream for ControllerRequestStream {
669 type Protocol = ControllerMarker;
670 type ControlHandle = ControllerControlHandle;
671
672 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
673 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
674 }
675
676 fn control_handle(&self) -> Self::ControlHandle {
677 ControllerControlHandle { inner: self.inner.clone() }
678 }
679
680 fn into_inner(
681 self,
682 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
683 {
684 (self.inner, self.is_terminated)
685 }
686
687 fn from_inner(
688 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
689 is_terminated: bool,
690 ) -> Self {
691 Self { inner, is_terminated }
692 }
693}
694
695impl futures::Stream for ControllerRequestStream {
696 type Item = Result<ControllerRequest, fidl::Error>;
697
698 fn poll_next(
699 mut self: std::pin::Pin<&mut Self>,
700 cx: &mut std::task::Context<'_>,
701 ) -> std::task::Poll<Option<Self::Item>> {
702 let this = &mut *self;
703 if this.inner.check_shutdown(cx) {
704 this.is_terminated = true;
705 return std::task::Poll::Ready(None);
706 }
707 if this.is_terminated {
708 panic!("polled ControllerRequestStream after completion");
709 }
710 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
711 |bytes, handles| {
712 match this.inner.channel().read_etc(cx, bytes, handles) {
713 std::task::Poll::Ready(Ok(())) => {}
714 std::task::Poll::Pending => return std::task::Poll::Pending,
715 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
716 this.is_terminated = true;
717 return std::task::Poll::Ready(None);
718 }
719 std::task::Poll::Ready(Err(e)) => {
720 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
721 e.into(),
722 ))));
723 }
724 }
725
726 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
728
729 std::task::Poll::Ready(Some(match header.ordinal {
730 0x494a469a8943213b => {
731 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
732 let mut req = fidl::new_empty!(
733 ControllerVsockConnectRequest,
734 fidl::encoding::DefaultFuchsiaResourceDialect
735 );
736 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerVsockConnectRequest>(&header, _body_bytes, handles, &mut req)?;
737 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
738 Ok(ControllerRequest::VsockConnect { payload: req, control_handle })
739 }
740 0x76eb46fdc63aa8b8 => {
741 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
742 let mut req = fidl::new_empty!(
743 ControllerSpawnConsoleRequest,
744 fidl::encoding::DefaultFuchsiaResourceDialect
745 );
746 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSpawnConsoleRequest>(&header, _body_bytes, handles, &mut req)?;
747 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
748 Ok(ControllerRequest::SpawnConsole {
749 payload: req,
750 responder: ControllerSpawnConsoleResponder {
751 control_handle: std::mem::ManuallyDrop::new(control_handle),
752 tx_id: header.tx_id,
753 },
754 })
755 }
756 0x47a7f039bb97f173 => {
757 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
758 let mut req = fidl::new_empty!(
759 ControllerGetVmoReferencesRequest,
760 fidl::encoding::DefaultFuchsiaResourceDialect
761 );
762 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerGetVmoReferencesRequest>(&header, _body_bytes, handles, &mut req)?;
763 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
764 Ok(ControllerRequest::GetVmoReferences {
765 payload: req,
766 responder: ControllerGetVmoReferencesResponder {
767 control_handle: std::mem::ManuallyDrop::new(control_handle),
768 tx_id: header.tx_id,
769 },
770 })
771 }
772 0x60a31a248576ffea => {
773 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
774 let mut req = fidl::new_empty!(
775 fidl::encoding::EmptyPayload,
776 fidl::encoding::DefaultFuchsiaResourceDialect
777 );
778 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
779 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
780 Ok(ControllerRequest::GetJobHandle {
781 responder: ControllerGetJobHandleResponder {
782 control_handle: std::mem::ManuallyDrop::new(control_handle),
783 tx_id: header.tx_id,
784 },
785 })
786 }
787 0x253b1a0d3b9639e3 => {
788 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
789 let mut req = fidl::new_empty!(
790 ControllerSendSignalRequest,
791 fidl::encoding::DefaultFuchsiaResourceDialect
792 );
793 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSendSignalRequest>(&header, _body_bytes, handles, &mut req)?;
794 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
795 Ok(ControllerRequest::SendSignal {
796 payload: req,
797 responder: ControllerSendSignalResponder {
798 control_handle: std::mem::ManuallyDrop::new(control_handle),
799 tx_id: header.tx_id,
800 },
801 })
802 }
803 0x2d2a49963abdee9b => {
804 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
805 let mut req = fidl::new_empty!(
806 ControllerSetSyscallLogFilterRequest,
807 fidl::encoding::DefaultFuchsiaResourceDialect
808 );
809 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetSyscallLogFilterRequest>(&header, _body_bytes, handles, &mut req)?;
810 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
811 Ok(ControllerRequest::SetSyscallLogFilter {
812 payload: req,
813 responder: ControllerSetSyscallLogFilterResponder {
814 control_handle: std::mem::ManuallyDrop::new(control_handle),
815 tx_id: header.tx_id,
816 },
817 })
818 }
819 0xd3ee36073fdfdf0 => {
820 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821 let mut req = fidl::new_empty!(
822 fidl::encoding::EmptyPayload,
823 fidl::encoding::DefaultFuchsiaResourceDialect
824 );
825 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
826 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
827 Ok(ControllerRequest::ClearSyscallLogFilters {
828 responder: ControllerClearSyscallLogFiltersResponder {
829 control_handle: std::mem::ManuallyDrop::new(control_handle),
830 tx_id: header.tx_id,
831 },
832 })
833 }
834 _ if header.tx_id == 0
835 && header
836 .dynamic_flags()
837 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
838 {
839 Ok(ControllerRequest::_UnknownMethod {
840 ordinal: header.ordinal,
841 control_handle: ControllerControlHandle { inner: this.inner.clone() },
842 method_type: fidl::MethodType::OneWay,
843 })
844 }
845 _ if header
846 .dynamic_flags()
847 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
848 {
849 this.inner.send_framework_err(
850 fidl::encoding::FrameworkErr::UnknownMethod,
851 header.tx_id,
852 header.ordinal,
853 header.dynamic_flags(),
854 (bytes, handles),
855 )?;
856 Ok(ControllerRequest::_UnknownMethod {
857 ordinal: header.ordinal,
858 control_handle: ControllerControlHandle { inner: this.inner.clone() },
859 method_type: fidl::MethodType::TwoWay,
860 })
861 }
862 _ => Err(fidl::Error::UnknownOrdinal {
863 ordinal: header.ordinal,
864 protocol_name:
865 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
866 }),
867 }))
868 },
869 )
870 }
871}
872
873#[derive(Debug)]
874pub enum ControllerRequest {
875 VsockConnect { payload: ControllerVsockConnectRequest, control_handle: ControllerControlHandle },
877 SpawnConsole {
882 payload: ControllerSpawnConsoleRequest,
883 responder: ControllerSpawnConsoleResponder,
884 },
885 GetVmoReferences {
887 payload: ControllerGetVmoReferencesRequest,
888 responder: ControllerGetVmoReferencesResponder,
889 },
890 GetJobHandle { responder: ControllerGetJobHandleResponder },
892 SendSignal { payload: ControllerSendSignalRequest, responder: ControllerSendSignalResponder },
894 SetSyscallLogFilter {
896 payload: ControllerSetSyscallLogFilterRequest,
897 responder: ControllerSetSyscallLogFilterResponder,
898 },
899 ClearSyscallLogFilters { responder: ControllerClearSyscallLogFiltersResponder },
901 #[non_exhaustive]
903 _UnknownMethod {
904 ordinal: u64,
906 control_handle: ControllerControlHandle,
907 method_type: fidl::MethodType,
908 },
909}
910
911impl ControllerRequest {
912 #[allow(irrefutable_let_patterns)]
913 pub fn into_vsock_connect(
914 self,
915 ) -> Option<(ControllerVsockConnectRequest, ControllerControlHandle)> {
916 if let ControllerRequest::VsockConnect { payload, control_handle } = self {
917 Some((payload, control_handle))
918 } else {
919 None
920 }
921 }
922
923 #[allow(irrefutable_let_patterns)]
924 pub fn into_spawn_console(
925 self,
926 ) -> Option<(ControllerSpawnConsoleRequest, ControllerSpawnConsoleResponder)> {
927 if let ControllerRequest::SpawnConsole { payload, responder } = self {
928 Some((payload, responder))
929 } else {
930 None
931 }
932 }
933
934 #[allow(irrefutable_let_patterns)]
935 pub fn into_get_vmo_references(
936 self,
937 ) -> Option<(ControllerGetVmoReferencesRequest, ControllerGetVmoReferencesResponder)> {
938 if let ControllerRequest::GetVmoReferences { payload, responder } = self {
939 Some((payload, responder))
940 } else {
941 None
942 }
943 }
944
945 #[allow(irrefutable_let_patterns)]
946 pub fn into_get_job_handle(self) -> Option<(ControllerGetJobHandleResponder)> {
947 if let ControllerRequest::GetJobHandle { responder } = self {
948 Some((responder))
949 } else {
950 None
951 }
952 }
953
954 #[allow(irrefutable_let_patterns)]
955 pub fn into_send_signal(
956 self,
957 ) -> Option<(ControllerSendSignalRequest, ControllerSendSignalResponder)> {
958 if let ControllerRequest::SendSignal { payload, responder } = self {
959 Some((payload, responder))
960 } else {
961 None
962 }
963 }
964
965 #[allow(irrefutable_let_patterns)]
966 pub fn into_set_syscall_log_filter(
967 self,
968 ) -> Option<(ControllerSetSyscallLogFilterRequest, ControllerSetSyscallLogFilterResponder)>
969 {
970 if let ControllerRequest::SetSyscallLogFilter { payload, responder } = self {
971 Some((payload, responder))
972 } else {
973 None
974 }
975 }
976
977 #[allow(irrefutable_let_patterns)]
978 pub fn into_clear_syscall_log_filters(
979 self,
980 ) -> Option<(ControllerClearSyscallLogFiltersResponder)> {
981 if let ControllerRequest::ClearSyscallLogFilters { responder } = self {
982 Some((responder))
983 } else {
984 None
985 }
986 }
987
988 pub fn method_name(&self) -> &'static str {
990 match *self {
991 ControllerRequest::VsockConnect { .. } => "vsock_connect",
992 ControllerRequest::SpawnConsole { .. } => "spawn_console",
993 ControllerRequest::GetVmoReferences { .. } => "get_vmo_references",
994 ControllerRequest::GetJobHandle { .. } => "get_job_handle",
995 ControllerRequest::SendSignal { .. } => "send_signal",
996 ControllerRequest::SetSyscallLogFilter { .. } => "set_syscall_log_filter",
997 ControllerRequest::ClearSyscallLogFilters { .. } => "clear_syscall_log_filters",
998 ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
999 "unknown one-way method"
1000 }
1001 ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1002 "unknown two-way method"
1003 }
1004 }
1005 }
1006}
1007
1008#[derive(Debug, Clone)]
1009pub struct ControllerControlHandle {
1010 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1011}
1012
1013impl ControllerControlHandle {
1014 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1015 self.inner.shutdown_with_epitaph(status.into())
1016 }
1017}
1018
1019impl fidl::endpoints::ControlHandle for ControllerControlHandle {
1020 fn shutdown(&self) {
1021 self.inner.shutdown()
1022 }
1023
1024 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1025 self.inner.shutdown_with_epitaph(status)
1026 }
1027
1028 fn is_closed(&self) -> bool {
1029 self.inner.channel().is_closed()
1030 }
1031 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1032 self.inner.channel().on_closed()
1033 }
1034
1035 #[cfg(target_os = "fuchsia")]
1036 fn signal_peer(
1037 &self,
1038 clear_mask: zx::Signals,
1039 set_mask: zx::Signals,
1040 ) -> Result<(), zx_status::Status> {
1041 use fidl::Peered;
1042 self.inner.channel().signal_peer(clear_mask, set_mask)
1043 }
1044}
1045
1046impl ControllerControlHandle {}
1047
1048#[must_use = "FIDL methods require a response to be sent"]
1049#[derive(Debug)]
1050pub struct ControllerSpawnConsoleResponder {
1051 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1052 tx_id: u32,
1053}
1054
1055impl std::ops::Drop for ControllerSpawnConsoleResponder {
1059 fn drop(&mut self) {
1060 self.control_handle.shutdown();
1061 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1063 }
1064}
1065
1066impl fidl::endpoints::Responder for ControllerSpawnConsoleResponder {
1067 type ControlHandle = ControllerControlHandle;
1068
1069 fn control_handle(&self) -> &ControllerControlHandle {
1070 &self.control_handle
1071 }
1072
1073 fn drop_without_shutdown(mut self) {
1074 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1076 std::mem::forget(self);
1078 }
1079}
1080
1081impl ControllerSpawnConsoleResponder {
1082 pub fn send(self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1086 let _result = self.send_raw(result);
1087 if _result.is_err() {
1088 self.control_handle.shutdown();
1089 }
1090 self.drop_without_shutdown();
1091 _result
1092 }
1093
1094 pub fn send_no_shutdown_on_err(
1096 self,
1097 mut result: Result<u8, SpawnConsoleError>,
1098 ) -> Result<(), fidl::Error> {
1099 let _result = self.send_raw(result);
1100 self.drop_without_shutdown();
1101 _result
1102 }
1103
1104 fn send_raw(&self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1105 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1106 ControllerSpawnConsoleResponse,
1107 SpawnConsoleError,
1108 >>(
1109 fidl::encoding::FlexibleResult::new(result.map(|exit_code| (exit_code,))),
1110 self.tx_id,
1111 0x76eb46fdc63aa8b8,
1112 fidl::encoding::DynamicFlags::FLEXIBLE,
1113 )
1114 }
1115}
1116
1117#[must_use = "FIDL methods require a response to be sent"]
1118#[derive(Debug)]
1119pub struct ControllerGetVmoReferencesResponder {
1120 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1121 tx_id: u32,
1122}
1123
1124impl std::ops::Drop for ControllerGetVmoReferencesResponder {
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 ControllerGetVmoReferencesResponder {
1136 type ControlHandle = ControllerControlHandle;
1137
1138 fn control_handle(&self) -> &ControllerControlHandle {
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 ControllerGetVmoReferencesResponder {
1151 pub fn send(self, mut payload: &ControllerGetVmoReferencesResponse) -> Result<(), fidl::Error> {
1155 let _result = self.send_raw(payload);
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(
1165 self,
1166 mut payload: &ControllerGetVmoReferencesResponse,
1167 ) -> Result<(), fidl::Error> {
1168 let _result = self.send_raw(payload);
1169 self.drop_without_shutdown();
1170 _result
1171 }
1172
1173 fn send_raw(
1174 &self,
1175 mut payload: &ControllerGetVmoReferencesResponse,
1176 ) -> Result<(), fidl::Error> {
1177 self.control_handle
1178 .inner
1179 .send::<fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>>(
1180 fidl::encoding::Flexible::new(payload),
1181 self.tx_id,
1182 0x47a7f039bb97f173,
1183 fidl::encoding::DynamicFlags::FLEXIBLE,
1184 )
1185 }
1186}
1187
1188#[must_use = "FIDL methods require a response to be sent"]
1189#[derive(Debug)]
1190pub struct ControllerGetJobHandleResponder {
1191 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1192 tx_id: u32,
1193}
1194
1195impl std::ops::Drop for ControllerGetJobHandleResponder {
1199 fn drop(&mut self) {
1200 self.control_handle.shutdown();
1201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1203 }
1204}
1205
1206impl fidl::endpoints::Responder for ControllerGetJobHandleResponder {
1207 type ControlHandle = ControllerControlHandle;
1208
1209 fn control_handle(&self) -> &ControllerControlHandle {
1210 &self.control_handle
1211 }
1212
1213 fn drop_without_shutdown(mut self) {
1214 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1216 std::mem::forget(self);
1218 }
1219}
1220
1221impl ControllerGetJobHandleResponder {
1222 pub fn send(self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1226 let _result = self.send_raw(payload);
1227 if _result.is_err() {
1228 self.control_handle.shutdown();
1229 }
1230 self.drop_without_shutdown();
1231 _result
1232 }
1233
1234 pub fn send_no_shutdown_on_err(
1236 self,
1237 mut payload: ControllerGetJobHandleResponse,
1238 ) -> Result<(), fidl::Error> {
1239 let _result = self.send_raw(payload);
1240 self.drop_without_shutdown();
1241 _result
1242 }
1243
1244 fn send_raw(&self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1245 self.control_handle
1246 .inner
1247 .send::<fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>>(
1248 fidl::encoding::Flexible::new(&mut payload),
1249 self.tx_id,
1250 0x60a31a248576ffea,
1251 fidl::encoding::DynamicFlags::FLEXIBLE,
1252 )
1253 }
1254}
1255
1256#[must_use = "FIDL methods require a response to be sent"]
1257#[derive(Debug)]
1258pub struct ControllerSendSignalResponder {
1259 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1260 tx_id: u32,
1261}
1262
1263impl std::ops::Drop for ControllerSendSignalResponder {
1267 fn drop(&mut self) {
1268 self.control_handle.shutdown();
1269 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1271 }
1272}
1273
1274impl fidl::endpoints::Responder for ControllerSendSignalResponder {
1275 type ControlHandle = ControllerControlHandle;
1276
1277 fn control_handle(&self) -> &ControllerControlHandle {
1278 &self.control_handle
1279 }
1280
1281 fn drop_without_shutdown(mut self) {
1282 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284 std::mem::forget(self);
1286 }
1287}
1288
1289impl ControllerSendSignalResponder {
1290 pub fn send(self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1294 let _result = self.send_raw(result);
1295 if _result.is_err() {
1296 self.control_handle.shutdown();
1297 }
1298 self.drop_without_shutdown();
1299 _result
1300 }
1301
1302 pub fn send_no_shutdown_on_err(
1304 self,
1305 mut result: Result<(), SignalError>,
1306 ) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(result);
1308 self.drop_without_shutdown();
1309 _result
1310 }
1311
1312 fn send_raw(&self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1313 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1314 fidl::encoding::EmptyStruct,
1315 SignalError,
1316 >>(
1317 fidl::encoding::FlexibleResult::new(result),
1318 self.tx_id,
1319 0x253b1a0d3b9639e3,
1320 fidl::encoding::DynamicFlags::FLEXIBLE,
1321 )
1322 }
1323}
1324
1325#[must_use = "FIDL methods require a response to be sent"]
1326#[derive(Debug)]
1327pub struct ControllerSetSyscallLogFilterResponder {
1328 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1329 tx_id: u32,
1330}
1331
1332impl std::ops::Drop for ControllerSetSyscallLogFilterResponder {
1336 fn drop(&mut self) {
1337 self.control_handle.shutdown();
1338 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340 }
1341}
1342
1343impl fidl::endpoints::Responder for ControllerSetSyscallLogFilterResponder {
1344 type ControlHandle = ControllerControlHandle;
1345
1346 fn control_handle(&self) -> &ControllerControlHandle {
1347 &self.control_handle
1348 }
1349
1350 fn drop_without_shutdown(mut self) {
1351 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1353 std::mem::forget(self);
1355 }
1356}
1357
1358impl ControllerSetSyscallLogFilterResponder {
1359 pub fn send(self, mut result: Result<(), SetSyscallLogFilterError>) -> Result<(), fidl::Error> {
1363 let _result = self.send_raw(result);
1364 if _result.is_err() {
1365 self.control_handle.shutdown();
1366 }
1367 self.drop_without_shutdown();
1368 _result
1369 }
1370
1371 pub fn send_no_shutdown_on_err(
1373 self,
1374 mut result: Result<(), SetSyscallLogFilterError>,
1375 ) -> Result<(), fidl::Error> {
1376 let _result = self.send_raw(result);
1377 self.drop_without_shutdown();
1378 _result
1379 }
1380
1381 fn send_raw(
1382 &self,
1383 mut result: Result<(), SetSyscallLogFilterError>,
1384 ) -> Result<(), fidl::Error> {
1385 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1386 fidl::encoding::EmptyStruct,
1387 SetSyscallLogFilterError,
1388 >>(
1389 fidl::encoding::FlexibleResult::new(result),
1390 self.tx_id,
1391 0x2d2a49963abdee9b,
1392 fidl::encoding::DynamicFlags::FLEXIBLE,
1393 )
1394 }
1395}
1396
1397#[must_use = "FIDL methods require a response to be sent"]
1398#[derive(Debug)]
1399pub struct ControllerClearSyscallLogFiltersResponder {
1400 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1401 tx_id: u32,
1402}
1403
1404impl std::ops::Drop for ControllerClearSyscallLogFiltersResponder {
1408 fn drop(&mut self) {
1409 self.control_handle.shutdown();
1410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1412 }
1413}
1414
1415impl fidl::endpoints::Responder for ControllerClearSyscallLogFiltersResponder {
1416 type ControlHandle = ControllerControlHandle;
1417
1418 fn control_handle(&self) -> &ControllerControlHandle {
1419 &self.control_handle
1420 }
1421
1422 fn drop_without_shutdown(mut self) {
1423 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1425 std::mem::forget(self);
1427 }
1428}
1429
1430impl ControllerClearSyscallLogFiltersResponder {
1431 pub fn send(self) -> Result<(), fidl::Error> {
1435 let _result = self.send_raw();
1436 if _result.is_err() {
1437 self.control_handle.shutdown();
1438 }
1439 self.drop_without_shutdown();
1440 _result
1441 }
1442
1443 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1445 let _result = self.send_raw();
1446 self.drop_without_shutdown();
1447 _result
1448 }
1449
1450 fn send_raw(&self) -> Result<(), fidl::Error> {
1451 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1452 fidl::encoding::Flexible::new(()),
1453 self.tx_id,
1454 0xd3ee36073fdfdf0,
1455 fidl::encoding::DynamicFlags::FLEXIBLE,
1456 )
1457 }
1458}
1459
1460mod internal {
1461 use super::*;
1462
1463 impl ControllerSpawnConsoleRequest {
1464 #[inline(always)]
1465 fn max_ordinal_present(&self) -> u64 {
1466 if let Some(_) = self.window_size {
1467 return 6;
1468 }
1469 if let Some(_) = self.environ {
1470 return 5;
1471 }
1472 if let Some(_) = self.argv {
1473 return 4;
1474 }
1475 if let Some(_) = self.binary_path {
1476 return 3;
1477 }
1478 if let Some(_) = self.console_out {
1479 return 2;
1480 }
1481 if let Some(_) = self.console_in {
1482 return 1;
1483 }
1484 0
1485 }
1486 }
1487
1488 impl fidl::encoding::ResourceTypeMarker for ControllerSpawnConsoleRequest {
1489 type Borrowed<'a> = &'a mut Self;
1490 fn take_or_borrow<'a>(
1491 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1492 ) -> Self::Borrowed<'a> {
1493 value
1494 }
1495 }
1496
1497 unsafe impl fidl::encoding::TypeMarker for ControllerSpawnConsoleRequest {
1498 type Owned = Self;
1499
1500 #[inline(always)]
1501 fn inline_align(_context: fidl::encoding::Context) -> usize {
1502 8
1503 }
1504
1505 #[inline(always)]
1506 fn inline_size(_context: fidl::encoding::Context) -> usize {
1507 16
1508 }
1509 }
1510
1511 unsafe impl
1512 fidl::encoding::Encode<
1513 ControllerSpawnConsoleRequest,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 > for &mut ControllerSpawnConsoleRequest
1516 {
1517 unsafe fn encode(
1518 self,
1519 encoder: &mut fidl::encoding::Encoder<
1520 '_,
1521 fidl::encoding::DefaultFuchsiaResourceDialect,
1522 >,
1523 offset: usize,
1524 mut depth: fidl::encoding::Depth,
1525 ) -> fidl::Result<()> {
1526 encoder.debug_check_bounds::<ControllerSpawnConsoleRequest>(offset);
1527 let max_ordinal: u64 = self.max_ordinal_present();
1529 encoder.write_num(max_ordinal, offset);
1530 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1531 if max_ordinal == 0 {
1533 return Ok(());
1534 }
1535 depth.increment()?;
1536 let envelope_size = 8;
1537 let bytes_len = max_ordinal as usize * envelope_size;
1538 #[allow(unused_variables)]
1539 let offset = encoder.out_of_line_offset(bytes_len);
1540 let mut _prev_end_offset: usize = 0;
1541 if 1 > max_ordinal {
1542 return Ok(());
1543 }
1544
1545 let cur_offset: usize = (1 - 1) * envelope_size;
1548
1549 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1551
1552 fidl::encoding::encode_in_envelope_optional::<
1557 fidl::encoding::HandleType<
1558 fidl::Socket,
1559 { fidl::ObjectType::SOCKET.into_raw() },
1560 2147483648,
1561 >,
1562 fidl::encoding::DefaultFuchsiaResourceDialect,
1563 >(
1564 self.console_in.as_mut().map(
1565 <fidl::encoding::HandleType<
1566 fidl::Socket,
1567 { fidl::ObjectType::SOCKET.into_raw() },
1568 2147483648,
1569 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1570 ),
1571 encoder,
1572 offset + cur_offset,
1573 depth,
1574 )?;
1575
1576 _prev_end_offset = cur_offset + envelope_size;
1577 if 2 > max_ordinal {
1578 return Ok(());
1579 }
1580
1581 let cur_offset: usize = (2 - 1) * envelope_size;
1584
1585 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1587
1588 fidl::encoding::encode_in_envelope_optional::<
1593 fidl::encoding::HandleType<
1594 fidl::Socket,
1595 { fidl::ObjectType::SOCKET.into_raw() },
1596 2147483648,
1597 >,
1598 fidl::encoding::DefaultFuchsiaResourceDialect,
1599 >(
1600 self.console_out.as_mut().map(
1601 <fidl::encoding::HandleType<
1602 fidl::Socket,
1603 { fidl::ObjectType::SOCKET.into_raw() },
1604 2147483648,
1605 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1606 ),
1607 encoder,
1608 offset + cur_offset,
1609 depth,
1610 )?;
1611
1612 _prev_end_offset = cur_offset + envelope_size;
1613 if 3 > max_ordinal {
1614 return Ok(());
1615 }
1616
1617 let cur_offset: usize = (3 - 1) * envelope_size;
1620
1621 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1623
1624 fidl::encoding::encode_in_envelope_optional::<
1629 fidl::encoding::UnboundedString,
1630 fidl::encoding::DefaultFuchsiaResourceDialect,
1631 >(
1632 self.binary_path.as_ref().map(
1633 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1634 ),
1635 encoder,
1636 offset + cur_offset,
1637 depth,
1638 )?;
1639
1640 _prev_end_offset = cur_offset + envelope_size;
1641 if 4 > max_ordinal {
1642 return Ok(());
1643 }
1644
1645 let cur_offset: usize = (4 - 1) * envelope_size;
1648
1649 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1651
1652 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1657 self.argv.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1658 encoder, offset + cur_offset, depth
1659 )?;
1660
1661 _prev_end_offset = cur_offset + envelope_size;
1662 if 5 > max_ordinal {
1663 return Ok(());
1664 }
1665
1666 let cur_offset: usize = (5 - 1) * envelope_size;
1669
1670 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1672
1673 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1678 self.environ.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1679 encoder, offset + cur_offset, depth
1680 )?;
1681
1682 _prev_end_offset = cur_offset + envelope_size;
1683 if 6 > max_ordinal {
1684 return Ok(());
1685 }
1686
1687 let cur_offset: usize = (6 - 1) * envelope_size;
1690
1691 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1693
1694 fidl::encoding::encode_in_envelope_optional::<
1699 ConsoleWindowSize,
1700 fidl::encoding::DefaultFuchsiaResourceDialect,
1701 >(
1702 self.window_size
1703 .as_ref()
1704 .map(<ConsoleWindowSize as fidl::encoding::ValueTypeMarker>::borrow),
1705 encoder,
1706 offset + cur_offset,
1707 depth,
1708 )?;
1709
1710 _prev_end_offset = cur_offset + envelope_size;
1711
1712 Ok(())
1713 }
1714 }
1715
1716 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1717 for ControllerSpawnConsoleRequest
1718 {
1719 #[inline(always)]
1720 fn new_empty() -> Self {
1721 Self::default()
1722 }
1723
1724 unsafe fn decode(
1725 &mut self,
1726 decoder: &mut fidl::encoding::Decoder<
1727 '_,
1728 fidl::encoding::DefaultFuchsiaResourceDialect,
1729 >,
1730 offset: usize,
1731 mut depth: fidl::encoding::Depth,
1732 ) -> fidl::Result<()> {
1733 decoder.debug_check_bounds::<Self>(offset);
1734 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1735 None => return Err(fidl::Error::NotNullable),
1736 Some(len) => len,
1737 };
1738 if len == 0 {
1740 return Ok(());
1741 };
1742 depth.increment()?;
1743 let envelope_size = 8;
1744 let bytes_len = len * envelope_size;
1745 let offset = decoder.out_of_line_offset(bytes_len)?;
1746 let mut _next_ordinal_to_read = 0;
1748 let mut next_offset = offset;
1749 let end_offset = offset + bytes_len;
1750 _next_ordinal_to_read += 1;
1751 if next_offset >= end_offset {
1752 return Ok(());
1753 }
1754
1755 while _next_ordinal_to_read < 1 {
1757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1758 _next_ordinal_to_read += 1;
1759 next_offset += envelope_size;
1760 }
1761
1762 let next_out_of_line = decoder.next_out_of_line();
1763 let handles_before = decoder.remaining_handles();
1764 if let Some((inlined, num_bytes, num_handles)) =
1765 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1766 {
1767 let member_inline_size = <fidl::encoding::HandleType<
1768 fidl::Socket,
1769 { fidl::ObjectType::SOCKET.into_raw() },
1770 2147483648,
1771 > as fidl::encoding::TypeMarker>::inline_size(
1772 decoder.context
1773 );
1774 if inlined != (member_inline_size <= 4) {
1775 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1776 }
1777 let inner_offset;
1778 let mut inner_depth = depth.clone();
1779 if inlined {
1780 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1781 inner_offset = next_offset;
1782 } else {
1783 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1784 inner_depth.increment()?;
1785 }
1786 let val_ref =
1787 self.console_in.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1788 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1789 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1790 {
1791 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1792 }
1793 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1794 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1795 }
1796 }
1797
1798 next_offset += envelope_size;
1799 _next_ordinal_to_read += 1;
1800 if next_offset >= end_offset {
1801 return Ok(());
1802 }
1803
1804 while _next_ordinal_to_read < 2 {
1806 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1807 _next_ordinal_to_read += 1;
1808 next_offset += envelope_size;
1809 }
1810
1811 let next_out_of_line = decoder.next_out_of_line();
1812 let handles_before = decoder.remaining_handles();
1813 if let Some((inlined, num_bytes, num_handles)) =
1814 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1815 {
1816 let member_inline_size = <fidl::encoding::HandleType<
1817 fidl::Socket,
1818 { fidl::ObjectType::SOCKET.into_raw() },
1819 2147483648,
1820 > as fidl::encoding::TypeMarker>::inline_size(
1821 decoder.context
1822 );
1823 if inlined != (member_inline_size <= 4) {
1824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1825 }
1826 let inner_offset;
1827 let mut inner_depth = depth.clone();
1828 if inlined {
1829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1830 inner_offset = next_offset;
1831 } else {
1832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1833 inner_depth.increment()?;
1834 }
1835 let val_ref =
1836 self.console_out.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1837 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1838 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1839 {
1840 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1841 }
1842 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1843 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1844 }
1845 }
1846
1847 next_offset += envelope_size;
1848 _next_ordinal_to_read += 1;
1849 if next_offset >= end_offset {
1850 return Ok(());
1851 }
1852
1853 while _next_ordinal_to_read < 3 {
1855 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1856 _next_ordinal_to_read += 1;
1857 next_offset += envelope_size;
1858 }
1859
1860 let next_out_of_line = decoder.next_out_of_line();
1861 let handles_before = decoder.remaining_handles();
1862 if let Some((inlined, num_bytes, num_handles)) =
1863 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1864 {
1865 let member_inline_size =
1866 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1867 decoder.context,
1868 );
1869 if inlined != (member_inline_size <= 4) {
1870 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1871 }
1872 let inner_offset;
1873 let mut inner_depth = depth.clone();
1874 if inlined {
1875 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1876 inner_offset = next_offset;
1877 } else {
1878 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1879 inner_depth.increment()?;
1880 }
1881 let val_ref = self.binary_path.get_or_insert_with(|| {
1882 fidl::new_empty!(
1883 fidl::encoding::UnboundedString,
1884 fidl::encoding::DefaultFuchsiaResourceDialect
1885 )
1886 });
1887 fidl::decode!(
1888 fidl::encoding::UnboundedString,
1889 fidl::encoding::DefaultFuchsiaResourceDialect,
1890 val_ref,
1891 decoder,
1892 inner_offset,
1893 inner_depth
1894 )?;
1895 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1896 {
1897 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1898 }
1899 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1900 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1901 }
1902 }
1903
1904 next_offset += envelope_size;
1905 _next_ordinal_to_read += 1;
1906 if next_offset >= end_offset {
1907 return Ok(());
1908 }
1909
1910 while _next_ordinal_to_read < 4 {
1912 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1913 _next_ordinal_to_read += 1;
1914 next_offset += envelope_size;
1915 }
1916
1917 let next_out_of_line = decoder.next_out_of_line();
1918 let handles_before = decoder.remaining_handles();
1919 if let Some((inlined, num_bytes, num_handles)) =
1920 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1921 {
1922 let member_inline_size = <fidl::encoding::UnboundedVector<
1923 fidl::encoding::UnboundedString,
1924 > as fidl::encoding::TypeMarker>::inline_size(
1925 decoder.context
1926 );
1927 if inlined != (member_inline_size <= 4) {
1928 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1929 }
1930 let inner_offset;
1931 let mut inner_depth = depth.clone();
1932 if inlined {
1933 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1934 inner_offset = next_offset;
1935 } else {
1936 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1937 inner_depth.increment()?;
1938 }
1939 let val_ref = self.argv.get_or_insert_with(|| {
1940 fidl::new_empty!(
1941 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1942 fidl::encoding::DefaultFuchsiaResourceDialect
1943 )
1944 });
1945 fidl::decode!(
1946 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1947 fidl::encoding::DefaultFuchsiaResourceDialect,
1948 val_ref,
1949 decoder,
1950 inner_offset,
1951 inner_depth
1952 )?;
1953 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1954 {
1955 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1956 }
1957 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1958 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1959 }
1960 }
1961
1962 next_offset += envelope_size;
1963 _next_ordinal_to_read += 1;
1964 if next_offset >= end_offset {
1965 return Ok(());
1966 }
1967
1968 while _next_ordinal_to_read < 5 {
1970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1971 _next_ordinal_to_read += 1;
1972 next_offset += envelope_size;
1973 }
1974
1975 let next_out_of_line = decoder.next_out_of_line();
1976 let handles_before = decoder.remaining_handles();
1977 if let Some((inlined, num_bytes, num_handles)) =
1978 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1979 {
1980 let member_inline_size = <fidl::encoding::UnboundedVector<
1981 fidl::encoding::UnboundedString,
1982 > as fidl::encoding::TypeMarker>::inline_size(
1983 decoder.context
1984 );
1985 if inlined != (member_inline_size <= 4) {
1986 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1987 }
1988 let inner_offset;
1989 let mut inner_depth = depth.clone();
1990 if inlined {
1991 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1992 inner_offset = next_offset;
1993 } else {
1994 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1995 inner_depth.increment()?;
1996 }
1997 let val_ref = self.environ.get_or_insert_with(|| {
1998 fidl::new_empty!(
1999 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2000 fidl::encoding::DefaultFuchsiaResourceDialect
2001 )
2002 });
2003 fidl::decode!(
2004 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2005 fidl::encoding::DefaultFuchsiaResourceDialect,
2006 val_ref,
2007 decoder,
2008 inner_offset,
2009 inner_depth
2010 )?;
2011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2012 {
2013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2014 }
2015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2017 }
2018 }
2019
2020 next_offset += envelope_size;
2021 _next_ordinal_to_read += 1;
2022 if next_offset >= end_offset {
2023 return Ok(());
2024 }
2025
2026 while _next_ordinal_to_read < 6 {
2028 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2029 _next_ordinal_to_read += 1;
2030 next_offset += envelope_size;
2031 }
2032
2033 let next_out_of_line = decoder.next_out_of_line();
2034 let handles_before = decoder.remaining_handles();
2035 if let Some((inlined, num_bytes, num_handles)) =
2036 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2037 {
2038 let member_inline_size =
2039 <ConsoleWindowSize as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2040 if inlined != (member_inline_size <= 4) {
2041 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2042 }
2043 let inner_offset;
2044 let mut inner_depth = depth.clone();
2045 if inlined {
2046 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2047 inner_offset = next_offset;
2048 } else {
2049 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2050 inner_depth.increment()?;
2051 }
2052 let val_ref = self.window_size.get_or_insert_with(|| {
2053 fidl::new_empty!(
2054 ConsoleWindowSize,
2055 fidl::encoding::DefaultFuchsiaResourceDialect
2056 )
2057 });
2058 fidl::decode!(
2059 ConsoleWindowSize,
2060 fidl::encoding::DefaultFuchsiaResourceDialect,
2061 val_ref,
2062 decoder,
2063 inner_offset,
2064 inner_depth
2065 )?;
2066 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2067 {
2068 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2069 }
2070 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2071 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2072 }
2073 }
2074
2075 next_offset += envelope_size;
2076
2077 while next_offset < end_offset {
2079 _next_ordinal_to_read += 1;
2080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2081 next_offset += envelope_size;
2082 }
2083
2084 Ok(())
2085 }
2086 }
2087
2088 impl ControllerVsockConnectRequest {
2089 #[inline(always)]
2090 fn max_ordinal_present(&self) -> u64 {
2091 if let Some(_) = self.bridge_socket {
2092 return 2;
2093 }
2094 if let Some(_) = self.port {
2095 return 1;
2096 }
2097 0
2098 }
2099 }
2100
2101 impl fidl::encoding::ResourceTypeMarker for ControllerVsockConnectRequest {
2102 type Borrowed<'a> = &'a mut Self;
2103 fn take_or_borrow<'a>(
2104 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2105 ) -> Self::Borrowed<'a> {
2106 value
2107 }
2108 }
2109
2110 unsafe impl fidl::encoding::TypeMarker for ControllerVsockConnectRequest {
2111 type Owned = Self;
2112
2113 #[inline(always)]
2114 fn inline_align(_context: fidl::encoding::Context) -> usize {
2115 8
2116 }
2117
2118 #[inline(always)]
2119 fn inline_size(_context: fidl::encoding::Context) -> usize {
2120 16
2121 }
2122 }
2123
2124 unsafe impl
2125 fidl::encoding::Encode<
2126 ControllerVsockConnectRequest,
2127 fidl::encoding::DefaultFuchsiaResourceDialect,
2128 > for &mut ControllerVsockConnectRequest
2129 {
2130 unsafe fn encode(
2131 self,
2132 encoder: &mut fidl::encoding::Encoder<
2133 '_,
2134 fidl::encoding::DefaultFuchsiaResourceDialect,
2135 >,
2136 offset: usize,
2137 mut depth: fidl::encoding::Depth,
2138 ) -> fidl::Result<()> {
2139 encoder.debug_check_bounds::<ControllerVsockConnectRequest>(offset);
2140 let max_ordinal: u64 = self.max_ordinal_present();
2142 encoder.write_num(max_ordinal, offset);
2143 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2144 if max_ordinal == 0 {
2146 return Ok(());
2147 }
2148 depth.increment()?;
2149 let envelope_size = 8;
2150 let bytes_len = max_ordinal as usize * envelope_size;
2151 #[allow(unused_variables)]
2152 let offset = encoder.out_of_line_offset(bytes_len);
2153 let mut _prev_end_offset: usize = 0;
2154 if 1 > max_ordinal {
2155 return Ok(());
2156 }
2157
2158 let cur_offset: usize = (1 - 1) * envelope_size;
2161
2162 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2164
2165 fidl::encoding::encode_in_envelope_optional::<
2170 u32,
2171 fidl::encoding::DefaultFuchsiaResourceDialect,
2172 >(
2173 self.port.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2174 encoder,
2175 offset + cur_offset,
2176 depth,
2177 )?;
2178
2179 _prev_end_offset = cur_offset + envelope_size;
2180 if 2 > max_ordinal {
2181 return Ok(());
2182 }
2183
2184 let cur_offset: usize = (2 - 1) * envelope_size;
2187
2188 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2190
2191 fidl::encoding::encode_in_envelope_optional::<
2196 fidl::encoding::HandleType<
2197 fidl::Socket,
2198 { fidl::ObjectType::SOCKET.into_raw() },
2199 2147483648,
2200 >,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 >(
2203 self.bridge_socket.as_mut().map(
2204 <fidl::encoding::HandleType<
2205 fidl::Socket,
2206 { fidl::ObjectType::SOCKET.into_raw() },
2207 2147483648,
2208 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2209 ),
2210 encoder,
2211 offset + cur_offset,
2212 depth,
2213 )?;
2214
2215 _prev_end_offset = cur_offset + envelope_size;
2216
2217 Ok(())
2218 }
2219 }
2220
2221 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2222 for ControllerVsockConnectRequest
2223 {
2224 #[inline(always)]
2225 fn new_empty() -> Self {
2226 Self::default()
2227 }
2228
2229 unsafe fn decode(
2230 &mut self,
2231 decoder: &mut fidl::encoding::Decoder<
2232 '_,
2233 fidl::encoding::DefaultFuchsiaResourceDialect,
2234 >,
2235 offset: usize,
2236 mut depth: fidl::encoding::Depth,
2237 ) -> fidl::Result<()> {
2238 decoder.debug_check_bounds::<Self>(offset);
2239 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2240 None => return Err(fidl::Error::NotNullable),
2241 Some(len) => len,
2242 };
2243 if len == 0 {
2245 return Ok(());
2246 };
2247 depth.increment()?;
2248 let envelope_size = 8;
2249 let bytes_len = len * envelope_size;
2250 let offset = decoder.out_of_line_offset(bytes_len)?;
2251 let mut _next_ordinal_to_read = 0;
2253 let mut next_offset = offset;
2254 let end_offset = offset + bytes_len;
2255 _next_ordinal_to_read += 1;
2256 if next_offset >= end_offset {
2257 return Ok(());
2258 }
2259
2260 while _next_ordinal_to_read < 1 {
2262 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2263 _next_ordinal_to_read += 1;
2264 next_offset += envelope_size;
2265 }
2266
2267 let next_out_of_line = decoder.next_out_of_line();
2268 let handles_before = decoder.remaining_handles();
2269 if let Some((inlined, num_bytes, num_handles)) =
2270 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2271 {
2272 let member_inline_size =
2273 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2274 if inlined != (member_inline_size <= 4) {
2275 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2276 }
2277 let inner_offset;
2278 let mut inner_depth = depth.clone();
2279 if inlined {
2280 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2281 inner_offset = next_offset;
2282 } else {
2283 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2284 inner_depth.increment()?;
2285 }
2286 let val_ref = self.port.get_or_insert_with(|| {
2287 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2288 });
2289 fidl::decode!(
2290 u32,
2291 fidl::encoding::DefaultFuchsiaResourceDialect,
2292 val_ref,
2293 decoder,
2294 inner_offset,
2295 inner_depth
2296 )?;
2297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2298 {
2299 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2300 }
2301 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2302 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2303 }
2304 }
2305
2306 next_offset += envelope_size;
2307 _next_ordinal_to_read += 1;
2308 if next_offset >= end_offset {
2309 return Ok(());
2310 }
2311
2312 while _next_ordinal_to_read < 2 {
2314 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2315 _next_ordinal_to_read += 1;
2316 next_offset += envelope_size;
2317 }
2318
2319 let next_out_of_line = decoder.next_out_of_line();
2320 let handles_before = decoder.remaining_handles();
2321 if let Some((inlined, num_bytes, num_handles)) =
2322 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2323 {
2324 let member_inline_size = <fidl::encoding::HandleType<
2325 fidl::Socket,
2326 { fidl::ObjectType::SOCKET.into_raw() },
2327 2147483648,
2328 > as fidl::encoding::TypeMarker>::inline_size(
2329 decoder.context
2330 );
2331 if inlined != (member_inline_size <= 4) {
2332 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2333 }
2334 let inner_offset;
2335 let mut inner_depth = depth.clone();
2336 if inlined {
2337 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2338 inner_offset = next_offset;
2339 } else {
2340 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2341 inner_depth.increment()?;
2342 }
2343 let val_ref =
2344 self.bridge_socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2345 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2346 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2347 {
2348 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2349 }
2350 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2351 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2352 }
2353 }
2354
2355 next_offset += envelope_size;
2356
2357 while next_offset < end_offset {
2359 _next_ordinal_to_read += 1;
2360 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2361 next_offset += envelope_size;
2362 }
2363
2364 Ok(())
2365 }
2366 }
2367
2368 impl ControllerGetJobHandleResponse {
2369 #[inline(always)]
2370 fn max_ordinal_present(&self) -> u64 {
2371 if let Some(_) = self.job {
2372 return 1;
2373 }
2374 0
2375 }
2376 }
2377
2378 impl fidl::encoding::ResourceTypeMarker for ControllerGetJobHandleResponse {
2379 type Borrowed<'a> = &'a mut Self;
2380 fn take_or_borrow<'a>(
2381 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2382 ) -> Self::Borrowed<'a> {
2383 value
2384 }
2385 }
2386
2387 unsafe impl fidl::encoding::TypeMarker for ControllerGetJobHandleResponse {
2388 type Owned = Self;
2389
2390 #[inline(always)]
2391 fn inline_align(_context: fidl::encoding::Context) -> usize {
2392 8
2393 }
2394
2395 #[inline(always)]
2396 fn inline_size(_context: fidl::encoding::Context) -> usize {
2397 16
2398 }
2399 }
2400
2401 unsafe impl
2402 fidl::encoding::Encode<
2403 ControllerGetJobHandleResponse,
2404 fidl::encoding::DefaultFuchsiaResourceDialect,
2405 > for &mut ControllerGetJobHandleResponse
2406 {
2407 unsafe fn encode(
2408 self,
2409 encoder: &mut fidl::encoding::Encoder<
2410 '_,
2411 fidl::encoding::DefaultFuchsiaResourceDialect,
2412 >,
2413 offset: usize,
2414 mut depth: fidl::encoding::Depth,
2415 ) -> fidl::Result<()> {
2416 encoder.debug_check_bounds::<ControllerGetJobHandleResponse>(offset);
2417 let max_ordinal: u64 = self.max_ordinal_present();
2419 encoder.write_num(max_ordinal, offset);
2420 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2421 if max_ordinal == 0 {
2423 return Ok(());
2424 }
2425 depth.increment()?;
2426 let envelope_size = 8;
2427 let bytes_len = max_ordinal as usize * envelope_size;
2428 #[allow(unused_variables)]
2429 let offset = encoder.out_of_line_offset(bytes_len);
2430 let mut _prev_end_offset: usize = 0;
2431 if 1 > max_ordinal {
2432 return Ok(());
2433 }
2434
2435 let cur_offset: usize = (1 - 1) * envelope_size;
2438
2439 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2441
2442 fidl::encoding::encode_in_envelope_optional::<
2447 fidl::encoding::HandleType<
2448 fidl::Job,
2449 { fidl::ObjectType::JOB.into_raw() },
2450 2147483648,
2451 >,
2452 fidl::encoding::DefaultFuchsiaResourceDialect,
2453 >(
2454 self.job.as_mut().map(
2455 <fidl::encoding::HandleType<
2456 fidl::Job,
2457 { fidl::ObjectType::JOB.into_raw() },
2458 2147483648,
2459 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2460 ),
2461 encoder,
2462 offset + cur_offset,
2463 depth,
2464 )?;
2465
2466 _prev_end_offset = cur_offset + envelope_size;
2467
2468 Ok(())
2469 }
2470 }
2471
2472 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2473 for ControllerGetJobHandleResponse
2474 {
2475 #[inline(always)]
2476 fn new_empty() -> Self {
2477 Self::default()
2478 }
2479
2480 unsafe fn decode(
2481 &mut self,
2482 decoder: &mut fidl::encoding::Decoder<
2483 '_,
2484 fidl::encoding::DefaultFuchsiaResourceDialect,
2485 >,
2486 offset: usize,
2487 mut depth: fidl::encoding::Depth,
2488 ) -> fidl::Result<()> {
2489 decoder.debug_check_bounds::<Self>(offset);
2490 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2491 None => return Err(fidl::Error::NotNullable),
2492 Some(len) => len,
2493 };
2494 if len == 0 {
2496 return Ok(());
2497 };
2498 depth.increment()?;
2499 let envelope_size = 8;
2500 let bytes_len = len * envelope_size;
2501 let offset = decoder.out_of_line_offset(bytes_len)?;
2502 let mut _next_ordinal_to_read = 0;
2504 let mut next_offset = offset;
2505 let end_offset = offset + bytes_len;
2506 _next_ordinal_to_read += 1;
2507 if next_offset >= end_offset {
2508 return Ok(());
2509 }
2510
2511 while _next_ordinal_to_read < 1 {
2513 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2514 _next_ordinal_to_read += 1;
2515 next_offset += envelope_size;
2516 }
2517
2518 let next_out_of_line = decoder.next_out_of_line();
2519 let handles_before = decoder.remaining_handles();
2520 if let Some((inlined, num_bytes, num_handles)) =
2521 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2522 {
2523 let member_inline_size = <fidl::encoding::HandleType<
2524 fidl::Job,
2525 { fidl::ObjectType::JOB.into_raw() },
2526 2147483648,
2527 > as fidl::encoding::TypeMarker>::inline_size(
2528 decoder.context
2529 );
2530 if inlined != (member_inline_size <= 4) {
2531 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2532 }
2533 let inner_offset;
2534 let mut inner_depth = depth.clone();
2535 if inlined {
2536 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2537 inner_offset = next_offset;
2538 } else {
2539 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2540 inner_depth.increment()?;
2541 }
2542 let val_ref =
2543 self.job.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2544 fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2545 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2546 {
2547 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2548 }
2549 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2550 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2551 }
2552 }
2553
2554 next_offset += envelope_size;
2555
2556 while next_offset < end_offset {
2558 _next_ordinal_to_read += 1;
2559 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2560 next_offset += envelope_size;
2561 }
2562
2563 Ok(())
2564 }
2565 }
2566}