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