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 fidl::endpoints::ControlHandle for ControllerControlHandle {
1014 fn shutdown(&self) {
1015 self.inner.shutdown()
1016 }
1017
1018 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1019 self.inner.shutdown_with_epitaph(status)
1020 }
1021
1022 fn is_closed(&self) -> bool {
1023 self.inner.channel().is_closed()
1024 }
1025 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1026 self.inner.channel().on_closed()
1027 }
1028
1029 #[cfg(target_os = "fuchsia")]
1030 fn signal_peer(
1031 &self,
1032 clear_mask: zx::Signals,
1033 set_mask: zx::Signals,
1034 ) -> Result<(), zx_status::Status> {
1035 use fidl::Peered;
1036 self.inner.channel().signal_peer(clear_mask, set_mask)
1037 }
1038}
1039
1040impl ControllerControlHandle {}
1041
1042#[must_use = "FIDL methods require a response to be sent"]
1043#[derive(Debug)]
1044pub struct ControllerSpawnConsoleResponder {
1045 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1046 tx_id: u32,
1047}
1048
1049impl std::ops::Drop for ControllerSpawnConsoleResponder {
1053 fn drop(&mut self) {
1054 self.control_handle.shutdown();
1055 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1057 }
1058}
1059
1060impl fidl::endpoints::Responder for ControllerSpawnConsoleResponder {
1061 type ControlHandle = ControllerControlHandle;
1062
1063 fn control_handle(&self) -> &ControllerControlHandle {
1064 &self.control_handle
1065 }
1066
1067 fn drop_without_shutdown(mut self) {
1068 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1070 std::mem::forget(self);
1072 }
1073}
1074
1075impl ControllerSpawnConsoleResponder {
1076 pub fn send(self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1080 let _result = self.send_raw(result);
1081 if _result.is_err() {
1082 self.control_handle.shutdown();
1083 }
1084 self.drop_without_shutdown();
1085 _result
1086 }
1087
1088 pub fn send_no_shutdown_on_err(
1090 self,
1091 mut result: Result<u8, SpawnConsoleError>,
1092 ) -> Result<(), fidl::Error> {
1093 let _result = self.send_raw(result);
1094 self.drop_without_shutdown();
1095 _result
1096 }
1097
1098 fn send_raw(&self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1099 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1100 ControllerSpawnConsoleResponse,
1101 SpawnConsoleError,
1102 >>(
1103 fidl::encoding::FlexibleResult::new(result.map(|exit_code| (exit_code,))),
1104 self.tx_id,
1105 0x76eb46fdc63aa8b8,
1106 fidl::encoding::DynamicFlags::FLEXIBLE,
1107 )
1108 }
1109}
1110
1111#[must_use = "FIDL methods require a response to be sent"]
1112#[derive(Debug)]
1113pub struct ControllerGetVmoReferencesResponder {
1114 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1115 tx_id: u32,
1116}
1117
1118impl std::ops::Drop for ControllerGetVmoReferencesResponder {
1122 fn drop(&mut self) {
1123 self.control_handle.shutdown();
1124 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1126 }
1127}
1128
1129impl fidl::endpoints::Responder for ControllerGetVmoReferencesResponder {
1130 type ControlHandle = ControllerControlHandle;
1131
1132 fn control_handle(&self) -> &ControllerControlHandle {
1133 &self.control_handle
1134 }
1135
1136 fn drop_without_shutdown(mut self) {
1137 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1139 std::mem::forget(self);
1141 }
1142}
1143
1144impl ControllerGetVmoReferencesResponder {
1145 pub fn send(self, mut payload: &ControllerGetVmoReferencesResponse) -> Result<(), fidl::Error> {
1149 let _result = self.send_raw(payload);
1150 if _result.is_err() {
1151 self.control_handle.shutdown();
1152 }
1153 self.drop_without_shutdown();
1154 _result
1155 }
1156
1157 pub fn send_no_shutdown_on_err(
1159 self,
1160 mut payload: &ControllerGetVmoReferencesResponse,
1161 ) -> Result<(), fidl::Error> {
1162 let _result = self.send_raw(payload);
1163 self.drop_without_shutdown();
1164 _result
1165 }
1166
1167 fn send_raw(
1168 &self,
1169 mut payload: &ControllerGetVmoReferencesResponse,
1170 ) -> Result<(), fidl::Error> {
1171 self.control_handle
1172 .inner
1173 .send::<fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>>(
1174 fidl::encoding::Flexible::new(payload),
1175 self.tx_id,
1176 0x47a7f039bb97f173,
1177 fidl::encoding::DynamicFlags::FLEXIBLE,
1178 )
1179 }
1180}
1181
1182#[must_use = "FIDL methods require a response to be sent"]
1183#[derive(Debug)]
1184pub struct ControllerGetJobHandleResponder {
1185 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1186 tx_id: u32,
1187}
1188
1189impl std::ops::Drop for ControllerGetJobHandleResponder {
1193 fn drop(&mut self) {
1194 self.control_handle.shutdown();
1195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1197 }
1198}
1199
1200impl fidl::endpoints::Responder for ControllerGetJobHandleResponder {
1201 type ControlHandle = ControllerControlHandle;
1202
1203 fn control_handle(&self) -> &ControllerControlHandle {
1204 &self.control_handle
1205 }
1206
1207 fn drop_without_shutdown(mut self) {
1208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1210 std::mem::forget(self);
1212 }
1213}
1214
1215impl ControllerGetJobHandleResponder {
1216 pub fn send(self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1220 let _result = self.send_raw(payload);
1221 if _result.is_err() {
1222 self.control_handle.shutdown();
1223 }
1224 self.drop_without_shutdown();
1225 _result
1226 }
1227
1228 pub fn send_no_shutdown_on_err(
1230 self,
1231 mut payload: ControllerGetJobHandleResponse,
1232 ) -> Result<(), fidl::Error> {
1233 let _result = self.send_raw(payload);
1234 self.drop_without_shutdown();
1235 _result
1236 }
1237
1238 fn send_raw(&self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1239 self.control_handle
1240 .inner
1241 .send::<fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>>(
1242 fidl::encoding::Flexible::new(&mut payload),
1243 self.tx_id,
1244 0x60a31a248576ffea,
1245 fidl::encoding::DynamicFlags::FLEXIBLE,
1246 )
1247 }
1248}
1249
1250#[must_use = "FIDL methods require a response to be sent"]
1251#[derive(Debug)]
1252pub struct ControllerSendSignalResponder {
1253 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1254 tx_id: u32,
1255}
1256
1257impl std::ops::Drop for ControllerSendSignalResponder {
1261 fn drop(&mut self) {
1262 self.control_handle.shutdown();
1263 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1265 }
1266}
1267
1268impl fidl::endpoints::Responder for ControllerSendSignalResponder {
1269 type ControlHandle = ControllerControlHandle;
1270
1271 fn control_handle(&self) -> &ControllerControlHandle {
1272 &self.control_handle
1273 }
1274
1275 fn drop_without_shutdown(mut self) {
1276 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1278 std::mem::forget(self);
1280 }
1281}
1282
1283impl ControllerSendSignalResponder {
1284 pub fn send(self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1288 let _result = self.send_raw(result);
1289 if _result.is_err() {
1290 self.control_handle.shutdown();
1291 }
1292 self.drop_without_shutdown();
1293 _result
1294 }
1295
1296 pub fn send_no_shutdown_on_err(
1298 self,
1299 mut result: Result<(), SignalError>,
1300 ) -> Result<(), fidl::Error> {
1301 let _result = self.send_raw(result);
1302 self.drop_without_shutdown();
1303 _result
1304 }
1305
1306 fn send_raw(&self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1307 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1308 fidl::encoding::EmptyStruct,
1309 SignalError,
1310 >>(
1311 fidl::encoding::FlexibleResult::new(result),
1312 self.tx_id,
1313 0x253b1a0d3b9639e3,
1314 fidl::encoding::DynamicFlags::FLEXIBLE,
1315 )
1316 }
1317}
1318
1319#[must_use = "FIDL methods require a response to be sent"]
1320#[derive(Debug)]
1321pub struct ControllerSetSyscallLogFilterResponder {
1322 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1323 tx_id: u32,
1324}
1325
1326impl std::ops::Drop for ControllerSetSyscallLogFilterResponder {
1330 fn drop(&mut self) {
1331 self.control_handle.shutdown();
1332 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1334 }
1335}
1336
1337impl fidl::endpoints::Responder for ControllerSetSyscallLogFilterResponder {
1338 type ControlHandle = ControllerControlHandle;
1339
1340 fn control_handle(&self) -> &ControllerControlHandle {
1341 &self.control_handle
1342 }
1343
1344 fn drop_without_shutdown(mut self) {
1345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1347 std::mem::forget(self);
1349 }
1350}
1351
1352impl ControllerSetSyscallLogFilterResponder {
1353 pub fn send(self, mut result: Result<(), SetSyscallLogFilterError>) -> Result<(), fidl::Error> {
1357 let _result = self.send_raw(result);
1358 if _result.is_err() {
1359 self.control_handle.shutdown();
1360 }
1361 self.drop_without_shutdown();
1362 _result
1363 }
1364
1365 pub fn send_no_shutdown_on_err(
1367 self,
1368 mut result: Result<(), SetSyscallLogFilterError>,
1369 ) -> Result<(), fidl::Error> {
1370 let _result = self.send_raw(result);
1371 self.drop_without_shutdown();
1372 _result
1373 }
1374
1375 fn send_raw(
1376 &self,
1377 mut result: Result<(), SetSyscallLogFilterError>,
1378 ) -> Result<(), fidl::Error> {
1379 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1380 fidl::encoding::EmptyStruct,
1381 SetSyscallLogFilterError,
1382 >>(
1383 fidl::encoding::FlexibleResult::new(result),
1384 self.tx_id,
1385 0x2d2a49963abdee9b,
1386 fidl::encoding::DynamicFlags::FLEXIBLE,
1387 )
1388 }
1389}
1390
1391#[must_use = "FIDL methods require a response to be sent"]
1392#[derive(Debug)]
1393pub struct ControllerClearSyscallLogFiltersResponder {
1394 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1395 tx_id: u32,
1396}
1397
1398impl std::ops::Drop for ControllerClearSyscallLogFiltersResponder {
1402 fn drop(&mut self) {
1403 self.control_handle.shutdown();
1404 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1406 }
1407}
1408
1409impl fidl::endpoints::Responder for ControllerClearSyscallLogFiltersResponder {
1410 type ControlHandle = ControllerControlHandle;
1411
1412 fn control_handle(&self) -> &ControllerControlHandle {
1413 &self.control_handle
1414 }
1415
1416 fn drop_without_shutdown(mut self) {
1417 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1419 std::mem::forget(self);
1421 }
1422}
1423
1424impl ControllerClearSyscallLogFiltersResponder {
1425 pub fn send(self) -> Result<(), fidl::Error> {
1429 let _result = self.send_raw();
1430 if _result.is_err() {
1431 self.control_handle.shutdown();
1432 }
1433 self.drop_without_shutdown();
1434 _result
1435 }
1436
1437 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1439 let _result = self.send_raw();
1440 self.drop_without_shutdown();
1441 _result
1442 }
1443
1444 fn send_raw(&self) -> Result<(), fidl::Error> {
1445 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1446 fidl::encoding::Flexible::new(()),
1447 self.tx_id,
1448 0xd3ee36073fdfdf0,
1449 fidl::encoding::DynamicFlags::FLEXIBLE,
1450 )
1451 }
1452}
1453
1454mod internal {
1455 use super::*;
1456
1457 impl ControllerSpawnConsoleRequest {
1458 #[inline(always)]
1459 fn max_ordinal_present(&self) -> u64 {
1460 if let Some(_) = self.window_size {
1461 return 6;
1462 }
1463 if let Some(_) = self.environ {
1464 return 5;
1465 }
1466 if let Some(_) = self.argv {
1467 return 4;
1468 }
1469 if let Some(_) = self.binary_path {
1470 return 3;
1471 }
1472 if let Some(_) = self.console_out {
1473 return 2;
1474 }
1475 if let Some(_) = self.console_in {
1476 return 1;
1477 }
1478 0
1479 }
1480 }
1481
1482 impl fidl::encoding::ResourceTypeMarker for ControllerSpawnConsoleRequest {
1483 type Borrowed<'a> = &'a mut Self;
1484 fn take_or_borrow<'a>(
1485 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1486 ) -> Self::Borrowed<'a> {
1487 value
1488 }
1489 }
1490
1491 unsafe impl fidl::encoding::TypeMarker for ControllerSpawnConsoleRequest {
1492 type Owned = Self;
1493
1494 #[inline(always)]
1495 fn inline_align(_context: fidl::encoding::Context) -> usize {
1496 8
1497 }
1498
1499 #[inline(always)]
1500 fn inline_size(_context: fidl::encoding::Context) -> usize {
1501 16
1502 }
1503 }
1504
1505 unsafe impl
1506 fidl::encoding::Encode<
1507 ControllerSpawnConsoleRequest,
1508 fidl::encoding::DefaultFuchsiaResourceDialect,
1509 > for &mut ControllerSpawnConsoleRequest
1510 {
1511 unsafe fn encode(
1512 self,
1513 encoder: &mut fidl::encoding::Encoder<
1514 '_,
1515 fidl::encoding::DefaultFuchsiaResourceDialect,
1516 >,
1517 offset: usize,
1518 mut depth: fidl::encoding::Depth,
1519 ) -> fidl::Result<()> {
1520 encoder.debug_check_bounds::<ControllerSpawnConsoleRequest>(offset);
1521 let max_ordinal: u64 = self.max_ordinal_present();
1523 encoder.write_num(max_ordinal, offset);
1524 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1525 if max_ordinal == 0 {
1527 return Ok(());
1528 }
1529 depth.increment()?;
1530 let envelope_size = 8;
1531 let bytes_len = max_ordinal as usize * envelope_size;
1532 #[allow(unused_variables)]
1533 let offset = encoder.out_of_line_offset(bytes_len);
1534 let mut _prev_end_offset: usize = 0;
1535 if 1 > max_ordinal {
1536 return Ok(());
1537 }
1538
1539 let cur_offset: usize = (1 - 1) * envelope_size;
1542
1543 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1545
1546 fidl::encoding::encode_in_envelope_optional::<
1551 fidl::encoding::HandleType<
1552 fidl::Socket,
1553 { fidl::ObjectType::SOCKET.into_raw() },
1554 2147483648,
1555 >,
1556 fidl::encoding::DefaultFuchsiaResourceDialect,
1557 >(
1558 self.console_in.as_mut().map(
1559 <fidl::encoding::HandleType<
1560 fidl::Socket,
1561 { fidl::ObjectType::SOCKET.into_raw() },
1562 2147483648,
1563 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1564 ),
1565 encoder,
1566 offset + cur_offset,
1567 depth,
1568 )?;
1569
1570 _prev_end_offset = cur_offset + envelope_size;
1571 if 2 > max_ordinal {
1572 return Ok(());
1573 }
1574
1575 let cur_offset: usize = (2 - 1) * envelope_size;
1578
1579 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1581
1582 fidl::encoding::encode_in_envelope_optional::<
1587 fidl::encoding::HandleType<
1588 fidl::Socket,
1589 { fidl::ObjectType::SOCKET.into_raw() },
1590 2147483648,
1591 >,
1592 fidl::encoding::DefaultFuchsiaResourceDialect,
1593 >(
1594 self.console_out.as_mut().map(
1595 <fidl::encoding::HandleType<
1596 fidl::Socket,
1597 { fidl::ObjectType::SOCKET.into_raw() },
1598 2147483648,
1599 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1600 ),
1601 encoder,
1602 offset + cur_offset,
1603 depth,
1604 )?;
1605
1606 _prev_end_offset = cur_offset + envelope_size;
1607 if 3 > max_ordinal {
1608 return Ok(());
1609 }
1610
1611 let cur_offset: usize = (3 - 1) * envelope_size;
1614
1615 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1617
1618 fidl::encoding::encode_in_envelope_optional::<
1623 fidl::encoding::UnboundedString,
1624 fidl::encoding::DefaultFuchsiaResourceDialect,
1625 >(
1626 self.binary_path.as_ref().map(
1627 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1628 ),
1629 encoder,
1630 offset + cur_offset,
1631 depth,
1632 )?;
1633
1634 _prev_end_offset = cur_offset + envelope_size;
1635 if 4 > max_ordinal {
1636 return Ok(());
1637 }
1638
1639 let cur_offset: usize = (4 - 1) * envelope_size;
1642
1643 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1645
1646 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1651 self.argv.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1652 encoder, offset + cur_offset, depth
1653 )?;
1654
1655 _prev_end_offset = cur_offset + envelope_size;
1656 if 5 > max_ordinal {
1657 return Ok(());
1658 }
1659
1660 let cur_offset: usize = (5 - 1) * envelope_size;
1663
1664 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1666
1667 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1672 self.environ.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1673 encoder, offset + cur_offset, depth
1674 )?;
1675
1676 _prev_end_offset = cur_offset + envelope_size;
1677 if 6 > max_ordinal {
1678 return Ok(());
1679 }
1680
1681 let cur_offset: usize = (6 - 1) * envelope_size;
1684
1685 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1687
1688 fidl::encoding::encode_in_envelope_optional::<
1693 ConsoleWindowSize,
1694 fidl::encoding::DefaultFuchsiaResourceDialect,
1695 >(
1696 self.window_size
1697 .as_ref()
1698 .map(<ConsoleWindowSize as fidl::encoding::ValueTypeMarker>::borrow),
1699 encoder,
1700 offset + cur_offset,
1701 depth,
1702 )?;
1703
1704 _prev_end_offset = cur_offset + envelope_size;
1705
1706 Ok(())
1707 }
1708 }
1709
1710 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1711 for ControllerSpawnConsoleRequest
1712 {
1713 #[inline(always)]
1714 fn new_empty() -> Self {
1715 Self::default()
1716 }
1717
1718 unsafe fn decode(
1719 &mut self,
1720 decoder: &mut fidl::encoding::Decoder<
1721 '_,
1722 fidl::encoding::DefaultFuchsiaResourceDialect,
1723 >,
1724 offset: usize,
1725 mut depth: fidl::encoding::Depth,
1726 ) -> fidl::Result<()> {
1727 decoder.debug_check_bounds::<Self>(offset);
1728 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1729 None => return Err(fidl::Error::NotNullable),
1730 Some(len) => len,
1731 };
1732 if len == 0 {
1734 return Ok(());
1735 };
1736 depth.increment()?;
1737 let envelope_size = 8;
1738 let bytes_len = len * envelope_size;
1739 let offset = decoder.out_of_line_offset(bytes_len)?;
1740 let mut _next_ordinal_to_read = 0;
1742 let mut next_offset = offset;
1743 let end_offset = offset + bytes_len;
1744 _next_ordinal_to_read += 1;
1745 if next_offset >= end_offset {
1746 return Ok(());
1747 }
1748
1749 while _next_ordinal_to_read < 1 {
1751 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1752 _next_ordinal_to_read += 1;
1753 next_offset += envelope_size;
1754 }
1755
1756 let next_out_of_line = decoder.next_out_of_line();
1757 let handles_before = decoder.remaining_handles();
1758 if let Some((inlined, num_bytes, num_handles)) =
1759 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1760 {
1761 let member_inline_size = <fidl::encoding::HandleType<
1762 fidl::Socket,
1763 { fidl::ObjectType::SOCKET.into_raw() },
1764 2147483648,
1765 > as fidl::encoding::TypeMarker>::inline_size(
1766 decoder.context
1767 );
1768 if inlined != (member_inline_size <= 4) {
1769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1770 }
1771 let inner_offset;
1772 let mut inner_depth = depth.clone();
1773 if inlined {
1774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1775 inner_offset = next_offset;
1776 } else {
1777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1778 inner_depth.increment()?;
1779 }
1780 let val_ref =
1781 self.console_in.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1782 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1784 {
1785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1786 }
1787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1789 }
1790 }
1791
1792 next_offset += envelope_size;
1793 _next_ordinal_to_read += 1;
1794 if next_offset >= end_offset {
1795 return Ok(());
1796 }
1797
1798 while _next_ordinal_to_read < 2 {
1800 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1801 _next_ordinal_to_read += 1;
1802 next_offset += envelope_size;
1803 }
1804
1805 let next_out_of_line = decoder.next_out_of_line();
1806 let handles_before = decoder.remaining_handles();
1807 if let Some((inlined, num_bytes, num_handles)) =
1808 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1809 {
1810 let member_inline_size = <fidl::encoding::HandleType<
1811 fidl::Socket,
1812 { fidl::ObjectType::SOCKET.into_raw() },
1813 2147483648,
1814 > as fidl::encoding::TypeMarker>::inline_size(
1815 decoder.context
1816 );
1817 if inlined != (member_inline_size <= 4) {
1818 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1819 }
1820 let inner_offset;
1821 let mut inner_depth = depth.clone();
1822 if inlined {
1823 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1824 inner_offset = next_offset;
1825 } else {
1826 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1827 inner_depth.increment()?;
1828 }
1829 let val_ref =
1830 self.console_out.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1831 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1832 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1833 {
1834 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1835 }
1836 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1837 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1838 }
1839 }
1840
1841 next_offset += envelope_size;
1842 _next_ordinal_to_read += 1;
1843 if next_offset >= end_offset {
1844 return Ok(());
1845 }
1846
1847 while _next_ordinal_to_read < 3 {
1849 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1850 _next_ordinal_to_read += 1;
1851 next_offset += envelope_size;
1852 }
1853
1854 let next_out_of_line = decoder.next_out_of_line();
1855 let handles_before = decoder.remaining_handles();
1856 if let Some((inlined, num_bytes, num_handles)) =
1857 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1858 {
1859 let member_inline_size =
1860 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1861 decoder.context,
1862 );
1863 if inlined != (member_inline_size <= 4) {
1864 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1865 }
1866 let inner_offset;
1867 let mut inner_depth = depth.clone();
1868 if inlined {
1869 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1870 inner_offset = next_offset;
1871 } else {
1872 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1873 inner_depth.increment()?;
1874 }
1875 let val_ref = self.binary_path.get_or_insert_with(|| {
1876 fidl::new_empty!(
1877 fidl::encoding::UnboundedString,
1878 fidl::encoding::DefaultFuchsiaResourceDialect
1879 )
1880 });
1881 fidl::decode!(
1882 fidl::encoding::UnboundedString,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 val_ref,
1885 decoder,
1886 inner_offset,
1887 inner_depth
1888 )?;
1889 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1890 {
1891 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1892 }
1893 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1894 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1895 }
1896 }
1897
1898 next_offset += envelope_size;
1899 _next_ordinal_to_read += 1;
1900 if next_offset >= end_offset {
1901 return Ok(());
1902 }
1903
1904 while _next_ordinal_to_read < 4 {
1906 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1907 _next_ordinal_to_read += 1;
1908 next_offset += envelope_size;
1909 }
1910
1911 let next_out_of_line = decoder.next_out_of_line();
1912 let handles_before = decoder.remaining_handles();
1913 if let Some((inlined, num_bytes, num_handles)) =
1914 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1915 {
1916 let member_inline_size = <fidl::encoding::UnboundedVector<
1917 fidl::encoding::UnboundedString,
1918 > as fidl::encoding::TypeMarker>::inline_size(
1919 decoder.context
1920 );
1921 if inlined != (member_inline_size <= 4) {
1922 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1923 }
1924 let inner_offset;
1925 let mut inner_depth = depth.clone();
1926 if inlined {
1927 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1928 inner_offset = next_offset;
1929 } else {
1930 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1931 inner_depth.increment()?;
1932 }
1933 let val_ref = self.argv.get_or_insert_with(|| {
1934 fidl::new_empty!(
1935 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1936 fidl::encoding::DefaultFuchsiaResourceDialect
1937 )
1938 });
1939 fidl::decode!(
1940 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1941 fidl::encoding::DefaultFuchsiaResourceDialect,
1942 val_ref,
1943 decoder,
1944 inner_offset,
1945 inner_depth
1946 )?;
1947 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1948 {
1949 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1950 }
1951 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1952 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1953 }
1954 }
1955
1956 next_offset += envelope_size;
1957 _next_ordinal_to_read += 1;
1958 if next_offset >= end_offset {
1959 return Ok(());
1960 }
1961
1962 while _next_ordinal_to_read < 5 {
1964 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1965 _next_ordinal_to_read += 1;
1966 next_offset += envelope_size;
1967 }
1968
1969 let next_out_of_line = decoder.next_out_of_line();
1970 let handles_before = decoder.remaining_handles();
1971 if let Some((inlined, num_bytes, num_handles)) =
1972 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1973 {
1974 let member_inline_size = <fidl::encoding::UnboundedVector<
1975 fidl::encoding::UnboundedString,
1976 > as fidl::encoding::TypeMarker>::inline_size(
1977 decoder.context
1978 );
1979 if inlined != (member_inline_size <= 4) {
1980 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1981 }
1982 let inner_offset;
1983 let mut inner_depth = depth.clone();
1984 if inlined {
1985 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1986 inner_offset = next_offset;
1987 } else {
1988 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1989 inner_depth.increment()?;
1990 }
1991 let val_ref = self.environ.get_or_insert_with(|| {
1992 fidl::new_empty!(
1993 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1994 fidl::encoding::DefaultFuchsiaResourceDialect
1995 )
1996 });
1997 fidl::decode!(
1998 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1999 fidl::encoding::DefaultFuchsiaResourceDialect,
2000 val_ref,
2001 decoder,
2002 inner_offset,
2003 inner_depth
2004 )?;
2005 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2006 {
2007 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2008 }
2009 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2010 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2011 }
2012 }
2013
2014 next_offset += envelope_size;
2015 _next_ordinal_to_read += 1;
2016 if next_offset >= end_offset {
2017 return Ok(());
2018 }
2019
2020 while _next_ordinal_to_read < 6 {
2022 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2023 _next_ordinal_to_read += 1;
2024 next_offset += envelope_size;
2025 }
2026
2027 let next_out_of_line = decoder.next_out_of_line();
2028 let handles_before = decoder.remaining_handles();
2029 if let Some((inlined, num_bytes, num_handles)) =
2030 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2031 {
2032 let member_inline_size =
2033 <ConsoleWindowSize as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2034 if inlined != (member_inline_size <= 4) {
2035 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2036 }
2037 let inner_offset;
2038 let mut inner_depth = depth.clone();
2039 if inlined {
2040 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2041 inner_offset = next_offset;
2042 } else {
2043 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2044 inner_depth.increment()?;
2045 }
2046 let val_ref = self.window_size.get_or_insert_with(|| {
2047 fidl::new_empty!(
2048 ConsoleWindowSize,
2049 fidl::encoding::DefaultFuchsiaResourceDialect
2050 )
2051 });
2052 fidl::decode!(
2053 ConsoleWindowSize,
2054 fidl::encoding::DefaultFuchsiaResourceDialect,
2055 val_ref,
2056 decoder,
2057 inner_offset,
2058 inner_depth
2059 )?;
2060 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2061 {
2062 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2063 }
2064 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2065 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2066 }
2067 }
2068
2069 next_offset += envelope_size;
2070
2071 while next_offset < end_offset {
2073 _next_ordinal_to_read += 1;
2074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2075 next_offset += envelope_size;
2076 }
2077
2078 Ok(())
2079 }
2080 }
2081
2082 impl ControllerVsockConnectRequest {
2083 #[inline(always)]
2084 fn max_ordinal_present(&self) -> u64 {
2085 if let Some(_) = self.bridge_socket {
2086 return 2;
2087 }
2088 if let Some(_) = self.port {
2089 return 1;
2090 }
2091 0
2092 }
2093 }
2094
2095 impl fidl::encoding::ResourceTypeMarker for ControllerVsockConnectRequest {
2096 type Borrowed<'a> = &'a mut Self;
2097 fn take_or_borrow<'a>(
2098 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2099 ) -> Self::Borrowed<'a> {
2100 value
2101 }
2102 }
2103
2104 unsafe impl fidl::encoding::TypeMarker for ControllerVsockConnectRequest {
2105 type Owned = Self;
2106
2107 #[inline(always)]
2108 fn inline_align(_context: fidl::encoding::Context) -> usize {
2109 8
2110 }
2111
2112 #[inline(always)]
2113 fn inline_size(_context: fidl::encoding::Context) -> usize {
2114 16
2115 }
2116 }
2117
2118 unsafe impl
2119 fidl::encoding::Encode<
2120 ControllerVsockConnectRequest,
2121 fidl::encoding::DefaultFuchsiaResourceDialect,
2122 > for &mut ControllerVsockConnectRequest
2123 {
2124 unsafe fn encode(
2125 self,
2126 encoder: &mut fidl::encoding::Encoder<
2127 '_,
2128 fidl::encoding::DefaultFuchsiaResourceDialect,
2129 >,
2130 offset: usize,
2131 mut depth: fidl::encoding::Depth,
2132 ) -> fidl::Result<()> {
2133 encoder.debug_check_bounds::<ControllerVsockConnectRequest>(offset);
2134 let max_ordinal: u64 = self.max_ordinal_present();
2136 encoder.write_num(max_ordinal, offset);
2137 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2138 if max_ordinal == 0 {
2140 return Ok(());
2141 }
2142 depth.increment()?;
2143 let envelope_size = 8;
2144 let bytes_len = max_ordinal as usize * envelope_size;
2145 #[allow(unused_variables)]
2146 let offset = encoder.out_of_line_offset(bytes_len);
2147 let mut _prev_end_offset: usize = 0;
2148 if 1 > max_ordinal {
2149 return Ok(());
2150 }
2151
2152 let cur_offset: usize = (1 - 1) * envelope_size;
2155
2156 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2158
2159 fidl::encoding::encode_in_envelope_optional::<
2164 u32,
2165 fidl::encoding::DefaultFuchsiaResourceDialect,
2166 >(
2167 self.port.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2168 encoder,
2169 offset + cur_offset,
2170 depth,
2171 )?;
2172
2173 _prev_end_offset = cur_offset + envelope_size;
2174 if 2 > max_ordinal {
2175 return Ok(());
2176 }
2177
2178 let cur_offset: usize = (2 - 1) * envelope_size;
2181
2182 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2184
2185 fidl::encoding::encode_in_envelope_optional::<
2190 fidl::encoding::HandleType<
2191 fidl::Socket,
2192 { fidl::ObjectType::SOCKET.into_raw() },
2193 2147483648,
2194 >,
2195 fidl::encoding::DefaultFuchsiaResourceDialect,
2196 >(
2197 self.bridge_socket.as_mut().map(
2198 <fidl::encoding::HandleType<
2199 fidl::Socket,
2200 { fidl::ObjectType::SOCKET.into_raw() },
2201 2147483648,
2202 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2203 ),
2204 encoder,
2205 offset + cur_offset,
2206 depth,
2207 )?;
2208
2209 _prev_end_offset = cur_offset + envelope_size;
2210
2211 Ok(())
2212 }
2213 }
2214
2215 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2216 for ControllerVsockConnectRequest
2217 {
2218 #[inline(always)]
2219 fn new_empty() -> Self {
2220 Self::default()
2221 }
2222
2223 unsafe fn decode(
2224 &mut self,
2225 decoder: &mut fidl::encoding::Decoder<
2226 '_,
2227 fidl::encoding::DefaultFuchsiaResourceDialect,
2228 >,
2229 offset: usize,
2230 mut depth: fidl::encoding::Depth,
2231 ) -> fidl::Result<()> {
2232 decoder.debug_check_bounds::<Self>(offset);
2233 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2234 None => return Err(fidl::Error::NotNullable),
2235 Some(len) => len,
2236 };
2237 if len == 0 {
2239 return Ok(());
2240 };
2241 depth.increment()?;
2242 let envelope_size = 8;
2243 let bytes_len = len * envelope_size;
2244 let offset = decoder.out_of_line_offset(bytes_len)?;
2245 let mut _next_ordinal_to_read = 0;
2247 let mut next_offset = offset;
2248 let end_offset = offset + bytes_len;
2249 _next_ordinal_to_read += 1;
2250 if next_offset >= end_offset {
2251 return Ok(());
2252 }
2253
2254 while _next_ordinal_to_read < 1 {
2256 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2257 _next_ordinal_to_read += 1;
2258 next_offset += envelope_size;
2259 }
2260
2261 let next_out_of_line = decoder.next_out_of_line();
2262 let handles_before = decoder.remaining_handles();
2263 if let Some((inlined, num_bytes, num_handles)) =
2264 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2265 {
2266 let member_inline_size =
2267 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2268 if inlined != (member_inline_size <= 4) {
2269 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2270 }
2271 let inner_offset;
2272 let mut inner_depth = depth.clone();
2273 if inlined {
2274 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2275 inner_offset = next_offset;
2276 } else {
2277 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2278 inner_depth.increment()?;
2279 }
2280 let val_ref = self.port.get_or_insert_with(|| {
2281 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2282 });
2283 fidl::decode!(
2284 u32,
2285 fidl::encoding::DefaultFuchsiaResourceDialect,
2286 val_ref,
2287 decoder,
2288 inner_offset,
2289 inner_depth
2290 )?;
2291 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2292 {
2293 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2294 }
2295 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2296 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2297 }
2298 }
2299
2300 next_offset += envelope_size;
2301 _next_ordinal_to_read += 1;
2302 if next_offset >= end_offset {
2303 return Ok(());
2304 }
2305
2306 while _next_ordinal_to_read < 2 {
2308 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2309 _next_ordinal_to_read += 1;
2310 next_offset += envelope_size;
2311 }
2312
2313 let next_out_of_line = decoder.next_out_of_line();
2314 let handles_before = decoder.remaining_handles();
2315 if let Some((inlined, num_bytes, num_handles)) =
2316 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2317 {
2318 let member_inline_size = <fidl::encoding::HandleType<
2319 fidl::Socket,
2320 { fidl::ObjectType::SOCKET.into_raw() },
2321 2147483648,
2322 > as fidl::encoding::TypeMarker>::inline_size(
2323 decoder.context
2324 );
2325 if inlined != (member_inline_size <= 4) {
2326 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2327 }
2328 let inner_offset;
2329 let mut inner_depth = depth.clone();
2330 if inlined {
2331 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2332 inner_offset = next_offset;
2333 } else {
2334 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2335 inner_depth.increment()?;
2336 }
2337 let val_ref =
2338 self.bridge_socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2339 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2340 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2341 {
2342 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2343 }
2344 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2345 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2346 }
2347 }
2348
2349 next_offset += envelope_size;
2350
2351 while next_offset < end_offset {
2353 _next_ordinal_to_read += 1;
2354 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2355 next_offset += envelope_size;
2356 }
2357
2358 Ok(())
2359 }
2360 }
2361
2362 impl ControllerGetJobHandleResponse {
2363 #[inline(always)]
2364 fn max_ordinal_present(&self) -> u64 {
2365 if let Some(_) = self.job {
2366 return 1;
2367 }
2368 0
2369 }
2370 }
2371
2372 impl fidl::encoding::ResourceTypeMarker for ControllerGetJobHandleResponse {
2373 type Borrowed<'a> = &'a mut Self;
2374 fn take_or_borrow<'a>(
2375 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2376 ) -> Self::Borrowed<'a> {
2377 value
2378 }
2379 }
2380
2381 unsafe impl fidl::encoding::TypeMarker for ControllerGetJobHandleResponse {
2382 type Owned = Self;
2383
2384 #[inline(always)]
2385 fn inline_align(_context: fidl::encoding::Context) -> usize {
2386 8
2387 }
2388
2389 #[inline(always)]
2390 fn inline_size(_context: fidl::encoding::Context) -> usize {
2391 16
2392 }
2393 }
2394
2395 unsafe impl
2396 fidl::encoding::Encode<
2397 ControllerGetJobHandleResponse,
2398 fidl::encoding::DefaultFuchsiaResourceDialect,
2399 > for &mut ControllerGetJobHandleResponse
2400 {
2401 unsafe fn encode(
2402 self,
2403 encoder: &mut fidl::encoding::Encoder<
2404 '_,
2405 fidl::encoding::DefaultFuchsiaResourceDialect,
2406 >,
2407 offset: usize,
2408 mut depth: fidl::encoding::Depth,
2409 ) -> fidl::Result<()> {
2410 encoder.debug_check_bounds::<ControllerGetJobHandleResponse>(offset);
2411 let max_ordinal: u64 = self.max_ordinal_present();
2413 encoder.write_num(max_ordinal, offset);
2414 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2415 if max_ordinal == 0 {
2417 return Ok(());
2418 }
2419 depth.increment()?;
2420 let envelope_size = 8;
2421 let bytes_len = max_ordinal as usize * envelope_size;
2422 #[allow(unused_variables)]
2423 let offset = encoder.out_of_line_offset(bytes_len);
2424 let mut _prev_end_offset: usize = 0;
2425 if 1 > max_ordinal {
2426 return Ok(());
2427 }
2428
2429 let cur_offset: usize = (1 - 1) * envelope_size;
2432
2433 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2435
2436 fidl::encoding::encode_in_envelope_optional::<
2441 fidl::encoding::HandleType<
2442 fidl::Job,
2443 { fidl::ObjectType::JOB.into_raw() },
2444 2147483648,
2445 >,
2446 fidl::encoding::DefaultFuchsiaResourceDialect,
2447 >(
2448 self.job.as_mut().map(
2449 <fidl::encoding::HandleType<
2450 fidl::Job,
2451 { fidl::ObjectType::JOB.into_raw() },
2452 2147483648,
2453 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2454 ),
2455 encoder,
2456 offset + cur_offset,
2457 depth,
2458 )?;
2459
2460 _prev_end_offset = cur_offset + envelope_size;
2461
2462 Ok(())
2463 }
2464 }
2465
2466 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2467 for ControllerGetJobHandleResponse
2468 {
2469 #[inline(always)]
2470 fn new_empty() -> Self {
2471 Self::default()
2472 }
2473
2474 unsafe fn decode(
2475 &mut self,
2476 decoder: &mut fidl::encoding::Decoder<
2477 '_,
2478 fidl::encoding::DefaultFuchsiaResourceDialect,
2479 >,
2480 offset: usize,
2481 mut depth: fidl::encoding::Depth,
2482 ) -> fidl::Result<()> {
2483 decoder.debug_check_bounds::<Self>(offset);
2484 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2485 None => return Err(fidl::Error::NotNullable),
2486 Some(len) => len,
2487 };
2488 if len == 0 {
2490 return Ok(());
2491 };
2492 depth.increment()?;
2493 let envelope_size = 8;
2494 let bytes_len = len * envelope_size;
2495 let offset = decoder.out_of_line_offset(bytes_len)?;
2496 let mut _next_ordinal_to_read = 0;
2498 let mut next_offset = offset;
2499 let end_offset = offset + bytes_len;
2500 _next_ordinal_to_read += 1;
2501 if next_offset >= end_offset {
2502 return Ok(());
2503 }
2504
2505 while _next_ordinal_to_read < 1 {
2507 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2508 _next_ordinal_to_read += 1;
2509 next_offset += envelope_size;
2510 }
2511
2512 let next_out_of_line = decoder.next_out_of_line();
2513 let handles_before = decoder.remaining_handles();
2514 if let Some((inlined, num_bytes, num_handles)) =
2515 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2516 {
2517 let member_inline_size = <fidl::encoding::HandleType<
2518 fidl::Job,
2519 { fidl::ObjectType::JOB.into_raw() },
2520 2147483648,
2521 > as fidl::encoding::TypeMarker>::inline_size(
2522 decoder.context
2523 );
2524 if inlined != (member_inline_size <= 4) {
2525 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2526 }
2527 let inner_offset;
2528 let mut inner_depth = depth.clone();
2529 if inlined {
2530 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2531 inner_offset = next_offset;
2532 } else {
2533 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2534 inner_depth.increment()?;
2535 }
2536 let val_ref =
2537 self.job.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2538 fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2539 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2540 {
2541 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2542 }
2543 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2544 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2545 }
2546 }
2547
2548 next_offset += envelope_size;
2549
2550 while next_offset < end_offset {
2552 _next_ordinal_to_read += 1;
2553 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2554 next_offset += envelope_size;
2555 }
2556
2557 Ok(())
2558 }
2559 }
2560}