Skip to main content

fidl_fuchsia_virtualization/
fidl_fuchsia_virtualization.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_virtualization__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14/// Properties describing a block device.
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct BlockSpec {
17    /// The ID used to identify the block device.
18    pub id: String,
19    /// The access mode for the block device.
20    pub mode: BlockMode,
21    /// The data format of the block device.
22    pub format: BlockFormat,
23}
24
25impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct GuestGetBalloonControllerRequest {
29    pub controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for GuestGetBalloonControllerRequest
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct GuestGetHostVsockEndpointRequest {
39    pub endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for GuestGetHostVsockEndpointRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct GuestGetMemControllerRequest {
49    pub controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for GuestGetMemControllerRequest
54{
55}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct GuestGetSerialResponse {
59    pub socket: fidl::Socket,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestGetSerialResponse {}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct GuestLifecycleBindRequest {
66    pub guest: fidl::endpoints::ServerEnd<GuestMarker>,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestLifecycleBindRequest {}
70
71#[derive(Debug, PartialEq)]
72pub struct GuestLifecycleCreateRequest {
73    pub guest_config: GuestConfig,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
77    for GuestLifecycleCreateRequest
78{
79}
80
81#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82pub struct GuestManagerConnectRequest {
83    pub controller: fidl::endpoints::ServerEnd<GuestMarker>,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
87    for GuestManagerConnectRequest
88{
89}
90
91#[derive(Debug, PartialEq)]
92pub struct GuestManagerGetInfoResponse {
93    pub guest_info: GuestInfo,
94}
95
96impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
97    for GuestManagerGetInfoResponse
98{
99}
100
101#[derive(Debug, PartialEq)]
102pub struct GuestManagerLaunchRequest {
103    pub guest_config: GuestConfig,
104    pub controller: fidl::endpoints::ServerEnd<GuestMarker>,
105}
106
107impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestManagerLaunchRequest {}
108
109#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110pub struct GuestGetConsoleResponse {
111    pub socket: fidl::Socket,
112}
113
114impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestGetConsoleResponse {}
115
116#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
117pub struct HostVsockAcceptorAcceptResponse {
118    pub socket: fidl::Socket,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
122    for HostVsockAcceptorAcceptResponse
123{
124}
125
126#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
127pub struct HostVsockEndpointConnectResponse {
128    pub socket: fidl::Socket,
129}
130
131impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
132    for HostVsockEndpointConnectResponse
133{
134}
135
136#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
137pub struct Listener {
138    pub port: u32,
139    pub acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
140}
141
142impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {}
143
144/// The configuration required to start up a guest. When adding a new field, consider updating
145/// fuchsia.virtualization.GuestDescriptor which is an informational snapshot of this table.
146#[derive(Debug, Default, PartialEq)]
147pub struct GuestConfig {
148    /// Type of kernel to load. Cannot be changed from the command-line.
149    pub kernel_type: Option<KernelType>,
150    /// File to load the kernel from. Cannot be changed from the command-line.
151    pub kernel: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
152    /// File to load the initial RAM disk from. Cannot be changed from the
153    /// command-line.
154    pub ramdisk: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
155    /// File to load the dtb overlay for a Linux kernel from. Cannot be changed
156    /// from the command-line.
157    pub dtb_overlay: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
158    /// Kernel command-line to use. Cannot be changed from the command-line.
159    pub cmdline: Option<String>,
160    /// Additional kernel command-lines to append to the main command-line.
161    pub cmdline_add: Option<Vec<String>>,
162    /// The number of CPUs to provide to a guest.
163    pub cpus: Option<u8>,
164    /// Amount of guest memory required, in bytes. This value may be rounded up depending on
165    /// the system configuration.
166    pub guest_memory: Option<u64>,
167    /// A list of block devices to give a guest. Cannot be changed from the
168    /// command-line.
169    pub block_devices: Option<Vec<BlockSpec>>,
170    /// A list of specifications for network devices.
171    pub net_devices: Option<Vec<NetSpec>>,
172    /// "11: wayland_device WaylandDevice" was removed
173    /// "12: magma_device MagmaDevice" was removed
174    /// Whether to add a default network device.
175    pub default_net: Option<bool>,
176    /// Enable virtio-balloon.
177    pub virtio_balloon: Option<bool>,
178    /// Enable virtio-console.
179    pub virtio_console: Option<bool>,
180    /// Enable virtio-gpu.
181    pub virtio_gpu: Option<bool>,
182    /// Enable virtio-rng.
183    pub virtio_rng: Option<bool>,
184    /// Enable virtio-vsock.
185    pub virtio_vsock: Option<bool>,
186    /// Enable virtio-sound.
187    pub virtio_sound: Option<bool>,
188    /// Enable input streams (capture) for virtio-sound.
189    pub virtio_sound_input: Option<bool>,
190    /// Host ports to listen for guest initiated vsock connections on. This can be used for
191    /// simplicity if a Listener is known at config creation time, or if a Listener must be
192    /// available at the moment of guest creation for timing reasons.
193    ///
194    /// To add a Listener after a guest starts, see HostVsockEndpoint::Listen.
195    pub vsock_listeners: Option<Vec<Listener>>,
196    /// Enable virtio-mem
197    pub virtio_mem: Option<bool>,
198    /// Size of the dynamically (un)pluggable memory block.
199    /// Memory can be (un)plugged at this granularity.
200    /// Smaller block size increases changes of successful unplug at the cost of increasing
201    /// the size of tracking bitmap.
202    pub virtio_mem_block_size: Option<u64>,
203    /// Size of the entire dynamically pluggable memory region
204    pub virtio_mem_region_size: Option<u64>,
205    /// Required alignment of the dynamically pluggable memory region
206    pub virtio_mem_region_alignment: Option<u64>,
207    #[doc(hidden)]
208    pub __source_breaking: fidl::marker::SourceBreaking,
209}
210
211impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {}
212
213#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
214pub enum BlockFormat {
215    /// File IO. All reads and writes go directly to disk as a flat file.
216    File(fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>),
217    /// QCOW image. All reads and writes go to a QCOW image.
218    Qcow(fidl::Channel),
219    /// Block IO. All reads and writes go to a block server.
220    Block(fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>),
221}
222
223impl BlockFormat {
224    #[inline]
225    pub fn ordinal(&self) -> u64 {
226        match *self {
227            Self::File(_) => 1,
228            Self::Qcow(_) => 2,
229            Self::Block(_) => 3,
230        }
231    }
232}
233
234impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {}
235
236#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
237pub struct AndroidGuestManagerMarker;
238
239impl fidl::endpoints::ProtocolMarker for AndroidGuestManagerMarker {
240    type Proxy = AndroidGuestManagerProxy;
241    type RequestStream = AndroidGuestManagerRequestStream;
242    #[cfg(target_os = "fuchsia")]
243    type SynchronousProxy = AndroidGuestManagerSynchronousProxy;
244
245    const DEBUG_NAME: &'static str = "fuchsia.virtualization.AndroidGuestManager";
246}
247impl fidl::endpoints::DiscoverableProtocolMarker for AndroidGuestManagerMarker {}
248
249pub trait AndroidGuestManagerProxyInterface: Send + Sync {
250    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
251        + Send;
252    fn r#launch(
253        &self,
254        guest_config: GuestConfig,
255        controller: fidl::endpoints::ServerEnd<GuestMarker>,
256    ) -> Self::LaunchResponseFut;
257    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
258    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
259    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
260        + Send;
261    fn r#connect(
262        &self,
263        controller: fidl::endpoints::ServerEnd<GuestMarker>,
264    ) -> Self::ConnectResponseFut;
265    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
266    fn r#get_info(&self) -> Self::GetInfoResponseFut;
267}
268#[derive(Debug)]
269#[cfg(target_os = "fuchsia")]
270pub struct AndroidGuestManagerSynchronousProxy {
271    client: fidl::client::sync::Client,
272}
273
274#[cfg(target_os = "fuchsia")]
275impl fidl::endpoints::SynchronousProxy for AndroidGuestManagerSynchronousProxy {
276    type Proxy = AndroidGuestManagerProxy;
277    type Protocol = AndroidGuestManagerMarker;
278
279    fn from_channel(inner: fidl::Channel) -> Self {
280        Self::new(inner)
281    }
282
283    fn into_channel(self) -> fidl::Channel {
284        self.client.into_channel()
285    }
286
287    fn as_channel(&self) -> &fidl::Channel {
288        self.client.as_channel()
289    }
290}
291
292#[cfg(target_os = "fuchsia")]
293impl AndroidGuestManagerSynchronousProxy {
294    pub fn new(channel: fidl::Channel) -> Self {
295        Self { client: fidl::client::sync::Client::new(channel) }
296    }
297
298    pub fn into_channel(self) -> fidl::Channel {
299        self.client.into_channel()
300    }
301
302    /// Waits until an event arrives and returns it. It is safe for other
303    /// threads to make concurrent requests while waiting for an event.
304    pub fn wait_for_event(
305        &self,
306        deadline: zx::MonotonicInstant,
307    ) -> Result<AndroidGuestManagerEvent, fidl::Error> {
308        AndroidGuestManagerEvent::decode(
309            self.client.wait_for_event::<AndroidGuestManagerMarker>(deadline)?,
310        )
311    }
312
313    /// Launch a new guest instance.
314    ///
315    /// Possible errors:
316    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
317    ///         problems detected by the guest manager.
318    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
319    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
320    ///         component logs for a more specific failure.
321    pub fn r#launch(
322        &self,
323        mut guest_config: GuestConfig,
324        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
325        ___deadline: zx::MonotonicInstant,
326    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
327        let _response =
328            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
329                fidl::encoding::EmptyStruct,
330                GuestManagerError,
331            >, AndroidGuestManagerMarker>(
332                (&mut guest_config, controller),
333                0x394a2e29f750323e,
334                fidl::encoding::DynamicFlags::empty(),
335                ___deadline,
336            )?;
337        Ok(_response.map(|x| x))
338    }
339
340    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
341    /// be used to launch another guest.
342    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
343        let _response = self.client.send_query::<
344            fidl::encoding::EmptyPayload,
345            fidl::encoding::EmptyPayload,
346            AndroidGuestManagerMarker,
347        >(
348            (),
349            0x3ad9a012982f872d,
350            fidl::encoding::DynamicFlags::empty(),
351            ___deadline,
352        )?;
353        Ok(_response)
354    }
355
356    /// Connect to a currently running guest.
357    ///
358    /// Possible errors:
359    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
360    ///         has launched before attempting to reconnect.
361    pub fn r#connect(
362        &self,
363        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
364        ___deadline: zx::MonotonicInstant,
365    ) -> Result<GuestManagerConnectResult, fidl::Error> {
366        let _response =
367            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
368                fidl::encoding::EmptyStruct,
369                GuestManagerError,
370            >, AndroidGuestManagerMarker>(
371                (controller,),
372                0x4e489076e3bb15b4,
373                fidl::encoding::DynamicFlags::empty(),
374                ___deadline,
375            )?;
376        Ok(_response.map(|x| x))
377    }
378
379    /// Query guest info
380    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
381        let _response = self.client.send_query::<
382            fidl::encoding::EmptyPayload,
383            GuestManagerGetInfoResponse,
384            AndroidGuestManagerMarker,
385        >(
386            (),
387            0x76892614aea695dc,
388            fidl::encoding::DynamicFlags::empty(),
389            ___deadline,
390        )?;
391        Ok(_response.guest_info)
392    }
393}
394
395#[cfg(target_os = "fuchsia")]
396impl From<AndroidGuestManagerSynchronousProxy> for zx::NullableHandle {
397    fn from(value: AndroidGuestManagerSynchronousProxy) -> Self {
398        value.into_channel().into()
399    }
400}
401
402#[cfg(target_os = "fuchsia")]
403impl From<fidl::Channel> for AndroidGuestManagerSynchronousProxy {
404    fn from(value: fidl::Channel) -> Self {
405        Self::new(value)
406    }
407}
408
409#[cfg(target_os = "fuchsia")]
410impl fidl::endpoints::FromClient for AndroidGuestManagerSynchronousProxy {
411    type Protocol = AndroidGuestManagerMarker;
412
413    fn from_client(value: fidl::endpoints::ClientEnd<AndroidGuestManagerMarker>) -> Self {
414        Self::new(value.into_channel())
415    }
416}
417
418#[derive(Debug, Clone)]
419pub struct AndroidGuestManagerProxy {
420    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
421}
422
423impl fidl::endpoints::Proxy for AndroidGuestManagerProxy {
424    type Protocol = AndroidGuestManagerMarker;
425
426    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
427        Self::new(inner)
428    }
429
430    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
431        self.client.into_channel().map_err(|client| Self { client })
432    }
433
434    fn as_channel(&self) -> &::fidl::AsyncChannel {
435        self.client.as_channel()
436    }
437}
438
439impl AndroidGuestManagerProxy {
440    /// Create a new Proxy for fuchsia.virtualization/AndroidGuestManager.
441    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
442        let protocol_name =
443            <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
444        Self { client: fidl::client::Client::new(channel, protocol_name) }
445    }
446
447    /// Get a Stream of events from the remote end of the protocol.
448    ///
449    /// # Panics
450    ///
451    /// Panics if the event stream was already taken.
452    pub fn take_event_stream(&self) -> AndroidGuestManagerEventStream {
453        AndroidGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
454    }
455
456    /// Launch a new guest instance.
457    ///
458    /// Possible errors:
459    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
460    ///         problems detected by the guest manager.
461    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
462    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
463    ///         component logs for a more specific failure.
464    pub fn r#launch(
465        &self,
466        mut guest_config: GuestConfig,
467        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
468    ) -> fidl::client::QueryResponseFut<
469        GuestManagerLaunchResult,
470        fidl::encoding::DefaultFuchsiaResourceDialect,
471    > {
472        AndroidGuestManagerProxyInterface::r#launch(self, guest_config, controller)
473    }
474
475    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
476    /// be used to launch another guest.
477    pub fn r#force_shutdown(
478        &self,
479    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
480        AndroidGuestManagerProxyInterface::r#force_shutdown(self)
481    }
482
483    /// Connect to a currently running guest.
484    ///
485    /// Possible errors:
486    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
487    ///         has launched before attempting to reconnect.
488    pub fn r#connect(
489        &self,
490        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
491    ) -> fidl::client::QueryResponseFut<
492        GuestManagerConnectResult,
493        fidl::encoding::DefaultFuchsiaResourceDialect,
494    > {
495        AndroidGuestManagerProxyInterface::r#connect(self, controller)
496    }
497
498    /// Query guest info
499    pub fn r#get_info(
500        &self,
501    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
502    {
503        AndroidGuestManagerProxyInterface::r#get_info(self)
504    }
505}
506
507impl AndroidGuestManagerProxyInterface for AndroidGuestManagerProxy {
508    type LaunchResponseFut = fidl::client::QueryResponseFut<
509        GuestManagerLaunchResult,
510        fidl::encoding::DefaultFuchsiaResourceDialect,
511    >;
512    fn r#launch(
513        &self,
514        mut guest_config: GuestConfig,
515        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
516    ) -> Self::LaunchResponseFut {
517        fn _decode(
518            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
519        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
520            let _response = fidl::client::decode_transaction_body::<
521                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
522                fidl::encoding::DefaultFuchsiaResourceDialect,
523                0x394a2e29f750323e,
524            >(_buf?)?;
525            Ok(_response.map(|x| x))
526        }
527        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
528            (&mut guest_config, controller),
529            0x394a2e29f750323e,
530            fidl::encoding::DynamicFlags::empty(),
531            _decode,
532        )
533    }
534
535    type ForceShutdownResponseFut =
536        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
537    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
538        fn _decode(
539            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
540        ) -> Result<(), fidl::Error> {
541            let _response = fidl::client::decode_transaction_body::<
542                fidl::encoding::EmptyPayload,
543                fidl::encoding::DefaultFuchsiaResourceDialect,
544                0x3ad9a012982f872d,
545            >(_buf?)?;
546            Ok(_response)
547        }
548        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
549            (),
550            0x3ad9a012982f872d,
551            fidl::encoding::DynamicFlags::empty(),
552            _decode,
553        )
554    }
555
556    type ConnectResponseFut = fidl::client::QueryResponseFut<
557        GuestManagerConnectResult,
558        fidl::encoding::DefaultFuchsiaResourceDialect,
559    >;
560    fn r#connect(
561        &self,
562        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
563    ) -> Self::ConnectResponseFut {
564        fn _decode(
565            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
566        ) -> Result<GuestManagerConnectResult, fidl::Error> {
567            let _response = fidl::client::decode_transaction_body::<
568                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
569                fidl::encoding::DefaultFuchsiaResourceDialect,
570                0x4e489076e3bb15b4,
571            >(_buf?)?;
572            Ok(_response.map(|x| x))
573        }
574        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
575            (controller,),
576            0x4e489076e3bb15b4,
577            fidl::encoding::DynamicFlags::empty(),
578            _decode,
579        )
580    }
581
582    type GetInfoResponseFut =
583        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
584    fn r#get_info(&self) -> Self::GetInfoResponseFut {
585        fn _decode(
586            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
587        ) -> Result<GuestInfo, fidl::Error> {
588            let _response = fidl::client::decode_transaction_body::<
589                GuestManagerGetInfoResponse,
590                fidl::encoding::DefaultFuchsiaResourceDialect,
591                0x76892614aea695dc,
592            >(_buf?)?;
593            Ok(_response.guest_info)
594        }
595        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
596            (),
597            0x76892614aea695dc,
598            fidl::encoding::DynamicFlags::empty(),
599            _decode,
600        )
601    }
602}
603
604pub struct AndroidGuestManagerEventStream {
605    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
606}
607
608impl std::marker::Unpin for AndroidGuestManagerEventStream {}
609
610impl futures::stream::FusedStream for AndroidGuestManagerEventStream {
611    fn is_terminated(&self) -> bool {
612        self.event_receiver.is_terminated()
613    }
614}
615
616impl futures::Stream for AndroidGuestManagerEventStream {
617    type Item = Result<AndroidGuestManagerEvent, fidl::Error>;
618
619    fn poll_next(
620        mut self: std::pin::Pin<&mut Self>,
621        cx: &mut std::task::Context<'_>,
622    ) -> std::task::Poll<Option<Self::Item>> {
623        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
624            &mut self.event_receiver,
625            cx
626        )?) {
627            Some(buf) => std::task::Poll::Ready(Some(AndroidGuestManagerEvent::decode(buf))),
628            None => std::task::Poll::Ready(None),
629        }
630    }
631}
632
633#[derive(Debug)]
634pub enum AndroidGuestManagerEvent {}
635
636impl AndroidGuestManagerEvent {
637    /// Decodes a message buffer as a [`AndroidGuestManagerEvent`].
638    fn decode(
639        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
640    ) -> Result<AndroidGuestManagerEvent, fidl::Error> {
641        let (bytes, _handles) = buf.split_mut();
642        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
643        debug_assert_eq!(tx_header.tx_id, 0);
644        match tx_header.ordinal {
645            _ => Err(fidl::Error::UnknownOrdinal {
646                ordinal: tx_header.ordinal,
647                protocol_name:
648                    <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
649            }),
650        }
651    }
652}
653
654/// A Stream of incoming requests for fuchsia.virtualization/AndroidGuestManager.
655pub struct AndroidGuestManagerRequestStream {
656    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
657    is_terminated: bool,
658}
659
660impl std::marker::Unpin for AndroidGuestManagerRequestStream {}
661
662impl futures::stream::FusedStream for AndroidGuestManagerRequestStream {
663    fn is_terminated(&self) -> bool {
664        self.is_terminated
665    }
666}
667
668impl fidl::endpoints::RequestStream for AndroidGuestManagerRequestStream {
669    type Protocol = AndroidGuestManagerMarker;
670    type ControlHandle = AndroidGuestManagerControlHandle;
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        AndroidGuestManagerControlHandle { 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 AndroidGuestManagerRequestStream {
696    type Item = Result<AndroidGuestManagerRequest, 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 AndroidGuestManagerRequestStream 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                // A message has been received from the channel
727                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
728
729                std::task::Poll::Ready(Some(match header.ordinal {
730                0x394a2e29f750323e => {
731                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
732                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
733                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
734                    let control_handle = AndroidGuestManagerControlHandle {
735                        inner: this.inner.clone(),
736                    };
737                    Ok(AndroidGuestManagerRequest::Launch {guest_config: req.guest_config,
738controller: req.controller,
739
740                        responder: AndroidGuestManagerLaunchResponder {
741                            control_handle: std::mem::ManuallyDrop::new(control_handle),
742                            tx_id: header.tx_id,
743                        },
744                    })
745                }
746                0x3ad9a012982f872d => {
747                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
748                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
749                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
750                    let control_handle = AndroidGuestManagerControlHandle {
751                        inner: this.inner.clone(),
752                    };
753                    Ok(AndroidGuestManagerRequest::ForceShutdown {
754                        responder: AndroidGuestManagerForceShutdownResponder {
755                            control_handle: std::mem::ManuallyDrop::new(control_handle),
756                            tx_id: header.tx_id,
757                        },
758                    })
759                }
760                0x4e489076e3bb15b4 => {
761                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
762                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
763                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
764                    let control_handle = AndroidGuestManagerControlHandle {
765                        inner: this.inner.clone(),
766                    };
767                    Ok(AndroidGuestManagerRequest::Connect {controller: req.controller,
768
769                        responder: AndroidGuestManagerConnectResponder {
770                            control_handle: std::mem::ManuallyDrop::new(control_handle),
771                            tx_id: header.tx_id,
772                        },
773                    })
774                }
775                0x76892614aea695dc => {
776                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
777                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
778                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
779                    let control_handle = AndroidGuestManagerControlHandle {
780                        inner: this.inner.clone(),
781                    };
782                    Ok(AndroidGuestManagerRequest::GetInfo {
783                        responder: AndroidGuestManagerGetInfoResponder {
784                            control_handle: std::mem::ManuallyDrop::new(control_handle),
785                            tx_id: header.tx_id,
786                        },
787                    })
788                }
789                _ => Err(fidl::Error::UnknownOrdinal {
790                    ordinal: header.ordinal,
791                    protocol_name: <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
792                }),
793            }))
794            },
795        )
796    }
797}
798
799#[derive(Debug)]
800pub enum AndroidGuestManagerRequest {
801    /// Launch a new guest instance.
802    ///
803    /// Possible errors:
804    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
805    ///         problems detected by the guest manager.
806    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
807    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
808    ///         component logs for a more specific failure.
809    Launch {
810        guest_config: GuestConfig,
811        controller: fidl::endpoints::ServerEnd<GuestMarker>,
812        responder: AndroidGuestManagerLaunchResponder,
813    },
814    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
815    /// be used to launch another guest.
816    ForceShutdown { responder: AndroidGuestManagerForceShutdownResponder },
817    /// Connect to a currently running guest.
818    ///
819    /// Possible errors:
820    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
821    ///         has launched before attempting to reconnect.
822    Connect {
823        controller: fidl::endpoints::ServerEnd<GuestMarker>,
824        responder: AndroidGuestManagerConnectResponder,
825    },
826    /// Query guest info
827    GetInfo { responder: AndroidGuestManagerGetInfoResponder },
828}
829
830impl AndroidGuestManagerRequest {
831    #[allow(irrefutable_let_patterns)]
832    pub fn into_launch(
833        self,
834    ) -> Option<(
835        GuestConfig,
836        fidl::endpoints::ServerEnd<GuestMarker>,
837        AndroidGuestManagerLaunchResponder,
838    )> {
839        if let AndroidGuestManagerRequest::Launch { guest_config, controller, responder } = self {
840            Some((guest_config, controller, responder))
841        } else {
842            None
843        }
844    }
845
846    #[allow(irrefutable_let_patterns)]
847    pub fn into_force_shutdown(self) -> Option<(AndroidGuestManagerForceShutdownResponder)> {
848        if let AndroidGuestManagerRequest::ForceShutdown { responder } = self {
849            Some((responder))
850        } else {
851            None
852        }
853    }
854
855    #[allow(irrefutable_let_patterns)]
856    pub fn into_connect(
857        self,
858    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, AndroidGuestManagerConnectResponder)>
859    {
860        if let AndroidGuestManagerRequest::Connect { controller, responder } = self {
861            Some((controller, responder))
862        } else {
863            None
864        }
865    }
866
867    #[allow(irrefutable_let_patterns)]
868    pub fn into_get_info(self) -> Option<(AndroidGuestManagerGetInfoResponder)> {
869        if let AndroidGuestManagerRequest::GetInfo { responder } = self {
870            Some((responder))
871        } else {
872            None
873        }
874    }
875
876    /// Name of the method defined in FIDL
877    pub fn method_name(&self) -> &'static str {
878        match *self {
879            AndroidGuestManagerRequest::Launch { .. } => "launch",
880            AndroidGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
881            AndroidGuestManagerRequest::Connect { .. } => "connect",
882            AndroidGuestManagerRequest::GetInfo { .. } => "get_info",
883        }
884    }
885}
886
887#[derive(Debug, Clone)]
888pub struct AndroidGuestManagerControlHandle {
889    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
890}
891
892impl fidl::endpoints::ControlHandle for AndroidGuestManagerControlHandle {
893    fn shutdown(&self) {
894        self.inner.shutdown()
895    }
896
897    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
898        self.inner.shutdown_with_epitaph(status)
899    }
900
901    fn is_closed(&self) -> bool {
902        self.inner.channel().is_closed()
903    }
904    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
905        self.inner.channel().on_closed()
906    }
907
908    #[cfg(target_os = "fuchsia")]
909    fn signal_peer(
910        &self,
911        clear_mask: zx::Signals,
912        set_mask: zx::Signals,
913    ) -> Result<(), zx_status::Status> {
914        use fidl::Peered;
915        self.inner.channel().signal_peer(clear_mask, set_mask)
916    }
917}
918
919impl AndroidGuestManagerControlHandle {}
920
921#[must_use = "FIDL methods require a response to be sent"]
922#[derive(Debug)]
923pub struct AndroidGuestManagerLaunchResponder {
924    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
925    tx_id: u32,
926}
927
928/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
929/// if the responder is dropped without sending a response, so that the client
930/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
931impl std::ops::Drop for AndroidGuestManagerLaunchResponder {
932    fn drop(&mut self) {
933        self.control_handle.shutdown();
934        // Safety: drops once, never accessed again
935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
936    }
937}
938
939impl fidl::endpoints::Responder for AndroidGuestManagerLaunchResponder {
940    type ControlHandle = AndroidGuestManagerControlHandle;
941
942    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
943        &self.control_handle
944    }
945
946    fn drop_without_shutdown(mut self) {
947        // Safety: drops once, never accessed again due to mem::forget
948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
949        // Prevent Drop from running (which would shut down the channel)
950        std::mem::forget(self);
951    }
952}
953
954impl AndroidGuestManagerLaunchResponder {
955    /// Sends a response to the FIDL transaction.
956    ///
957    /// Sets the channel to shutdown if an error occurs.
958    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
959        let _result = self.send_raw(result);
960        if _result.is_err() {
961            self.control_handle.shutdown();
962        }
963        self.drop_without_shutdown();
964        _result
965    }
966
967    /// Similar to "send" but does not shutdown the channel if an error occurs.
968    pub fn send_no_shutdown_on_err(
969        self,
970        mut result: Result<(), GuestManagerError>,
971    ) -> Result<(), fidl::Error> {
972        let _result = self.send_raw(result);
973        self.drop_without_shutdown();
974        _result
975    }
976
977    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
978        self.control_handle.inner.send::<fidl::encoding::ResultType<
979            fidl::encoding::EmptyStruct,
980            GuestManagerError,
981        >>(
982            result,
983            self.tx_id,
984            0x394a2e29f750323e,
985            fidl::encoding::DynamicFlags::empty(),
986        )
987    }
988}
989
990#[must_use = "FIDL methods require a response to be sent"]
991#[derive(Debug)]
992pub struct AndroidGuestManagerForceShutdownResponder {
993    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
994    tx_id: u32,
995}
996
997/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
998/// if the responder is dropped without sending a response, so that the client
999/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1000impl std::ops::Drop for AndroidGuestManagerForceShutdownResponder {
1001    fn drop(&mut self) {
1002        self.control_handle.shutdown();
1003        // Safety: drops once, never accessed again
1004        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1005    }
1006}
1007
1008impl fidl::endpoints::Responder for AndroidGuestManagerForceShutdownResponder {
1009    type ControlHandle = AndroidGuestManagerControlHandle;
1010
1011    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1012        &self.control_handle
1013    }
1014
1015    fn drop_without_shutdown(mut self) {
1016        // Safety: drops once, never accessed again due to mem::forget
1017        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1018        // Prevent Drop from running (which would shut down the channel)
1019        std::mem::forget(self);
1020    }
1021}
1022
1023impl AndroidGuestManagerForceShutdownResponder {
1024    /// Sends a response to the FIDL transaction.
1025    ///
1026    /// Sets the channel to shutdown if an error occurs.
1027    pub fn send(self) -> Result<(), fidl::Error> {
1028        let _result = self.send_raw();
1029        if _result.is_err() {
1030            self.control_handle.shutdown();
1031        }
1032        self.drop_without_shutdown();
1033        _result
1034    }
1035
1036    /// Similar to "send" but does not shutdown the channel if an error occurs.
1037    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1038        let _result = self.send_raw();
1039        self.drop_without_shutdown();
1040        _result
1041    }
1042
1043    fn send_raw(&self) -> Result<(), fidl::Error> {
1044        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1045            (),
1046            self.tx_id,
1047            0x3ad9a012982f872d,
1048            fidl::encoding::DynamicFlags::empty(),
1049        )
1050    }
1051}
1052
1053#[must_use = "FIDL methods require a response to be sent"]
1054#[derive(Debug)]
1055pub struct AndroidGuestManagerConnectResponder {
1056    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
1057    tx_id: u32,
1058}
1059
1060/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
1061/// if the responder is dropped without sending a response, so that the client
1062/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1063impl std::ops::Drop for AndroidGuestManagerConnectResponder {
1064    fn drop(&mut self) {
1065        self.control_handle.shutdown();
1066        // Safety: drops once, never accessed again
1067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1068    }
1069}
1070
1071impl fidl::endpoints::Responder for AndroidGuestManagerConnectResponder {
1072    type ControlHandle = AndroidGuestManagerControlHandle;
1073
1074    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1075        &self.control_handle
1076    }
1077
1078    fn drop_without_shutdown(mut self) {
1079        // Safety: drops once, never accessed again due to mem::forget
1080        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1081        // Prevent Drop from running (which would shut down the channel)
1082        std::mem::forget(self);
1083    }
1084}
1085
1086impl AndroidGuestManagerConnectResponder {
1087    /// Sends a response to the FIDL transaction.
1088    ///
1089    /// Sets the channel to shutdown if an error occurs.
1090    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1091        let _result = self.send_raw(result);
1092        if _result.is_err() {
1093            self.control_handle.shutdown();
1094        }
1095        self.drop_without_shutdown();
1096        _result
1097    }
1098
1099    /// Similar to "send" but does not shutdown the channel if an error occurs.
1100    pub fn send_no_shutdown_on_err(
1101        self,
1102        mut result: Result<(), GuestManagerError>,
1103    ) -> Result<(), fidl::Error> {
1104        let _result = self.send_raw(result);
1105        self.drop_without_shutdown();
1106        _result
1107    }
1108
1109    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1110        self.control_handle.inner.send::<fidl::encoding::ResultType<
1111            fidl::encoding::EmptyStruct,
1112            GuestManagerError,
1113        >>(
1114            result,
1115            self.tx_id,
1116            0x4e489076e3bb15b4,
1117            fidl::encoding::DynamicFlags::empty(),
1118        )
1119    }
1120}
1121
1122#[must_use = "FIDL methods require a response to be sent"]
1123#[derive(Debug)]
1124pub struct AndroidGuestManagerGetInfoResponder {
1125    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
1126    tx_id: u32,
1127}
1128
1129/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
1130/// if the responder is dropped without sending a response, so that the client
1131/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1132impl std::ops::Drop for AndroidGuestManagerGetInfoResponder {
1133    fn drop(&mut self) {
1134        self.control_handle.shutdown();
1135        // Safety: drops once, never accessed again
1136        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1137    }
1138}
1139
1140impl fidl::endpoints::Responder for AndroidGuestManagerGetInfoResponder {
1141    type ControlHandle = AndroidGuestManagerControlHandle;
1142
1143    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1144        &self.control_handle
1145    }
1146
1147    fn drop_without_shutdown(mut self) {
1148        // Safety: drops once, never accessed again due to mem::forget
1149        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1150        // Prevent Drop from running (which would shut down the channel)
1151        std::mem::forget(self);
1152    }
1153}
1154
1155impl AndroidGuestManagerGetInfoResponder {
1156    /// Sends a response to the FIDL transaction.
1157    ///
1158    /// Sets the channel to shutdown if an error occurs.
1159    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1160        let _result = self.send_raw(guest_info);
1161        if _result.is_err() {
1162            self.control_handle.shutdown();
1163        }
1164        self.drop_without_shutdown();
1165        _result
1166    }
1167
1168    /// Similar to "send" but does not shutdown the channel if an error occurs.
1169    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1170        let _result = self.send_raw(guest_info);
1171        self.drop_without_shutdown();
1172        _result
1173    }
1174
1175    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1176        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
1177            (guest_info,),
1178            self.tx_id,
1179            0x76892614aea695dc,
1180            fidl::encoding::DynamicFlags::empty(),
1181        )
1182    }
1183}
1184
1185#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1186pub struct BalloonControllerMarker;
1187
1188impl fidl::endpoints::ProtocolMarker for BalloonControllerMarker {
1189    type Proxy = BalloonControllerProxy;
1190    type RequestStream = BalloonControllerRequestStream;
1191    #[cfg(target_os = "fuchsia")]
1192    type SynchronousProxy = BalloonControllerSynchronousProxy;
1193
1194    const DEBUG_NAME: &'static str = "fuchsia.virtualization.BalloonController";
1195}
1196impl fidl::endpoints::DiscoverableProtocolMarker for BalloonControllerMarker {}
1197
1198pub trait BalloonControllerProxyInterface: Send + Sync {
1199    type GetBalloonSizeResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>>
1200        + Send;
1201    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut;
1202    fn r#request_num_pages(&self, requested_num_pages: u32) -> Result<(), fidl::Error>;
1203    type GetMemStatsResponseFut: std::future::Future<Output = Result<(i32, Option<Vec<MemStat>>), fidl::Error>>
1204        + Send;
1205    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
1206}
1207#[derive(Debug)]
1208#[cfg(target_os = "fuchsia")]
1209pub struct BalloonControllerSynchronousProxy {
1210    client: fidl::client::sync::Client,
1211}
1212
1213#[cfg(target_os = "fuchsia")]
1214impl fidl::endpoints::SynchronousProxy for BalloonControllerSynchronousProxy {
1215    type Proxy = BalloonControllerProxy;
1216    type Protocol = BalloonControllerMarker;
1217
1218    fn from_channel(inner: fidl::Channel) -> Self {
1219        Self::new(inner)
1220    }
1221
1222    fn into_channel(self) -> fidl::Channel {
1223        self.client.into_channel()
1224    }
1225
1226    fn as_channel(&self) -> &fidl::Channel {
1227        self.client.as_channel()
1228    }
1229}
1230
1231#[cfg(target_os = "fuchsia")]
1232impl BalloonControllerSynchronousProxy {
1233    pub fn new(channel: fidl::Channel) -> Self {
1234        Self { client: fidl::client::sync::Client::new(channel) }
1235    }
1236
1237    pub fn into_channel(self) -> fidl::Channel {
1238        self.client.into_channel()
1239    }
1240
1241    /// Waits until an event arrives and returns it. It is safe for other
1242    /// threads to make concurrent requests while waiting for an event.
1243    pub fn wait_for_event(
1244        &self,
1245        deadline: zx::MonotonicInstant,
1246    ) -> Result<BalloonControllerEvent, fidl::Error> {
1247        BalloonControllerEvent::decode(
1248            self.client.wait_for_event::<BalloonControllerMarker>(deadline)?,
1249        )
1250    }
1251
1252    /// Get the current and requested number of pages in the memory balloon.
1253    ///
1254    /// current_num_pages is the number of pages balloon has right now.
1255    /// requested_num_pages is the desired number of pages in the balloon.
1256    ///
1257    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1258    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1259    pub fn r#get_balloon_size(
1260        &self,
1261        ___deadline: zx::MonotonicInstant,
1262    ) -> Result<(u32, u32), fidl::Error> {
1263        let _response = self.client.send_query::<
1264            fidl::encoding::EmptyPayload,
1265            BalloonControllerGetBalloonSizeResponse,
1266            BalloonControllerMarker,
1267        >(
1268            (),
1269            0x2bb2ebaa6ff64d0b,
1270            fidl::encoding::DynamicFlags::empty(),
1271            ___deadline,
1272        )?;
1273        Ok((_response.current_num_pages, _response.requested_num_pages))
1274    }
1275
1276    /// Request a number of pages to be supplied to the memory balloon.
1277    ///
1278    /// If `requested_num_pages` is greater than the `current_num_pages` config
1279    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1280    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1281    /// the guest driver MAY reclaim pages from the memory balloon.
1282    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1283        self.client.send::<BalloonControllerRequestNumPagesRequest>(
1284            (requested_num_pages,),
1285            0x55c444d65e1df1e8,
1286            fidl::encoding::DynamicFlags::empty(),
1287        )
1288    }
1289
1290    /// Get memory statistics of the guest instance.
1291    pub fn r#get_mem_stats(
1292        &self,
1293        ___deadline: zx::MonotonicInstant,
1294    ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
1295        let _response = self.client.send_query::<
1296            fidl::encoding::EmptyPayload,
1297            BalloonControllerGetMemStatsResponse,
1298            BalloonControllerMarker,
1299        >(
1300            (),
1301            0x676199795cc01142,
1302            fidl::encoding::DynamicFlags::empty(),
1303            ___deadline,
1304        )?;
1305        Ok((_response.status, _response.mem_stats))
1306    }
1307}
1308
1309#[cfg(target_os = "fuchsia")]
1310impl From<BalloonControllerSynchronousProxy> for zx::NullableHandle {
1311    fn from(value: BalloonControllerSynchronousProxy) -> Self {
1312        value.into_channel().into()
1313    }
1314}
1315
1316#[cfg(target_os = "fuchsia")]
1317impl From<fidl::Channel> for BalloonControllerSynchronousProxy {
1318    fn from(value: fidl::Channel) -> Self {
1319        Self::new(value)
1320    }
1321}
1322
1323#[cfg(target_os = "fuchsia")]
1324impl fidl::endpoints::FromClient for BalloonControllerSynchronousProxy {
1325    type Protocol = BalloonControllerMarker;
1326
1327    fn from_client(value: fidl::endpoints::ClientEnd<BalloonControllerMarker>) -> Self {
1328        Self::new(value.into_channel())
1329    }
1330}
1331
1332#[derive(Debug, Clone)]
1333pub struct BalloonControllerProxy {
1334    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1335}
1336
1337impl fidl::endpoints::Proxy for BalloonControllerProxy {
1338    type Protocol = BalloonControllerMarker;
1339
1340    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1341        Self::new(inner)
1342    }
1343
1344    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1345        self.client.into_channel().map_err(|client| Self { client })
1346    }
1347
1348    fn as_channel(&self) -> &::fidl::AsyncChannel {
1349        self.client.as_channel()
1350    }
1351}
1352
1353impl BalloonControllerProxy {
1354    /// Create a new Proxy for fuchsia.virtualization/BalloonController.
1355    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1356        let protocol_name =
1357            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1358        Self { client: fidl::client::Client::new(channel, protocol_name) }
1359    }
1360
1361    /// Get a Stream of events from the remote end of the protocol.
1362    ///
1363    /// # Panics
1364    ///
1365    /// Panics if the event stream was already taken.
1366    pub fn take_event_stream(&self) -> BalloonControllerEventStream {
1367        BalloonControllerEventStream { event_receiver: self.client.take_event_receiver() }
1368    }
1369
1370    /// Get the current and requested number of pages in the memory balloon.
1371    ///
1372    /// current_num_pages is the number of pages balloon has right now.
1373    /// requested_num_pages is the desired number of pages in the balloon.
1374    ///
1375    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1376    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1377    pub fn r#get_balloon_size(
1378        &self,
1379    ) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
1380    {
1381        BalloonControllerProxyInterface::r#get_balloon_size(self)
1382    }
1383
1384    /// Request a number of pages to be supplied to the memory balloon.
1385    ///
1386    /// If `requested_num_pages` is greater than the `current_num_pages` config
1387    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1388    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1389    /// the guest driver MAY reclaim pages from the memory balloon.
1390    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1391        BalloonControllerProxyInterface::r#request_num_pages(self, requested_num_pages)
1392    }
1393
1394    /// Get memory statistics of the guest instance.
1395    pub fn r#get_mem_stats(
1396        &self,
1397    ) -> fidl::client::QueryResponseFut<
1398        (i32, Option<Vec<MemStat>>),
1399        fidl::encoding::DefaultFuchsiaResourceDialect,
1400    > {
1401        BalloonControllerProxyInterface::r#get_mem_stats(self)
1402    }
1403}
1404
1405impl BalloonControllerProxyInterface for BalloonControllerProxy {
1406    type GetBalloonSizeResponseFut =
1407        fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
1408    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut {
1409        fn _decode(
1410            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1411        ) -> Result<(u32, u32), fidl::Error> {
1412            let _response = fidl::client::decode_transaction_body::<
1413                BalloonControllerGetBalloonSizeResponse,
1414                fidl::encoding::DefaultFuchsiaResourceDialect,
1415                0x2bb2ebaa6ff64d0b,
1416            >(_buf?)?;
1417            Ok((_response.current_num_pages, _response.requested_num_pages))
1418        }
1419        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, u32)>(
1420            (),
1421            0x2bb2ebaa6ff64d0b,
1422            fidl::encoding::DynamicFlags::empty(),
1423            _decode,
1424        )
1425    }
1426
1427    fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1428        self.client.send::<BalloonControllerRequestNumPagesRequest>(
1429            (requested_num_pages,),
1430            0x55c444d65e1df1e8,
1431            fidl::encoding::DynamicFlags::empty(),
1432        )
1433    }
1434
1435    type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
1436        (i32, Option<Vec<MemStat>>),
1437        fidl::encoding::DefaultFuchsiaResourceDialect,
1438    >;
1439    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
1440        fn _decode(
1441            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1442        ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
1443            let _response = fidl::client::decode_transaction_body::<
1444                BalloonControllerGetMemStatsResponse,
1445                fidl::encoding::DefaultFuchsiaResourceDialect,
1446                0x676199795cc01142,
1447            >(_buf?)?;
1448            Ok((_response.status, _response.mem_stats))
1449        }
1450        self.client
1451            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Vec<MemStat>>)>(
1452                (),
1453                0x676199795cc01142,
1454                fidl::encoding::DynamicFlags::empty(),
1455                _decode,
1456            )
1457    }
1458}
1459
1460pub struct BalloonControllerEventStream {
1461    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1462}
1463
1464impl std::marker::Unpin for BalloonControllerEventStream {}
1465
1466impl futures::stream::FusedStream for BalloonControllerEventStream {
1467    fn is_terminated(&self) -> bool {
1468        self.event_receiver.is_terminated()
1469    }
1470}
1471
1472impl futures::Stream for BalloonControllerEventStream {
1473    type Item = Result<BalloonControllerEvent, fidl::Error>;
1474
1475    fn poll_next(
1476        mut self: std::pin::Pin<&mut Self>,
1477        cx: &mut std::task::Context<'_>,
1478    ) -> std::task::Poll<Option<Self::Item>> {
1479        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1480            &mut self.event_receiver,
1481            cx
1482        )?) {
1483            Some(buf) => std::task::Poll::Ready(Some(BalloonControllerEvent::decode(buf))),
1484            None => std::task::Poll::Ready(None),
1485        }
1486    }
1487}
1488
1489#[derive(Debug)]
1490pub enum BalloonControllerEvent {}
1491
1492impl BalloonControllerEvent {
1493    /// Decodes a message buffer as a [`BalloonControllerEvent`].
1494    fn decode(
1495        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1496    ) -> Result<BalloonControllerEvent, fidl::Error> {
1497        let (bytes, _handles) = buf.split_mut();
1498        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1499        debug_assert_eq!(tx_header.tx_id, 0);
1500        match tx_header.ordinal {
1501            _ => Err(fidl::Error::UnknownOrdinal {
1502                ordinal: tx_header.ordinal,
1503                protocol_name:
1504                    <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1505            }),
1506        }
1507    }
1508}
1509
1510/// A Stream of incoming requests for fuchsia.virtualization/BalloonController.
1511pub struct BalloonControllerRequestStream {
1512    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1513    is_terminated: bool,
1514}
1515
1516impl std::marker::Unpin for BalloonControllerRequestStream {}
1517
1518impl futures::stream::FusedStream for BalloonControllerRequestStream {
1519    fn is_terminated(&self) -> bool {
1520        self.is_terminated
1521    }
1522}
1523
1524impl fidl::endpoints::RequestStream for BalloonControllerRequestStream {
1525    type Protocol = BalloonControllerMarker;
1526    type ControlHandle = BalloonControllerControlHandle;
1527
1528    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1529        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1530    }
1531
1532    fn control_handle(&self) -> Self::ControlHandle {
1533        BalloonControllerControlHandle { inner: self.inner.clone() }
1534    }
1535
1536    fn into_inner(
1537        self,
1538    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1539    {
1540        (self.inner, self.is_terminated)
1541    }
1542
1543    fn from_inner(
1544        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1545        is_terminated: bool,
1546    ) -> Self {
1547        Self { inner, is_terminated }
1548    }
1549}
1550
1551impl futures::Stream for BalloonControllerRequestStream {
1552    type Item = Result<BalloonControllerRequest, fidl::Error>;
1553
1554    fn poll_next(
1555        mut self: std::pin::Pin<&mut Self>,
1556        cx: &mut std::task::Context<'_>,
1557    ) -> std::task::Poll<Option<Self::Item>> {
1558        let this = &mut *self;
1559        if this.inner.check_shutdown(cx) {
1560            this.is_terminated = true;
1561            return std::task::Poll::Ready(None);
1562        }
1563        if this.is_terminated {
1564            panic!("polled BalloonControllerRequestStream after completion");
1565        }
1566        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1567            |bytes, handles| {
1568                match this.inner.channel().read_etc(cx, bytes, handles) {
1569                    std::task::Poll::Ready(Ok(())) => {}
1570                    std::task::Poll::Pending => return std::task::Poll::Pending,
1571                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1572                        this.is_terminated = true;
1573                        return std::task::Poll::Ready(None);
1574                    }
1575                    std::task::Poll::Ready(Err(e)) => {
1576                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1577                            e.into(),
1578                        ))));
1579                    }
1580                }
1581
1582                // A message has been received from the channel
1583                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1584
1585                std::task::Poll::Ready(Some(match header.ordinal {
1586                    0x2bb2ebaa6ff64d0b => {
1587                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1588                        let mut req = fidl::new_empty!(
1589                            fidl::encoding::EmptyPayload,
1590                            fidl::encoding::DefaultFuchsiaResourceDialect
1591                        );
1592                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1593                        let control_handle =
1594                            BalloonControllerControlHandle { inner: this.inner.clone() };
1595                        Ok(BalloonControllerRequest::GetBalloonSize {
1596                            responder: BalloonControllerGetBalloonSizeResponder {
1597                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1598                                tx_id: header.tx_id,
1599                            },
1600                        })
1601                    }
1602                    0x55c444d65e1df1e8 => {
1603                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1604                        let mut req = fidl::new_empty!(
1605                            BalloonControllerRequestNumPagesRequest,
1606                            fidl::encoding::DefaultFuchsiaResourceDialect
1607                        );
1608                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BalloonControllerRequestNumPagesRequest>(&header, _body_bytes, handles, &mut req)?;
1609                        let control_handle =
1610                            BalloonControllerControlHandle { inner: this.inner.clone() };
1611                        Ok(BalloonControllerRequest::RequestNumPages {
1612                            requested_num_pages: req.requested_num_pages,
1613
1614                            control_handle,
1615                        })
1616                    }
1617                    0x676199795cc01142 => {
1618                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1619                        let mut req = fidl::new_empty!(
1620                            fidl::encoding::EmptyPayload,
1621                            fidl::encoding::DefaultFuchsiaResourceDialect
1622                        );
1623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1624                        let control_handle =
1625                            BalloonControllerControlHandle { inner: this.inner.clone() };
1626                        Ok(BalloonControllerRequest::GetMemStats {
1627                            responder: BalloonControllerGetMemStatsResponder {
1628                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1629                                tx_id: header.tx_id,
1630                            },
1631                        })
1632                    }
1633                    _ => Err(fidl::Error::UnknownOrdinal {
1634                        ordinal: header.ordinal,
1635                        protocol_name:
1636                            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1637                    }),
1638                }))
1639            },
1640        )
1641    }
1642}
1643
1644/// A `BalloonController` controls a guest instance's memory balloon.
1645#[derive(Debug)]
1646pub enum BalloonControllerRequest {
1647    /// Get the current and requested number of pages in the memory balloon.
1648    ///
1649    /// current_num_pages is the number of pages balloon has right now.
1650    /// requested_num_pages is the desired number of pages in the balloon.
1651    ///
1652    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1653    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1654    GetBalloonSize { responder: BalloonControllerGetBalloonSizeResponder },
1655    /// Request a number of pages to be supplied to the memory balloon.
1656    ///
1657    /// If `requested_num_pages` is greater than the `current_num_pages` config
1658    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1659    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1660    /// the guest driver MAY reclaim pages from the memory balloon.
1661    RequestNumPages { requested_num_pages: u32, control_handle: BalloonControllerControlHandle },
1662    /// Get memory statistics of the guest instance.
1663    GetMemStats { responder: BalloonControllerGetMemStatsResponder },
1664}
1665
1666impl BalloonControllerRequest {
1667    #[allow(irrefutable_let_patterns)]
1668    pub fn into_get_balloon_size(self) -> Option<(BalloonControllerGetBalloonSizeResponder)> {
1669        if let BalloonControllerRequest::GetBalloonSize { responder } = self {
1670            Some((responder))
1671        } else {
1672            None
1673        }
1674    }
1675
1676    #[allow(irrefutable_let_patterns)]
1677    pub fn into_request_num_pages(self) -> Option<(u32, BalloonControllerControlHandle)> {
1678        if let BalloonControllerRequest::RequestNumPages { requested_num_pages, control_handle } =
1679            self
1680        {
1681            Some((requested_num_pages, control_handle))
1682        } else {
1683            None
1684        }
1685    }
1686
1687    #[allow(irrefutable_let_patterns)]
1688    pub fn into_get_mem_stats(self) -> Option<(BalloonControllerGetMemStatsResponder)> {
1689        if let BalloonControllerRequest::GetMemStats { responder } = self {
1690            Some((responder))
1691        } else {
1692            None
1693        }
1694    }
1695
1696    /// Name of the method defined in FIDL
1697    pub fn method_name(&self) -> &'static str {
1698        match *self {
1699            BalloonControllerRequest::GetBalloonSize { .. } => "get_balloon_size",
1700            BalloonControllerRequest::RequestNumPages { .. } => "request_num_pages",
1701            BalloonControllerRequest::GetMemStats { .. } => "get_mem_stats",
1702        }
1703    }
1704}
1705
1706#[derive(Debug, Clone)]
1707pub struct BalloonControllerControlHandle {
1708    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1709}
1710
1711impl fidl::endpoints::ControlHandle for BalloonControllerControlHandle {
1712    fn shutdown(&self) {
1713        self.inner.shutdown()
1714    }
1715
1716    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1717        self.inner.shutdown_with_epitaph(status)
1718    }
1719
1720    fn is_closed(&self) -> bool {
1721        self.inner.channel().is_closed()
1722    }
1723    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1724        self.inner.channel().on_closed()
1725    }
1726
1727    #[cfg(target_os = "fuchsia")]
1728    fn signal_peer(
1729        &self,
1730        clear_mask: zx::Signals,
1731        set_mask: zx::Signals,
1732    ) -> Result<(), zx_status::Status> {
1733        use fidl::Peered;
1734        self.inner.channel().signal_peer(clear_mask, set_mask)
1735    }
1736}
1737
1738impl BalloonControllerControlHandle {}
1739
1740#[must_use = "FIDL methods require a response to be sent"]
1741#[derive(Debug)]
1742pub struct BalloonControllerGetBalloonSizeResponder {
1743    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
1744    tx_id: u32,
1745}
1746
1747/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
1748/// if the responder is dropped without sending a response, so that the client
1749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1750impl std::ops::Drop for BalloonControllerGetBalloonSizeResponder {
1751    fn drop(&mut self) {
1752        self.control_handle.shutdown();
1753        // Safety: drops once, never accessed again
1754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1755    }
1756}
1757
1758impl fidl::endpoints::Responder for BalloonControllerGetBalloonSizeResponder {
1759    type ControlHandle = BalloonControllerControlHandle;
1760
1761    fn control_handle(&self) -> &BalloonControllerControlHandle {
1762        &self.control_handle
1763    }
1764
1765    fn drop_without_shutdown(mut self) {
1766        // Safety: drops once, never accessed again due to mem::forget
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768        // Prevent Drop from running (which would shut down the channel)
1769        std::mem::forget(self);
1770    }
1771}
1772
1773impl BalloonControllerGetBalloonSizeResponder {
1774    /// Sends a response to the FIDL transaction.
1775    ///
1776    /// Sets the channel to shutdown if an error occurs.
1777    pub fn send(
1778        self,
1779        mut current_num_pages: u32,
1780        mut requested_num_pages: u32,
1781    ) -> Result<(), fidl::Error> {
1782        let _result = self.send_raw(current_num_pages, requested_num_pages);
1783        if _result.is_err() {
1784            self.control_handle.shutdown();
1785        }
1786        self.drop_without_shutdown();
1787        _result
1788    }
1789
1790    /// Similar to "send" but does not shutdown the channel if an error occurs.
1791    pub fn send_no_shutdown_on_err(
1792        self,
1793        mut current_num_pages: u32,
1794        mut requested_num_pages: u32,
1795    ) -> Result<(), fidl::Error> {
1796        let _result = self.send_raw(current_num_pages, requested_num_pages);
1797        self.drop_without_shutdown();
1798        _result
1799    }
1800
1801    fn send_raw(
1802        &self,
1803        mut current_num_pages: u32,
1804        mut requested_num_pages: u32,
1805    ) -> Result<(), fidl::Error> {
1806        self.control_handle.inner.send::<BalloonControllerGetBalloonSizeResponse>(
1807            (current_num_pages, requested_num_pages),
1808            self.tx_id,
1809            0x2bb2ebaa6ff64d0b,
1810            fidl::encoding::DynamicFlags::empty(),
1811        )
1812    }
1813}
1814
1815#[must_use = "FIDL methods require a response to be sent"]
1816#[derive(Debug)]
1817pub struct BalloonControllerGetMemStatsResponder {
1818    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
1819    tx_id: u32,
1820}
1821
1822/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
1823/// if the responder is dropped without sending a response, so that the client
1824/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1825impl std::ops::Drop for BalloonControllerGetMemStatsResponder {
1826    fn drop(&mut self) {
1827        self.control_handle.shutdown();
1828        // Safety: drops once, never accessed again
1829        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1830    }
1831}
1832
1833impl fidl::endpoints::Responder for BalloonControllerGetMemStatsResponder {
1834    type ControlHandle = BalloonControllerControlHandle;
1835
1836    fn control_handle(&self) -> &BalloonControllerControlHandle {
1837        &self.control_handle
1838    }
1839
1840    fn drop_without_shutdown(mut self) {
1841        // Safety: drops once, never accessed again due to mem::forget
1842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1843        // Prevent Drop from running (which would shut down the channel)
1844        std::mem::forget(self);
1845    }
1846}
1847
1848impl BalloonControllerGetMemStatsResponder {
1849    /// Sends a response to the FIDL transaction.
1850    ///
1851    /// Sets the channel to shutdown if an error occurs.
1852    pub fn send(
1853        self,
1854        mut status: i32,
1855        mut mem_stats: Option<&[MemStat]>,
1856    ) -> Result<(), fidl::Error> {
1857        let _result = self.send_raw(status, mem_stats);
1858        if _result.is_err() {
1859            self.control_handle.shutdown();
1860        }
1861        self.drop_without_shutdown();
1862        _result
1863    }
1864
1865    /// Similar to "send" but does not shutdown the channel if an error occurs.
1866    pub fn send_no_shutdown_on_err(
1867        self,
1868        mut status: i32,
1869        mut mem_stats: Option<&[MemStat]>,
1870    ) -> Result<(), fidl::Error> {
1871        let _result = self.send_raw(status, mem_stats);
1872        self.drop_without_shutdown();
1873        _result
1874    }
1875
1876    fn send_raw(
1877        &self,
1878        mut status: i32,
1879        mut mem_stats: Option<&[MemStat]>,
1880    ) -> Result<(), fidl::Error> {
1881        self.control_handle.inner.send::<BalloonControllerGetMemStatsResponse>(
1882            (status, mem_stats),
1883            self.tx_id,
1884            0x676199795cc01142,
1885            fidl::encoding::DynamicFlags::empty(),
1886        )
1887    }
1888}
1889
1890#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1891pub struct DebianGuestManagerMarker;
1892
1893impl fidl::endpoints::ProtocolMarker for DebianGuestManagerMarker {
1894    type Proxy = DebianGuestManagerProxy;
1895    type RequestStream = DebianGuestManagerRequestStream;
1896    #[cfg(target_os = "fuchsia")]
1897    type SynchronousProxy = DebianGuestManagerSynchronousProxy;
1898
1899    const DEBUG_NAME: &'static str = "fuchsia.virtualization.DebianGuestManager";
1900}
1901impl fidl::endpoints::DiscoverableProtocolMarker for DebianGuestManagerMarker {}
1902
1903pub trait DebianGuestManagerProxyInterface: Send + Sync {
1904    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
1905        + Send;
1906    fn r#launch(
1907        &self,
1908        guest_config: GuestConfig,
1909        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1910    ) -> Self::LaunchResponseFut;
1911    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1912    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
1913    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
1914        + Send;
1915    fn r#connect(
1916        &self,
1917        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1918    ) -> Self::ConnectResponseFut;
1919    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
1920    fn r#get_info(&self) -> Self::GetInfoResponseFut;
1921}
1922#[derive(Debug)]
1923#[cfg(target_os = "fuchsia")]
1924pub struct DebianGuestManagerSynchronousProxy {
1925    client: fidl::client::sync::Client,
1926}
1927
1928#[cfg(target_os = "fuchsia")]
1929impl fidl::endpoints::SynchronousProxy for DebianGuestManagerSynchronousProxy {
1930    type Proxy = DebianGuestManagerProxy;
1931    type Protocol = DebianGuestManagerMarker;
1932
1933    fn from_channel(inner: fidl::Channel) -> Self {
1934        Self::new(inner)
1935    }
1936
1937    fn into_channel(self) -> fidl::Channel {
1938        self.client.into_channel()
1939    }
1940
1941    fn as_channel(&self) -> &fidl::Channel {
1942        self.client.as_channel()
1943    }
1944}
1945
1946#[cfg(target_os = "fuchsia")]
1947impl DebianGuestManagerSynchronousProxy {
1948    pub fn new(channel: fidl::Channel) -> Self {
1949        Self { client: fidl::client::sync::Client::new(channel) }
1950    }
1951
1952    pub fn into_channel(self) -> fidl::Channel {
1953        self.client.into_channel()
1954    }
1955
1956    /// Waits until an event arrives and returns it. It is safe for other
1957    /// threads to make concurrent requests while waiting for an event.
1958    pub fn wait_for_event(
1959        &self,
1960        deadline: zx::MonotonicInstant,
1961    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
1962        DebianGuestManagerEvent::decode(
1963            self.client.wait_for_event::<DebianGuestManagerMarker>(deadline)?,
1964        )
1965    }
1966
1967    /// Launch a new guest instance.
1968    ///
1969    /// Possible errors:
1970    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
1971    ///         problems detected by the guest manager.
1972    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
1973    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
1974    ///         component logs for a more specific failure.
1975    pub fn r#launch(
1976        &self,
1977        mut guest_config: GuestConfig,
1978        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1979        ___deadline: zx::MonotonicInstant,
1980    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
1981        let _response =
1982            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
1983                fidl::encoding::EmptyStruct,
1984                GuestManagerError,
1985            >, DebianGuestManagerMarker>(
1986                (&mut guest_config, controller),
1987                0x394a2e29f750323e,
1988                fidl::encoding::DynamicFlags::empty(),
1989                ___deadline,
1990            )?;
1991        Ok(_response.map(|x| x))
1992    }
1993
1994    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
1995    /// be used to launch another guest.
1996    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1997        let _response = self.client.send_query::<
1998            fidl::encoding::EmptyPayload,
1999            fidl::encoding::EmptyPayload,
2000            DebianGuestManagerMarker,
2001        >(
2002            (),
2003            0x3ad9a012982f872d,
2004            fidl::encoding::DynamicFlags::empty(),
2005            ___deadline,
2006        )?;
2007        Ok(_response)
2008    }
2009
2010    /// Connect to a currently running guest.
2011    ///
2012    /// Possible errors:
2013    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2014    ///         has launched before attempting to reconnect.
2015    pub fn r#connect(
2016        &self,
2017        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2018        ___deadline: zx::MonotonicInstant,
2019    ) -> Result<GuestManagerConnectResult, fidl::Error> {
2020        let _response =
2021            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
2022                fidl::encoding::EmptyStruct,
2023                GuestManagerError,
2024            >, DebianGuestManagerMarker>(
2025                (controller,),
2026                0x4e489076e3bb15b4,
2027                fidl::encoding::DynamicFlags::empty(),
2028                ___deadline,
2029            )?;
2030        Ok(_response.map(|x| x))
2031    }
2032
2033    /// Query guest info
2034    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
2035        let _response = self.client.send_query::<
2036            fidl::encoding::EmptyPayload,
2037            GuestManagerGetInfoResponse,
2038            DebianGuestManagerMarker,
2039        >(
2040            (),
2041            0x76892614aea695dc,
2042            fidl::encoding::DynamicFlags::empty(),
2043            ___deadline,
2044        )?;
2045        Ok(_response.guest_info)
2046    }
2047}
2048
2049#[cfg(target_os = "fuchsia")]
2050impl From<DebianGuestManagerSynchronousProxy> for zx::NullableHandle {
2051    fn from(value: DebianGuestManagerSynchronousProxy) -> Self {
2052        value.into_channel().into()
2053    }
2054}
2055
2056#[cfg(target_os = "fuchsia")]
2057impl From<fidl::Channel> for DebianGuestManagerSynchronousProxy {
2058    fn from(value: fidl::Channel) -> Self {
2059        Self::new(value)
2060    }
2061}
2062
2063#[cfg(target_os = "fuchsia")]
2064impl fidl::endpoints::FromClient for DebianGuestManagerSynchronousProxy {
2065    type Protocol = DebianGuestManagerMarker;
2066
2067    fn from_client(value: fidl::endpoints::ClientEnd<DebianGuestManagerMarker>) -> Self {
2068        Self::new(value.into_channel())
2069    }
2070}
2071
2072#[derive(Debug, Clone)]
2073pub struct DebianGuestManagerProxy {
2074    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2075}
2076
2077impl fidl::endpoints::Proxy for DebianGuestManagerProxy {
2078    type Protocol = DebianGuestManagerMarker;
2079
2080    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2081        Self::new(inner)
2082    }
2083
2084    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2085        self.client.into_channel().map_err(|client| Self { client })
2086    }
2087
2088    fn as_channel(&self) -> &::fidl::AsyncChannel {
2089        self.client.as_channel()
2090    }
2091}
2092
2093impl DebianGuestManagerProxy {
2094    /// Create a new Proxy for fuchsia.virtualization/DebianGuestManager.
2095    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2096        let protocol_name =
2097            <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2098        Self { client: fidl::client::Client::new(channel, protocol_name) }
2099    }
2100
2101    /// Get a Stream of events from the remote end of the protocol.
2102    ///
2103    /// # Panics
2104    ///
2105    /// Panics if the event stream was already taken.
2106    pub fn take_event_stream(&self) -> DebianGuestManagerEventStream {
2107        DebianGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
2108    }
2109
2110    /// Launch a new guest instance.
2111    ///
2112    /// Possible errors:
2113    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
2114    ///         problems detected by the guest manager.
2115    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
2116    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
2117    ///         component logs for a more specific failure.
2118    pub fn r#launch(
2119        &self,
2120        mut guest_config: GuestConfig,
2121        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2122    ) -> fidl::client::QueryResponseFut<
2123        GuestManagerLaunchResult,
2124        fidl::encoding::DefaultFuchsiaResourceDialect,
2125    > {
2126        DebianGuestManagerProxyInterface::r#launch(self, guest_config, controller)
2127    }
2128
2129    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
2130    /// be used to launch another guest.
2131    pub fn r#force_shutdown(
2132        &self,
2133    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2134        DebianGuestManagerProxyInterface::r#force_shutdown(self)
2135    }
2136
2137    /// Connect to a currently running guest.
2138    ///
2139    /// Possible errors:
2140    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2141    ///         has launched before attempting to reconnect.
2142    pub fn r#connect(
2143        &self,
2144        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2145    ) -> fidl::client::QueryResponseFut<
2146        GuestManagerConnectResult,
2147        fidl::encoding::DefaultFuchsiaResourceDialect,
2148    > {
2149        DebianGuestManagerProxyInterface::r#connect(self, controller)
2150    }
2151
2152    /// Query guest info
2153    pub fn r#get_info(
2154        &self,
2155    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2156    {
2157        DebianGuestManagerProxyInterface::r#get_info(self)
2158    }
2159}
2160
2161impl DebianGuestManagerProxyInterface for DebianGuestManagerProxy {
2162    type LaunchResponseFut = fidl::client::QueryResponseFut<
2163        GuestManagerLaunchResult,
2164        fidl::encoding::DefaultFuchsiaResourceDialect,
2165    >;
2166    fn r#launch(
2167        &self,
2168        mut guest_config: GuestConfig,
2169        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2170    ) -> Self::LaunchResponseFut {
2171        fn _decode(
2172            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2173        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
2174            let _response = fidl::client::decode_transaction_body::<
2175                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
2176                fidl::encoding::DefaultFuchsiaResourceDialect,
2177                0x394a2e29f750323e,
2178            >(_buf?)?;
2179            Ok(_response.map(|x| x))
2180        }
2181        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
2182            (&mut guest_config, controller),
2183            0x394a2e29f750323e,
2184            fidl::encoding::DynamicFlags::empty(),
2185            _decode,
2186        )
2187    }
2188
2189    type ForceShutdownResponseFut =
2190        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2191    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
2192        fn _decode(
2193            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2194        ) -> Result<(), fidl::Error> {
2195            let _response = fidl::client::decode_transaction_body::<
2196                fidl::encoding::EmptyPayload,
2197                fidl::encoding::DefaultFuchsiaResourceDialect,
2198                0x3ad9a012982f872d,
2199            >(_buf?)?;
2200            Ok(_response)
2201        }
2202        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2203            (),
2204            0x3ad9a012982f872d,
2205            fidl::encoding::DynamicFlags::empty(),
2206            _decode,
2207        )
2208    }
2209
2210    type ConnectResponseFut = fidl::client::QueryResponseFut<
2211        GuestManagerConnectResult,
2212        fidl::encoding::DefaultFuchsiaResourceDialect,
2213    >;
2214    fn r#connect(
2215        &self,
2216        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2217    ) -> Self::ConnectResponseFut {
2218        fn _decode(
2219            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2220        ) -> Result<GuestManagerConnectResult, fidl::Error> {
2221            let _response = fidl::client::decode_transaction_body::<
2222                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
2223                fidl::encoding::DefaultFuchsiaResourceDialect,
2224                0x4e489076e3bb15b4,
2225            >(_buf?)?;
2226            Ok(_response.map(|x| x))
2227        }
2228        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
2229            (controller,),
2230            0x4e489076e3bb15b4,
2231            fidl::encoding::DynamicFlags::empty(),
2232            _decode,
2233        )
2234    }
2235
2236    type GetInfoResponseFut =
2237        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
2238    fn r#get_info(&self) -> Self::GetInfoResponseFut {
2239        fn _decode(
2240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2241        ) -> Result<GuestInfo, fidl::Error> {
2242            let _response = fidl::client::decode_transaction_body::<
2243                GuestManagerGetInfoResponse,
2244                fidl::encoding::DefaultFuchsiaResourceDialect,
2245                0x76892614aea695dc,
2246            >(_buf?)?;
2247            Ok(_response.guest_info)
2248        }
2249        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
2250            (),
2251            0x76892614aea695dc,
2252            fidl::encoding::DynamicFlags::empty(),
2253            _decode,
2254        )
2255    }
2256}
2257
2258pub struct DebianGuestManagerEventStream {
2259    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2260}
2261
2262impl std::marker::Unpin for DebianGuestManagerEventStream {}
2263
2264impl futures::stream::FusedStream for DebianGuestManagerEventStream {
2265    fn is_terminated(&self) -> bool {
2266        self.event_receiver.is_terminated()
2267    }
2268}
2269
2270impl futures::Stream for DebianGuestManagerEventStream {
2271    type Item = Result<DebianGuestManagerEvent, fidl::Error>;
2272
2273    fn poll_next(
2274        mut self: std::pin::Pin<&mut Self>,
2275        cx: &mut std::task::Context<'_>,
2276    ) -> std::task::Poll<Option<Self::Item>> {
2277        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2278            &mut self.event_receiver,
2279            cx
2280        )?) {
2281            Some(buf) => std::task::Poll::Ready(Some(DebianGuestManagerEvent::decode(buf))),
2282            None => std::task::Poll::Ready(None),
2283        }
2284    }
2285}
2286
2287#[derive(Debug)]
2288pub enum DebianGuestManagerEvent {}
2289
2290impl DebianGuestManagerEvent {
2291    /// Decodes a message buffer as a [`DebianGuestManagerEvent`].
2292    fn decode(
2293        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2294    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
2295        let (bytes, _handles) = buf.split_mut();
2296        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2297        debug_assert_eq!(tx_header.tx_id, 0);
2298        match tx_header.ordinal {
2299            _ => Err(fidl::Error::UnknownOrdinal {
2300                ordinal: tx_header.ordinal,
2301                protocol_name:
2302                    <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2303            }),
2304        }
2305    }
2306}
2307
2308/// A Stream of incoming requests for fuchsia.virtualization/DebianGuestManager.
2309pub struct DebianGuestManagerRequestStream {
2310    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2311    is_terminated: bool,
2312}
2313
2314impl std::marker::Unpin for DebianGuestManagerRequestStream {}
2315
2316impl futures::stream::FusedStream for DebianGuestManagerRequestStream {
2317    fn is_terminated(&self) -> bool {
2318        self.is_terminated
2319    }
2320}
2321
2322impl fidl::endpoints::RequestStream for DebianGuestManagerRequestStream {
2323    type Protocol = DebianGuestManagerMarker;
2324    type ControlHandle = DebianGuestManagerControlHandle;
2325
2326    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2327        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2328    }
2329
2330    fn control_handle(&self) -> Self::ControlHandle {
2331        DebianGuestManagerControlHandle { inner: self.inner.clone() }
2332    }
2333
2334    fn into_inner(
2335        self,
2336    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2337    {
2338        (self.inner, self.is_terminated)
2339    }
2340
2341    fn from_inner(
2342        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2343        is_terminated: bool,
2344    ) -> Self {
2345        Self { inner, is_terminated }
2346    }
2347}
2348
2349impl futures::Stream for DebianGuestManagerRequestStream {
2350    type Item = Result<DebianGuestManagerRequest, fidl::Error>;
2351
2352    fn poll_next(
2353        mut self: std::pin::Pin<&mut Self>,
2354        cx: &mut std::task::Context<'_>,
2355    ) -> std::task::Poll<Option<Self::Item>> {
2356        let this = &mut *self;
2357        if this.inner.check_shutdown(cx) {
2358            this.is_terminated = true;
2359            return std::task::Poll::Ready(None);
2360        }
2361        if this.is_terminated {
2362            panic!("polled DebianGuestManagerRequestStream after completion");
2363        }
2364        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2365            |bytes, handles| {
2366                match this.inner.channel().read_etc(cx, bytes, handles) {
2367                    std::task::Poll::Ready(Ok(())) => {}
2368                    std::task::Poll::Pending => return std::task::Poll::Pending,
2369                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2370                        this.is_terminated = true;
2371                        return std::task::Poll::Ready(None);
2372                    }
2373                    std::task::Poll::Ready(Err(e)) => {
2374                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2375                            e.into(),
2376                        ))));
2377                    }
2378                }
2379
2380                // A message has been received from the channel
2381                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2382
2383                std::task::Poll::Ready(Some(match header.ordinal {
2384                0x394a2e29f750323e => {
2385                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2386                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2387                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
2388                    let control_handle = DebianGuestManagerControlHandle {
2389                        inner: this.inner.clone(),
2390                    };
2391                    Ok(DebianGuestManagerRequest::Launch {guest_config: req.guest_config,
2392controller: req.controller,
2393
2394                        responder: DebianGuestManagerLaunchResponder {
2395                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2396                            tx_id: header.tx_id,
2397                        },
2398                    })
2399                }
2400                0x3ad9a012982f872d => {
2401                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2402                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2403                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2404                    let control_handle = DebianGuestManagerControlHandle {
2405                        inner: this.inner.clone(),
2406                    };
2407                    Ok(DebianGuestManagerRequest::ForceShutdown {
2408                        responder: DebianGuestManagerForceShutdownResponder {
2409                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2410                            tx_id: header.tx_id,
2411                        },
2412                    })
2413                }
2414                0x4e489076e3bb15b4 => {
2415                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2416                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2417                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2418                    let control_handle = DebianGuestManagerControlHandle {
2419                        inner: this.inner.clone(),
2420                    };
2421                    Ok(DebianGuestManagerRequest::Connect {controller: req.controller,
2422
2423                        responder: DebianGuestManagerConnectResponder {
2424                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2425                            tx_id: header.tx_id,
2426                        },
2427                    })
2428                }
2429                0x76892614aea695dc => {
2430                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2431                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2432                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2433                    let control_handle = DebianGuestManagerControlHandle {
2434                        inner: this.inner.clone(),
2435                    };
2436                    Ok(DebianGuestManagerRequest::GetInfo {
2437                        responder: DebianGuestManagerGetInfoResponder {
2438                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2439                            tx_id: header.tx_id,
2440                        },
2441                    })
2442                }
2443                _ => Err(fidl::Error::UnknownOrdinal {
2444                    ordinal: header.ordinal,
2445                    protocol_name: <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2446                }),
2447            }))
2448            },
2449        )
2450    }
2451}
2452
2453#[derive(Debug)]
2454pub enum DebianGuestManagerRequest {
2455    /// Launch a new guest instance.
2456    ///
2457    /// Possible errors:
2458    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
2459    ///         problems detected by the guest manager.
2460    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
2461    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
2462    ///         component logs for a more specific failure.
2463    Launch {
2464        guest_config: GuestConfig,
2465        controller: fidl::endpoints::ServerEnd<GuestMarker>,
2466        responder: DebianGuestManagerLaunchResponder,
2467    },
2468    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
2469    /// be used to launch another guest.
2470    ForceShutdown { responder: DebianGuestManagerForceShutdownResponder },
2471    /// Connect to a currently running guest.
2472    ///
2473    /// Possible errors:
2474    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2475    ///         has launched before attempting to reconnect.
2476    Connect {
2477        controller: fidl::endpoints::ServerEnd<GuestMarker>,
2478        responder: DebianGuestManagerConnectResponder,
2479    },
2480    /// Query guest info
2481    GetInfo { responder: DebianGuestManagerGetInfoResponder },
2482}
2483
2484impl DebianGuestManagerRequest {
2485    #[allow(irrefutable_let_patterns)]
2486    pub fn into_launch(
2487        self,
2488    ) -> Option<(
2489        GuestConfig,
2490        fidl::endpoints::ServerEnd<GuestMarker>,
2491        DebianGuestManagerLaunchResponder,
2492    )> {
2493        if let DebianGuestManagerRequest::Launch { guest_config, controller, responder } = self {
2494            Some((guest_config, controller, responder))
2495        } else {
2496            None
2497        }
2498    }
2499
2500    #[allow(irrefutable_let_patterns)]
2501    pub fn into_force_shutdown(self) -> Option<(DebianGuestManagerForceShutdownResponder)> {
2502        if let DebianGuestManagerRequest::ForceShutdown { responder } = self {
2503            Some((responder))
2504        } else {
2505            None
2506        }
2507    }
2508
2509    #[allow(irrefutable_let_patterns)]
2510    pub fn into_connect(
2511        self,
2512    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, DebianGuestManagerConnectResponder)> {
2513        if let DebianGuestManagerRequest::Connect { controller, responder } = self {
2514            Some((controller, responder))
2515        } else {
2516            None
2517        }
2518    }
2519
2520    #[allow(irrefutable_let_patterns)]
2521    pub fn into_get_info(self) -> Option<(DebianGuestManagerGetInfoResponder)> {
2522        if let DebianGuestManagerRequest::GetInfo { responder } = self {
2523            Some((responder))
2524        } else {
2525            None
2526        }
2527    }
2528
2529    /// Name of the method defined in FIDL
2530    pub fn method_name(&self) -> &'static str {
2531        match *self {
2532            DebianGuestManagerRequest::Launch { .. } => "launch",
2533            DebianGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
2534            DebianGuestManagerRequest::Connect { .. } => "connect",
2535            DebianGuestManagerRequest::GetInfo { .. } => "get_info",
2536        }
2537    }
2538}
2539
2540#[derive(Debug, Clone)]
2541pub struct DebianGuestManagerControlHandle {
2542    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2543}
2544
2545impl fidl::endpoints::ControlHandle for DebianGuestManagerControlHandle {
2546    fn shutdown(&self) {
2547        self.inner.shutdown()
2548    }
2549
2550    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2551        self.inner.shutdown_with_epitaph(status)
2552    }
2553
2554    fn is_closed(&self) -> bool {
2555        self.inner.channel().is_closed()
2556    }
2557    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2558        self.inner.channel().on_closed()
2559    }
2560
2561    #[cfg(target_os = "fuchsia")]
2562    fn signal_peer(
2563        &self,
2564        clear_mask: zx::Signals,
2565        set_mask: zx::Signals,
2566    ) -> Result<(), zx_status::Status> {
2567        use fidl::Peered;
2568        self.inner.channel().signal_peer(clear_mask, set_mask)
2569    }
2570}
2571
2572impl DebianGuestManagerControlHandle {}
2573
2574#[must_use = "FIDL methods require a response to be sent"]
2575#[derive(Debug)]
2576pub struct DebianGuestManagerLaunchResponder {
2577    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2578    tx_id: u32,
2579}
2580
2581/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2582/// if the responder is dropped without sending a response, so that the client
2583/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2584impl std::ops::Drop for DebianGuestManagerLaunchResponder {
2585    fn drop(&mut self) {
2586        self.control_handle.shutdown();
2587        // Safety: drops once, never accessed again
2588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2589    }
2590}
2591
2592impl fidl::endpoints::Responder for DebianGuestManagerLaunchResponder {
2593    type ControlHandle = DebianGuestManagerControlHandle;
2594
2595    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2596        &self.control_handle
2597    }
2598
2599    fn drop_without_shutdown(mut self) {
2600        // Safety: drops once, never accessed again due to mem::forget
2601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2602        // Prevent Drop from running (which would shut down the channel)
2603        std::mem::forget(self);
2604    }
2605}
2606
2607impl DebianGuestManagerLaunchResponder {
2608    /// Sends a response to the FIDL transaction.
2609    ///
2610    /// Sets the channel to shutdown if an error occurs.
2611    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2612        let _result = self.send_raw(result);
2613        if _result.is_err() {
2614            self.control_handle.shutdown();
2615        }
2616        self.drop_without_shutdown();
2617        _result
2618    }
2619
2620    /// Similar to "send" but does not shutdown the channel if an error occurs.
2621    pub fn send_no_shutdown_on_err(
2622        self,
2623        mut result: Result<(), GuestManagerError>,
2624    ) -> Result<(), fidl::Error> {
2625        let _result = self.send_raw(result);
2626        self.drop_without_shutdown();
2627        _result
2628    }
2629
2630    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2631        self.control_handle.inner.send::<fidl::encoding::ResultType<
2632            fidl::encoding::EmptyStruct,
2633            GuestManagerError,
2634        >>(
2635            result,
2636            self.tx_id,
2637            0x394a2e29f750323e,
2638            fidl::encoding::DynamicFlags::empty(),
2639        )
2640    }
2641}
2642
2643#[must_use = "FIDL methods require a response to be sent"]
2644#[derive(Debug)]
2645pub struct DebianGuestManagerForceShutdownResponder {
2646    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2647    tx_id: u32,
2648}
2649
2650/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2651/// if the responder is dropped without sending a response, so that the client
2652/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2653impl std::ops::Drop for DebianGuestManagerForceShutdownResponder {
2654    fn drop(&mut self) {
2655        self.control_handle.shutdown();
2656        // Safety: drops once, never accessed again
2657        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2658    }
2659}
2660
2661impl fidl::endpoints::Responder for DebianGuestManagerForceShutdownResponder {
2662    type ControlHandle = DebianGuestManagerControlHandle;
2663
2664    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2665        &self.control_handle
2666    }
2667
2668    fn drop_without_shutdown(mut self) {
2669        // Safety: drops once, never accessed again due to mem::forget
2670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2671        // Prevent Drop from running (which would shut down the channel)
2672        std::mem::forget(self);
2673    }
2674}
2675
2676impl DebianGuestManagerForceShutdownResponder {
2677    /// Sends a response to the FIDL transaction.
2678    ///
2679    /// Sets the channel to shutdown if an error occurs.
2680    pub fn send(self) -> Result<(), fidl::Error> {
2681        let _result = self.send_raw();
2682        if _result.is_err() {
2683            self.control_handle.shutdown();
2684        }
2685        self.drop_without_shutdown();
2686        _result
2687    }
2688
2689    /// Similar to "send" but does not shutdown the channel if an error occurs.
2690    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2691        let _result = self.send_raw();
2692        self.drop_without_shutdown();
2693        _result
2694    }
2695
2696    fn send_raw(&self) -> Result<(), fidl::Error> {
2697        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2698            (),
2699            self.tx_id,
2700            0x3ad9a012982f872d,
2701            fidl::encoding::DynamicFlags::empty(),
2702        )
2703    }
2704}
2705
2706#[must_use = "FIDL methods require a response to be sent"]
2707#[derive(Debug)]
2708pub struct DebianGuestManagerConnectResponder {
2709    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2710    tx_id: u32,
2711}
2712
2713/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2714/// if the responder is dropped without sending a response, so that the client
2715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2716impl std::ops::Drop for DebianGuestManagerConnectResponder {
2717    fn drop(&mut self) {
2718        self.control_handle.shutdown();
2719        // Safety: drops once, never accessed again
2720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2721    }
2722}
2723
2724impl fidl::endpoints::Responder for DebianGuestManagerConnectResponder {
2725    type ControlHandle = DebianGuestManagerControlHandle;
2726
2727    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2728        &self.control_handle
2729    }
2730
2731    fn drop_without_shutdown(mut self) {
2732        // Safety: drops once, never accessed again due to mem::forget
2733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2734        // Prevent Drop from running (which would shut down the channel)
2735        std::mem::forget(self);
2736    }
2737}
2738
2739impl DebianGuestManagerConnectResponder {
2740    /// Sends a response to the FIDL transaction.
2741    ///
2742    /// Sets the channel to shutdown if an error occurs.
2743    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2744        let _result = self.send_raw(result);
2745        if _result.is_err() {
2746            self.control_handle.shutdown();
2747        }
2748        self.drop_without_shutdown();
2749        _result
2750    }
2751
2752    /// Similar to "send" but does not shutdown the channel if an error occurs.
2753    pub fn send_no_shutdown_on_err(
2754        self,
2755        mut result: Result<(), GuestManagerError>,
2756    ) -> Result<(), fidl::Error> {
2757        let _result = self.send_raw(result);
2758        self.drop_without_shutdown();
2759        _result
2760    }
2761
2762    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2763        self.control_handle.inner.send::<fidl::encoding::ResultType<
2764            fidl::encoding::EmptyStruct,
2765            GuestManagerError,
2766        >>(
2767            result,
2768            self.tx_id,
2769            0x4e489076e3bb15b4,
2770            fidl::encoding::DynamicFlags::empty(),
2771        )
2772    }
2773}
2774
2775#[must_use = "FIDL methods require a response to be sent"]
2776#[derive(Debug)]
2777pub struct DebianGuestManagerGetInfoResponder {
2778    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2779    tx_id: u32,
2780}
2781
2782/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2783/// if the responder is dropped without sending a response, so that the client
2784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2785impl std::ops::Drop for DebianGuestManagerGetInfoResponder {
2786    fn drop(&mut self) {
2787        self.control_handle.shutdown();
2788        // Safety: drops once, never accessed again
2789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2790    }
2791}
2792
2793impl fidl::endpoints::Responder for DebianGuestManagerGetInfoResponder {
2794    type ControlHandle = DebianGuestManagerControlHandle;
2795
2796    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2797        &self.control_handle
2798    }
2799
2800    fn drop_without_shutdown(mut self) {
2801        // Safety: drops once, never accessed again due to mem::forget
2802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2803        // Prevent Drop from running (which would shut down the channel)
2804        std::mem::forget(self);
2805    }
2806}
2807
2808impl DebianGuestManagerGetInfoResponder {
2809    /// Sends a response to the FIDL transaction.
2810    ///
2811    /// Sets the channel to shutdown if an error occurs.
2812    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2813        let _result = self.send_raw(guest_info);
2814        if _result.is_err() {
2815            self.control_handle.shutdown();
2816        }
2817        self.drop_without_shutdown();
2818        _result
2819    }
2820
2821    /// Similar to "send" but does not shutdown the channel if an error occurs.
2822    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2823        let _result = self.send_raw(guest_info);
2824        self.drop_without_shutdown();
2825        _result
2826    }
2827
2828    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2829        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
2830            (guest_info,),
2831            self.tx_id,
2832            0x76892614aea695dc,
2833            fidl::encoding::DynamicFlags::empty(),
2834        )
2835    }
2836}
2837
2838#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2839pub struct GuestMarker;
2840
2841impl fidl::endpoints::ProtocolMarker for GuestMarker {
2842    type Proxy = GuestProxy;
2843    type RequestStream = GuestRequestStream;
2844    #[cfg(target_os = "fuchsia")]
2845    type SynchronousProxy = GuestSynchronousProxy;
2846
2847    const DEBUG_NAME: &'static str = "fuchsia.virtualization.Guest";
2848}
2849impl fidl::endpoints::DiscoverableProtocolMarker for GuestMarker {}
2850pub type GuestGetConsoleResult = Result<fidl::Socket, GuestError>;
2851pub type GuestGetHostVsockEndpointResult = Result<(), GuestError>;
2852pub type GuestGetBalloonControllerResult = Result<(), GuestError>;
2853pub type GuestGetMemControllerResult = Result<(), GuestError>;
2854
2855pub trait GuestProxyInterface: Send + Sync {
2856    type GetConsoleResponseFut: std::future::Future<Output = Result<GuestGetConsoleResult, fidl::Error>>
2857        + Send;
2858    fn r#get_console(&self) -> Self::GetConsoleResponseFut;
2859    type GetSerialResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
2860        + Send;
2861    fn r#get_serial(&self) -> Self::GetSerialResponseFut;
2862    type GetHostVsockEndpointResponseFut: std::future::Future<Output = Result<GuestGetHostVsockEndpointResult, fidl::Error>>
2863        + Send;
2864    fn r#get_host_vsock_endpoint(
2865        &self,
2866        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2867    ) -> Self::GetHostVsockEndpointResponseFut;
2868    type GetBalloonControllerResponseFut: std::future::Future<Output = Result<GuestGetBalloonControllerResult, fidl::Error>>
2869        + Send;
2870    fn r#get_balloon_controller(
2871        &self,
2872        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2873    ) -> Self::GetBalloonControllerResponseFut;
2874    type GetMemControllerResponseFut: std::future::Future<Output = Result<GuestGetMemControllerResult, fidl::Error>>
2875        + Send;
2876    fn r#get_mem_controller(
2877        &self,
2878        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2879    ) -> Self::GetMemControllerResponseFut;
2880}
2881#[derive(Debug)]
2882#[cfg(target_os = "fuchsia")]
2883pub struct GuestSynchronousProxy {
2884    client: fidl::client::sync::Client,
2885}
2886
2887#[cfg(target_os = "fuchsia")]
2888impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
2889    type Proxy = GuestProxy;
2890    type Protocol = GuestMarker;
2891
2892    fn from_channel(inner: fidl::Channel) -> Self {
2893        Self::new(inner)
2894    }
2895
2896    fn into_channel(self) -> fidl::Channel {
2897        self.client.into_channel()
2898    }
2899
2900    fn as_channel(&self) -> &fidl::Channel {
2901        self.client.as_channel()
2902    }
2903}
2904
2905#[cfg(target_os = "fuchsia")]
2906impl GuestSynchronousProxy {
2907    pub fn new(channel: fidl::Channel) -> Self {
2908        Self { client: fidl::client::sync::Client::new(channel) }
2909    }
2910
2911    pub fn into_channel(self) -> fidl::Channel {
2912        self.client.into_channel()
2913    }
2914
2915    /// Waits until an event arrives and returns it. It is safe for other
2916    /// threads to make concurrent requests while waiting for an event.
2917    pub fn wait_for_event(
2918        &self,
2919        deadline: zx::MonotonicInstant,
2920    ) -> Result<GuestEvent, fidl::Error> {
2921        GuestEvent::decode(self.client.wait_for_event::<GuestMarker>(deadline)?)
2922    }
2923
2924    /// Get a guest console.
2925    ///
2926    /// The details regarding what output is produced and what input is accepted
2927    /// are determined by each guest, but will typically be a read/write socket
2928    /// with a shell.
2929    ///
2930    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
2931    pub fn r#get_console(
2932        &self,
2933        ___deadline: zx::MonotonicInstant,
2934    ) -> Result<GuestGetConsoleResult, fidl::Error> {
2935        let _response = self.client.send_query::<
2936            fidl::encoding::EmptyPayload,
2937            fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
2938            GuestMarker,
2939        >(
2940            (),
2941            0x48cbcecb7793806e,
2942            fidl::encoding::DynamicFlags::empty(),
2943            ___deadline,
2944        )?;
2945        Ok(_response.map(|x| x.socket))
2946    }
2947
2948    /// Get the socket for low-level guest debug logs.
2949    ///
2950    /// The details regarding what output is produced and what input is accepted
2951    /// are determined by each guest, but will typically be a read-only socket
2952    /// with the guest kernel's serial logs.
2953    pub fn r#get_serial(
2954        &self,
2955        ___deadline: zx::MonotonicInstant,
2956    ) -> Result<fidl::Socket, fidl::Error> {
2957        let _response = self
2958            .client
2959            .send_query::<fidl::encoding::EmptyPayload, GuestGetSerialResponse, GuestMarker>(
2960                (),
2961                0xcdd541a160d7044,
2962                fidl::encoding::DynamicFlags::empty(),
2963                ___deadline,
2964            )?;
2965        Ok(_response.socket)
2966    }
2967
2968    /// Get the vsock endpoint for the guest.
2969    ///
2970    /// This endpoint can be used to register listeners for guest initiated connections, and
2971    /// to initiate connections from a client. If listeners need to be registered before the guest
2972    /// starts so that they are immediately available, set them via the guest config instead of
2973    /// using this endpoint.
2974    ///
2975    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
2976    pub fn r#get_host_vsock_endpoint(
2977        &self,
2978        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2979        ___deadline: zx::MonotonicInstant,
2980    ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
2981        let _response = self.client.send_query::<
2982            GuestGetHostVsockEndpointRequest,
2983            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2984            GuestMarker,
2985        >(
2986            (endpoint,),
2987            0x766e96aeb9c28ed1,
2988            fidl::encoding::DynamicFlags::empty(),
2989            ___deadline,
2990        )?;
2991        Ok(_response.map(|x| x))
2992    }
2993
2994    /// Get the balloon controller endpoint for the guest.
2995    ///
2996    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
2997    pub fn r#get_balloon_controller(
2998        &self,
2999        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3000        ___deadline: zx::MonotonicInstant,
3001    ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
3002        let _response = self.client.send_query::<
3003            GuestGetBalloonControllerRequest,
3004            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3005            GuestMarker,
3006        >(
3007            (controller,),
3008            0x7b210bff219ac84e,
3009            fidl::encoding::DynamicFlags::empty(),
3010            ___deadline,
3011        )?;
3012        Ok(_response.map(|x| x))
3013    }
3014
3015    /// Get the mem controller endpoint for the guest.
3016    ///
3017    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
3018    pub fn r#get_mem_controller(
3019        &self,
3020        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3021        ___deadline: zx::MonotonicInstant,
3022    ) -> Result<GuestGetMemControllerResult, fidl::Error> {
3023        let _response = self.client.send_query::<
3024            GuestGetMemControllerRequest,
3025            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3026            GuestMarker,
3027        >(
3028            (controller,),
3029            0x170b19f4b867a01c,
3030            fidl::encoding::DynamicFlags::empty(),
3031            ___deadline,
3032        )?;
3033        Ok(_response.map(|x| x))
3034    }
3035}
3036
3037#[cfg(target_os = "fuchsia")]
3038impl From<GuestSynchronousProxy> for zx::NullableHandle {
3039    fn from(value: GuestSynchronousProxy) -> Self {
3040        value.into_channel().into()
3041    }
3042}
3043
3044#[cfg(target_os = "fuchsia")]
3045impl From<fidl::Channel> for GuestSynchronousProxy {
3046    fn from(value: fidl::Channel) -> Self {
3047        Self::new(value)
3048    }
3049}
3050
3051#[cfg(target_os = "fuchsia")]
3052impl fidl::endpoints::FromClient for GuestSynchronousProxy {
3053    type Protocol = GuestMarker;
3054
3055    fn from_client(value: fidl::endpoints::ClientEnd<GuestMarker>) -> Self {
3056        Self::new(value.into_channel())
3057    }
3058}
3059
3060#[derive(Debug, Clone)]
3061pub struct GuestProxy {
3062    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3063}
3064
3065impl fidl::endpoints::Proxy for GuestProxy {
3066    type Protocol = GuestMarker;
3067
3068    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3069        Self::new(inner)
3070    }
3071
3072    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3073        self.client.into_channel().map_err(|client| Self { client })
3074    }
3075
3076    fn as_channel(&self) -> &::fidl::AsyncChannel {
3077        self.client.as_channel()
3078    }
3079}
3080
3081impl GuestProxy {
3082    /// Create a new Proxy for fuchsia.virtualization/Guest.
3083    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3084        let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3085        Self { client: fidl::client::Client::new(channel, protocol_name) }
3086    }
3087
3088    /// Get a Stream of events from the remote end of the protocol.
3089    ///
3090    /// # Panics
3091    ///
3092    /// Panics if the event stream was already taken.
3093    pub fn take_event_stream(&self) -> GuestEventStream {
3094        GuestEventStream { event_receiver: self.client.take_event_receiver() }
3095    }
3096
3097    /// Get a guest console.
3098    ///
3099    /// The details regarding what output is produced and what input is accepted
3100    /// are determined by each guest, but will typically be a read/write socket
3101    /// with a shell.
3102    ///
3103    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
3104    pub fn r#get_console(
3105        &self,
3106    ) -> fidl::client::QueryResponseFut<
3107        GuestGetConsoleResult,
3108        fidl::encoding::DefaultFuchsiaResourceDialect,
3109    > {
3110        GuestProxyInterface::r#get_console(self)
3111    }
3112
3113    /// Get the socket for low-level guest debug logs.
3114    ///
3115    /// The details regarding what output is produced and what input is accepted
3116    /// are determined by each guest, but will typically be a read-only socket
3117    /// with the guest kernel's serial logs.
3118    pub fn r#get_serial(
3119        &self,
3120    ) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
3121    {
3122        GuestProxyInterface::r#get_serial(self)
3123    }
3124
3125    /// Get the vsock endpoint for the guest.
3126    ///
3127    /// This endpoint can be used to register listeners for guest initiated connections, and
3128    /// to initiate connections from a client. If listeners need to be registered before the guest
3129    /// starts so that they are immediately available, set them via the guest config instead of
3130    /// using this endpoint.
3131    ///
3132    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
3133    pub fn r#get_host_vsock_endpoint(
3134        &self,
3135        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3136    ) -> fidl::client::QueryResponseFut<
3137        GuestGetHostVsockEndpointResult,
3138        fidl::encoding::DefaultFuchsiaResourceDialect,
3139    > {
3140        GuestProxyInterface::r#get_host_vsock_endpoint(self, endpoint)
3141    }
3142
3143    /// Get the balloon controller endpoint for the guest.
3144    ///
3145    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
3146    pub fn r#get_balloon_controller(
3147        &self,
3148        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3149    ) -> fidl::client::QueryResponseFut<
3150        GuestGetBalloonControllerResult,
3151        fidl::encoding::DefaultFuchsiaResourceDialect,
3152    > {
3153        GuestProxyInterface::r#get_balloon_controller(self, controller)
3154    }
3155
3156    /// Get the mem controller endpoint for the guest.
3157    ///
3158    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
3159    pub fn r#get_mem_controller(
3160        &self,
3161        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3162    ) -> fidl::client::QueryResponseFut<
3163        GuestGetMemControllerResult,
3164        fidl::encoding::DefaultFuchsiaResourceDialect,
3165    > {
3166        GuestProxyInterface::r#get_mem_controller(self, controller)
3167    }
3168}
3169
3170impl GuestProxyInterface for GuestProxy {
3171    type GetConsoleResponseFut = fidl::client::QueryResponseFut<
3172        GuestGetConsoleResult,
3173        fidl::encoding::DefaultFuchsiaResourceDialect,
3174    >;
3175    fn r#get_console(&self) -> Self::GetConsoleResponseFut {
3176        fn _decode(
3177            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3178        ) -> Result<GuestGetConsoleResult, fidl::Error> {
3179            let _response = fidl::client::decode_transaction_body::<
3180                fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
3181                fidl::encoding::DefaultFuchsiaResourceDialect,
3182                0x48cbcecb7793806e,
3183            >(_buf?)?;
3184            Ok(_response.map(|x| x.socket))
3185        }
3186        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestGetConsoleResult>(
3187            (),
3188            0x48cbcecb7793806e,
3189            fidl::encoding::DynamicFlags::empty(),
3190            _decode,
3191        )
3192    }
3193
3194    type GetSerialResponseFut =
3195        fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
3196    fn r#get_serial(&self) -> Self::GetSerialResponseFut {
3197        fn _decode(
3198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3199        ) -> Result<fidl::Socket, fidl::Error> {
3200            let _response = fidl::client::decode_transaction_body::<
3201                GuestGetSerialResponse,
3202                fidl::encoding::DefaultFuchsiaResourceDialect,
3203                0xcdd541a160d7044,
3204            >(_buf?)?;
3205            Ok(_response.socket)
3206        }
3207        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Socket>(
3208            (),
3209            0xcdd541a160d7044,
3210            fidl::encoding::DynamicFlags::empty(),
3211            _decode,
3212        )
3213    }
3214
3215    type GetHostVsockEndpointResponseFut = fidl::client::QueryResponseFut<
3216        GuestGetHostVsockEndpointResult,
3217        fidl::encoding::DefaultFuchsiaResourceDialect,
3218    >;
3219    fn r#get_host_vsock_endpoint(
3220        &self,
3221        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3222    ) -> Self::GetHostVsockEndpointResponseFut {
3223        fn _decode(
3224            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3225        ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
3226            let _response = fidl::client::decode_transaction_body::<
3227                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3228                fidl::encoding::DefaultFuchsiaResourceDialect,
3229                0x766e96aeb9c28ed1,
3230            >(_buf?)?;
3231            Ok(_response.map(|x| x))
3232        }
3233        self.client.send_query_and_decode::<
3234            GuestGetHostVsockEndpointRequest,
3235            GuestGetHostVsockEndpointResult,
3236        >(
3237            (endpoint,),
3238            0x766e96aeb9c28ed1,
3239            fidl::encoding::DynamicFlags::empty(),
3240            _decode,
3241        )
3242    }
3243
3244    type GetBalloonControllerResponseFut = fidl::client::QueryResponseFut<
3245        GuestGetBalloonControllerResult,
3246        fidl::encoding::DefaultFuchsiaResourceDialect,
3247    >;
3248    fn r#get_balloon_controller(
3249        &self,
3250        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3251    ) -> Self::GetBalloonControllerResponseFut {
3252        fn _decode(
3253            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3254        ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
3255            let _response = fidl::client::decode_transaction_body::<
3256                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3257                fidl::encoding::DefaultFuchsiaResourceDialect,
3258                0x7b210bff219ac84e,
3259            >(_buf?)?;
3260            Ok(_response.map(|x| x))
3261        }
3262        self.client.send_query_and_decode::<
3263            GuestGetBalloonControllerRequest,
3264            GuestGetBalloonControllerResult,
3265        >(
3266            (controller,),
3267            0x7b210bff219ac84e,
3268            fidl::encoding::DynamicFlags::empty(),
3269            _decode,
3270        )
3271    }
3272
3273    type GetMemControllerResponseFut = fidl::client::QueryResponseFut<
3274        GuestGetMemControllerResult,
3275        fidl::encoding::DefaultFuchsiaResourceDialect,
3276    >;
3277    fn r#get_mem_controller(
3278        &self,
3279        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3280    ) -> Self::GetMemControllerResponseFut {
3281        fn _decode(
3282            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3283        ) -> Result<GuestGetMemControllerResult, fidl::Error> {
3284            let _response = fidl::client::decode_transaction_body::<
3285                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3286                fidl::encoding::DefaultFuchsiaResourceDialect,
3287                0x170b19f4b867a01c,
3288            >(_buf?)?;
3289            Ok(_response.map(|x| x))
3290        }
3291        self.client
3292            .send_query_and_decode::<GuestGetMemControllerRequest, GuestGetMemControllerResult>(
3293                (controller,),
3294                0x170b19f4b867a01c,
3295                fidl::encoding::DynamicFlags::empty(),
3296                _decode,
3297            )
3298    }
3299}
3300
3301pub struct GuestEventStream {
3302    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3303}
3304
3305impl std::marker::Unpin for GuestEventStream {}
3306
3307impl futures::stream::FusedStream for GuestEventStream {
3308    fn is_terminated(&self) -> bool {
3309        self.event_receiver.is_terminated()
3310    }
3311}
3312
3313impl futures::Stream for GuestEventStream {
3314    type Item = Result<GuestEvent, fidl::Error>;
3315
3316    fn poll_next(
3317        mut self: std::pin::Pin<&mut Self>,
3318        cx: &mut std::task::Context<'_>,
3319    ) -> std::task::Poll<Option<Self::Item>> {
3320        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3321            &mut self.event_receiver,
3322            cx
3323        )?) {
3324            Some(buf) => std::task::Poll::Ready(Some(GuestEvent::decode(buf))),
3325            None => std::task::Poll::Ready(None),
3326        }
3327    }
3328}
3329
3330#[derive(Debug)]
3331pub enum GuestEvent {}
3332
3333impl GuestEvent {
3334    /// Decodes a message buffer as a [`GuestEvent`].
3335    fn decode(
3336        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3337    ) -> Result<GuestEvent, fidl::Error> {
3338        let (bytes, _handles) = buf.split_mut();
3339        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3340        debug_assert_eq!(tx_header.tx_id, 0);
3341        match tx_header.ordinal {
3342            _ => Err(fidl::Error::UnknownOrdinal {
3343                ordinal: tx_header.ordinal,
3344                protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3345            }),
3346        }
3347    }
3348}
3349
3350/// A Stream of incoming requests for fuchsia.virtualization/Guest.
3351pub struct GuestRequestStream {
3352    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3353    is_terminated: bool,
3354}
3355
3356impl std::marker::Unpin for GuestRequestStream {}
3357
3358impl futures::stream::FusedStream for GuestRequestStream {
3359    fn is_terminated(&self) -> bool {
3360        self.is_terminated
3361    }
3362}
3363
3364impl fidl::endpoints::RequestStream for GuestRequestStream {
3365    type Protocol = GuestMarker;
3366    type ControlHandle = GuestControlHandle;
3367
3368    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3369        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3370    }
3371
3372    fn control_handle(&self) -> Self::ControlHandle {
3373        GuestControlHandle { inner: self.inner.clone() }
3374    }
3375
3376    fn into_inner(
3377        self,
3378    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3379    {
3380        (self.inner, self.is_terminated)
3381    }
3382
3383    fn from_inner(
3384        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3385        is_terminated: bool,
3386    ) -> Self {
3387        Self { inner, is_terminated }
3388    }
3389}
3390
3391impl futures::Stream for GuestRequestStream {
3392    type Item = Result<GuestRequest, fidl::Error>;
3393
3394    fn poll_next(
3395        mut self: std::pin::Pin<&mut Self>,
3396        cx: &mut std::task::Context<'_>,
3397    ) -> std::task::Poll<Option<Self::Item>> {
3398        let this = &mut *self;
3399        if this.inner.check_shutdown(cx) {
3400            this.is_terminated = true;
3401            return std::task::Poll::Ready(None);
3402        }
3403        if this.is_terminated {
3404            panic!("polled GuestRequestStream after completion");
3405        }
3406        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3407            |bytes, handles| {
3408                match this.inner.channel().read_etc(cx, bytes, handles) {
3409                    std::task::Poll::Ready(Ok(())) => {}
3410                    std::task::Poll::Pending => return std::task::Poll::Pending,
3411                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3412                        this.is_terminated = true;
3413                        return std::task::Poll::Ready(None);
3414                    }
3415                    std::task::Poll::Ready(Err(e)) => {
3416                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3417                            e.into(),
3418                        ))));
3419                    }
3420                }
3421
3422                // A message has been received from the channel
3423                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3424
3425                std::task::Poll::Ready(Some(match header.ordinal {
3426                    0x48cbcecb7793806e => {
3427                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3428                        let mut req = fidl::new_empty!(
3429                            fidl::encoding::EmptyPayload,
3430                            fidl::encoding::DefaultFuchsiaResourceDialect
3431                        );
3432                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3433                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3434                        Ok(GuestRequest::GetConsole {
3435                            responder: GuestGetConsoleResponder {
3436                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3437                                tx_id: header.tx_id,
3438                            },
3439                        })
3440                    }
3441                    0xcdd541a160d7044 => {
3442                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3443                        let mut req = fidl::new_empty!(
3444                            fidl::encoding::EmptyPayload,
3445                            fidl::encoding::DefaultFuchsiaResourceDialect
3446                        );
3447                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3448                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3449                        Ok(GuestRequest::GetSerial {
3450                            responder: GuestGetSerialResponder {
3451                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3452                                tx_id: header.tx_id,
3453                            },
3454                        })
3455                    }
3456                    0x766e96aeb9c28ed1 => {
3457                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3458                        let mut req = fidl::new_empty!(
3459                            GuestGetHostVsockEndpointRequest,
3460                            fidl::encoding::DefaultFuchsiaResourceDialect
3461                        );
3462                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetHostVsockEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
3463                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3464                        Ok(GuestRequest::GetHostVsockEndpoint {
3465                            endpoint: req.endpoint,
3466
3467                            responder: GuestGetHostVsockEndpointResponder {
3468                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3469                                tx_id: header.tx_id,
3470                            },
3471                        })
3472                    }
3473                    0x7b210bff219ac84e => {
3474                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3475                        let mut req = fidl::new_empty!(
3476                            GuestGetBalloonControllerRequest,
3477                            fidl::encoding::DefaultFuchsiaResourceDialect
3478                        );
3479                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetBalloonControllerRequest>(&header, _body_bytes, handles, &mut req)?;
3480                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3481                        Ok(GuestRequest::GetBalloonController {
3482                            controller: req.controller,
3483
3484                            responder: GuestGetBalloonControllerResponder {
3485                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3486                                tx_id: header.tx_id,
3487                            },
3488                        })
3489                    }
3490                    0x170b19f4b867a01c => {
3491                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3492                        let mut req = fidl::new_empty!(
3493                            GuestGetMemControllerRequest,
3494                            fidl::encoding::DefaultFuchsiaResourceDialect
3495                        );
3496                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetMemControllerRequest>(&header, _body_bytes, handles, &mut req)?;
3497                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3498                        Ok(GuestRequest::GetMemController {
3499                            controller: req.controller,
3500
3501                            responder: GuestGetMemControllerResponder {
3502                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3503                                tx_id: header.tx_id,
3504                            },
3505                        })
3506                    }
3507                    _ => Err(fidl::Error::UnknownOrdinal {
3508                        ordinal: header.ordinal,
3509                        protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3510                    }),
3511                }))
3512            },
3513        )
3514    }
3515}
3516
3517/// The guest client API providing high level access to guest features. When the guest terminates,
3518/// this channel will contain a ZX_OK epitaph on a clean shutdown, a ZX_ERR_INTERNAL epitaph on
3519/// an unexpected shutdown, and no epitaph if the component crashed.
3520#[derive(Debug)]
3521pub enum GuestRequest {
3522    /// Get a guest console.
3523    ///
3524    /// The details regarding what output is produced and what input is accepted
3525    /// are determined by each guest, but will typically be a read/write socket
3526    /// with a shell.
3527    ///
3528    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
3529    GetConsole { responder: GuestGetConsoleResponder },
3530    /// Get the socket for low-level guest debug logs.
3531    ///
3532    /// The details regarding what output is produced and what input is accepted
3533    /// are determined by each guest, but will typically be a read-only socket
3534    /// with the guest kernel's serial logs.
3535    GetSerial { responder: GuestGetSerialResponder },
3536    /// Get the vsock endpoint for the guest.
3537    ///
3538    /// This endpoint can be used to register listeners for guest initiated connections, and
3539    /// to initiate connections from a client. If listeners need to be registered before the guest
3540    /// starts so that they are immediately available, set them via the guest config instead of
3541    /// using this endpoint.
3542    ///
3543    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
3544    GetHostVsockEndpoint {
3545        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3546        responder: GuestGetHostVsockEndpointResponder,
3547    },
3548    /// Get the balloon controller endpoint for the guest.
3549    ///
3550    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
3551    GetBalloonController {
3552        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3553        responder: GuestGetBalloonControllerResponder,
3554    },
3555    /// Get the mem controller endpoint for the guest.
3556    ///
3557    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
3558    GetMemController {
3559        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3560        responder: GuestGetMemControllerResponder,
3561    },
3562}
3563
3564impl GuestRequest {
3565    #[allow(irrefutable_let_patterns)]
3566    pub fn into_get_console(self) -> Option<(GuestGetConsoleResponder)> {
3567        if let GuestRequest::GetConsole { responder } = self { Some((responder)) } else { None }
3568    }
3569
3570    #[allow(irrefutable_let_patterns)]
3571    pub fn into_get_serial(self) -> Option<(GuestGetSerialResponder)> {
3572        if let GuestRequest::GetSerial { responder } = self { Some((responder)) } else { None }
3573    }
3574
3575    #[allow(irrefutable_let_patterns)]
3576    pub fn into_get_host_vsock_endpoint(
3577        self,
3578    ) -> Option<(
3579        fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3580        GuestGetHostVsockEndpointResponder,
3581    )> {
3582        if let GuestRequest::GetHostVsockEndpoint { endpoint, responder } = self {
3583            Some((endpoint, responder))
3584        } else {
3585            None
3586        }
3587    }
3588
3589    #[allow(irrefutable_let_patterns)]
3590    pub fn into_get_balloon_controller(
3591        self,
3592    ) -> Option<(
3593        fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3594        GuestGetBalloonControllerResponder,
3595    )> {
3596        if let GuestRequest::GetBalloonController { controller, responder } = self {
3597            Some((controller, responder))
3598        } else {
3599            None
3600        }
3601    }
3602
3603    #[allow(irrefutable_let_patterns)]
3604    pub fn into_get_mem_controller(
3605        self,
3606    ) -> Option<(fidl::endpoints::ServerEnd<MemControllerMarker>, GuestGetMemControllerResponder)>
3607    {
3608        if let GuestRequest::GetMemController { controller, responder } = self {
3609            Some((controller, responder))
3610        } else {
3611            None
3612        }
3613    }
3614
3615    /// Name of the method defined in FIDL
3616    pub fn method_name(&self) -> &'static str {
3617        match *self {
3618            GuestRequest::GetConsole { .. } => "get_console",
3619            GuestRequest::GetSerial { .. } => "get_serial",
3620            GuestRequest::GetHostVsockEndpoint { .. } => "get_host_vsock_endpoint",
3621            GuestRequest::GetBalloonController { .. } => "get_balloon_controller",
3622            GuestRequest::GetMemController { .. } => "get_mem_controller",
3623        }
3624    }
3625}
3626
3627#[derive(Debug, Clone)]
3628pub struct GuestControlHandle {
3629    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3630}
3631
3632impl fidl::endpoints::ControlHandle for GuestControlHandle {
3633    fn shutdown(&self) {
3634        self.inner.shutdown()
3635    }
3636
3637    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3638        self.inner.shutdown_with_epitaph(status)
3639    }
3640
3641    fn is_closed(&self) -> bool {
3642        self.inner.channel().is_closed()
3643    }
3644    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3645        self.inner.channel().on_closed()
3646    }
3647
3648    #[cfg(target_os = "fuchsia")]
3649    fn signal_peer(
3650        &self,
3651        clear_mask: zx::Signals,
3652        set_mask: zx::Signals,
3653    ) -> Result<(), zx_status::Status> {
3654        use fidl::Peered;
3655        self.inner.channel().signal_peer(clear_mask, set_mask)
3656    }
3657}
3658
3659impl GuestControlHandle {}
3660
3661#[must_use = "FIDL methods require a response to be sent"]
3662#[derive(Debug)]
3663pub struct GuestGetConsoleResponder {
3664    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3665    tx_id: u32,
3666}
3667
3668/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3669/// if the responder is dropped without sending a response, so that the client
3670/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3671impl std::ops::Drop for GuestGetConsoleResponder {
3672    fn drop(&mut self) {
3673        self.control_handle.shutdown();
3674        // Safety: drops once, never accessed again
3675        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3676    }
3677}
3678
3679impl fidl::endpoints::Responder for GuestGetConsoleResponder {
3680    type ControlHandle = GuestControlHandle;
3681
3682    fn control_handle(&self) -> &GuestControlHandle {
3683        &self.control_handle
3684    }
3685
3686    fn drop_without_shutdown(mut self) {
3687        // Safety: drops once, never accessed again due to mem::forget
3688        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3689        // Prevent Drop from running (which would shut down the channel)
3690        std::mem::forget(self);
3691    }
3692}
3693
3694impl GuestGetConsoleResponder {
3695    /// Sends a response to the FIDL transaction.
3696    ///
3697    /// Sets the channel to shutdown if an error occurs.
3698    pub fn send(self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
3699        let _result = self.send_raw(result);
3700        if _result.is_err() {
3701            self.control_handle.shutdown();
3702        }
3703        self.drop_without_shutdown();
3704        _result
3705    }
3706
3707    /// Similar to "send" but does not shutdown the channel if an error occurs.
3708    pub fn send_no_shutdown_on_err(
3709        self,
3710        mut result: Result<fidl::Socket, GuestError>,
3711    ) -> Result<(), fidl::Error> {
3712        let _result = self.send_raw(result);
3713        self.drop_without_shutdown();
3714        _result
3715    }
3716
3717    fn send_raw(&self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
3718        self.control_handle
3719            .inner
3720            .send::<fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>>(
3721                result.map(|socket| (socket,)),
3722                self.tx_id,
3723                0x48cbcecb7793806e,
3724                fidl::encoding::DynamicFlags::empty(),
3725            )
3726    }
3727}
3728
3729#[must_use = "FIDL methods require a response to be sent"]
3730#[derive(Debug)]
3731pub struct GuestGetSerialResponder {
3732    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3733    tx_id: u32,
3734}
3735
3736/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3737/// if the responder is dropped without sending a response, so that the client
3738/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3739impl std::ops::Drop for GuestGetSerialResponder {
3740    fn drop(&mut self) {
3741        self.control_handle.shutdown();
3742        // Safety: drops once, never accessed again
3743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3744    }
3745}
3746
3747impl fidl::endpoints::Responder for GuestGetSerialResponder {
3748    type ControlHandle = GuestControlHandle;
3749
3750    fn control_handle(&self) -> &GuestControlHandle {
3751        &self.control_handle
3752    }
3753
3754    fn drop_without_shutdown(mut self) {
3755        // Safety: drops once, never accessed again due to mem::forget
3756        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3757        // Prevent Drop from running (which would shut down the channel)
3758        std::mem::forget(self);
3759    }
3760}
3761
3762impl GuestGetSerialResponder {
3763    /// Sends a response to the FIDL transaction.
3764    ///
3765    /// Sets the channel to shutdown if an error occurs.
3766    pub fn send(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3767        let _result = self.send_raw(socket);
3768        if _result.is_err() {
3769            self.control_handle.shutdown();
3770        }
3771        self.drop_without_shutdown();
3772        _result
3773    }
3774
3775    /// Similar to "send" but does not shutdown the channel if an error occurs.
3776    pub fn send_no_shutdown_on_err(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3777        let _result = self.send_raw(socket);
3778        self.drop_without_shutdown();
3779        _result
3780    }
3781
3782    fn send_raw(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3783        self.control_handle.inner.send::<GuestGetSerialResponse>(
3784            (socket,),
3785            self.tx_id,
3786            0xcdd541a160d7044,
3787            fidl::encoding::DynamicFlags::empty(),
3788        )
3789    }
3790}
3791
3792#[must_use = "FIDL methods require a response to be sent"]
3793#[derive(Debug)]
3794pub struct GuestGetHostVsockEndpointResponder {
3795    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3796    tx_id: u32,
3797}
3798
3799/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3800/// if the responder is dropped without sending a response, so that the client
3801/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3802impl std::ops::Drop for GuestGetHostVsockEndpointResponder {
3803    fn drop(&mut self) {
3804        self.control_handle.shutdown();
3805        // Safety: drops once, never accessed again
3806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3807    }
3808}
3809
3810impl fidl::endpoints::Responder for GuestGetHostVsockEndpointResponder {
3811    type ControlHandle = GuestControlHandle;
3812
3813    fn control_handle(&self) -> &GuestControlHandle {
3814        &self.control_handle
3815    }
3816
3817    fn drop_without_shutdown(mut self) {
3818        // Safety: drops once, never accessed again due to mem::forget
3819        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3820        // Prevent Drop from running (which would shut down the channel)
3821        std::mem::forget(self);
3822    }
3823}
3824
3825impl GuestGetHostVsockEndpointResponder {
3826    /// Sends a response to the FIDL transaction.
3827    ///
3828    /// Sets the channel to shutdown if an error occurs.
3829    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3830        let _result = self.send_raw(result);
3831        if _result.is_err() {
3832            self.control_handle.shutdown();
3833        }
3834        self.drop_without_shutdown();
3835        _result
3836    }
3837
3838    /// Similar to "send" but does not shutdown the channel if an error occurs.
3839    pub fn send_no_shutdown_on_err(
3840        self,
3841        mut result: Result<(), GuestError>,
3842    ) -> Result<(), fidl::Error> {
3843        let _result = self.send_raw(result);
3844        self.drop_without_shutdown();
3845        _result
3846    }
3847
3848    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3849        self.control_handle
3850            .inner
3851            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3852                result,
3853                self.tx_id,
3854                0x766e96aeb9c28ed1,
3855                fidl::encoding::DynamicFlags::empty(),
3856            )
3857    }
3858}
3859
3860#[must_use = "FIDL methods require a response to be sent"]
3861#[derive(Debug)]
3862pub struct GuestGetBalloonControllerResponder {
3863    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3864    tx_id: u32,
3865}
3866
3867/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3868/// if the responder is dropped without sending a response, so that the client
3869/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3870impl std::ops::Drop for GuestGetBalloonControllerResponder {
3871    fn drop(&mut self) {
3872        self.control_handle.shutdown();
3873        // Safety: drops once, never accessed again
3874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3875    }
3876}
3877
3878impl fidl::endpoints::Responder for GuestGetBalloonControllerResponder {
3879    type ControlHandle = GuestControlHandle;
3880
3881    fn control_handle(&self) -> &GuestControlHandle {
3882        &self.control_handle
3883    }
3884
3885    fn drop_without_shutdown(mut self) {
3886        // Safety: drops once, never accessed again due to mem::forget
3887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3888        // Prevent Drop from running (which would shut down the channel)
3889        std::mem::forget(self);
3890    }
3891}
3892
3893impl GuestGetBalloonControllerResponder {
3894    /// Sends a response to the FIDL transaction.
3895    ///
3896    /// Sets the channel to shutdown if an error occurs.
3897    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3898        let _result = self.send_raw(result);
3899        if _result.is_err() {
3900            self.control_handle.shutdown();
3901        }
3902        self.drop_without_shutdown();
3903        _result
3904    }
3905
3906    /// Similar to "send" but does not shutdown the channel if an error occurs.
3907    pub fn send_no_shutdown_on_err(
3908        self,
3909        mut result: Result<(), GuestError>,
3910    ) -> Result<(), fidl::Error> {
3911        let _result = self.send_raw(result);
3912        self.drop_without_shutdown();
3913        _result
3914    }
3915
3916    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3917        self.control_handle
3918            .inner
3919            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3920                result,
3921                self.tx_id,
3922                0x7b210bff219ac84e,
3923                fidl::encoding::DynamicFlags::empty(),
3924            )
3925    }
3926}
3927
3928#[must_use = "FIDL methods require a response to be sent"]
3929#[derive(Debug)]
3930pub struct GuestGetMemControllerResponder {
3931    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3932    tx_id: u32,
3933}
3934
3935/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3936/// if the responder is dropped without sending a response, so that the client
3937/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3938impl std::ops::Drop for GuestGetMemControllerResponder {
3939    fn drop(&mut self) {
3940        self.control_handle.shutdown();
3941        // Safety: drops once, never accessed again
3942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3943    }
3944}
3945
3946impl fidl::endpoints::Responder for GuestGetMemControllerResponder {
3947    type ControlHandle = GuestControlHandle;
3948
3949    fn control_handle(&self) -> &GuestControlHandle {
3950        &self.control_handle
3951    }
3952
3953    fn drop_without_shutdown(mut self) {
3954        // Safety: drops once, never accessed again due to mem::forget
3955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3956        // Prevent Drop from running (which would shut down the channel)
3957        std::mem::forget(self);
3958    }
3959}
3960
3961impl GuestGetMemControllerResponder {
3962    /// Sends a response to the FIDL transaction.
3963    ///
3964    /// Sets the channel to shutdown if an error occurs.
3965    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3966        let _result = self.send_raw(result);
3967        if _result.is_err() {
3968            self.control_handle.shutdown();
3969        }
3970        self.drop_without_shutdown();
3971        _result
3972    }
3973
3974    /// Similar to "send" but does not shutdown the channel if an error occurs.
3975    pub fn send_no_shutdown_on_err(
3976        self,
3977        mut result: Result<(), GuestError>,
3978    ) -> Result<(), fidl::Error> {
3979        let _result = self.send_raw(result);
3980        self.drop_without_shutdown();
3981        _result
3982    }
3983
3984    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3985        self.control_handle
3986            .inner
3987            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3988                result,
3989                self.tx_id,
3990                0x170b19f4b867a01c,
3991                fidl::encoding::DynamicFlags::empty(),
3992            )
3993    }
3994}
3995
3996#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3997pub struct GuestLifecycleMarker;
3998
3999impl fidl::endpoints::ProtocolMarker for GuestLifecycleMarker {
4000    type Proxy = GuestLifecycleProxy;
4001    type RequestStream = GuestLifecycleRequestStream;
4002    #[cfg(target_os = "fuchsia")]
4003    type SynchronousProxy = GuestLifecycleSynchronousProxy;
4004
4005    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestLifecycle";
4006}
4007impl fidl::endpoints::DiscoverableProtocolMarker for GuestLifecycleMarker {}
4008pub type GuestLifecycleCreateResult = Result<(), GuestError>;
4009pub type GuestLifecycleRunResult = Result<(), GuestError>;
4010
4011pub trait GuestLifecycleProxyInterface: Send + Sync {
4012    type CreateResponseFut: std::future::Future<Output = Result<GuestLifecycleCreateResult, fidl::Error>>
4013        + Send;
4014    fn r#create(&self, guest_config: GuestConfig) -> Self::CreateResponseFut;
4015    fn r#bind(&self, guest: fidl::endpoints::ServerEnd<GuestMarker>) -> Result<(), fidl::Error>;
4016    type RunResponseFut: std::future::Future<Output = Result<GuestLifecycleRunResult, fidl::Error>>
4017        + Send;
4018    fn r#run(&self) -> Self::RunResponseFut;
4019    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4020    fn r#stop(&self) -> Self::StopResponseFut;
4021}
4022#[derive(Debug)]
4023#[cfg(target_os = "fuchsia")]
4024pub struct GuestLifecycleSynchronousProxy {
4025    client: fidl::client::sync::Client,
4026}
4027
4028#[cfg(target_os = "fuchsia")]
4029impl fidl::endpoints::SynchronousProxy for GuestLifecycleSynchronousProxy {
4030    type Proxy = GuestLifecycleProxy;
4031    type Protocol = GuestLifecycleMarker;
4032
4033    fn from_channel(inner: fidl::Channel) -> Self {
4034        Self::new(inner)
4035    }
4036
4037    fn into_channel(self) -> fidl::Channel {
4038        self.client.into_channel()
4039    }
4040
4041    fn as_channel(&self) -> &fidl::Channel {
4042        self.client.as_channel()
4043    }
4044}
4045
4046#[cfg(target_os = "fuchsia")]
4047impl GuestLifecycleSynchronousProxy {
4048    pub fn new(channel: fidl::Channel) -> Self {
4049        Self { client: fidl::client::sync::Client::new(channel) }
4050    }
4051
4052    pub fn into_channel(self) -> fidl::Channel {
4053        self.client.into_channel()
4054    }
4055
4056    /// Waits until an event arrives and returns it. It is safe for other
4057    /// threads to make concurrent requests while waiting for an event.
4058    pub fn wait_for_event(
4059        &self,
4060        deadline: zx::MonotonicInstant,
4061    ) -> Result<GuestLifecycleEvent, fidl::Error> {
4062        GuestLifecycleEvent::decode(self.client.wait_for_event::<GuestLifecycleMarker>(deadline)?)
4063    }
4064
4065    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4066    /// the kernel without starting the VCPU or device dispatch loops.
4067    ///
4068    /// Possible errors:
4069    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4070    ///         recreated.
4071    ///
4072    /// All other errors are related to VMM initialization.
4073    pub fn r#create(
4074        &self,
4075        mut guest_config: GuestConfig,
4076        ___deadline: zx::MonotonicInstant,
4077    ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
4078        let _response = self.client.send_query::<
4079            GuestLifecycleCreateRequest,
4080            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4081            GuestLifecycleMarker,
4082        >(
4083            (&mut guest_config,),
4084            0x152719eed416ed41,
4085            fidl::encoding::DynamicFlags::empty(),
4086            ___deadline,
4087        )?;
4088        Ok(_response.map(|x| x))
4089    }
4090
4091    /// Binds to the Guest protocol for an initialized guest.
4092    ///
4093    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4094    /// will be immediately closed.
4095    pub fn r#bind(
4096        &self,
4097        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4098    ) -> Result<(), fidl::Error> {
4099        self.client.send::<GuestLifecycleBindRequest>(
4100            (guest,),
4101            0x57dd3e245f9598ed,
4102            fidl::encoding::DynamicFlags::empty(),
4103        )
4104    }
4105
4106    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4107    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4108    ///
4109    /// Possible errors:
4110    ///     - ALREADY_RUNING: The VMM has already been started.
4111    ///     - NOT_CREATED: Run was called before the VMM was created.
4112    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4113    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4114    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4115    pub fn r#run(
4116        &self,
4117        ___deadline: zx::MonotonicInstant,
4118    ) -> Result<GuestLifecycleRunResult, fidl::Error> {
4119        let _response = self.client.send_query::<
4120            fidl::encoding::EmptyPayload,
4121            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4122            GuestLifecycleMarker,
4123        >(
4124            (),
4125            0x2907fef2ac775657,
4126            fidl::encoding::DynamicFlags::empty(),
4127            ___deadline,
4128        )?;
4129        Ok(_response.map(|x| x))
4130    }
4131
4132    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4133    /// Create and then Run can be called again.
4134    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4135        let _response = self.client.send_query::<
4136            fidl::encoding::EmptyPayload,
4137            fidl::encoding::EmptyPayload,
4138            GuestLifecycleMarker,
4139        >(
4140            (),
4141            0x27eef9c535ac8eb4,
4142            fidl::encoding::DynamicFlags::empty(),
4143            ___deadline,
4144        )?;
4145        Ok(_response)
4146    }
4147}
4148
4149#[cfg(target_os = "fuchsia")]
4150impl From<GuestLifecycleSynchronousProxy> for zx::NullableHandle {
4151    fn from(value: GuestLifecycleSynchronousProxy) -> Self {
4152        value.into_channel().into()
4153    }
4154}
4155
4156#[cfg(target_os = "fuchsia")]
4157impl From<fidl::Channel> for GuestLifecycleSynchronousProxy {
4158    fn from(value: fidl::Channel) -> Self {
4159        Self::new(value)
4160    }
4161}
4162
4163#[cfg(target_os = "fuchsia")]
4164impl fidl::endpoints::FromClient for GuestLifecycleSynchronousProxy {
4165    type Protocol = GuestLifecycleMarker;
4166
4167    fn from_client(value: fidl::endpoints::ClientEnd<GuestLifecycleMarker>) -> Self {
4168        Self::new(value.into_channel())
4169    }
4170}
4171
4172#[derive(Debug, Clone)]
4173pub struct GuestLifecycleProxy {
4174    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4175}
4176
4177impl fidl::endpoints::Proxy for GuestLifecycleProxy {
4178    type Protocol = GuestLifecycleMarker;
4179
4180    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4181        Self::new(inner)
4182    }
4183
4184    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4185        self.client.into_channel().map_err(|client| Self { client })
4186    }
4187
4188    fn as_channel(&self) -> &::fidl::AsyncChannel {
4189        self.client.as_channel()
4190    }
4191}
4192
4193impl GuestLifecycleProxy {
4194    /// Create a new Proxy for fuchsia.virtualization/GuestLifecycle.
4195    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4196        let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4197        Self { client: fidl::client::Client::new(channel, protocol_name) }
4198    }
4199
4200    /// Get a Stream of events from the remote end of the protocol.
4201    ///
4202    /// # Panics
4203    ///
4204    /// Panics if the event stream was already taken.
4205    pub fn take_event_stream(&self) -> GuestLifecycleEventStream {
4206        GuestLifecycleEventStream { event_receiver: self.client.take_event_receiver() }
4207    }
4208
4209    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4210    /// the kernel without starting the VCPU or device dispatch loops.
4211    ///
4212    /// Possible errors:
4213    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4214    ///         recreated.
4215    ///
4216    /// All other errors are related to VMM initialization.
4217    pub fn r#create(
4218        &self,
4219        mut guest_config: GuestConfig,
4220    ) -> fidl::client::QueryResponseFut<
4221        GuestLifecycleCreateResult,
4222        fidl::encoding::DefaultFuchsiaResourceDialect,
4223    > {
4224        GuestLifecycleProxyInterface::r#create(self, guest_config)
4225    }
4226
4227    /// Binds to the Guest protocol for an initialized guest.
4228    ///
4229    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4230    /// will be immediately closed.
4231    pub fn r#bind(
4232        &self,
4233        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4234    ) -> Result<(), fidl::Error> {
4235        GuestLifecycleProxyInterface::r#bind(self, guest)
4236    }
4237
4238    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4239    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4240    ///
4241    /// Possible errors:
4242    ///     - ALREADY_RUNING: The VMM has already been started.
4243    ///     - NOT_CREATED: Run was called before the VMM was created.
4244    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4245    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4246    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4247    pub fn r#run(
4248        &self,
4249    ) -> fidl::client::QueryResponseFut<
4250        GuestLifecycleRunResult,
4251        fidl::encoding::DefaultFuchsiaResourceDialect,
4252    > {
4253        GuestLifecycleProxyInterface::r#run(self)
4254    }
4255
4256    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4257    /// Create and then Run can be called again.
4258    pub fn r#stop(
4259        &self,
4260    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4261        GuestLifecycleProxyInterface::r#stop(self)
4262    }
4263}
4264
4265impl GuestLifecycleProxyInterface for GuestLifecycleProxy {
4266    type CreateResponseFut = fidl::client::QueryResponseFut<
4267        GuestLifecycleCreateResult,
4268        fidl::encoding::DefaultFuchsiaResourceDialect,
4269    >;
4270    fn r#create(&self, mut guest_config: GuestConfig) -> Self::CreateResponseFut {
4271        fn _decode(
4272            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4273        ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
4274            let _response = fidl::client::decode_transaction_body::<
4275                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4276                fidl::encoding::DefaultFuchsiaResourceDialect,
4277                0x152719eed416ed41,
4278            >(_buf?)?;
4279            Ok(_response.map(|x| x))
4280        }
4281        self.client
4282            .send_query_and_decode::<GuestLifecycleCreateRequest, GuestLifecycleCreateResult>(
4283                (&mut guest_config,),
4284                0x152719eed416ed41,
4285                fidl::encoding::DynamicFlags::empty(),
4286                _decode,
4287            )
4288    }
4289
4290    fn r#bind(
4291        &self,
4292        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4293    ) -> Result<(), fidl::Error> {
4294        self.client.send::<GuestLifecycleBindRequest>(
4295            (guest,),
4296            0x57dd3e245f9598ed,
4297            fidl::encoding::DynamicFlags::empty(),
4298        )
4299    }
4300
4301    type RunResponseFut = fidl::client::QueryResponseFut<
4302        GuestLifecycleRunResult,
4303        fidl::encoding::DefaultFuchsiaResourceDialect,
4304    >;
4305    fn r#run(&self) -> Self::RunResponseFut {
4306        fn _decode(
4307            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4308        ) -> Result<GuestLifecycleRunResult, fidl::Error> {
4309            let _response = fidl::client::decode_transaction_body::<
4310                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4311                fidl::encoding::DefaultFuchsiaResourceDialect,
4312                0x2907fef2ac775657,
4313            >(_buf?)?;
4314            Ok(_response.map(|x| x))
4315        }
4316        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestLifecycleRunResult>(
4317            (),
4318            0x2907fef2ac775657,
4319            fidl::encoding::DynamicFlags::empty(),
4320            _decode,
4321        )
4322    }
4323
4324    type StopResponseFut =
4325        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4326    fn r#stop(&self) -> Self::StopResponseFut {
4327        fn _decode(
4328            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4329        ) -> Result<(), fidl::Error> {
4330            let _response = fidl::client::decode_transaction_body::<
4331                fidl::encoding::EmptyPayload,
4332                fidl::encoding::DefaultFuchsiaResourceDialect,
4333                0x27eef9c535ac8eb4,
4334            >(_buf?)?;
4335            Ok(_response)
4336        }
4337        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4338            (),
4339            0x27eef9c535ac8eb4,
4340            fidl::encoding::DynamicFlags::empty(),
4341            _decode,
4342        )
4343    }
4344}
4345
4346pub struct GuestLifecycleEventStream {
4347    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4348}
4349
4350impl std::marker::Unpin for GuestLifecycleEventStream {}
4351
4352impl futures::stream::FusedStream for GuestLifecycleEventStream {
4353    fn is_terminated(&self) -> bool {
4354        self.event_receiver.is_terminated()
4355    }
4356}
4357
4358impl futures::Stream for GuestLifecycleEventStream {
4359    type Item = Result<GuestLifecycleEvent, fidl::Error>;
4360
4361    fn poll_next(
4362        mut self: std::pin::Pin<&mut Self>,
4363        cx: &mut std::task::Context<'_>,
4364    ) -> std::task::Poll<Option<Self::Item>> {
4365        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4366            &mut self.event_receiver,
4367            cx
4368        )?) {
4369            Some(buf) => std::task::Poll::Ready(Some(GuestLifecycleEvent::decode(buf))),
4370            None => std::task::Poll::Ready(None),
4371        }
4372    }
4373}
4374
4375#[derive(Debug)]
4376pub enum GuestLifecycleEvent {}
4377
4378impl GuestLifecycleEvent {
4379    /// Decodes a message buffer as a [`GuestLifecycleEvent`].
4380    fn decode(
4381        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4382    ) -> Result<GuestLifecycleEvent, fidl::Error> {
4383        let (bytes, _handles) = buf.split_mut();
4384        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4385        debug_assert_eq!(tx_header.tx_id, 0);
4386        match tx_header.ordinal {
4387            _ => Err(fidl::Error::UnknownOrdinal {
4388                ordinal: tx_header.ordinal,
4389                protocol_name:
4390                    <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4391            }),
4392        }
4393    }
4394}
4395
4396/// A Stream of incoming requests for fuchsia.virtualization/GuestLifecycle.
4397pub struct GuestLifecycleRequestStream {
4398    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4399    is_terminated: bool,
4400}
4401
4402impl std::marker::Unpin for GuestLifecycleRequestStream {}
4403
4404impl futures::stream::FusedStream for GuestLifecycleRequestStream {
4405    fn is_terminated(&self) -> bool {
4406        self.is_terminated
4407    }
4408}
4409
4410impl fidl::endpoints::RequestStream for GuestLifecycleRequestStream {
4411    type Protocol = GuestLifecycleMarker;
4412    type ControlHandle = GuestLifecycleControlHandle;
4413
4414    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4415        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4416    }
4417
4418    fn control_handle(&self) -> Self::ControlHandle {
4419        GuestLifecycleControlHandle { inner: self.inner.clone() }
4420    }
4421
4422    fn into_inner(
4423        self,
4424    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4425    {
4426        (self.inner, self.is_terminated)
4427    }
4428
4429    fn from_inner(
4430        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4431        is_terminated: bool,
4432    ) -> Self {
4433        Self { inner, is_terminated }
4434    }
4435}
4436
4437impl futures::Stream for GuestLifecycleRequestStream {
4438    type Item = Result<GuestLifecycleRequest, fidl::Error>;
4439
4440    fn poll_next(
4441        mut self: std::pin::Pin<&mut Self>,
4442        cx: &mut std::task::Context<'_>,
4443    ) -> std::task::Poll<Option<Self::Item>> {
4444        let this = &mut *self;
4445        if this.inner.check_shutdown(cx) {
4446            this.is_terminated = true;
4447            return std::task::Poll::Ready(None);
4448        }
4449        if this.is_terminated {
4450            panic!("polled GuestLifecycleRequestStream after completion");
4451        }
4452        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4453            |bytes, handles| {
4454                match this.inner.channel().read_etc(cx, bytes, handles) {
4455                    std::task::Poll::Ready(Ok(())) => {}
4456                    std::task::Poll::Pending => return std::task::Poll::Pending,
4457                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4458                        this.is_terminated = true;
4459                        return std::task::Poll::Ready(None);
4460                    }
4461                    std::task::Poll::Ready(Err(e)) => {
4462                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4463                            e.into(),
4464                        ))));
4465                    }
4466                }
4467
4468                // A message has been received from the channel
4469                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4470
4471                std::task::Poll::Ready(Some(match header.ordinal {
4472                    0x152719eed416ed41 => {
4473                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4474                        let mut req = fidl::new_empty!(
4475                            GuestLifecycleCreateRequest,
4476                            fidl::encoding::DefaultFuchsiaResourceDialect
4477                        );
4478                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4479                        let control_handle =
4480                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4481                        Ok(GuestLifecycleRequest::Create {
4482                            guest_config: req.guest_config,
4483
4484                            responder: GuestLifecycleCreateResponder {
4485                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4486                                tx_id: header.tx_id,
4487                            },
4488                        })
4489                    }
4490                    0x57dd3e245f9598ed => {
4491                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4492                        let mut req = fidl::new_empty!(
4493                            GuestLifecycleBindRequest,
4494                            fidl::encoding::DefaultFuchsiaResourceDialect
4495                        );
4496                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleBindRequest>(&header, _body_bytes, handles, &mut req)?;
4497                        let control_handle =
4498                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4499                        Ok(GuestLifecycleRequest::Bind { guest: req.guest, control_handle })
4500                    }
4501                    0x2907fef2ac775657 => {
4502                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4503                        let mut req = fidl::new_empty!(
4504                            fidl::encoding::EmptyPayload,
4505                            fidl::encoding::DefaultFuchsiaResourceDialect
4506                        );
4507                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4508                        let control_handle =
4509                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4510                        Ok(GuestLifecycleRequest::Run {
4511                            responder: GuestLifecycleRunResponder {
4512                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4513                                tx_id: header.tx_id,
4514                            },
4515                        })
4516                    }
4517                    0x27eef9c535ac8eb4 => {
4518                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4519                        let mut req = fidl::new_empty!(
4520                            fidl::encoding::EmptyPayload,
4521                            fidl::encoding::DefaultFuchsiaResourceDialect
4522                        );
4523                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4524                        let control_handle =
4525                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4526                        Ok(GuestLifecycleRequest::Stop {
4527                            responder: GuestLifecycleStopResponder {
4528                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4529                                tx_id: header.tx_id,
4530                            },
4531                        })
4532                    }
4533                    _ => Err(fidl::Error::UnknownOrdinal {
4534                        ordinal: header.ordinal,
4535                        protocol_name:
4536                            <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4537                    }),
4538                }))
4539            },
4540        )
4541    }
4542}
4543
4544/// The guest control plane allowing for creating, starting, and stopping the guest.
4545#[derive(Debug)]
4546pub enum GuestLifecycleRequest {
4547    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4548    /// the kernel without starting the VCPU or device dispatch loops.
4549    ///
4550    /// Possible errors:
4551    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4552    ///         recreated.
4553    ///
4554    /// All other errors are related to VMM initialization.
4555    Create { guest_config: GuestConfig, responder: GuestLifecycleCreateResponder },
4556    /// Binds to the Guest protocol for an initialized guest.
4557    ///
4558    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4559    /// will be immediately closed.
4560    Bind {
4561        guest: fidl::endpoints::ServerEnd<GuestMarker>,
4562        control_handle: GuestLifecycleControlHandle,
4563    },
4564    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4565    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4566    ///
4567    /// Possible errors:
4568    ///     - ALREADY_RUNING: The VMM has already been started.
4569    ///     - NOT_CREATED: Run was called before the VMM was created.
4570    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4571    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4572    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4573    Run { responder: GuestLifecycleRunResponder },
4574    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4575    /// Create and then Run can be called again.
4576    Stop { responder: GuestLifecycleStopResponder },
4577}
4578
4579impl GuestLifecycleRequest {
4580    #[allow(irrefutable_let_patterns)]
4581    pub fn into_create(self) -> Option<(GuestConfig, GuestLifecycleCreateResponder)> {
4582        if let GuestLifecycleRequest::Create { guest_config, responder } = self {
4583            Some((guest_config, responder))
4584        } else {
4585            None
4586        }
4587    }
4588
4589    #[allow(irrefutable_let_patterns)]
4590    pub fn into_bind(
4591        self,
4592    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestLifecycleControlHandle)> {
4593        if let GuestLifecycleRequest::Bind { guest, control_handle } = self {
4594            Some((guest, control_handle))
4595        } else {
4596            None
4597        }
4598    }
4599
4600    #[allow(irrefutable_let_patterns)]
4601    pub fn into_run(self) -> Option<(GuestLifecycleRunResponder)> {
4602        if let GuestLifecycleRequest::Run { responder } = self { Some((responder)) } else { None }
4603    }
4604
4605    #[allow(irrefutable_let_patterns)]
4606    pub fn into_stop(self) -> Option<(GuestLifecycleStopResponder)> {
4607        if let GuestLifecycleRequest::Stop { responder } = self { Some((responder)) } else { None }
4608    }
4609
4610    /// Name of the method defined in FIDL
4611    pub fn method_name(&self) -> &'static str {
4612        match *self {
4613            GuestLifecycleRequest::Create { .. } => "create",
4614            GuestLifecycleRequest::Bind { .. } => "bind",
4615            GuestLifecycleRequest::Run { .. } => "run",
4616            GuestLifecycleRequest::Stop { .. } => "stop",
4617        }
4618    }
4619}
4620
4621#[derive(Debug, Clone)]
4622pub struct GuestLifecycleControlHandle {
4623    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4624}
4625
4626impl fidl::endpoints::ControlHandle for GuestLifecycleControlHandle {
4627    fn shutdown(&self) {
4628        self.inner.shutdown()
4629    }
4630
4631    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4632        self.inner.shutdown_with_epitaph(status)
4633    }
4634
4635    fn is_closed(&self) -> bool {
4636        self.inner.channel().is_closed()
4637    }
4638    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4639        self.inner.channel().on_closed()
4640    }
4641
4642    #[cfg(target_os = "fuchsia")]
4643    fn signal_peer(
4644        &self,
4645        clear_mask: zx::Signals,
4646        set_mask: zx::Signals,
4647    ) -> Result<(), zx_status::Status> {
4648        use fidl::Peered;
4649        self.inner.channel().signal_peer(clear_mask, set_mask)
4650    }
4651}
4652
4653impl GuestLifecycleControlHandle {}
4654
4655#[must_use = "FIDL methods require a response to be sent"]
4656#[derive(Debug)]
4657pub struct GuestLifecycleCreateResponder {
4658    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4659    tx_id: u32,
4660}
4661
4662/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4663/// if the responder is dropped without sending a response, so that the client
4664/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4665impl std::ops::Drop for GuestLifecycleCreateResponder {
4666    fn drop(&mut self) {
4667        self.control_handle.shutdown();
4668        // Safety: drops once, never accessed again
4669        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4670    }
4671}
4672
4673impl fidl::endpoints::Responder for GuestLifecycleCreateResponder {
4674    type ControlHandle = GuestLifecycleControlHandle;
4675
4676    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4677        &self.control_handle
4678    }
4679
4680    fn drop_without_shutdown(mut self) {
4681        // Safety: drops once, never accessed again due to mem::forget
4682        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4683        // Prevent Drop from running (which would shut down the channel)
4684        std::mem::forget(self);
4685    }
4686}
4687
4688impl GuestLifecycleCreateResponder {
4689    /// Sends a response to the FIDL transaction.
4690    ///
4691    /// Sets the channel to shutdown if an error occurs.
4692    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4693        let _result = self.send_raw(result);
4694        if _result.is_err() {
4695            self.control_handle.shutdown();
4696        }
4697        self.drop_without_shutdown();
4698        _result
4699    }
4700
4701    /// Similar to "send" but does not shutdown the channel if an error occurs.
4702    pub fn send_no_shutdown_on_err(
4703        self,
4704        mut result: Result<(), GuestError>,
4705    ) -> Result<(), fidl::Error> {
4706        let _result = self.send_raw(result);
4707        self.drop_without_shutdown();
4708        _result
4709    }
4710
4711    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4712        self.control_handle
4713            .inner
4714            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
4715                result,
4716                self.tx_id,
4717                0x152719eed416ed41,
4718                fidl::encoding::DynamicFlags::empty(),
4719            )
4720    }
4721}
4722
4723#[must_use = "FIDL methods require a response to be sent"]
4724#[derive(Debug)]
4725pub struct GuestLifecycleRunResponder {
4726    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4727    tx_id: u32,
4728}
4729
4730/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4731/// if the responder is dropped without sending a response, so that the client
4732/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4733impl std::ops::Drop for GuestLifecycleRunResponder {
4734    fn drop(&mut self) {
4735        self.control_handle.shutdown();
4736        // Safety: drops once, never accessed again
4737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4738    }
4739}
4740
4741impl fidl::endpoints::Responder for GuestLifecycleRunResponder {
4742    type ControlHandle = GuestLifecycleControlHandle;
4743
4744    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4745        &self.control_handle
4746    }
4747
4748    fn drop_without_shutdown(mut self) {
4749        // Safety: drops once, never accessed again due to mem::forget
4750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4751        // Prevent Drop from running (which would shut down the channel)
4752        std::mem::forget(self);
4753    }
4754}
4755
4756impl GuestLifecycleRunResponder {
4757    /// Sends a response to the FIDL transaction.
4758    ///
4759    /// Sets the channel to shutdown if an error occurs.
4760    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4761        let _result = self.send_raw(result);
4762        if _result.is_err() {
4763            self.control_handle.shutdown();
4764        }
4765        self.drop_without_shutdown();
4766        _result
4767    }
4768
4769    /// Similar to "send" but does not shutdown the channel if an error occurs.
4770    pub fn send_no_shutdown_on_err(
4771        self,
4772        mut result: Result<(), GuestError>,
4773    ) -> Result<(), fidl::Error> {
4774        let _result = self.send_raw(result);
4775        self.drop_without_shutdown();
4776        _result
4777    }
4778
4779    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4780        self.control_handle
4781            .inner
4782            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
4783                result,
4784                self.tx_id,
4785                0x2907fef2ac775657,
4786                fidl::encoding::DynamicFlags::empty(),
4787            )
4788    }
4789}
4790
4791#[must_use = "FIDL methods require a response to be sent"]
4792#[derive(Debug)]
4793pub struct GuestLifecycleStopResponder {
4794    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4795    tx_id: u32,
4796}
4797
4798/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4799/// if the responder is dropped without sending a response, so that the client
4800/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4801impl std::ops::Drop for GuestLifecycleStopResponder {
4802    fn drop(&mut self) {
4803        self.control_handle.shutdown();
4804        // Safety: drops once, never accessed again
4805        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4806    }
4807}
4808
4809impl fidl::endpoints::Responder for GuestLifecycleStopResponder {
4810    type ControlHandle = GuestLifecycleControlHandle;
4811
4812    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4813        &self.control_handle
4814    }
4815
4816    fn drop_without_shutdown(mut self) {
4817        // Safety: drops once, never accessed again due to mem::forget
4818        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4819        // Prevent Drop from running (which would shut down the channel)
4820        std::mem::forget(self);
4821    }
4822}
4823
4824impl GuestLifecycleStopResponder {
4825    /// Sends a response to the FIDL transaction.
4826    ///
4827    /// Sets the channel to shutdown if an error occurs.
4828    pub fn send(self) -> Result<(), fidl::Error> {
4829        let _result = self.send_raw();
4830        if _result.is_err() {
4831            self.control_handle.shutdown();
4832        }
4833        self.drop_without_shutdown();
4834        _result
4835    }
4836
4837    /// Similar to "send" but does not shutdown the channel if an error occurs.
4838    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4839        let _result = self.send_raw();
4840        self.drop_without_shutdown();
4841        _result
4842    }
4843
4844    fn send_raw(&self) -> Result<(), fidl::Error> {
4845        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4846            (),
4847            self.tx_id,
4848            0x27eef9c535ac8eb4,
4849            fidl::encoding::DynamicFlags::empty(),
4850        )
4851    }
4852}
4853
4854#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4855pub struct GuestManagerMarker;
4856
4857impl fidl::endpoints::ProtocolMarker for GuestManagerMarker {
4858    type Proxy = GuestManagerProxy;
4859    type RequestStream = GuestManagerRequestStream;
4860    #[cfg(target_os = "fuchsia")]
4861    type SynchronousProxy = GuestManagerSynchronousProxy;
4862
4863    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestManager";
4864}
4865impl fidl::endpoints::DiscoverableProtocolMarker for GuestManagerMarker {}
4866pub type GuestManagerLaunchResult = Result<(), GuestManagerError>;
4867pub type GuestManagerConnectResult = Result<(), GuestManagerError>;
4868
4869pub trait GuestManagerProxyInterface: Send + Sync {
4870    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
4871        + Send;
4872    fn r#launch(
4873        &self,
4874        guest_config: GuestConfig,
4875        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4876    ) -> Self::LaunchResponseFut;
4877    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4878    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
4879    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
4880        + Send;
4881    fn r#connect(
4882        &self,
4883        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4884    ) -> Self::ConnectResponseFut;
4885    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
4886    fn r#get_info(&self) -> Self::GetInfoResponseFut;
4887}
4888#[derive(Debug)]
4889#[cfg(target_os = "fuchsia")]
4890pub struct GuestManagerSynchronousProxy {
4891    client: fidl::client::sync::Client,
4892}
4893
4894#[cfg(target_os = "fuchsia")]
4895impl fidl::endpoints::SynchronousProxy for GuestManagerSynchronousProxy {
4896    type Proxy = GuestManagerProxy;
4897    type Protocol = GuestManagerMarker;
4898
4899    fn from_channel(inner: fidl::Channel) -> Self {
4900        Self::new(inner)
4901    }
4902
4903    fn into_channel(self) -> fidl::Channel {
4904        self.client.into_channel()
4905    }
4906
4907    fn as_channel(&self) -> &fidl::Channel {
4908        self.client.as_channel()
4909    }
4910}
4911
4912#[cfg(target_os = "fuchsia")]
4913impl GuestManagerSynchronousProxy {
4914    pub fn new(channel: fidl::Channel) -> Self {
4915        Self { client: fidl::client::sync::Client::new(channel) }
4916    }
4917
4918    pub fn into_channel(self) -> fidl::Channel {
4919        self.client.into_channel()
4920    }
4921
4922    /// Waits until an event arrives and returns it. It is safe for other
4923    /// threads to make concurrent requests while waiting for an event.
4924    pub fn wait_for_event(
4925        &self,
4926        deadline: zx::MonotonicInstant,
4927    ) -> Result<GuestManagerEvent, fidl::Error> {
4928        GuestManagerEvent::decode(self.client.wait_for_event::<GuestManagerMarker>(deadline)?)
4929    }
4930
4931    /// Launch a new guest instance.
4932    ///
4933    /// Possible errors:
4934    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
4935    ///         problems detected by the guest manager.
4936    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
4937    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
4938    ///         component logs for a more specific failure.
4939    pub fn r#launch(
4940        &self,
4941        mut guest_config: GuestConfig,
4942        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4943        ___deadline: zx::MonotonicInstant,
4944    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
4945        let _response =
4946            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
4947                fidl::encoding::EmptyStruct,
4948                GuestManagerError,
4949            >, GuestManagerMarker>(
4950                (&mut guest_config, controller),
4951                0x394a2e29f750323e,
4952                fidl::encoding::DynamicFlags::empty(),
4953                ___deadline,
4954            )?;
4955        Ok(_response.map(|x| x))
4956    }
4957
4958    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
4959    /// be used to launch another guest.
4960    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4961        let _response = self.client.send_query::<
4962            fidl::encoding::EmptyPayload,
4963            fidl::encoding::EmptyPayload,
4964            GuestManagerMarker,
4965        >(
4966            (),
4967            0x3ad9a012982f872d,
4968            fidl::encoding::DynamicFlags::empty(),
4969            ___deadline,
4970        )?;
4971        Ok(_response)
4972    }
4973
4974    /// Connect to a currently running guest.
4975    ///
4976    /// Possible errors:
4977    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
4978    ///         has launched before attempting to reconnect.
4979    pub fn r#connect(
4980        &self,
4981        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4982        ___deadline: zx::MonotonicInstant,
4983    ) -> Result<GuestManagerConnectResult, fidl::Error> {
4984        let _response =
4985            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
4986                fidl::encoding::EmptyStruct,
4987                GuestManagerError,
4988            >, GuestManagerMarker>(
4989                (controller,),
4990                0x4e489076e3bb15b4,
4991                fidl::encoding::DynamicFlags::empty(),
4992                ___deadline,
4993            )?;
4994        Ok(_response.map(|x| x))
4995    }
4996
4997    /// Query guest info
4998    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
4999        let _response = self.client.send_query::<
5000            fidl::encoding::EmptyPayload,
5001            GuestManagerGetInfoResponse,
5002            GuestManagerMarker,
5003        >(
5004            (),
5005            0x76892614aea695dc,
5006            fidl::encoding::DynamicFlags::empty(),
5007            ___deadline,
5008        )?;
5009        Ok(_response.guest_info)
5010    }
5011}
5012
5013#[cfg(target_os = "fuchsia")]
5014impl From<GuestManagerSynchronousProxy> for zx::NullableHandle {
5015    fn from(value: GuestManagerSynchronousProxy) -> Self {
5016        value.into_channel().into()
5017    }
5018}
5019
5020#[cfg(target_os = "fuchsia")]
5021impl From<fidl::Channel> for GuestManagerSynchronousProxy {
5022    fn from(value: fidl::Channel) -> Self {
5023        Self::new(value)
5024    }
5025}
5026
5027#[cfg(target_os = "fuchsia")]
5028impl fidl::endpoints::FromClient for GuestManagerSynchronousProxy {
5029    type Protocol = GuestManagerMarker;
5030
5031    fn from_client(value: fidl::endpoints::ClientEnd<GuestManagerMarker>) -> Self {
5032        Self::new(value.into_channel())
5033    }
5034}
5035
5036#[derive(Debug, Clone)]
5037pub struct GuestManagerProxy {
5038    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5039}
5040
5041impl fidl::endpoints::Proxy for GuestManagerProxy {
5042    type Protocol = GuestManagerMarker;
5043
5044    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5045        Self::new(inner)
5046    }
5047
5048    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5049        self.client.into_channel().map_err(|client| Self { client })
5050    }
5051
5052    fn as_channel(&self) -> &::fidl::AsyncChannel {
5053        self.client.as_channel()
5054    }
5055}
5056
5057impl GuestManagerProxy {
5058    /// Create a new Proxy for fuchsia.virtualization/GuestManager.
5059    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5060        let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5061        Self { client: fidl::client::Client::new(channel, protocol_name) }
5062    }
5063
5064    /// Get a Stream of events from the remote end of the protocol.
5065    ///
5066    /// # Panics
5067    ///
5068    /// Panics if the event stream was already taken.
5069    pub fn take_event_stream(&self) -> GuestManagerEventStream {
5070        GuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
5071    }
5072
5073    /// Launch a new guest instance.
5074    ///
5075    /// Possible errors:
5076    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
5077    ///         problems detected by the guest manager.
5078    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
5079    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
5080    ///         component logs for a more specific failure.
5081    pub fn r#launch(
5082        &self,
5083        mut guest_config: GuestConfig,
5084        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5085    ) -> fidl::client::QueryResponseFut<
5086        GuestManagerLaunchResult,
5087        fidl::encoding::DefaultFuchsiaResourceDialect,
5088    > {
5089        GuestManagerProxyInterface::r#launch(self, guest_config, controller)
5090    }
5091
5092    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
5093    /// be used to launch another guest.
5094    pub fn r#force_shutdown(
5095        &self,
5096    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5097        GuestManagerProxyInterface::r#force_shutdown(self)
5098    }
5099
5100    /// Connect to a currently running guest.
5101    ///
5102    /// Possible errors:
5103    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
5104    ///         has launched before attempting to reconnect.
5105    pub fn r#connect(
5106        &self,
5107        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5108    ) -> fidl::client::QueryResponseFut<
5109        GuestManagerConnectResult,
5110        fidl::encoding::DefaultFuchsiaResourceDialect,
5111    > {
5112        GuestManagerProxyInterface::r#connect(self, controller)
5113    }
5114
5115    /// Query guest info
5116    pub fn r#get_info(
5117        &self,
5118    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
5119    {
5120        GuestManagerProxyInterface::r#get_info(self)
5121    }
5122}
5123
5124impl GuestManagerProxyInterface for GuestManagerProxy {
5125    type LaunchResponseFut = fidl::client::QueryResponseFut<
5126        GuestManagerLaunchResult,
5127        fidl::encoding::DefaultFuchsiaResourceDialect,
5128    >;
5129    fn r#launch(
5130        &self,
5131        mut guest_config: GuestConfig,
5132        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5133    ) -> Self::LaunchResponseFut {
5134        fn _decode(
5135            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5136        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
5137            let _response = fidl::client::decode_transaction_body::<
5138                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
5139                fidl::encoding::DefaultFuchsiaResourceDialect,
5140                0x394a2e29f750323e,
5141            >(_buf?)?;
5142            Ok(_response.map(|x| x))
5143        }
5144        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
5145            (&mut guest_config, controller),
5146            0x394a2e29f750323e,
5147            fidl::encoding::DynamicFlags::empty(),
5148            _decode,
5149        )
5150    }
5151
5152    type ForceShutdownResponseFut =
5153        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5154    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
5155        fn _decode(
5156            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5157        ) -> Result<(), fidl::Error> {
5158            let _response = fidl::client::decode_transaction_body::<
5159                fidl::encoding::EmptyPayload,
5160                fidl::encoding::DefaultFuchsiaResourceDialect,
5161                0x3ad9a012982f872d,
5162            >(_buf?)?;
5163            Ok(_response)
5164        }
5165        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5166            (),
5167            0x3ad9a012982f872d,
5168            fidl::encoding::DynamicFlags::empty(),
5169            _decode,
5170        )
5171    }
5172
5173    type ConnectResponseFut = fidl::client::QueryResponseFut<
5174        GuestManagerConnectResult,
5175        fidl::encoding::DefaultFuchsiaResourceDialect,
5176    >;
5177    fn r#connect(
5178        &self,
5179        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5180    ) -> Self::ConnectResponseFut {
5181        fn _decode(
5182            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5183        ) -> Result<GuestManagerConnectResult, fidl::Error> {
5184            let _response = fidl::client::decode_transaction_body::<
5185                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
5186                fidl::encoding::DefaultFuchsiaResourceDialect,
5187                0x4e489076e3bb15b4,
5188            >(_buf?)?;
5189            Ok(_response.map(|x| x))
5190        }
5191        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
5192            (controller,),
5193            0x4e489076e3bb15b4,
5194            fidl::encoding::DynamicFlags::empty(),
5195            _decode,
5196        )
5197    }
5198
5199    type GetInfoResponseFut =
5200        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
5201    fn r#get_info(&self) -> Self::GetInfoResponseFut {
5202        fn _decode(
5203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5204        ) -> Result<GuestInfo, fidl::Error> {
5205            let _response = fidl::client::decode_transaction_body::<
5206                GuestManagerGetInfoResponse,
5207                fidl::encoding::DefaultFuchsiaResourceDialect,
5208                0x76892614aea695dc,
5209            >(_buf?)?;
5210            Ok(_response.guest_info)
5211        }
5212        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
5213            (),
5214            0x76892614aea695dc,
5215            fidl::encoding::DynamicFlags::empty(),
5216            _decode,
5217        )
5218    }
5219}
5220
5221pub struct GuestManagerEventStream {
5222    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5223}
5224
5225impl std::marker::Unpin for GuestManagerEventStream {}
5226
5227impl futures::stream::FusedStream for GuestManagerEventStream {
5228    fn is_terminated(&self) -> bool {
5229        self.event_receiver.is_terminated()
5230    }
5231}
5232
5233impl futures::Stream for GuestManagerEventStream {
5234    type Item = Result<GuestManagerEvent, fidl::Error>;
5235
5236    fn poll_next(
5237        mut self: std::pin::Pin<&mut Self>,
5238        cx: &mut std::task::Context<'_>,
5239    ) -> std::task::Poll<Option<Self::Item>> {
5240        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5241            &mut self.event_receiver,
5242            cx
5243        )?) {
5244            Some(buf) => std::task::Poll::Ready(Some(GuestManagerEvent::decode(buf))),
5245            None => std::task::Poll::Ready(None),
5246        }
5247    }
5248}
5249
5250#[derive(Debug)]
5251pub enum GuestManagerEvent {}
5252
5253impl GuestManagerEvent {
5254    /// Decodes a message buffer as a [`GuestManagerEvent`].
5255    fn decode(
5256        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5257    ) -> Result<GuestManagerEvent, fidl::Error> {
5258        let (bytes, _handles) = buf.split_mut();
5259        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5260        debug_assert_eq!(tx_header.tx_id, 0);
5261        match tx_header.ordinal {
5262            _ => Err(fidl::Error::UnknownOrdinal {
5263                ordinal: tx_header.ordinal,
5264                protocol_name: <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5265            }),
5266        }
5267    }
5268}
5269
5270/// A Stream of incoming requests for fuchsia.virtualization/GuestManager.
5271pub struct GuestManagerRequestStream {
5272    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5273    is_terminated: bool,
5274}
5275
5276impl std::marker::Unpin for GuestManagerRequestStream {}
5277
5278impl futures::stream::FusedStream for GuestManagerRequestStream {
5279    fn is_terminated(&self) -> bool {
5280        self.is_terminated
5281    }
5282}
5283
5284impl fidl::endpoints::RequestStream for GuestManagerRequestStream {
5285    type Protocol = GuestManagerMarker;
5286    type ControlHandle = GuestManagerControlHandle;
5287
5288    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5289        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5290    }
5291
5292    fn control_handle(&self) -> Self::ControlHandle {
5293        GuestManagerControlHandle { inner: self.inner.clone() }
5294    }
5295
5296    fn into_inner(
5297        self,
5298    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5299    {
5300        (self.inner, self.is_terminated)
5301    }
5302
5303    fn from_inner(
5304        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5305        is_terminated: bool,
5306    ) -> Self {
5307        Self { inner, is_terminated }
5308    }
5309}
5310
5311impl futures::Stream for GuestManagerRequestStream {
5312    type Item = Result<GuestManagerRequest, fidl::Error>;
5313
5314    fn poll_next(
5315        mut self: std::pin::Pin<&mut Self>,
5316        cx: &mut std::task::Context<'_>,
5317    ) -> std::task::Poll<Option<Self::Item>> {
5318        let this = &mut *self;
5319        if this.inner.check_shutdown(cx) {
5320            this.is_terminated = true;
5321            return std::task::Poll::Ready(None);
5322        }
5323        if this.is_terminated {
5324            panic!("polled GuestManagerRequestStream after completion");
5325        }
5326        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5327            |bytes, handles| {
5328                match this.inner.channel().read_etc(cx, bytes, handles) {
5329                    std::task::Poll::Ready(Ok(())) => {}
5330                    std::task::Poll::Pending => return std::task::Poll::Pending,
5331                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5332                        this.is_terminated = true;
5333                        return std::task::Poll::Ready(None);
5334                    }
5335                    std::task::Poll::Ready(Err(e)) => {
5336                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5337                            e.into(),
5338                        ))));
5339                    }
5340                }
5341
5342                // A message has been received from the channel
5343                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5344
5345                std::task::Poll::Ready(Some(match header.ordinal {
5346                    0x394a2e29f750323e => {
5347                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5348                        let mut req = fidl::new_empty!(
5349                            GuestManagerLaunchRequest,
5350                            fidl::encoding::DefaultFuchsiaResourceDialect
5351                        );
5352                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
5353                        let control_handle =
5354                            GuestManagerControlHandle { inner: this.inner.clone() };
5355                        Ok(GuestManagerRequest::Launch {
5356                            guest_config: req.guest_config,
5357                            controller: req.controller,
5358
5359                            responder: GuestManagerLaunchResponder {
5360                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5361                                tx_id: header.tx_id,
5362                            },
5363                        })
5364                    }
5365                    0x3ad9a012982f872d => {
5366                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5367                        let mut req = fidl::new_empty!(
5368                            fidl::encoding::EmptyPayload,
5369                            fidl::encoding::DefaultFuchsiaResourceDialect
5370                        );
5371                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5372                        let control_handle =
5373                            GuestManagerControlHandle { inner: this.inner.clone() };
5374                        Ok(GuestManagerRequest::ForceShutdown {
5375                            responder: GuestManagerForceShutdownResponder {
5376                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5377                                tx_id: header.tx_id,
5378                            },
5379                        })
5380                    }
5381                    0x4e489076e3bb15b4 => {
5382                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5383                        let mut req = fidl::new_empty!(
5384                            GuestManagerConnectRequest,
5385                            fidl::encoding::DefaultFuchsiaResourceDialect
5386                        );
5387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5388                        let control_handle =
5389                            GuestManagerControlHandle { inner: this.inner.clone() };
5390                        Ok(GuestManagerRequest::Connect {
5391                            controller: req.controller,
5392
5393                            responder: GuestManagerConnectResponder {
5394                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5395                                tx_id: header.tx_id,
5396                            },
5397                        })
5398                    }
5399                    0x76892614aea695dc => {
5400                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5401                        let mut req = fidl::new_empty!(
5402                            fidl::encoding::EmptyPayload,
5403                            fidl::encoding::DefaultFuchsiaResourceDialect
5404                        );
5405                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5406                        let control_handle =
5407                            GuestManagerControlHandle { inner: this.inner.clone() };
5408                        Ok(GuestManagerRequest::GetInfo {
5409                            responder: GuestManagerGetInfoResponder {
5410                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5411                                tx_id: header.tx_id,
5412                            },
5413                        })
5414                    }
5415                    _ => Err(fidl::Error::UnknownOrdinal {
5416                        ordinal: header.ordinal,
5417                        protocol_name:
5418                            <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5419                    }),
5420                }))
5421            },
5422        )
5423    }
5424}
5425
5426#[derive(Debug)]
5427pub enum GuestManagerRequest {
5428    /// Launch a new guest instance.
5429    ///
5430    /// Possible errors:
5431    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
5432    ///         problems detected by the guest manager.
5433    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
5434    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
5435    ///         component logs for a more specific failure.
5436    Launch {
5437        guest_config: GuestConfig,
5438        controller: fidl::endpoints::ServerEnd<GuestMarker>,
5439        responder: GuestManagerLaunchResponder,
5440    },
5441    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
5442    /// be used to launch another guest.
5443    ForceShutdown { responder: GuestManagerForceShutdownResponder },
5444    /// Connect to a currently running guest.
5445    ///
5446    /// Possible errors:
5447    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
5448    ///         has launched before attempting to reconnect.
5449    Connect {
5450        controller: fidl::endpoints::ServerEnd<GuestMarker>,
5451        responder: GuestManagerConnectResponder,
5452    },
5453    /// Query guest info
5454    GetInfo { responder: GuestManagerGetInfoResponder },
5455}
5456
5457impl GuestManagerRequest {
5458    #[allow(irrefutable_let_patterns)]
5459    pub fn into_launch(
5460        self,
5461    ) -> Option<(GuestConfig, fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerLaunchResponder)>
5462    {
5463        if let GuestManagerRequest::Launch { guest_config, controller, responder } = self {
5464            Some((guest_config, controller, responder))
5465        } else {
5466            None
5467        }
5468    }
5469
5470    #[allow(irrefutable_let_patterns)]
5471    pub fn into_force_shutdown(self) -> Option<(GuestManagerForceShutdownResponder)> {
5472        if let GuestManagerRequest::ForceShutdown { responder } = self {
5473            Some((responder))
5474        } else {
5475            None
5476        }
5477    }
5478
5479    #[allow(irrefutable_let_patterns)]
5480    pub fn into_connect(
5481        self,
5482    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerConnectResponder)> {
5483        if let GuestManagerRequest::Connect { controller, responder } = self {
5484            Some((controller, responder))
5485        } else {
5486            None
5487        }
5488    }
5489
5490    #[allow(irrefutable_let_patterns)]
5491    pub fn into_get_info(self) -> Option<(GuestManagerGetInfoResponder)> {
5492        if let GuestManagerRequest::GetInfo { responder } = self { Some((responder)) } else { None }
5493    }
5494
5495    /// Name of the method defined in FIDL
5496    pub fn method_name(&self) -> &'static str {
5497        match *self {
5498            GuestManagerRequest::Launch { .. } => "launch",
5499            GuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
5500            GuestManagerRequest::Connect { .. } => "connect",
5501            GuestManagerRequest::GetInfo { .. } => "get_info",
5502        }
5503    }
5504}
5505
5506#[derive(Debug, Clone)]
5507pub struct GuestManagerControlHandle {
5508    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5509}
5510
5511impl fidl::endpoints::ControlHandle for GuestManagerControlHandle {
5512    fn shutdown(&self) {
5513        self.inner.shutdown()
5514    }
5515
5516    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5517        self.inner.shutdown_with_epitaph(status)
5518    }
5519
5520    fn is_closed(&self) -> bool {
5521        self.inner.channel().is_closed()
5522    }
5523    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5524        self.inner.channel().on_closed()
5525    }
5526
5527    #[cfg(target_os = "fuchsia")]
5528    fn signal_peer(
5529        &self,
5530        clear_mask: zx::Signals,
5531        set_mask: zx::Signals,
5532    ) -> Result<(), zx_status::Status> {
5533        use fidl::Peered;
5534        self.inner.channel().signal_peer(clear_mask, set_mask)
5535    }
5536}
5537
5538impl GuestManagerControlHandle {}
5539
5540#[must_use = "FIDL methods require a response to be sent"]
5541#[derive(Debug)]
5542pub struct GuestManagerLaunchResponder {
5543    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5544    tx_id: u32,
5545}
5546
5547/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5548/// if the responder is dropped without sending a response, so that the client
5549/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5550impl std::ops::Drop for GuestManagerLaunchResponder {
5551    fn drop(&mut self) {
5552        self.control_handle.shutdown();
5553        // Safety: drops once, never accessed again
5554        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5555    }
5556}
5557
5558impl fidl::endpoints::Responder for GuestManagerLaunchResponder {
5559    type ControlHandle = GuestManagerControlHandle;
5560
5561    fn control_handle(&self) -> &GuestManagerControlHandle {
5562        &self.control_handle
5563    }
5564
5565    fn drop_without_shutdown(mut self) {
5566        // Safety: drops once, never accessed again due to mem::forget
5567        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5568        // Prevent Drop from running (which would shut down the channel)
5569        std::mem::forget(self);
5570    }
5571}
5572
5573impl GuestManagerLaunchResponder {
5574    /// Sends a response to the FIDL transaction.
5575    ///
5576    /// Sets the channel to shutdown if an error occurs.
5577    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5578        let _result = self.send_raw(result);
5579        if _result.is_err() {
5580            self.control_handle.shutdown();
5581        }
5582        self.drop_without_shutdown();
5583        _result
5584    }
5585
5586    /// Similar to "send" but does not shutdown the channel if an error occurs.
5587    pub fn send_no_shutdown_on_err(
5588        self,
5589        mut result: Result<(), GuestManagerError>,
5590    ) -> Result<(), fidl::Error> {
5591        let _result = self.send_raw(result);
5592        self.drop_without_shutdown();
5593        _result
5594    }
5595
5596    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5597        self.control_handle.inner.send::<fidl::encoding::ResultType<
5598            fidl::encoding::EmptyStruct,
5599            GuestManagerError,
5600        >>(
5601            result,
5602            self.tx_id,
5603            0x394a2e29f750323e,
5604            fidl::encoding::DynamicFlags::empty(),
5605        )
5606    }
5607}
5608
5609#[must_use = "FIDL methods require a response to be sent"]
5610#[derive(Debug)]
5611pub struct GuestManagerForceShutdownResponder {
5612    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5613    tx_id: u32,
5614}
5615
5616/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5617/// if the responder is dropped without sending a response, so that the client
5618/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5619impl std::ops::Drop for GuestManagerForceShutdownResponder {
5620    fn drop(&mut self) {
5621        self.control_handle.shutdown();
5622        // Safety: drops once, never accessed again
5623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5624    }
5625}
5626
5627impl fidl::endpoints::Responder for GuestManagerForceShutdownResponder {
5628    type ControlHandle = GuestManagerControlHandle;
5629
5630    fn control_handle(&self) -> &GuestManagerControlHandle {
5631        &self.control_handle
5632    }
5633
5634    fn drop_without_shutdown(mut self) {
5635        // Safety: drops once, never accessed again due to mem::forget
5636        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5637        // Prevent Drop from running (which would shut down the channel)
5638        std::mem::forget(self);
5639    }
5640}
5641
5642impl GuestManagerForceShutdownResponder {
5643    /// Sends a response to the FIDL transaction.
5644    ///
5645    /// Sets the channel to shutdown if an error occurs.
5646    pub fn send(self) -> Result<(), fidl::Error> {
5647        let _result = self.send_raw();
5648        if _result.is_err() {
5649            self.control_handle.shutdown();
5650        }
5651        self.drop_without_shutdown();
5652        _result
5653    }
5654
5655    /// Similar to "send" but does not shutdown the channel if an error occurs.
5656    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5657        let _result = self.send_raw();
5658        self.drop_without_shutdown();
5659        _result
5660    }
5661
5662    fn send_raw(&self) -> Result<(), fidl::Error> {
5663        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5664            (),
5665            self.tx_id,
5666            0x3ad9a012982f872d,
5667            fidl::encoding::DynamicFlags::empty(),
5668        )
5669    }
5670}
5671
5672#[must_use = "FIDL methods require a response to be sent"]
5673#[derive(Debug)]
5674pub struct GuestManagerConnectResponder {
5675    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5676    tx_id: u32,
5677}
5678
5679/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5680/// if the responder is dropped without sending a response, so that the client
5681/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5682impl std::ops::Drop for GuestManagerConnectResponder {
5683    fn drop(&mut self) {
5684        self.control_handle.shutdown();
5685        // Safety: drops once, never accessed again
5686        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5687    }
5688}
5689
5690impl fidl::endpoints::Responder for GuestManagerConnectResponder {
5691    type ControlHandle = GuestManagerControlHandle;
5692
5693    fn control_handle(&self) -> &GuestManagerControlHandle {
5694        &self.control_handle
5695    }
5696
5697    fn drop_without_shutdown(mut self) {
5698        // Safety: drops once, never accessed again due to mem::forget
5699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5700        // Prevent Drop from running (which would shut down the channel)
5701        std::mem::forget(self);
5702    }
5703}
5704
5705impl GuestManagerConnectResponder {
5706    /// Sends a response to the FIDL transaction.
5707    ///
5708    /// Sets the channel to shutdown if an error occurs.
5709    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5710        let _result = self.send_raw(result);
5711        if _result.is_err() {
5712            self.control_handle.shutdown();
5713        }
5714        self.drop_without_shutdown();
5715        _result
5716    }
5717
5718    /// Similar to "send" but does not shutdown the channel if an error occurs.
5719    pub fn send_no_shutdown_on_err(
5720        self,
5721        mut result: Result<(), GuestManagerError>,
5722    ) -> Result<(), fidl::Error> {
5723        let _result = self.send_raw(result);
5724        self.drop_without_shutdown();
5725        _result
5726    }
5727
5728    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5729        self.control_handle.inner.send::<fidl::encoding::ResultType<
5730            fidl::encoding::EmptyStruct,
5731            GuestManagerError,
5732        >>(
5733            result,
5734            self.tx_id,
5735            0x4e489076e3bb15b4,
5736            fidl::encoding::DynamicFlags::empty(),
5737        )
5738    }
5739}
5740
5741#[must_use = "FIDL methods require a response to be sent"]
5742#[derive(Debug)]
5743pub struct GuestManagerGetInfoResponder {
5744    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5745    tx_id: u32,
5746}
5747
5748/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5749/// if the responder is dropped without sending a response, so that the client
5750/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5751impl std::ops::Drop for GuestManagerGetInfoResponder {
5752    fn drop(&mut self) {
5753        self.control_handle.shutdown();
5754        // Safety: drops once, never accessed again
5755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5756    }
5757}
5758
5759impl fidl::endpoints::Responder for GuestManagerGetInfoResponder {
5760    type ControlHandle = GuestManagerControlHandle;
5761
5762    fn control_handle(&self) -> &GuestManagerControlHandle {
5763        &self.control_handle
5764    }
5765
5766    fn drop_without_shutdown(mut self) {
5767        // Safety: drops once, never accessed again due to mem::forget
5768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5769        // Prevent Drop from running (which would shut down the channel)
5770        std::mem::forget(self);
5771    }
5772}
5773
5774impl GuestManagerGetInfoResponder {
5775    /// Sends a response to the FIDL transaction.
5776    ///
5777    /// Sets the channel to shutdown if an error occurs.
5778    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5779        let _result = self.send_raw(guest_info);
5780        if _result.is_err() {
5781            self.control_handle.shutdown();
5782        }
5783        self.drop_without_shutdown();
5784        _result
5785    }
5786
5787    /// Similar to "send" but does not shutdown the channel if an error occurs.
5788    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5789        let _result = self.send_raw(guest_info);
5790        self.drop_without_shutdown();
5791        _result
5792    }
5793
5794    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5795        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
5796            (guest_info,),
5797            self.tx_id,
5798            0x76892614aea695dc,
5799            fidl::encoding::DynamicFlags::empty(),
5800        )
5801    }
5802}
5803
5804#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5805pub struct HostVsockAcceptorMarker;
5806
5807impl fidl::endpoints::ProtocolMarker for HostVsockAcceptorMarker {
5808    type Proxy = HostVsockAcceptorProxy;
5809    type RequestStream = HostVsockAcceptorRequestStream;
5810    #[cfg(target_os = "fuchsia")]
5811    type SynchronousProxy = HostVsockAcceptorSynchronousProxy;
5812
5813    const DEBUG_NAME: &'static str = "(anonymous) HostVsockAcceptor";
5814}
5815pub type HostVsockAcceptorAcceptResult = Result<fidl::Socket, i32>;
5816
5817pub trait HostVsockAcceptorProxyInterface: Send + Sync {
5818    type AcceptResponseFut: std::future::Future<Output = Result<HostVsockAcceptorAcceptResult, fidl::Error>>
5819        + Send;
5820    fn r#accept(&self, src_cid: u32, src_port: u32, port: u32) -> Self::AcceptResponseFut;
5821}
5822#[derive(Debug)]
5823#[cfg(target_os = "fuchsia")]
5824pub struct HostVsockAcceptorSynchronousProxy {
5825    client: fidl::client::sync::Client,
5826}
5827
5828#[cfg(target_os = "fuchsia")]
5829impl fidl::endpoints::SynchronousProxy for HostVsockAcceptorSynchronousProxy {
5830    type Proxy = HostVsockAcceptorProxy;
5831    type Protocol = HostVsockAcceptorMarker;
5832
5833    fn from_channel(inner: fidl::Channel) -> Self {
5834        Self::new(inner)
5835    }
5836
5837    fn into_channel(self) -> fidl::Channel {
5838        self.client.into_channel()
5839    }
5840
5841    fn as_channel(&self) -> &fidl::Channel {
5842        self.client.as_channel()
5843    }
5844}
5845
5846#[cfg(target_os = "fuchsia")]
5847impl HostVsockAcceptorSynchronousProxy {
5848    pub fn new(channel: fidl::Channel) -> Self {
5849        Self { client: fidl::client::sync::Client::new(channel) }
5850    }
5851
5852    pub fn into_channel(self) -> fidl::Channel {
5853        self.client.into_channel()
5854    }
5855
5856    /// Waits until an event arrives and returns it. It is safe for other
5857    /// threads to make concurrent requests while waiting for an event.
5858    pub fn wait_for_event(
5859        &self,
5860        deadline: zx::MonotonicInstant,
5861    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
5862        HostVsockAcceptorEvent::decode(
5863            self.client.wait_for_event::<HostVsockAcceptorMarker>(deadline)?,
5864        )
5865    }
5866
5867    pub fn r#accept(
5868        &self,
5869        mut src_cid: u32,
5870        mut src_port: u32,
5871        mut port: u32,
5872        ___deadline: zx::MonotonicInstant,
5873    ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
5874        let _response = self.client.send_query::<
5875            HostVsockAcceptorAcceptRequest,
5876            fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
5877            HostVsockAcceptorMarker,
5878        >(
5879            (src_cid, src_port, port,),
5880            0x6996ed935beaa2d7,
5881            fidl::encoding::DynamicFlags::empty(),
5882            ___deadline,
5883        )?;
5884        Ok(_response.map(|x| x.socket))
5885    }
5886}
5887
5888#[cfg(target_os = "fuchsia")]
5889impl From<HostVsockAcceptorSynchronousProxy> for zx::NullableHandle {
5890    fn from(value: HostVsockAcceptorSynchronousProxy) -> Self {
5891        value.into_channel().into()
5892    }
5893}
5894
5895#[cfg(target_os = "fuchsia")]
5896impl From<fidl::Channel> for HostVsockAcceptorSynchronousProxy {
5897    fn from(value: fidl::Channel) -> Self {
5898        Self::new(value)
5899    }
5900}
5901
5902#[cfg(target_os = "fuchsia")]
5903impl fidl::endpoints::FromClient for HostVsockAcceptorSynchronousProxy {
5904    type Protocol = HostVsockAcceptorMarker;
5905
5906    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>) -> Self {
5907        Self::new(value.into_channel())
5908    }
5909}
5910
5911#[derive(Debug, Clone)]
5912pub struct HostVsockAcceptorProxy {
5913    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5914}
5915
5916impl fidl::endpoints::Proxy for HostVsockAcceptorProxy {
5917    type Protocol = HostVsockAcceptorMarker;
5918
5919    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5920        Self::new(inner)
5921    }
5922
5923    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5924        self.client.into_channel().map_err(|client| Self { client })
5925    }
5926
5927    fn as_channel(&self) -> &::fidl::AsyncChannel {
5928        self.client.as_channel()
5929    }
5930}
5931
5932impl HostVsockAcceptorProxy {
5933    /// Create a new Proxy for fuchsia.virtualization/HostVsockAcceptor.
5934    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5935        let protocol_name =
5936            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5937        Self { client: fidl::client::Client::new(channel, protocol_name) }
5938    }
5939
5940    /// Get a Stream of events from the remote end of the protocol.
5941    ///
5942    /// # Panics
5943    ///
5944    /// Panics if the event stream was already taken.
5945    pub fn take_event_stream(&self) -> HostVsockAcceptorEventStream {
5946        HostVsockAcceptorEventStream { event_receiver: self.client.take_event_receiver() }
5947    }
5948
5949    pub fn r#accept(
5950        &self,
5951        mut src_cid: u32,
5952        mut src_port: u32,
5953        mut port: u32,
5954    ) -> fidl::client::QueryResponseFut<
5955        HostVsockAcceptorAcceptResult,
5956        fidl::encoding::DefaultFuchsiaResourceDialect,
5957    > {
5958        HostVsockAcceptorProxyInterface::r#accept(self, src_cid, src_port, port)
5959    }
5960}
5961
5962impl HostVsockAcceptorProxyInterface for HostVsockAcceptorProxy {
5963    type AcceptResponseFut = fidl::client::QueryResponseFut<
5964        HostVsockAcceptorAcceptResult,
5965        fidl::encoding::DefaultFuchsiaResourceDialect,
5966    >;
5967    fn r#accept(
5968        &self,
5969        mut src_cid: u32,
5970        mut src_port: u32,
5971        mut port: u32,
5972    ) -> Self::AcceptResponseFut {
5973        fn _decode(
5974            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5975        ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
5976            let _response = fidl::client::decode_transaction_body::<
5977                fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
5978                fidl::encoding::DefaultFuchsiaResourceDialect,
5979                0x6996ed935beaa2d7,
5980            >(_buf?)?;
5981            Ok(_response.map(|x| x.socket))
5982        }
5983        self.client
5984            .send_query_and_decode::<HostVsockAcceptorAcceptRequest, HostVsockAcceptorAcceptResult>(
5985                (src_cid, src_port, port),
5986                0x6996ed935beaa2d7,
5987                fidl::encoding::DynamicFlags::empty(),
5988                _decode,
5989            )
5990    }
5991}
5992
5993pub struct HostVsockAcceptorEventStream {
5994    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5995}
5996
5997impl std::marker::Unpin for HostVsockAcceptorEventStream {}
5998
5999impl futures::stream::FusedStream for HostVsockAcceptorEventStream {
6000    fn is_terminated(&self) -> bool {
6001        self.event_receiver.is_terminated()
6002    }
6003}
6004
6005impl futures::Stream for HostVsockAcceptorEventStream {
6006    type Item = Result<HostVsockAcceptorEvent, fidl::Error>;
6007
6008    fn poll_next(
6009        mut self: std::pin::Pin<&mut Self>,
6010        cx: &mut std::task::Context<'_>,
6011    ) -> std::task::Poll<Option<Self::Item>> {
6012        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6013            &mut self.event_receiver,
6014            cx
6015        )?) {
6016            Some(buf) => std::task::Poll::Ready(Some(HostVsockAcceptorEvent::decode(buf))),
6017            None => std::task::Poll::Ready(None),
6018        }
6019    }
6020}
6021
6022#[derive(Debug)]
6023pub enum HostVsockAcceptorEvent {}
6024
6025impl HostVsockAcceptorEvent {
6026    /// Decodes a message buffer as a [`HostVsockAcceptorEvent`].
6027    fn decode(
6028        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6029    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
6030        let (bytes, _handles) = buf.split_mut();
6031        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6032        debug_assert_eq!(tx_header.tx_id, 0);
6033        match tx_header.ordinal {
6034            _ => Err(fidl::Error::UnknownOrdinal {
6035                ordinal: tx_header.ordinal,
6036                protocol_name:
6037                    <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6038            }),
6039        }
6040    }
6041}
6042
6043/// A Stream of incoming requests for fuchsia.virtualization/HostVsockAcceptor.
6044pub struct HostVsockAcceptorRequestStream {
6045    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6046    is_terminated: bool,
6047}
6048
6049impl std::marker::Unpin for HostVsockAcceptorRequestStream {}
6050
6051impl futures::stream::FusedStream for HostVsockAcceptorRequestStream {
6052    fn is_terminated(&self) -> bool {
6053        self.is_terminated
6054    }
6055}
6056
6057impl fidl::endpoints::RequestStream for HostVsockAcceptorRequestStream {
6058    type Protocol = HostVsockAcceptorMarker;
6059    type ControlHandle = HostVsockAcceptorControlHandle;
6060
6061    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6062        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6063    }
6064
6065    fn control_handle(&self) -> Self::ControlHandle {
6066        HostVsockAcceptorControlHandle { inner: self.inner.clone() }
6067    }
6068
6069    fn into_inner(
6070        self,
6071    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6072    {
6073        (self.inner, self.is_terminated)
6074    }
6075
6076    fn from_inner(
6077        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6078        is_terminated: bool,
6079    ) -> Self {
6080        Self { inner, is_terminated }
6081    }
6082}
6083
6084impl futures::Stream for HostVsockAcceptorRequestStream {
6085    type Item = Result<HostVsockAcceptorRequest, fidl::Error>;
6086
6087    fn poll_next(
6088        mut self: std::pin::Pin<&mut Self>,
6089        cx: &mut std::task::Context<'_>,
6090    ) -> std::task::Poll<Option<Self::Item>> {
6091        let this = &mut *self;
6092        if this.inner.check_shutdown(cx) {
6093            this.is_terminated = true;
6094            return std::task::Poll::Ready(None);
6095        }
6096        if this.is_terminated {
6097            panic!("polled HostVsockAcceptorRequestStream after completion");
6098        }
6099        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6100            |bytes, handles| {
6101                match this.inner.channel().read_etc(cx, bytes, handles) {
6102                    std::task::Poll::Ready(Ok(())) => {}
6103                    std::task::Poll::Pending => return std::task::Poll::Pending,
6104                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6105                        this.is_terminated = true;
6106                        return std::task::Poll::Ready(None);
6107                    }
6108                    std::task::Poll::Ready(Err(e)) => {
6109                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6110                            e.into(),
6111                        ))));
6112                    }
6113                }
6114
6115                // A message has been received from the channel
6116                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6117
6118                std::task::Poll::Ready(Some(match header.ordinal {
6119                    0x6996ed935beaa2d7 => {
6120                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6121                        let mut req = fidl::new_empty!(
6122                            HostVsockAcceptorAcceptRequest,
6123                            fidl::encoding::DefaultFuchsiaResourceDialect
6124                        );
6125                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockAcceptorAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
6126                        let control_handle =
6127                            HostVsockAcceptorControlHandle { inner: this.inner.clone() };
6128                        Ok(HostVsockAcceptorRequest::Accept {
6129                            src_cid: req.src_cid,
6130                            src_port: req.src_port,
6131                            port: req.port,
6132
6133                            responder: HostVsockAcceptorAcceptResponder {
6134                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6135                                tx_id: header.tx_id,
6136                            },
6137                        })
6138                    }
6139                    _ => Err(fidl::Error::UnknownOrdinal {
6140                        ordinal: header.ordinal,
6141                        protocol_name:
6142                            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6143                    }),
6144                }))
6145            },
6146        )
6147    }
6148}
6149
6150/// Exposed by a host capable of listening via vsocks. A variant of a
6151/// `GuestVsockAcceptor` that is responsible for creating the `socket` with which
6152/// to communicate.
6153#[derive(Debug)]
6154pub enum HostVsockAcceptorRequest {
6155    Accept { src_cid: u32, src_port: u32, port: u32, responder: HostVsockAcceptorAcceptResponder },
6156}
6157
6158impl HostVsockAcceptorRequest {
6159    #[allow(irrefutable_let_patterns)]
6160    pub fn into_accept(self) -> Option<(u32, u32, u32, HostVsockAcceptorAcceptResponder)> {
6161        if let HostVsockAcceptorRequest::Accept { src_cid, src_port, port, responder } = self {
6162            Some((src_cid, src_port, port, responder))
6163        } else {
6164            None
6165        }
6166    }
6167
6168    /// Name of the method defined in FIDL
6169    pub fn method_name(&self) -> &'static str {
6170        match *self {
6171            HostVsockAcceptorRequest::Accept { .. } => "accept",
6172        }
6173    }
6174}
6175
6176#[derive(Debug, Clone)]
6177pub struct HostVsockAcceptorControlHandle {
6178    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6179}
6180
6181impl fidl::endpoints::ControlHandle for HostVsockAcceptorControlHandle {
6182    fn shutdown(&self) {
6183        self.inner.shutdown()
6184    }
6185
6186    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6187        self.inner.shutdown_with_epitaph(status)
6188    }
6189
6190    fn is_closed(&self) -> bool {
6191        self.inner.channel().is_closed()
6192    }
6193    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6194        self.inner.channel().on_closed()
6195    }
6196
6197    #[cfg(target_os = "fuchsia")]
6198    fn signal_peer(
6199        &self,
6200        clear_mask: zx::Signals,
6201        set_mask: zx::Signals,
6202    ) -> Result<(), zx_status::Status> {
6203        use fidl::Peered;
6204        self.inner.channel().signal_peer(clear_mask, set_mask)
6205    }
6206}
6207
6208impl HostVsockAcceptorControlHandle {}
6209
6210#[must_use = "FIDL methods require a response to be sent"]
6211#[derive(Debug)]
6212pub struct HostVsockAcceptorAcceptResponder {
6213    control_handle: std::mem::ManuallyDrop<HostVsockAcceptorControlHandle>,
6214    tx_id: u32,
6215}
6216
6217/// Set the the channel to be shutdown (see [`HostVsockAcceptorControlHandle::shutdown`])
6218/// if the responder is dropped without sending a response, so that the client
6219/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6220impl std::ops::Drop for HostVsockAcceptorAcceptResponder {
6221    fn drop(&mut self) {
6222        self.control_handle.shutdown();
6223        // Safety: drops once, never accessed again
6224        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6225    }
6226}
6227
6228impl fidl::endpoints::Responder for HostVsockAcceptorAcceptResponder {
6229    type ControlHandle = HostVsockAcceptorControlHandle;
6230
6231    fn control_handle(&self) -> &HostVsockAcceptorControlHandle {
6232        &self.control_handle
6233    }
6234
6235    fn drop_without_shutdown(mut self) {
6236        // Safety: drops once, never accessed again due to mem::forget
6237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6238        // Prevent Drop from running (which would shut down the channel)
6239        std::mem::forget(self);
6240    }
6241}
6242
6243impl HostVsockAcceptorAcceptResponder {
6244    /// Sends a response to the FIDL transaction.
6245    ///
6246    /// Sets the channel to shutdown if an error occurs.
6247    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6248        let _result = self.send_raw(result);
6249        if _result.is_err() {
6250            self.control_handle.shutdown();
6251        }
6252        self.drop_without_shutdown();
6253        _result
6254    }
6255
6256    /// Similar to "send" but does not shutdown the channel if an error occurs.
6257    pub fn send_no_shutdown_on_err(
6258        self,
6259        mut result: Result<fidl::Socket, i32>,
6260    ) -> Result<(), fidl::Error> {
6261        let _result = self.send_raw(result);
6262        self.drop_without_shutdown();
6263        _result
6264    }
6265
6266    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6267        self.control_handle
6268            .inner
6269            .send::<fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>>(
6270                result.map(|socket| (socket,)),
6271                self.tx_id,
6272                0x6996ed935beaa2d7,
6273                fidl::encoding::DynamicFlags::empty(),
6274            )
6275    }
6276}
6277
6278#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6279pub struct HostVsockEndpointMarker;
6280
6281impl fidl::endpoints::ProtocolMarker for HostVsockEndpointMarker {
6282    type Proxy = HostVsockEndpointProxy;
6283    type RequestStream = HostVsockEndpointRequestStream;
6284    #[cfg(target_os = "fuchsia")]
6285    type SynchronousProxy = HostVsockEndpointSynchronousProxy;
6286
6287    const DEBUG_NAME: &'static str = "fuchsia.virtualization.HostVsockEndpoint";
6288}
6289impl fidl::endpoints::DiscoverableProtocolMarker for HostVsockEndpointMarker {}
6290pub type HostVsockEndpointListenResult = Result<(), i32>;
6291pub type HostVsockEndpointConnectResult = Result<fidl::Socket, i32>;
6292
6293pub trait HostVsockEndpointProxyInterface: Send + Sync {
6294    type ListenResponseFut: std::future::Future<Output = Result<HostVsockEndpointListenResult, fidl::Error>>
6295        + Send;
6296    fn r#listen(
6297        &self,
6298        port: u32,
6299        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6300    ) -> Self::ListenResponseFut;
6301    type ConnectResponseFut: std::future::Future<Output = Result<HostVsockEndpointConnectResult, fidl::Error>>
6302        + Send;
6303    fn r#connect(&self, guest_port: u32) -> Self::ConnectResponseFut;
6304}
6305#[derive(Debug)]
6306#[cfg(target_os = "fuchsia")]
6307pub struct HostVsockEndpointSynchronousProxy {
6308    client: fidl::client::sync::Client,
6309}
6310
6311#[cfg(target_os = "fuchsia")]
6312impl fidl::endpoints::SynchronousProxy for HostVsockEndpointSynchronousProxy {
6313    type Proxy = HostVsockEndpointProxy;
6314    type Protocol = HostVsockEndpointMarker;
6315
6316    fn from_channel(inner: fidl::Channel) -> Self {
6317        Self::new(inner)
6318    }
6319
6320    fn into_channel(self) -> fidl::Channel {
6321        self.client.into_channel()
6322    }
6323
6324    fn as_channel(&self) -> &fidl::Channel {
6325        self.client.as_channel()
6326    }
6327}
6328
6329#[cfg(target_os = "fuchsia")]
6330impl HostVsockEndpointSynchronousProxy {
6331    pub fn new(channel: fidl::Channel) -> Self {
6332        Self { client: fidl::client::sync::Client::new(channel) }
6333    }
6334
6335    pub fn into_channel(self) -> fidl::Channel {
6336        self.client.into_channel()
6337    }
6338
6339    /// Waits until an event arrives and returns it. It is safe for other
6340    /// threads to make concurrent requests while waiting for an event.
6341    pub fn wait_for_event(
6342        &self,
6343        deadline: zx::MonotonicInstant,
6344    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
6345        HostVsockEndpointEvent::decode(
6346            self.client.wait_for_event::<HostVsockEndpointMarker>(deadline)?,
6347        )
6348    }
6349
6350    /// Instructs the device to listen for guest initiated connections to a given port by
6351    /// using `acceptor` when the guest creates a connection.
6352    ///
6353    /// Possible errors:
6354    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6355    pub fn r#listen(
6356        &self,
6357        mut port: u32,
6358        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6359        ___deadline: zx::MonotonicInstant,
6360    ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
6361        let _response = self.client.send_query::<
6362            Listener,
6363            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6364            HostVsockEndpointMarker,
6365        >(
6366            (port, acceptor,),
6367            0xfd88f3b4767f2c7,
6368            fidl::encoding::DynamicFlags::empty(),
6369            ___deadline,
6370        )?;
6371        Ok(_response.map(|x| x))
6372    }
6373
6374    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6375    /// ephemeral host port.
6376    ///
6377    /// Possible errors:
6378    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6379    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6380    ///
6381    /// Other errors are related to socket creation, see
6382    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6383    pub fn r#connect(
6384        &self,
6385        mut guest_port: u32,
6386        ___deadline: zx::MonotonicInstant,
6387    ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
6388        let _response = self.client.send_query::<
6389            HostVsockEndpointConnectRequest,
6390            fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
6391            HostVsockEndpointMarker,
6392        >(
6393            (guest_port,),
6394            0x4d12e10e946b43e4,
6395            fidl::encoding::DynamicFlags::empty(),
6396            ___deadline,
6397        )?;
6398        Ok(_response.map(|x| x.socket))
6399    }
6400}
6401
6402#[cfg(target_os = "fuchsia")]
6403impl From<HostVsockEndpointSynchronousProxy> for zx::NullableHandle {
6404    fn from(value: HostVsockEndpointSynchronousProxy) -> Self {
6405        value.into_channel().into()
6406    }
6407}
6408
6409#[cfg(target_os = "fuchsia")]
6410impl From<fidl::Channel> for HostVsockEndpointSynchronousProxy {
6411    fn from(value: fidl::Channel) -> Self {
6412        Self::new(value)
6413    }
6414}
6415
6416#[cfg(target_os = "fuchsia")]
6417impl fidl::endpoints::FromClient for HostVsockEndpointSynchronousProxy {
6418    type Protocol = HostVsockEndpointMarker;
6419
6420    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockEndpointMarker>) -> Self {
6421        Self::new(value.into_channel())
6422    }
6423}
6424
6425#[derive(Debug, Clone)]
6426pub struct HostVsockEndpointProxy {
6427    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6428}
6429
6430impl fidl::endpoints::Proxy for HostVsockEndpointProxy {
6431    type Protocol = HostVsockEndpointMarker;
6432
6433    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6434        Self::new(inner)
6435    }
6436
6437    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6438        self.client.into_channel().map_err(|client| Self { client })
6439    }
6440
6441    fn as_channel(&self) -> &::fidl::AsyncChannel {
6442        self.client.as_channel()
6443    }
6444}
6445
6446impl HostVsockEndpointProxy {
6447    /// Create a new Proxy for fuchsia.virtualization/HostVsockEndpoint.
6448    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6449        let protocol_name =
6450            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6451        Self { client: fidl::client::Client::new(channel, protocol_name) }
6452    }
6453
6454    /// Get a Stream of events from the remote end of the protocol.
6455    ///
6456    /// # Panics
6457    ///
6458    /// Panics if the event stream was already taken.
6459    pub fn take_event_stream(&self) -> HostVsockEndpointEventStream {
6460        HostVsockEndpointEventStream { event_receiver: self.client.take_event_receiver() }
6461    }
6462
6463    /// Instructs the device to listen for guest initiated connections to a given port by
6464    /// using `acceptor` when the guest creates a connection.
6465    ///
6466    /// Possible errors:
6467    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6468    pub fn r#listen(
6469        &self,
6470        mut port: u32,
6471        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6472    ) -> fidl::client::QueryResponseFut<
6473        HostVsockEndpointListenResult,
6474        fidl::encoding::DefaultFuchsiaResourceDialect,
6475    > {
6476        HostVsockEndpointProxyInterface::r#listen(self, port, acceptor)
6477    }
6478
6479    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6480    /// ephemeral host port.
6481    ///
6482    /// Possible errors:
6483    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6484    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6485    ///
6486    /// Other errors are related to socket creation, see
6487    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6488    pub fn r#connect(
6489        &self,
6490        mut guest_port: u32,
6491    ) -> fidl::client::QueryResponseFut<
6492        HostVsockEndpointConnectResult,
6493        fidl::encoding::DefaultFuchsiaResourceDialect,
6494    > {
6495        HostVsockEndpointProxyInterface::r#connect(self, guest_port)
6496    }
6497}
6498
6499impl HostVsockEndpointProxyInterface for HostVsockEndpointProxy {
6500    type ListenResponseFut = fidl::client::QueryResponseFut<
6501        HostVsockEndpointListenResult,
6502        fidl::encoding::DefaultFuchsiaResourceDialect,
6503    >;
6504    fn r#listen(
6505        &self,
6506        mut port: u32,
6507        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6508    ) -> Self::ListenResponseFut {
6509        fn _decode(
6510            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6511        ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
6512            let _response = fidl::client::decode_transaction_body::<
6513                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6514                fidl::encoding::DefaultFuchsiaResourceDialect,
6515                0xfd88f3b4767f2c7,
6516            >(_buf?)?;
6517            Ok(_response.map(|x| x))
6518        }
6519        self.client.send_query_and_decode::<Listener, HostVsockEndpointListenResult>(
6520            (port, acceptor),
6521            0xfd88f3b4767f2c7,
6522            fidl::encoding::DynamicFlags::empty(),
6523            _decode,
6524        )
6525    }
6526
6527    type ConnectResponseFut = fidl::client::QueryResponseFut<
6528        HostVsockEndpointConnectResult,
6529        fidl::encoding::DefaultFuchsiaResourceDialect,
6530    >;
6531    fn r#connect(&self, mut guest_port: u32) -> Self::ConnectResponseFut {
6532        fn _decode(
6533            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6534        ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
6535            let _response = fidl::client::decode_transaction_body::<
6536                fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
6537                fidl::encoding::DefaultFuchsiaResourceDialect,
6538                0x4d12e10e946b43e4,
6539            >(_buf?)?;
6540            Ok(_response.map(|x| x.socket))
6541        }
6542        self.client.send_query_and_decode::<
6543            HostVsockEndpointConnectRequest,
6544            HostVsockEndpointConnectResult,
6545        >(
6546            (guest_port,),
6547            0x4d12e10e946b43e4,
6548            fidl::encoding::DynamicFlags::empty(),
6549            _decode,
6550        )
6551    }
6552}
6553
6554pub struct HostVsockEndpointEventStream {
6555    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6556}
6557
6558impl std::marker::Unpin for HostVsockEndpointEventStream {}
6559
6560impl futures::stream::FusedStream for HostVsockEndpointEventStream {
6561    fn is_terminated(&self) -> bool {
6562        self.event_receiver.is_terminated()
6563    }
6564}
6565
6566impl futures::Stream for HostVsockEndpointEventStream {
6567    type Item = Result<HostVsockEndpointEvent, fidl::Error>;
6568
6569    fn poll_next(
6570        mut self: std::pin::Pin<&mut Self>,
6571        cx: &mut std::task::Context<'_>,
6572    ) -> std::task::Poll<Option<Self::Item>> {
6573        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6574            &mut self.event_receiver,
6575            cx
6576        )?) {
6577            Some(buf) => std::task::Poll::Ready(Some(HostVsockEndpointEvent::decode(buf))),
6578            None => std::task::Poll::Ready(None),
6579        }
6580    }
6581}
6582
6583#[derive(Debug)]
6584pub enum HostVsockEndpointEvent {}
6585
6586impl HostVsockEndpointEvent {
6587    /// Decodes a message buffer as a [`HostVsockEndpointEvent`].
6588    fn decode(
6589        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6590    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
6591        let (bytes, _handles) = buf.split_mut();
6592        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6593        debug_assert_eq!(tx_header.tx_id, 0);
6594        match tx_header.ordinal {
6595            _ => Err(fidl::Error::UnknownOrdinal {
6596                ordinal: tx_header.ordinal,
6597                protocol_name:
6598                    <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6599            }),
6600        }
6601    }
6602}
6603
6604/// A Stream of incoming requests for fuchsia.virtualization/HostVsockEndpoint.
6605pub struct HostVsockEndpointRequestStream {
6606    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6607    is_terminated: bool,
6608}
6609
6610impl std::marker::Unpin for HostVsockEndpointRequestStream {}
6611
6612impl futures::stream::FusedStream for HostVsockEndpointRequestStream {
6613    fn is_terminated(&self) -> bool {
6614        self.is_terminated
6615    }
6616}
6617
6618impl fidl::endpoints::RequestStream for HostVsockEndpointRequestStream {
6619    type Protocol = HostVsockEndpointMarker;
6620    type ControlHandle = HostVsockEndpointControlHandle;
6621
6622    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6623        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6624    }
6625
6626    fn control_handle(&self) -> Self::ControlHandle {
6627        HostVsockEndpointControlHandle { inner: self.inner.clone() }
6628    }
6629
6630    fn into_inner(
6631        self,
6632    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6633    {
6634        (self.inner, self.is_terminated)
6635    }
6636
6637    fn from_inner(
6638        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6639        is_terminated: bool,
6640    ) -> Self {
6641        Self { inner, is_terminated }
6642    }
6643}
6644
6645impl futures::Stream for HostVsockEndpointRequestStream {
6646    type Item = Result<HostVsockEndpointRequest, fidl::Error>;
6647
6648    fn poll_next(
6649        mut self: std::pin::Pin<&mut Self>,
6650        cx: &mut std::task::Context<'_>,
6651    ) -> std::task::Poll<Option<Self::Item>> {
6652        let this = &mut *self;
6653        if this.inner.check_shutdown(cx) {
6654            this.is_terminated = true;
6655            return std::task::Poll::Ready(None);
6656        }
6657        if this.is_terminated {
6658            panic!("polled HostVsockEndpointRequestStream after completion");
6659        }
6660        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6661            |bytes, handles| {
6662                match this.inner.channel().read_etc(cx, bytes, handles) {
6663                    std::task::Poll::Ready(Ok(())) => {}
6664                    std::task::Poll::Pending => return std::task::Poll::Pending,
6665                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6666                        this.is_terminated = true;
6667                        return std::task::Poll::Ready(None);
6668                    }
6669                    std::task::Poll::Ready(Err(e)) => {
6670                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6671                            e.into(),
6672                        ))));
6673                    }
6674                }
6675
6676                // A message has been received from the channel
6677                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6678
6679                std::task::Poll::Ready(Some(match header.ordinal {
6680                    0xfd88f3b4767f2c7 => {
6681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6682                        let mut req = fidl::new_empty!(
6683                            Listener,
6684                            fidl::encoding::DefaultFuchsiaResourceDialect
6685                        );
6686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Listener>(&header, _body_bytes, handles, &mut req)?;
6687                        let control_handle =
6688                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
6689                        Ok(HostVsockEndpointRequest::Listen {
6690                            port: req.port,
6691                            acceptor: req.acceptor,
6692
6693                            responder: HostVsockEndpointListenResponder {
6694                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6695                                tx_id: header.tx_id,
6696                            },
6697                        })
6698                    }
6699                    0x4d12e10e946b43e4 => {
6700                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6701                        let mut req = fidl::new_empty!(
6702                            HostVsockEndpointConnectRequest,
6703                            fidl::encoding::DefaultFuchsiaResourceDialect
6704                        );
6705                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockEndpointConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6706                        let control_handle =
6707                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
6708                        Ok(HostVsockEndpointRequest::Connect {
6709                            guest_port: req.guest_port,
6710
6711                            responder: HostVsockEndpointConnectResponder {
6712                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6713                                tx_id: header.tx_id,
6714                            },
6715                        })
6716                    }
6717                    _ => Err(fidl::Error::UnknownOrdinal {
6718                        ordinal: header.ordinal,
6719                        protocol_name:
6720                            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6721                    }),
6722                }))
6723            },
6724        )
6725    }
6726}
6727
6728/// Exposed by a host to provide the ability for listeners to be multiplexed by
6729/// port and to manage dynamic port allocation for outbound connections.
6730#[derive(Debug)]
6731pub enum HostVsockEndpointRequest {
6732    /// Instructs the device to listen for guest initiated connections to a given port by
6733    /// using `acceptor` when the guest creates a connection.
6734    ///
6735    /// Possible errors:
6736    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6737    Listen {
6738        port: u32,
6739        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6740        responder: HostVsockEndpointListenResponder,
6741    },
6742    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6743    /// ephemeral host port.
6744    ///
6745    /// Possible errors:
6746    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6747    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6748    ///
6749    /// Other errors are related to socket creation, see
6750    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6751    Connect { guest_port: u32, responder: HostVsockEndpointConnectResponder },
6752}
6753
6754impl HostVsockEndpointRequest {
6755    #[allow(irrefutable_let_patterns)]
6756    pub fn into_listen(
6757        self,
6758    ) -> Option<(
6759        u32,
6760        fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6761        HostVsockEndpointListenResponder,
6762    )> {
6763        if let HostVsockEndpointRequest::Listen { port, acceptor, responder } = self {
6764            Some((port, acceptor, responder))
6765        } else {
6766            None
6767        }
6768    }
6769
6770    #[allow(irrefutable_let_patterns)]
6771    pub fn into_connect(self) -> Option<(u32, HostVsockEndpointConnectResponder)> {
6772        if let HostVsockEndpointRequest::Connect { guest_port, responder } = self {
6773            Some((guest_port, responder))
6774        } else {
6775            None
6776        }
6777    }
6778
6779    /// Name of the method defined in FIDL
6780    pub fn method_name(&self) -> &'static str {
6781        match *self {
6782            HostVsockEndpointRequest::Listen { .. } => "listen",
6783            HostVsockEndpointRequest::Connect { .. } => "connect",
6784        }
6785    }
6786}
6787
6788#[derive(Debug, Clone)]
6789pub struct HostVsockEndpointControlHandle {
6790    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6791}
6792
6793impl fidl::endpoints::ControlHandle for HostVsockEndpointControlHandle {
6794    fn shutdown(&self) {
6795        self.inner.shutdown()
6796    }
6797
6798    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6799        self.inner.shutdown_with_epitaph(status)
6800    }
6801
6802    fn is_closed(&self) -> bool {
6803        self.inner.channel().is_closed()
6804    }
6805    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6806        self.inner.channel().on_closed()
6807    }
6808
6809    #[cfg(target_os = "fuchsia")]
6810    fn signal_peer(
6811        &self,
6812        clear_mask: zx::Signals,
6813        set_mask: zx::Signals,
6814    ) -> Result<(), zx_status::Status> {
6815        use fidl::Peered;
6816        self.inner.channel().signal_peer(clear_mask, set_mask)
6817    }
6818}
6819
6820impl HostVsockEndpointControlHandle {}
6821
6822#[must_use = "FIDL methods require a response to be sent"]
6823#[derive(Debug)]
6824pub struct HostVsockEndpointListenResponder {
6825    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
6826    tx_id: u32,
6827}
6828
6829/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
6830/// if the responder is dropped without sending a response, so that the client
6831/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6832impl std::ops::Drop for HostVsockEndpointListenResponder {
6833    fn drop(&mut self) {
6834        self.control_handle.shutdown();
6835        // Safety: drops once, never accessed again
6836        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6837    }
6838}
6839
6840impl fidl::endpoints::Responder for HostVsockEndpointListenResponder {
6841    type ControlHandle = HostVsockEndpointControlHandle;
6842
6843    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
6844        &self.control_handle
6845    }
6846
6847    fn drop_without_shutdown(mut self) {
6848        // Safety: drops once, never accessed again due to mem::forget
6849        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6850        // Prevent Drop from running (which would shut down the channel)
6851        std::mem::forget(self);
6852    }
6853}
6854
6855impl HostVsockEndpointListenResponder {
6856    /// Sends a response to the FIDL transaction.
6857    ///
6858    /// Sets the channel to shutdown if an error occurs.
6859    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6860        let _result = self.send_raw(result);
6861        if _result.is_err() {
6862            self.control_handle.shutdown();
6863        }
6864        self.drop_without_shutdown();
6865        _result
6866    }
6867
6868    /// Similar to "send" but does not shutdown the channel if an error occurs.
6869    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6870        let _result = self.send_raw(result);
6871        self.drop_without_shutdown();
6872        _result
6873    }
6874
6875    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6876        self.control_handle
6877            .inner
6878            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6879                result,
6880                self.tx_id,
6881                0xfd88f3b4767f2c7,
6882                fidl::encoding::DynamicFlags::empty(),
6883            )
6884    }
6885}
6886
6887#[must_use = "FIDL methods require a response to be sent"]
6888#[derive(Debug)]
6889pub struct HostVsockEndpointConnectResponder {
6890    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
6891    tx_id: u32,
6892}
6893
6894/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
6895/// if the responder is dropped without sending a response, so that the client
6896/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6897impl std::ops::Drop for HostVsockEndpointConnectResponder {
6898    fn drop(&mut self) {
6899        self.control_handle.shutdown();
6900        // Safety: drops once, never accessed again
6901        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6902    }
6903}
6904
6905impl fidl::endpoints::Responder for HostVsockEndpointConnectResponder {
6906    type ControlHandle = HostVsockEndpointControlHandle;
6907
6908    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
6909        &self.control_handle
6910    }
6911
6912    fn drop_without_shutdown(mut self) {
6913        // Safety: drops once, never accessed again due to mem::forget
6914        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6915        // Prevent Drop from running (which would shut down the channel)
6916        std::mem::forget(self);
6917    }
6918}
6919
6920impl HostVsockEndpointConnectResponder {
6921    /// Sends a response to the FIDL transaction.
6922    ///
6923    /// Sets the channel to shutdown if an error occurs.
6924    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6925        let _result = self.send_raw(result);
6926        if _result.is_err() {
6927            self.control_handle.shutdown();
6928        }
6929        self.drop_without_shutdown();
6930        _result
6931    }
6932
6933    /// Similar to "send" but does not shutdown the channel if an error occurs.
6934    pub fn send_no_shutdown_on_err(
6935        self,
6936        mut result: Result<fidl::Socket, i32>,
6937    ) -> Result<(), fidl::Error> {
6938        let _result = self.send_raw(result);
6939        self.drop_without_shutdown();
6940        _result
6941    }
6942
6943    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6944        self.control_handle
6945            .inner
6946            .send::<fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>>(
6947                result.map(|socket| (socket,)),
6948                self.tx_id,
6949                0x4d12e10e946b43e4,
6950                fidl::encoding::DynamicFlags::empty(),
6951            )
6952    }
6953}
6954
6955#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6956pub struct LinuxManagerMarker;
6957
6958impl fidl::endpoints::ProtocolMarker for LinuxManagerMarker {
6959    type Proxy = LinuxManagerProxy;
6960    type RequestStream = LinuxManagerRequestStream;
6961    #[cfg(target_os = "fuchsia")]
6962    type SynchronousProxy = LinuxManagerSynchronousProxy;
6963
6964    const DEBUG_NAME: &'static str = "fuchsia.virtualization.LinuxManager";
6965}
6966impl fidl::endpoints::DiscoverableProtocolMarker for LinuxManagerMarker {}
6967pub type LinuxManagerStartAndGetLinuxGuestInfoResult = Result<LinuxGuestInfo, i32>;
6968pub type LinuxManagerWipeDataResult = Result<(), i32>;
6969
6970pub trait LinuxManagerProxyInterface: Send + Sync {
6971    type StartAndGetLinuxGuestInfoResponseFut: std::future::Future<
6972            Output = Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error>,
6973        > + Send;
6974    fn r#start_and_get_linux_guest_info(
6975        &self,
6976        label: &str,
6977    ) -> Self::StartAndGetLinuxGuestInfoResponseFut;
6978    type WipeDataResponseFut: std::future::Future<Output = Result<LinuxManagerWipeDataResult, fidl::Error>>
6979        + Send;
6980    fn r#wipe_data(&self) -> Self::WipeDataResponseFut;
6981    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error>;
6982}
6983#[derive(Debug)]
6984#[cfg(target_os = "fuchsia")]
6985pub struct LinuxManagerSynchronousProxy {
6986    client: fidl::client::sync::Client,
6987}
6988
6989#[cfg(target_os = "fuchsia")]
6990impl fidl::endpoints::SynchronousProxy for LinuxManagerSynchronousProxy {
6991    type Proxy = LinuxManagerProxy;
6992    type Protocol = LinuxManagerMarker;
6993
6994    fn from_channel(inner: fidl::Channel) -> Self {
6995        Self::new(inner)
6996    }
6997
6998    fn into_channel(self) -> fidl::Channel {
6999        self.client.into_channel()
7000    }
7001
7002    fn as_channel(&self) -> &fidl::Channel {
7003        self.client.as_channel()
7004    }
7005}
7006
7007#[cfg(target_os = "fuchsia")]
7008impl LinuxManagerSynchronousProxy {
7009    pub fn new(channel: fidl::Channel) -> Self {
7010        Self { client: fidl::client::sync::Client::new(channel) }
7011    }
7012
7013    pub fn into_channel(self) -> fidl::Channel {
7014        self.client.into_channel()
7015    }
7016
7017    /// Waits until an event arrives and returns it. It is safe for other
7018    /// threads to make concurrent requests while waiting for an event.
7019    pub fn wait_for_event(
7020        &self,
7021        deadline: zx::MonotonicInstant,
7022    ) -> Result<LinuxManagerEvent, fidl::Error> {
7023        LinuxManagerEvent::decode(self.client.wait_for_event::<LinuxManagerMarker>(deadline)?)
7024    }
7025
7026    /// Get Linux guest environment info.
7027    ///
7028    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
7029    pub fn r#start_and_get_linux_guest_info(
7030        &self,
7031        mut label: &str,
7032        ___deadline: zx::MonotonicInstant,
7033    ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
7034        let _response = self.client.send_query::<
7035            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7036            fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
7037            LinuxManagerMarker,
7038        >(
7039            (label,),
7040            0x11809ced100a2bea,
7041            fidl::encoding::DynamicFlags::empty(),
7042            ___deadline,
7043        )?;
7044        Ok(_response.map(|x| x.info))
7045    }
7046
7047    /// Clears the stateful data. This includes any installed containers and any user data
7048    /// they may contain.
7049    ///
7050    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7051    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7052    /// operation.
7053    pub fn r#wipe_data(
7054        &self,
7055        ___deadline: zx::MonotonicInstant,
7056    ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
7057        let _response = self.client.send_query::<
7058            fidl::encoding::EmptyPayload,
7059            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7060            LinuxManagerMarker,
7061        >(
7062            (),
7063            0x732c69394548a76a,
7064            fidl::encoding::DynamicFlags::empty(),
7065            ___deadline,
7066        )?;
7067        Ok(_response.map(|x| x))
7068    }
7069
7070    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7071    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7072    /// the epitaph) before attempting to launch another guest.
7073    ///
7074    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7075    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7076    /// a component crash).
7077    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7078        self.client.send::<fidl::encoding::EmptyPayload>(
7079            (),
7080            0x5dab12b50bc9909d,
7081            fidl::encoding::DynamicFlags::empty(),
7082        )
7083    }
7084}
7085
7086#[cfg(target_os = "fuchsia")]
7087impl From<LinuxManagerSynchronousProxy> for zx::NullableHandle {
7088    fn from(value: LinuxManagerSynchronousProxy) -> Self {
7089        value.into_channel().into()
7090    }
7091}
7092
7093#[cfg(target_os = "fuchsia")]
7094impl From<fidl::Channel> for LinuxManagerSynchronousProxy {
7095    fn from(value: fidl::Channel) -> Self {
7096        Self::new(value)
7097    }
7098}
7099
7100#[cfg(target_os = "fuchsia")]
7101impl fidl::endpoints::FromClient for LinuxManagerSynchronousProxy {
7102    type Protocol = LinuxManagerMarker;
7103
7104    fn from_client(value: fidl::endpoints::ClientEnd<LinuxManagerMarker>) -> Self {
7105        Self::new(value.into_channel())
7106    }
7107}
7108
7109#[derive(Debug, Clone)]
7110pub struct LinuxManagerProxy {
7111    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7112}
7113
7114impl fidl::endpoints::Proxy for LinuxManagerProxy {
7115    type Protocol = LinuxManagerMarker;
7116
7117    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7118        Self::new(inner)
7119    }
7120
7121    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7122        self.client.into_channel().map_err(|client| Self { client })
7123    }
7124
7125    fn as_channel(&self) -> &::fidl::AsyncChannel {
7126        self.client.as_channel()
7127    }
7128}
7129
7130impl LinuxManagerProxy {
7131    /// Create a new Proxy for fuchsia.virtualization/LinuxManager.
7132    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7133        let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7134        Self { client: fidl::client::Client::new(channel, protocol_name) }
7135    }
7136
7137    /// Get a Stream of events from the remote end of the protocol.
7138    ///
7139    /// # Panics
7140    ///
7141    /// Panics if the event stream was already taken.
7142    pub fn take_event_stream(&self) -> LinuxManagerEventStream {
7143        LinuxManagerEventStream { event_receiver: self.client.take_event_receiver() }
7144    }
7145
7146    /// Get Linux guest environment info.
7147    ///
7148    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
7149    pub fn r#start_and_get_linux_guest_info(
7150        &self,
7151        mut label: &str,
7152    ) -> fidl::client::QueryResponseFut<
7153        LinuxManagerStartAndGetLinuxGuestInfoResult,
7154        fidl::encoding::DefaultFuchsiaResourceDialect,
7155    > {
7156        LinuxManagerProxyInterface::r#start_and_get_linux_guest_info(self, label)
7157    }
7158
7159    /// Clears the stateful data. This includes any installed containers and any user data
7160    /// they may contain.
7161    ///
7162    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7163    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7164    /// operation.
7165    pub fn r#wipe_data(
7166        &self,
7167    ) -> fidl::client::QueryResponseFut<
7168        LinuxManagerWipeDataResult,
7169        fidl::encoding::DefaultFuchsiaResourceDialect,
7170    > {
7171        LinuxManagerProxyInterface::r#wipe_data(self)
7172    }
7173
7174    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7175    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7176    /// the epitaph) before attempting to launch another guest.
7177    ///
7178    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7179    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7180    /// a component crash).
7181    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7182        LinuxManagerProxyInterface::r#graceful_shutdown(self)
7183    }
7184}
7185
7186impl LinuxManagerProxyInterface for LinuxManagerProxy {
7187    type StartAndGetLinuxGuestInfoResponseFut = fidl::client::QueryResponseFut<
7188        LinuxManagerStartAndGetLinuxGuestInfoResult,
7189        fidl::encoding::DefaultFuchsiaResourceDialect,
7190    >;
7191    fn r#start_and_get_linux_guest_info(
7192        &self,
7193        mut label: &str,
7194    ) -> Self::StartAndGetLinuxGuestInfoResponseFut {
7195        fn _decode(
7196            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7197        ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
7198            let _response = fidl::client::decode_transaction_body::<
7199                fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
7200                fidl::encoding::DefaultFuchsiaResourceDialect,
7201                0x11809ced100a2bea,
7202            >(_buf?)?;
7203            Ok(_response.map(|x| x.info))
7204        }
7205        self.client.send_query_and_decode::<
7206            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7207            LinuxManagerStartAndGetLinuxGuestInfoResult,
7208        >(
7209            (label,),
7210            0x11809ced100a2bea,
7211            fidl::encoding::DynamicFlags::empty(),
7212            _decode,
7213        )
7214    }
7215
7216    type WipeDataResponseFut = fidl::client::QueryResponseFut<
7217        LinuxManagerWipeDataResult,
7218        fidl::encoding::DefaultFuchsiaResourceDialect,
7219    >;
7220    fn r#wipe_data(&self) -> Self::WipeDataResponseFut {
7221        fn _decode(
7222            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7223        ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
7224            let _response = fidl::client::decode_transaction_body::<
7225                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7226                fidl::encoding::DefaultFuchsiaResourceDialect,
7227                0x732c69394548a76a,
7228            >(_buf?)?;
7229            Ok(_response.map(|x| x))
7230        }
7231        self.client
7232            .send_query_and_decode::<fidl::encoding::EmptyPayload, LinuxManagerWipeDataResult>(
7233                (),
7234                0x732c69394548a76a,
7235                fidl::encoding::DynamicFlags::empty(),
7236                _decode,
7237            )
7238    }
7239
7240    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7241        self.client.send::<fidl::encoding::EmptyPayload>(
7242            (),
7243            0x5dab12b50bc9909d,
7244            fidl::encoding::DynamicFlags::empty(),
7245        )
7246    }
7247}
7248
7249pub struct LinuxManagerEventStream {
7250    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7251}
7252
7253impl std::marker::Unpin for LinuxManagerEventStream {}
7254
7255impl futures::stream::FusedStream for LinuxManagerEventStream {
7256    fn is_terminated(&self) -> bool {
7257        self.event_receiver.is_terminated()
7258    }
7259}
7260
7261impl futures::Stream for LinuxManagerEventStream {
7262    type Item = Result<LinuxManagerEvent, fidl::Error>;
7263
7264    fn poll_next(
7265        mut self: std::pin::Pin<&mut Self>,
7266        cx: &mut std::task::Context<'_>,
7267    ) -> std::task::Poll<Option<Self::Item>> {
7268        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7269            &mut self.event_receiver,
7270            cx
7271        )?) {
7272            Some(buf) => std::task::Poll::Ready(Some(LinuxManagerEvent::decode(buf))),
7273            None => std::task::Poll::Ready(None),
7274        }
7275    }
7276}
7277
7278#[derive(Debug)]
7279pub enum LinuxManagerEvent {
7280    OnGuestInfoChanged { label: String, info: LinuxGuestInfo },
7281}
7282
7283impl LinuxManagerEvent {
7284    #[allow(irrefutable_let_patterns)]
7285    pub fn into_on_guest_info_changed(self) -> Option<(String, LinuxGuestInfo)> {
7286        if let LinuxManagerEvent::OnGuestInfoChanged { label, info } = self {
7287            Some((label, info))
7288        } else {
7289            None
7290        }
7291    }
7292
7293    /// Decodes a message buffer as a [`LinuxManagerEvent`].
7294    fn decode(
7295        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7296    ) -> Result<LinuxManagerEvent, fidl::Error> {
7297        let (bytes, _handles) = buf.split_mut();
7298        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7299        debug_assert_eq!(tx_header.tx_id, 0);
7300        match tx_header.ordinal {
7301            0x30a9be4c43d6a2d6 => {
7302                let mut out = fidl::new_empty!(
7303                    LinuxManagerOnGuestInfoChangedRequest,
7304                    fidl::encoding::DefaultFuchsiaResourceDialect
7305                );
7306                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerOnGuestInfoChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7307                Ok((LinuxManagerEvent::OnGuestInfoChanged { label: out.label, info: out.info }))
7308            }
7309            _ => Err(fidl::Error::UnknownOrdinal {
7310                ordinal: tx_header.ordinal,
7311                protocol_name: <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7312            }),
7313        }
7314    }
7315}
7316
7317/// A Stream of incoming requests for fuchsia.virtualization/LinuxManager.
7318pub struct LinuxManagerRequestStream {
7319    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7320    is_terminated: bool,
7321}
7322
7323impl std::marker::Unpin for LinuxManagerRequestStream {}
7324
7325impl futures::stream::FusedStream for LinuxManagerRequestStream {
7326    fn is_terminated(&self) -> bool {
7327        self.is_terminated
7328    }
7329}
7330
7331impl fidl::endpoints::RequestStream for LinuxManagerRequestStream {
7332    type Protocol = LinuxManagerMarker;
7333    type ControlHandle = LinuxManagerControlHandle;
7334
7335    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7336        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7337    }
7338
7339    fn control_handle(&self) -> Self::ControlHandle {
7340        LinuxManagerControlHandle { inner: self.inner.clone() }
7341    }
7342
7343    fn into_inner(
7344        self,
7345    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7346    {
7347        (self.inner, self.is_terminated)
7348    }
7349
7350    fn from_inner(
7351        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7352        is_terminated: bool,
7353    ) -> Self {
7354        Self { inner, is_terminated }
7355    }
7356}
7357
7358impl futures::Stream for LinuxManagerRequestStream {
7359    type Item = Result<LinuxManagerRequest, fidl::Error>;
7360
7361    fn poll_next(
7362        mut self: std::pin::Pin<&mut Self>,
7363        cx: &mut std::task::Context<'_>,
7364    ) -> std::task::Poll<Option<Self::Item>> {
7365        let this = &mut *self;
7366        if this.inner.check_shutdown(cx) {
7367            this.is_terminated = true;
7368            return std::task::Poll::Ready(None);
7369        }
7370        if this.is_terminated {
7371            panic!("polled LinuxManagerRequestStream after completion");
7372        }
7373        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7374            |bytes, handles| {
7375                match this.inner.channel().read_etc(cx, bytes, handles) {
7376                    std::task::Poll::Ready(Ok(())) => {}
7377                    std::task::Poll::Pending => return std::task::Poll::Pending,
7378                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7379                        this.is_terminated = true;
7380                        return std::task::Poll::Ready(None);
7381                    }
7382                    std::task::Poll::Ready(Err(e)) => {
7383                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7384                            e.into(),
7385                        ))));
7386                    }
7387                }
7388
7389                // A message has been received from the channel
7390                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7391
7392                std::task::Poll::Ready(Some(match header.ordinal {
7393                    0x11809ced100a2bea => {
7394                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7395                        let mut req = fidl::new_empty!(
7396                            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7397                            fidl::encoding::DefaultFuchsiaResourceDialect
7398                        );
7399                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(&header, _body_bytes, handles, &mut req)?;
7400                        let control_handle =
7401                            LinuxManagerControlHandle { inner: this.inner.clone() };
7402                        Ok(LinuxManagerRequest::StartAndGetLinuxGuestInfo {
7403                            label: req.label,
7404
7405                            responder: LinuxManagerStartAndGetLinuxGuestInfoResponder {
7406                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7407                                tx_id: header.tx_id,
7408                            },
7409                        })
7410                    }
7411                    0x732c69394548a76a => {
7412                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7413                        let mut req = fidl::new_empty!(
7414                            fidl::encoding::EmptyPayload,
7415                            fidl::encoding::DefaultFuchsiaResourceDialect
7416                        );
7417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7418                        let control_handle =
7419                            LinuxManagerControlHandle { inner: this.inner.clone() };
7420                        Ok(LinuxManagerRequest::WipeData {
7421                            responder: LinuxManagerWipeDataResponder {
7422                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7423                                tx_id: header.tx_id,
7424                            },
7425                        })
7426                    }
7427                    0x5dab12b50bc9909d => {
7428                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7429                        let mut req = fidl::new_empty!(
7430                            fidl::encoding::EmptyPayload,
7431                            fidl::encoding::DefaultFuchsiaResourceDialect
7432                        );
7433                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7434                        let control_handle =
7435                            LinuxManagerControlHandle { inner: this.inner.clone() };
7436                        Ok(LinuxManagerRequest::GracefulShutdown { control_handle })
7437                    }
7438                    _ => Err(fidl::Error::UnknownOrdinal {
7439                        ordinal: header.ordinal,
7440                        protocol_name:
7441                            <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7442                    }),
7443                }))
7444            },
7445        )
7446    }
7447}
7448
7449/// A `LinuxManager` provides access to the status of Linux guest instances.
7450#[derive(Debug)]
7451pub enum LinuxManagerRequest {
7452    /// Get Linux guest environment info.
7453    ///
7454    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
7455    StartAndGetLinuxGuestInfo {
7456        label: String,
7457        responder: LinuxManagerStartAndGetLinuxGuestInfoResponder,
7458    },
7459    /// Clears the stateful data. This includes any installed containers and any user data
7460    /// they may contain.
7461    ///
7462    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7463    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7464    /// operation.
7465    WipeData { responder: LinuxManagerWipeDataResponder },
7466    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7467    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7468    /// the epitaph) before attempting to launch another guest.
7469    ///
7470    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7471    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7472    /// a component crash).
7473    GracefulShutdown { control_handle: LinuxManagerControlHandle },
7474}
7475
7476impl LinuxManagerRequest {
7477    #[allow(irrefutable_let_patterns)]
7478    pub fn into_start_and_get_linux_guest_info(
7479        self,
7480    ) -> Option<(String, LinuxManagerStartAndGetLinuxGuestInfoResponder)> {
7481        if let LinuxManagerRequest::StartAndGetLinuxGuestInfo { label, responder } = self {
7482            Some((label, responder))
7483        } else {
7484            None
7485        }
7486    }
7487
7488    #[allow(irrefutable_let_patterns)]
7489    pub fn into_wipe_data(self) -> Option<(LinuxManagerWipeDataResponder)> {
7490        if let LinuxManagerRequest::WipeData { responder } = self {
7491            Some((responder))
7492        } else {
7493            None
7494        }
7495    }
7496
7497    #[allow(irrefutable_let_patterns)]
7498    pub fn into_graceful_shutdown(self) -> Option<(LinuxManagerControlHandle)> {
7499        if let LinuxManagerRequest::GracefulShutdown { control_handle } = self {
7500            Some((control_handle))
7501        } else {
7502            None
7503        }
7504    }
7505
7506    /// Name of the method defined in FIDL
7507    pub fn method_name(&self) -> &'static str {
7508        match *self {
7509            LinuxManagerRequest::StartAndGetLinuxGuestInfo { .. } => {
7510                "start_and_get_linux_guest_info"
7511            }
7512            LinuxManagerRequest::WipeData { .. } => "wipe_data",
7513            LinuxManagerRequest::GracefulShutdown { .. } => "graceful_shutdown",
7514        }
7515    }
7516}
7517
7518#[derive(Debug, Clone)]
7519pub struct LinuxManagerControlHandle {
7520    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7521}
7522
7523impl fidl::endpoints::ControlHandle for LinuxManagerControlHandle {
7524    fn shutdown(&self) {
7525        self.inner.shutdown()
7526    }
7527
7528    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7529        self.inner.shutdown_with_epitaph(status)
7530    }
7531
7532    fn is_closed(&self) -> bool {
7533        self.inner.channel().is_closed()
7534    }
7535    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7536        self.inner.channel().on_closed()
7537    }
7538
7539    #[cfg(target_os = "fuchsia")]
7540    fn signal_peer(
7541        &self,
7542        clear_mask: zx::Signals,
7543        set_mask: zx::Signals,
7544    ) -> Result<(), zx_status::Status> {
7545        use fidl::Peered;
7546        self.inner.channel().signal_peer(clear_mask, set_mask)
7547    }
7548}
7549
7550impl LinuxManagerControlHandle {
7551    pub fn send_on_guest_info_changed(
7552        &self,
7553        mut label: &str,
7554        mut info: &LinuxGuestInfo,
7555    ) -> Result<(), fidl::Error> {
7556        self.inner.send::<LinuxManagerOnGuestInfoChangedRequest>(
7557            (label, info),
7558            0,
7559            0x30a9be4c43d6a2d6,
7560            fidl::encoding::DynamicFlags::empty(),
7561        )
7562    }
7563}
7564
7565#[must_use = "FIDL methods require a response to be sent"]
7566#[derive(Debug)]
7567pub struct LinuxManagerStartAndGetLinuxGuestInfoResponder {
7568    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
7569    tx_id: u32,
7570}
7571
7572/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
7573/// if the responder is dropped without sending a response, so that the client
7574/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7575impl std::ops::Drop for LinuxManagerStartAndGetLinuxGuestInfoResponder {
7576    fn drop(&mut self) {
7577        self.control_handle.shutdown();
7578        // Safety: drops once, never accessed again
7579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7580    }
7581}
7582
7583impl fidl::endpoints::Responder for LinuxManagerStartAndGetLinuxGuestInfoResponder {
7584    type ControlHandle = LinuxManagerControlHandle;
7585
7586    fn control_handle(&self) -> &LinuxManagerControlHandle {
7587        &self.control_handle
7588    }
7589
7590    fn drop_without_shutdown(mut self) {
7591        // Safety: drops once, never accessed again due to mem::forget
7592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7593        // Prevent Drop from running (which would shut down the channel)
7594        std::mem::forget(self);
7595    }
7596}
7597
7598impl LinuxManagerStartAndGetLinuxGuestInfoResponder {
7599    /// Sends a response to the FIDL transaction.
7600    ///
7601    /// Sets the channel to shutdown if an error occurs.
7602    pub fn send(self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
7603        let _result = self.send_raw(result);
7604        if _result.is_err() {
7605            self.control_handle.shutdown();
7606        }
7607        self.drop_without_shutdown();
7608        _result
7609    }
7610
7611    /// Similar to "send" but does not shutdown the channel if an error occurs.
7612    pub fn send_no_shutdown_on_err(
7613        self,
7614        mut result: Result<&LinuxGuestInfo, i32>,
7615    ) -> Result<(), fidl::Error> {
7616        let _result = self.send_raw(result);
7617        self.drop_without_shutdown();
7618        _result
7619    }
7620
7621    fn send_raw(&self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
7622        self.control_handle.inner.send::<fidl::encoding::ResultType<
7623            LinuxManagerStartAndGetLinuxGuestInfoResponse,
7624            i32,
7625        >>(
7626            result.map(|info| (info,)),
7627            self.tx_id,
7628            0x11809ced100a2bea,
7629            fidl::encoding::DynamicFlags::empty(),
7630        )
7631    }
7632}
7633
7634#[must_use = "FIDL methods require a response to be sent"]
7635#[derive(Debug)]
7636pub struct LinuxManagerWipeDataResponder {
7637    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
7638    tx_id: u32,
7639}
7640
7641/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
7642/// if the responder is dropped without sending a response, so that the client
7643/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7644impl std::ops::Drop for LinuxManagerWipeDataResponder {
7645    fn drop(&mut self) {
7646        self.control_handle.shutdown();
7647        // Safety: drops once, never accessed again
7648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7649    }
7650}
7651
7652impl fidl::endpoints::Responder for LinuxManagerWipeDataResponder {
7653    type ControlHandle = LinuxManagerControlHandle;
7654
7655    fn control_handle(&self) -> &LinuxManagerControlHandle {
7656        &self.control_handle
7657    }
7658
7659    fn drop_without_shutdown(mut self) {
7660        // Safety: drops once, never accessed again due to mem::forget
7661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7662        // Prevent Drop from running (which would shut down the channel)
7663        std::mem::forget(self);
7664    }
7665}
7666
7667impl LinuxManagerWipeDataResponder {
7668    /// Sends a response to the FIDL transaction.
7669    ///
7670    /// Sets the channel to shutdown if an error occurs.
7671    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7672        let _result = self.send_raw(result);
7673        if _result.is_err() {
7674            self.control_handle.shutdown();
7675        }
7676        self.drop_without_shutdown();
7677        _result
7678    }
7679
7680    /// Similar to "send" but does not shutdown the channel if an error occurs.
7681    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7682        let _result = self.send_raw(result);
7683        self.drop_without_shutdown();
7684        _result
7685    }
7686
7687    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7688        self.control_handle
7689            .inner
7690            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7691                result,
7692                self.tx_id,
7693                0x732c69394548a76a,
7694                fidl::encoding::DynamicFlags::empty(),
7695            )
7696    }
7697}
7698
7699#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7700pub struct MemControllerMarker;
7701
7702impl fidl::endpoints::ProtocolMarker for MemControllerMarker {
7703    type Proxy = MemControllerProxy;
7704    type RequestStream = MemControllerRequestStream;
7705    #[cfg(target_os = "fuchsia")]
7706    type SynchronousProxy = MemControllerSynchronousProxy;
7707
7708    const DEBUG_NAME: &'static str = "fuchsia.virtualization.MemController";
7709}
7710impl fidl::endpoints::DiscoverableProtocolMarker for MemControllerMarker {}
7711
7712pub trait MemControllerProxyInterface: Send + Sync {
7713    type GetMemSizeResponseFut: std::future::Future<Output = Result<(u64, u64, u64, u64, u64), fidl::Error>>
7714        + Send;
7715    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut;
7716    fn r#request_size(&self, requested_size: u64) -> Result<(), fidl::Error>;
7717}
7718#[derive(Debug)]
7719#[cfg(target_os = "fuchsia")]
7720pub struct MemControllerSynchronousProxy {
7721    client: fidl::client::sync::Client,
7722}
7723
7724#[cfg(target_os = "fuchsia")]
7725impl fidl::endpoints::SynchronousProxy for MemControllerSynchronousProxy {
7726    type Proxy = MemControllerProxy;
7727    type Protocol = MemControllerMarker;
7728
7729    fn from_channel(inner: fidl::Channel) -> Self {
7730        Self::new(inner)
7731    }
7732
7733    fn into_channel(self) -> fidl::Channel {
7734        self.client.into_channel()
7735    }
7736
7737    fn as_channel(&self) -> &fidl::Channel {
7738        self.client.as_channel()
7739    }
7740}
7741
7742#[cfg(target_os = "fuchsia")]
7743impl MemControllerSynchronousProxy {
7744    pub fn new(channel: fidl::Channel) -> Self {
7745        Self { client: fidl::client::sync::Client::new(channel) }
7746    }
7747
7748    pub fn into_channel(self) -> fidl::Channel {
7749        self.client.into_channel()
7750    }
7751
7752    /// Waits until an event arrives and returns it. It is safe for other
7753    /// threads to make concurrent requests while waiting for an event.
7754    pub fn wait_for_event(
7755        &self,
7756        deadline: zx::MonotonicInstant,
7757    ) -> Result<MemControllerEvent, fidl::Error> {
7758        MemControllerEvent::decode(self.client.wait_for_event::<MemControllerMarker>(deadline)?)
7759    }
7760
7761    /// Get the configured region size, usable region size, plugged size and requestd size
7762    ///
7763    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
7764    /// region_size is the size of device-managed memory region in bytes. Cannot change.
7765    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
7766    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
7767    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
7768    /// memory region.
7769    /// requested_size is the requested amount of plugged memory within the usable device-managed
7770    /// memory region.
7771    pub fn r#get_mem_size(
7772        &self,
7773        ___deadline: zx::MonotonicInstant,
7774    ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
7775        let _response = self.client.send_query::<
7776            fidl::encoding::EmptyPayload,
7777            MemControllerGetMemSizeResponse,
7778            MemControllerMarker,
7779        >(
7780            (),
7781            0x6e9d496f9b66ea56,
7782            fidl::encoding::DynamicFlags::empty(),
7783            ___deadline,
7784        )?;
7785        Ok((
7786            _response.block_size,
7787            _response.region_size,
7788            _response.usable_region_size,
7789            _response.plugged_size,
7790            _response.requested_size,
7791        ))
7792    }
7793
7794    /// Update the requested size to plug or unplug memory
7795    ///
7796    /// The driver SHOULD react to resize requests from the device (requested_size in the device
7797    /// configuration changed) by (un)plugging memory blocks.
7798    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7799        self.client.send::<MemControllerRequestSizeRequest>(
7800            (requested_size,),
7801            0x12f8e2cc21ee8102,
7802            fidl::encoding::DynamicFlags::empty(),
7803        )
7804    }
7805}
7806
7807#[cfg(target_os = "fuchsia")]
7808impl From<MemControllerSynchronousProxy> for zx::NullableHandle {
7809    fn from(value: MemControllerSynchronousProxy) -> Self {
7810        value.into_channel().into()
7811    }
7812}
7813
7814#[cfg(target_os = "fuchsia")]
7815impl From<fidl::Channel> for MemControllerSynchronousProxy {
7816    fn from(value: fidl::Channel) -> Self {
7817        Self::new(value)
7818    }
7819}
7820
7821#[cfg(target_os = "fuchsia")]
7822impl fidl::endpoints::FromClient for MemControllerSynchronousProxy {
7823    type Protocol = MemControllerMarker;
7824
7825    fn from_client(value: fidl::endpoints::ClientEnd<MemControllerMarker>) -> Self {
7826        Self::new(value.into_channel())
7827    }
7828}
7829
7830#[derive(Debug, Clone)]
7831pub struct MemControllerProxy {
7832    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7833}
7834
7835impl fidl::endpoints::Proxy for MemControllerProxy {
7836    type Protocol = MemControllerMarker;
7837
7838    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7839        Self::new(inner)
7840    }
7841
7842    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7843        self.client.into_channel().map_err(|client| Self { client })
7844    }
7845
7846    fn as_channel(&self) -> &::fidl::AsyncChannel {
7847        self.client.as_channel()
7848    }
7849}
7850
7851impl MemControllerProxy {
7852    /// Create a new Proxy for fuchsia.virtualization/MemController.
7853    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7854        let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7855        Self { client: fidl::client::Client::new(channel, protocol_name) }
7856    }
7857
7858    /// Get a Stream of events from the remote end of the protocol.
7859    ///
7860    /// # Panics
7861    ///
7862    /// Panics if the event stream was already taken.
7863    pub fn take_event_stream(&self) -> MemControllerEventStream {
7864        MemControllerEventStream { event_receiver: self.client.take_event_receiver() }
7865    }
7866
7867    /// Get the configured region size, usable region size, plugged size and requestd size
7868    ///
7869    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
7870    /// region_size is the size of device-managed memory region in bytes. Cannot change.
7871    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
7872    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
7873    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
7874    /// memory region.
7875    /// requested_size is the requested amount of plugged memory within the usable device-managed
7876    /// memory region.
7877    pub fn r#get_mem_size(
7878        &self,
7879    ) -> fidl::client::QueryResponseFut<
7880        (u64, u64, u64, u64, u64),
7881        fidl::encoding::DefaultFuchsiaResourceDialect,
7882    > {
7883        MemControllerProxyInterface::r#get_mem_size(self)
7884    }
7885
7886    /// Update the requested size to plug or unplug memory
7887    ///
7888    /// The driver SHOULD react to resize requests from the device (requested_size in the device
7889    /// configuration changed) by (un)plugging memory blocks.
7890    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7891        MemControllerProxyInterface::r#request_size(self, requested_size)
7892    }
7893}
7894
7895impl MemControllerProxyInterface for MemControllerProxy {
7896    type GetMemSizeResponseFut = fidl::client::QueryResponseFut<
7897        (u64, u64, u64, u64, u64),
7898        fidl::encoding::DefaultFuchsiaResourceDialect,
7899    >;
7900    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut {
7901        fn _decode(
7902            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7903        ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
7904            let _response = fidl::client::decode_transaction_body::<
7905                MemControllerGetMemSizeResponse,
7906                fidl::encoding::DefaultFuchsiaResourceDialect,
7907                0x6e9d496f9b66ea56,
7908            >(_buf?)?;
7909            Ok((
7910                _response.block_size,
7911                _response.region_size,
7912                _response.usable_region_size,
7913                _response.plugged_size,
7914                _response.requested_size,
7915            ))
7916        }
7917        self.client
7918            .send_query_and_decode::<fidl::encoding::EmptyPayload, (u64, u64, u64, u64, u64)>(
7919                (),
7920                0x6e9d496f9b66ea56,
7921                fidl::encoding::DynamicFlags::empty(),
7922                _decode,
7923            )
7924    }
7925
7926    fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7927        self.client.send::<MemControllerRequestSizeRequest>(
7928            (requested_size,),
7929            0x12f8e2cc21ee8102,
7930            fidl::encoding::DynamicFlags::empty(),
7931        )
7932    }
7933}
7934
7935pub struct MemControllerEventStream {
7936    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7937}
7938
7939impl std::marker::Unpin for MemControllerEventStream {}
7940
7941impl futures::stream::FusedStream for MemControllerEventStream {
7942    fn is_terminated(&self) -> bool {
7943        self.event_receiver.is_terminated()
7944    }
7945}
7946
7947impl futures::Stream for MemControllerEventStream {
7948    type Item = Result<MemControllerEvent, fidl::Error>;
7949
7950    fn poll_next(
7951        mut self: std::pin::Pin<&mut Self>,
7952        cx: &mut std::task::Context<'_>,
7953    ) -> std::task::Poll<Option<Self::Item>> {
7954        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7955            &mut self.event_receiver,
7956            cx
7957        )?) {
7958            Some(buf) => std::task::Poll::Ready(Some(MemControllerEvent::decode(buf))),
7959            None => std::task::Poll::Ready(None),
7960        }
7961    }
7962}
7963
7964#[derive(Debug)]
7965pub enum MemControllerEvent {}
7966
7967impl MemControllerEvent {
7968    /// Decodes a message buffer as a [`MemControllerEvent`].
7969    fn decode(
7970        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7971    ) -> Result<MemControllerEvent, fidl::Error> {
7972        let (bytes, _handles) = buf.split_mut();
7973        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7974        debug_assert_eq!(tx_header.tx_id, 0);
7975        match tx_header.ordinal {
7976            _ => Err(fidl::Error::UnknownOrdinal {
7977                ordinal: tx_header.ordinal,
7978                protocol_name: <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7979            }),
7980        }
7981    }
7982}
7983
7984/// A Stream of incoming requests for fuchsia.virtualization/MemController.
7985pub struct MemControllerRequestStream {
7986    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7987    is_terminated: bool,
7988}
7989
7990impl std::marker::Unpin for MemControllerRequestStream {}
7991
7992impl futures::stream::FusedStream for MemControllerRequestStream {
7993    fn is_terminated(&self) -> bool {
7994        self.is_terminated
7995    }
7996}
7997
7998impl fidl::endpoints::RequestStream for MemControllerRequestStream {
7999    type Protocol = MemControllerMarker;
8000    type ControlHandle = MemControllerControlHandle;
8001
8002    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8003        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8004    }
8005
8006    fn control_handle(&self) -> Self::ControlHandle {
8007        MemControllerControlHandle { inner: self.inner.clone() }
8008    }
8009
8010    fn into_inner(
8011        self,
8012    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8013    {
8014        (self.inner, self.is_terminated)
8015    }
8016
8017    fn from_inner(
8018        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8019        is_terminated: bool,
8020    ) -> Self {
8021        Self { inner, is_terminated }
8022    }
8023}
8024
8025impl futures::Stream for MemControllerRequestStream {
8026    type Item = Result<MemControllerRequest, fidl::Error>;
8027
8028    fn poll_next(
8029        mut self: std::pin::Pin<&mut Self>,
8030        cx: &mut std::task::Context<'_>,
8031    ) -> std::task::Poll<Option<Self::Item>> {
8032        let this = &mut *self;
8033        if this.inner.check_shutdown(cx) {
8034            this.is_terminated = true;
8035            return std::task::Poll::Ready(None);
8036        }
8037        if this.is_terminated {
8038            panic!("polled MemControllerRequestStream after completion");
8039        }
8040        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8041            |bytes, handles| {
8042                match this.inner.channel().read_etc(cx, bytes, handles) {
8043                    std::task::Poll::Ready(Ok(())) => {}
8044                    std::task::Poll::Pending => return std::task::Poll::Pending,
8045                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8046                        this.is_terminated = true;
8047                        return std::task::Poll::Ready(None);
8048                    }
8049                    std::task::Poll::Ready(Err(e)) => {
8050                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8051                            e.into(),
8052                        ))));
8053                    }
8054                }
8055
8056                // A message has been received from the channel
8057                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8058
8059                std::task::Poll::Ready(Some(match header.ordinal {
8060                    0x6e9d496f9b66ea56 => {
8061                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8062                        let mut req = fidl::new_empty!(
8063                            fidl::encoding::EmptyPayload,
8064                            fidl::encoding::DefaultFuchsiaResourceDialect
8065                        );
8066                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8067                        let control_handle =
8068                            MemControllerControlHandle { inner: this.inner.clone() };
8069                        Ok(MemControllerRequest::GetMemSize {
8070                            responder: MemControllerGetMemSizeResponder {
8071                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8072                                tx_id: header.tx_id,
8073                            },
8074                        })
8075                    }
8076                    0x12f8e2cc21ee8102 => {
8077                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8078                        let mut req = fidl::new_empty!(
8079                            MemControllerRequestSizeRequest,
8080                            fidl::encoding::DefaultFuchsiaResourceDialect
8081                        );
8082                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemControllerRequestSizeRequest>(&header, _body_bytes, handles, &mut req)?;
8083                        let control_handle =
8084                            MemControllerControlHandle { inner: this.inner.clone() };
8085                        Ok(MemControllerRequest::RequestSize {
8086                            requested_size: req.requested_size,
8087
8088                            control_handle,
8089                        })
8090                    }
8091                    _ => Err(fidl::Error::UnknownOrdinal {
8092                        ordinal: header.ordinal,
8093                        protocol_name:
8094                            <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8095                    }),
8096                }))
8097            },
8098        )
8099    }
8100}
8101
8102/// A `MemController` controls a guest's virtio-mem
8103#[derive(Debug)]
8104pub enum MemControllerRequest {
8105    /// Get the configured region size, usable region size, plugged size and requestd size
8106    ///
8107    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
8108    /// region_size is the size of device-managed memory region in bytes. Cannot change.
8109    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
8110    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
8111    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
8112    /// memory region.
8113    /// requested_size is the requested amount of plugged memory within the usable device-managed
8114    /// memory region.
8115    GetMemSize { responder: MemControllerGetMemSizeResponder },
8116    /// Update the requested size to plug or unplug memory
8117    ///
8118    /// The driver SHOULD react to resize requests from the device (requested_size in the device
8119    /// configuration changed) by (un)plugging memory blocks.
8120    RequestSize { requested_size: u64, control_handle: MemControllerControlHandle },
8121}
8122
8123impl MemControllerRequest {
8124    #[allow(irrefutable_let_patterns)]
8125    pub fn into_get_mem_size(self) -> Option<(MemControllerGetMemSizeResponder)> {
8126        if let MemControllerRequest::GetMemSize { responder } = self {
8127            Some((responder))
8128        } else {
8129            None
8130        }
8131    }
8132
8133    #[allow(irrefutable_let_patterns)]
8134    pub fn into_request_size(self) -> Option<(u64, MemControllerControlHandle)> {
8135        if let MemControllerRequest::RequestSize { requested_size, control_handle } = self {
8136            Some((requested_size, control_handle))
8137        } else {
8138            None
8139        }
8140    }
8141
8142    /// Name of the method defined in FIDL
8143    pub fn method_name(&self) -> &'static str {
8144        match *self {
8145            MemControllerRequest::GetMemSize { .. } => "get_mem_size",
8146            MemControllerRequest::RequestSize { .. } => "request_size",
8147        }
8148    }
8149}
8150
8151#[derive(Debug, Clone)]
8152pub struct MemControllerControlHandle {
8153    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8154}
8155
8156impl fidl::endpoints::ControlHandle for MemControllerControlHandle {
8157    fn shutdown(&self) {
8158        self.inner.shutdown()
8159    }
8160
8161    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8162        self.inner.shutdown_with_epitaph(status)
8163    }
8164
8165    fn is_closed(&self) -> bool {
8166        self.inner.channel().is_closed()
8167    }
8168    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8169        self.inner.channel().on_closed()
8170    }
8171
8172    #[cfg(target_os = "fuchsia")]
8173    fn signal_peer(
8174        &self,
8175        clear_mask: zx::Signals,
8176        set_mask: zx::Signals,
8177    ) -> Result<(), zx_status::Status> {
8178        use fidl::Peered;
8179        self.inner.channel().signal_peer(clear_mask, set_mask)
8180    }
8181}
8182
8183impl MemControllerControlHandle {}
8184
8185#[must_use = "FIDL methods require a response to be sent"]
8186#[derive(Debug)]
8187pub struct MemControllerGetMemSizeResponder {
8188    control_handle: std::mem::ManuallyDrop<MemControllerControlHandle>,
8189    tx_id: u32,
8190}
8191
8192/// Set the the channel to be shutdown (see [`MemControllerControlHandle::shutdown`])
8193/// if the responder is dropped without sending a response, so that the client
8194/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8195impl std::ops::Drop for MemControllerGetMemSizeResponder {
8196    fn drop(&mut self) {
8197        self.control_handle.shutdown();
8198        // Safety: drops once, never accessed again
8199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8200    }
8201}
8202
8203impl fidl::endpoints::Responder for MemControllerGetMemSizeResponder {
8204    type ControlHandle = MemControllerControlHandle;
8205
8206    fn control_handle(&self) -> &MemControllerControlHandle {
8207        &self.control_handle
8208    }
8209
8210    fn drop_without_shutdown(mut self) {
8211        // Safety: drops once, never accessed again due to mem::forget
8212        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8213        // Prevent Drop from running (which would shut down the channel)
8214        std::mem::forget(self);
8215    }
8216}
8217
8218impl MemControllerGetMemSizeResponder {
8219    /// Sends a response to the FIDL transaction.
8220    ///
8221    /// Sets the channel to shutdown if an error occurs.
8222    pub fn send(
8223        self,
8224        mut block_size: u64,
8225        mut region_size: u64,
8226        mut usable_region_size: u64,
8227        mut plugged_size: u64,
8228        mut requested_size: u64,
8229    ) -> Result<(), fidl::Error> {
8230        let _result = self.send_raw(
8231            block_size,
8232            region_size,
8233            usable_region_size,
8234            plugged_size,
8235            requested_size,
8236        );
8237        if _result.is_err() {
8238            self.control_handle.shutdown();
8239        }
8240        self.drop_without_shutdown();
8241        _result
8242    }
8243
8244    /// Similar to "send" but does not shutdown the channel if an error occurs.
8245    pub fn send_no_shutdown_on_err(
8246        self,
8247        mut block_size: u64,
8248        mut region_size: u64,
8249        mut usable_region_size: u64,
8250        mut plugged_size: u64,
8251        mut requested_size: u64,
8252    ) -> Result<(), fidl::Error> {
8253        let _result = self.send_raw(
8254            block_size,
8255            region_size,
8256            usable_region_size,
8257            plugged_size,
8258            requested_size,
8259        );
8260        self.drop_without_shutdown();
8261        _result
8262    }
8263
8264    fn send_raw(
8265        &self,
8266        mut block_size: u64,
8267        mut region_size: u64,
8268        mut usable_region_size: u64,
8269        mut plugged_size: u64,
8270        mut requested_size: u64,
8271    ) -> Result<(), fidl::Error> {
8272        self.control_handle.inner.send::<MemControllerGetMemSizeResponse>(
8273            (block_size, region_size, usable_region_size, plugged_size, requested_size),
8274            self.tx_id,
8275            0x6e9d496f9b66ea56,
8276            fidl::encoding::DynamicFlags::empty(),
8277        )
8278    }
8279}
8280
8281#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8282pub struct TerminaGuestManagerMarker;
8283
8284impl fidl::endpoints::ProtocolMarker for TerminaGuestManagerMarker {
8285    type Proxy = TerminaGuestManagerProxy;
8286    type RequestStream = TerminaGuestManagerRequestStream;
8287    #[cfg(target_os = "fuchsia")]
8288    type SynchronousProxy = TerminaGuestManagerSynchronousProxy;
8289
8290    const DEBUG_NAME: &'static str = "fuchsia.virtualization.TerminaGuestManager";
8291}
8292impl fidl::endpoints::DiscoverableProtocolMarker for TerminaGuestManagerMarker {}
8293
8294pub trait TerminaGuestManagerProxyInterface: Send + Sync {
8295    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
8296        + Send;
8297    fn r#launch(
8298        &self,
8299        guest_config: GuestConfig,
8300        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8301    ) -> Self::LaunchResponseFut;
8302    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8303    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
8304    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
8305        + Send;
8306    fn r#connect(
8307        &self,
8308        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8309    ) -> Self::ConnectResponseFut;
8310    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
8311    fn r#get_info(&self) -> Self::GetInfoResponseFut;
8312}
8313#[derive(Debug)]
8314#[cfg(target_os = "fuchsia")]
8315pub struct TerminaGuestManagerSynchronousProxy {
8316    client: fidl::client::sync::Client,
8317}
8318
8319#[cfg(target_os = "fuchsia")]
8320impl fidl::endpoints::SynchronousProxy for TerminaGuestManagerSynchronousProxy {
8321    type Proxy = TerminaGuestManagerProxy;
8322    type Protocol = TerminaGuestManagerMarker;
8323
8324    fn from_channel(inner: fidl::Channel) -> Self {
8325        Self::new(inner)
8326    }
8327
8328    fn into_channel(self) -> fidl::Channel {
8329        self.client.into_channel()
8330    }
8331
8332    fn as_channel(&self) -> &fidl::Channel {
8333        self.client.as_channel()
8334    }
8335}
8336
8337#[cfg(target_os = "fuchsia")]
8338impl TerminaGuestManagerSynchronousProxy {
8339    pub fn new(channel: fidl::Channel) -> Self {
8340        Self { client: fidl::client::sync::Client::new(channel) }
8341    }
8342
8343    pub fn into_channel(self) -> fidl::Channel {
8344        self.client.into_channel()
8345    }
8346
8347    /// Waits until an event arrives and returns it. It is safe for other
8348    /// threads to make concurrent requests while waiting for an event.
8349    pub fn wait_for_event(
8350        &self,
8351        deadline: zx::MonotonicInstant,
8352    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
8353        TerminaGuestManagerEvent::decode(
8354            self.client.wait_for_event::<TerminaGuestManagerMarker>(deadline)?,
8355        )
8356    }
8357
8358    /// Launch a new guest instance.
8359    ///
8360    /// Possible errors:
8361    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8362    ///         problems detected by the guest manager.
8363    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8364    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8365    ///         component logs for a more specific failure.
8366    pub fn r#launch(
8367        &self,
8368        mut guest_config: GuestConfig,
8369        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8370        ___deadline: zx::MonotonicInstant,
8371    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8372        let _response =
8373            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
8374                fidl::encoding::EmptyStruct,
8375                GuestManagerError,
8376            >, TerminaGuestManagerMarker>(
8377                (&mut guest_config, controller),
8378                0x394a2e29f750323e,
8379                fidl::encoding::DynamicFlags::empty(),
8380                ___deadline,
8381            )?;
8382        Ok(_response.map(|x| x))
8383    }
8384
8385    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8386    /// be used to launch another guest.
8387    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
8388        let _response = self.client.send_query::<
8389            fidl::encoding::EmptyPayload,
8390            fidl::encoding::EmptyPayload,
8391            TerminaGuestManagerMarker,
8392        >(
8393            (),
8394            0x3ad9a012982f872d,
8395            fidl::encoding::DynamicFlags::empty(),
8396            ___deadline,
8397        )?;
8398        Ok(_response)
8399    }
8400
8401    /// Connect to a currently running guest.
8402    ///
8403    /// Possible errors:
8404    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8405    ///         has launched before attempting to reconnect.
8406    pub fn r#connect(
8407        &self,
8408        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8409        ___deadline: zx::MonotonicInstant,
8410    ) -> Result<GuestManagerConnectResult, fidl::Error> {
8411        let _response =
8412            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
8413                fidl::encoding::EmptyStruct,
8414                GuestManagerError,
8415            >, TerminaGuestManagerMarker>(
8416                (controller,),
8417                0x4e489076e3bb15b4,
8418                fidl::encoding::DynamicFlags::empty(),
8419                ___deadline,
8420            )?;
8421        Ok(_response.map(|x| x))
8422    }
8423
8424    /// Query guest info
8425    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
8426        let _response = self.client.send_query::<
8427            fidl::encoding::EmptyPayload,
8428            GuestManagerGetInfoResponse,
8429            TerminaGuestManagerMarker,
8430        >(
8431            (),
8432            0x76892614aea695dc,
8433            fidl::encoding::DynamicFlags::empty(),
8434            ___deadline,
8435        )?;
8436        Ok(_response.guest_info)
8437    }
8438}
8439
8440#[cfg(target_os = "fuchsia")]
8441impl From<TerminaGuestManagerSynchronousProxy> for zx::NullableHandle {
8442    fn from(value: TerminaGuestManagerSynchronousProxy) -> Self {
8443        value.into_channel().into()
8444    }
8445}
8446
8447#[cfg(target_os = "fuchsia")]
8448impl From<fidl::Channel> for TerminaGuestManagerSynchronousProxy {
8449    fn from(value: fidl::Channel) -> Self {
8450        Self::new(value)
8451    }
8452}
8453
8454#[cfg(target_os = "fuchsia")]
8455impl fidl::endpoints::FromClient for TerminaGuestManagerSynchronousProxy {
8456    type Protocol = TerminaGuestManagerMarker;
8457
8458    fn from_client(value: fidl::endpoints::ClientEnd<TerminaGuestManagerMarker>) -> Self {
8459        Self::new(value.into_channel())
8460    }
8461}
8462
8463#[derive(Debug, Clone)]
8464pub struct TerminaGuestManagerProxy {
8465    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8466}
8467
8468impl fidl::endpoints::Proxy for TerminaGuestManagerProxy {
8469    type Protocol = TerminaGuestManagerMarker;
8470
8471    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8472        Self::new(inner)
8473    }
8474
8475    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8476        self.client.into_channel().map_err(|client| Self { client })
8477    }
8478
8479    fn as_channel(&self) -> &::fidl::AsyncChannel {
8480        self.client.as_channel()
8481    }
8482}
8483
8484impl TerminaGuestManagerProxy {
8485    /// Create a new Proxy for fuchsia.virtualization/TerminaGuestManager.
8486    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8487        let protocol_name =
8488            <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8489        Self { client: fidl::client::Client::new(channel, protocol_name) }
8490    }
8491
8492    /// Get a Stream of events from the remote end of the protocol.
8493    ///
8494    /// # Panics
8495    ///
8496    /// Panics if the event stream was already taken.
8497    pub fn take_event_stream(&self) -> TerminaGuestManagerEventStream {
8498        TerminaGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
8499    }
8500
8501    /// Launch a new guest instance.
8502    ///
8503    /// Possible errors:
8504    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8505    ///         problems detected by the guest manager.
8506    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8507    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8508    ///         component logs for a more specific failure.
8509    pub fn r#launch(
8510        &self,
8511        mut guest_config: GuestConfig,
8512        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8513    ) -> fidl::client::QueryResponseFut<
8514        GuestManagerLaunchResult,
8515        fidl::encoding::DefaultFuchsiaResourceDialect,
8516    > {
8517        TerminaGuestManagerProxyInterface::r#launch(self, guest_config, controller)
8518    }
8519
8520    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8521    /// be used to launch another guest.
8522    pub fn r#force_shutdown(
8523        &self,
8524    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8525        TerminaGuestManagerProxyInterface::r#force_shutdown(self)
8526    }
8527
8528    /// Connect to a currently running guest.
8529    ///
8530    /// Possible errors:
8531    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8532    ///         has launched before attempting to reconnect.
8533    pub fn r#connect(
8534        &self,
8535        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8536    ) -> fidl::client::QueryResponseFut<
8537        GuestManagerConnectResult,
8538        fidl::encoding::DefaultFuchsiaResourceDialect,
8539    > {
8540        TerminaGuestManagerProxyInterface::r#connect(self, controller)
8541    }
8542
8543    /// Query guest info
8544    pub fn r#get_info(
8545        &self,
8546    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
8547    {
8548        TerminaGuestManagerProxyInterface::r#get_info(self)
8549    }
8550}
8551
8552impl TerminaGuestManagerProxyInterface for TerminaGuestManagerProxy {
8553    type LaunchResponseFut = fidl::client::QueryResponseFut<
8554        GuestManagerLaunchResult,
8555        fidl::encoding::DefaultFuchsiaResourceDialect,
8556    >;
8557    fn r#launch(
8558        &self,
8559        mut guest_config: GuestConfig,
8560        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8561    ) -> Self::LaunchResponseFut {
8562        fn _decode(
8563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8564        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8565            let _response = fidl::client::decode_transaction_body::<
8566                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8567                fidl::encoding::DefaultFuchsiaResourceDialect,
8568                0x394a2e29f750323e,
8569            >(_buf?)?;
8570            Ok(_response.map(|x| x))
8571        }
8572        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
8573            (&mut guest_config, controller),
8574            0x394a2e29f750323e,
8575            fidl::encoding::DynamicFlags::empty(),
8576            _decode,
8577        )
8578    }
8579
8580    type ForceShutdownResponseFut =
8581        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8582    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
8583        fn _decode(
8584            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8585        ) -> Result<(), fidl::Error> {
8586            let _response = fidl::client::decode_transaction_body::<
8587                fidl::encoding::EmptyPayload,
8588                fidl::encoding::DefaultFuchsiaResourceDialect,
8589                0x3ad9a012982f872d,
8590            >(_buf?)?;
8591            Ok(_response)
8592        }
8593        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8594            (),
8595            0x3ad9a012982f872d,
8596            fidl::encoding::DynamicFlags::empty(),
8597            _decode,
8598        )
8599    }
8600
8601    type ConnectResponseFut = fidl::client::QueryResponseFut<
8602        GuestManagerConnectResult,
8603        fidl::encoding::DefaultFuchsiaResourceDialect,
8604    >;
8605    fn r#connect(
8606        &self,
8607        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8608    ) -> Self::ConnectResponseFut {
8609        fn _decode(
8610            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8611        ) -> Result<GuestManagerConnectResult, fidl::Error> {
8612            let _response = fidl::client::decode_transaction_body::<
8613                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8614                fidl::encoding::DefaultFuchsiaResourceDialect,
8615                0x4e489076e3bb15b4,
8616            >(_buf?)?;
8617            Ok(_response.map(|x| x))
8618        }
8619        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
8620            (controller,),
8621            0x4e489076e3bb15b4,
8622            fidl::encoding::DynamicFlags::empty(),
8623            _decode,
8624        )
8625    }
8626
8627    type GetInfoResponseFut =
8628        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
8629    fn r#get_info(&self) -> Self::GetInfoResponseFut {
8630        fn _decode(
8631            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8632        ) -> Result<GuestInfo, fidl::Error> {
8633            let _response = fidl::client::decode_transaction_body::<
8634                GuestManagerGetInfoResponse,
8635                fidl::encoding::DefaultFuchsiaResourceDialect,
8636                0x76892614aea695dc,
8637            >(_buf?)?;
8638            Ok(_response.guest_info)
8639        }
8640        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
8641            (),
8642            0x76892614aea695dc,
8643            fidl::encoding::DynamicFlags::empty(),
8644            _decode,
8645        )
8646    }
8647}
8648
8649pub struct TerminaGuestManagerEventStream {
8650    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8651}
8652
8653impl std::marker::Unpin for TerminaGuestManagerEventStream {}
8654
8655impl futures::stream::FusedStream for TerminaGuestManagerEventStream {
8656    fn is_terminated(&self) -> bool {
8657        self.event_receiver.is_terminated()
8658    }
8659}
8660
8661impl futures::Stream for TerminaGuestManagerEventStream {
8662    type Item = Result<TerminaGuestManagerEvent, fidl::Error>;
8663
8664    fn poll_next(
8665        mut self: std::pin::Pin<&mut Self>,
8666        cx: &mut std::task::Context<'_>,
8667    ) -> std::task::Poll<Option<Self::Item>> {
8668        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8669            &mut self.event_receiver,
8670            cx
8671        )?) {
8672            Some(buf) => std::task::Poll::Ready(Some(TerminaGuestManagerEvent::decode(buf))),
8673            None => std::task::Poll::Ready(None),
8674        }
8675    }
8676}
8677
8678#[derive(Debug)]
8679pub enum TerminaGuestManagerEvent {}
8680
8681impl TerminaGuestManagerEvent {
8682    /// Decodes a message buffer as a [`TerminaGuestManagerEvent`].
8683    fn decode(
8684        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8685    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
8686        let (bytes, _handles) = buf.split_mut();
8687        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8688        debug_assert_eq!(tx_header.tx_id, 0);
8689        match tx_header.ordinal {
8690            _ => Err(fidl::Error::UnknownOrdinal {
8691                ordinal: tx_header.ordinal,
8692                protocol_name:
8693                    <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8694            }),
8695        }
8696    }
8697}
8698
8699/// A Stream of incoming requests for fuchsia.virtualization/TerminaGuestManager.
8700pub struct TerminaGuestManagerRequestStream {
8701    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8702    is_terminated: bool,
8703}
8704
8705impl std::marker::Unpin for TerminaGuestManagerRequestStream {}
8706
8707impl futures::stream::FusedStream for TerminaGuestManagerRequestStream {
8708    fn is_terminated(&self) -> bool {
8709        self.is_terminated
8710    }
8711}
8712
8713impl fidl::endpoints::RequestStream for TerminaGuestManagerRequestStream {
8714    type Protocol = TerminaGuestManagerMarker;
8715    type ControlHandle = TerminaGuestManagerControlHandle;
8716
8717    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8718        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8719    }
8720
8721    fn control_handle(&self) -> Self::ControlHandle {
8722        TerminaGuestManagerControlHandle { inner: self.inner.clone() }
8723    }
8724
8725    fn into_inner(
8726        self,
8727    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8728    {
8729        (self.inner, self.is_terminated)
8730    }
8731
8732    fn from_inner(
8733        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8734        is_terminated: bool,
8735    ) -> Self {
8736        Self { inner, is_terminated }
8737    }
8738}
8739
8740impl futures::Stream for TerminaGuestManagerRequestStream {
8741    type Item = Result<TerminaGuestManagerRequest, fidl::Error>;
8742
8743    fn poll_next(
8744        mut self: std::pin::Pin<&mut Self>,
8745        cx: &mut std::task::Context<'_>,
8746    ) -> std::task::Poll<Option<Self::Item>> {
8747        let this = &mut *self;
8748        if this.inner.check_shutdown(cx) {
8749            this.is_terminated = true;
8750            return std::task::Poll::Ready(None);
8751        }
8752        if this.is_terminated {
8753            panic!("polled TerminaGuestManagerRequestStream after completion");
8754        }
8755        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8756            |bytes, handles| {
8757                match this.inner.channel().read_etc(cx, bytes, handles) {
8758                    std::task::Poll::Ready(Ok(())) => {}
8759                    std::task::Poll::Pending => return std::task::Poll::Pending,
8760                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8761                        this.is_terminated = true;
8762                        return std::task::Poll::Ready(None);
8763                    }
8764                    std::task::Poll::Ready(Err(e)) => {
8765                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8766                            e.into(),
8767                        ))));
8768                    }
8769                }
8770
8771                // A message has been received from the channel
8772                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8773
8774                std::task::Poll::Ready(Some(match header.ordinal {
8775                0x394a2e29f750323e => {
8776                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8777                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8778                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
8779                    let control_handle = TerminaGuestManagerControlHandle {
8780                        inner: this.inner.clone(),
8781                    };
8782                    Ok(TerminaGuestManagerRequest::Launch {guest_config: req.guest_config,
8783controller: req.controller,
8784
8785                        responder: TerminaGuestManagerLaunchResponder {
8786                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8787                            tx_id: header.tx_id,
8788                        },
8789                    })
8790                }
8791                0x3ad9a012982f872d => {
8792                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8793                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8794                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8795                    let control_handle = TerminaGuestManagerControlHandle {
8796                        inner: this.inner.clone(),
8797                    };
8798                    Ok(TerminaGuestManagerRequest::ForceShutdown {
8799                        responder: TerminaGuestManagerForceShutdownResponder {
8800                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8801                            tx_id: header.tx_id,
8802                        },
8803                    })
8804                }
8805                0x4e489076e3bb15b4 => {
8806                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8807                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8808                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8809                    let control_handle = TerminaGuestManagerControlHandle {
8810                        inner: this.inner.clone(),
8811                    };
8812                    Ok(TerminaGuestManagerRequest::Connect {controller: req.controller,
8813
8814                        responder: TerminaGuestManagerConnectResponder {
8815                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8816                            tx_id: header.tx_id,
8817                        },
8818                    })
8819                }
8820                0x76892614aea695dc => {
8821                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8822                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8823                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8824                    let control_handle = TerminaGuestManagerControlHandle {
8825                        inner: this.inner.clone(),
8826                    };
8827                    Ok(TerminaGuestManagerRequest::GetInfo {
8828                        responder: TerminaGuestManagerGetInfoResponder {
8829                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8830                            tx_id: header.tx_id,
8831                        },
8832                    })
8833                }
8834                _ => Err(fidl::Error::UnknownOrdinal {
8835                    ordinal: header.ordinal,
8836                    protocol_name: <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8837                }),
8838            }))
8839            },
8840        )
8841    }
8842}
8843
8844#[derive(Debug)]
8845pub enum TerminaGuestManagerRequest {
8846    /// Launch a new guest instance.
8847    ///
8848    /// Possible errors:
8849    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8850    ///         problems detected by the guest manager.
8851    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8852    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8853    ///         component logs for a more specific failure.
8854    Launch {
8855        guest_config: GuestConfig,
8856        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8857        responder: TerminaGuestManagerLaunchResponder,
8858    },
8859    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8860    /// be used to launch another guest.
8861    ForceShutdown { responder: TerminaGuestManagerForceShutdownResponder },
8862    /// Connect to a currently running guest.
8863    ///
8864    /// Possible errors:
8865    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8866    ///         has launched before attempting to reconnect.
8867    Connect {
8868        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8869        responder: TerminaGuestManagerConnectResponder,
8870    },
8871    /// Query guest info
8872    GetInfo { responder: TerminaGuestManagerGetInfoResponder },
8873}
8874
8875impl TerminaGuestManagerRequest {
8876    #[allow(irrefutable_let_patterns)]
8877    pub fn into_launch(
8878        self,
8879    ) -> Option<(
8880        GuestConfig,
8881        fidl::endpoints::ServerEnd<GuestMarker>,
8882        TerminaGuestManagerLaunchResponder,
8883    )> {
8884        if let TerminaGuestManagerRequest::Launch { guest_config, controller, responder } = self {
8885            Some((guest_config, controller, responder))
8886        } else {
8887            None
8888        }
8889    }
8890
8891    #[allow(irrefutable_let_patterns)]
8892    pub fn into_force_shutdown(self) -> Option<(TerminaGuestManagerForceShutdownResponder)> {
8893        if let TerminaGuestManagerRequest::ForceShutdown { responder } = self {
8894            Some((responder))
8895        } else {
8896            None
8897        }
8898    }
8899
8900    #[allow(irrefutable_let_patterns)]
8901    pub fn into_connect(
8902        self,
8903    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, TerminaGuestManagerConnectResponder)>
8904    {
8905        if let TerminaGuestManagerRequest::Connect { controller, responder } = self {
8906            Some((controller, responder))
8907        } else {
8908            None
8909        }
8910    }
8911
8912    #[allow(irrefutable_let_patterns)]
8913    pub fn into_get_info(self) -> Option<(TerminaGuestManagerGetInfoResponder)> {
8914        if let TerminaGuestManagerRequest::GetInfo { responder } = self {
8915            Some((responder))
8916        } else {
8917            None
8918        }
8919    }
8920
8921    /// Name of the method defined in FIDL
8922    pub fn method_name(&self) -> &'static str {
8923        match *self {
8924            TerminaGuestManagerRequest::Launch { .. } => "launch",
8925            TerminaGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
8926            TerminaGuestManagerRequest::Connect { .. } => "connect",
8927            TerminaGuestManagerRequest::GetInfo { .. } => "get_info",
8928        }
8929    }
8930}
8931
8932#[derive(Debug, Clone)]
8933pub struct TerminaGuestManagerControlHandle {
8934    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8935}
8936
8937impl fidl::endpoints::ControlHandle for TerminaGuestManagerControlHandle {
8938    fn shutdown(&self) {
8939        self.inner.shutdown()
8940    }
8941
8942    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8943        self.inner.shutdown_with_epitaph(status)
8944    }
8945
8946    fn is_closed(&self) -> bool {
8947        self.inner.channel().is_closed()
8948    }
8949    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8950        self.inner.channel().on_closed()
8951    }
8952
8953    #[cfg(target_os = "fuchsia")]
8954    fn signal_peer(
8955        &self,
8956        clear_mask: zx::Signals,
8957        set_mask: zx::Signals,
8958    ) -> Result<(), zx_status::Status> {
8959        use fidl::Peered;
8960        self.inner.channel().signal_peer(clear_mask, set_mask)
8961    }
8962}
8963
8964impl TerminaGuestManagerControlHandle {}
8965
8966#[must_use = "FIDL methods require a response to be sent"]
8967#[derive(Debug)]
8968pub struct TerminaGuestManagerLaunchResponder {
8969    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8970    tx_id: u32,
8971}
8972
8973/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8974/// if the responder is dropped without sending a response, so that the client
8975/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8976impl std::ops::Drop for TerminaGuestManagerLaunchResponder {
8977    fn drop(&mut self) {
8978        self.control_handle.shutdown();
8979        // Safety: drops once, never accessed again
8980        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8981    }
8982}
8983
8984impl fidl::endpoints::Responder for TerminaGuestManagerLaunchResponder {
8985    type ControlHandle = TerminaGuestManagerControlHandle;
8986
8987    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8988        &self.control_handle
8989    }
8990
8991    fn drop_without_shutdown(mut self) {
8992        // Safety: drops once, never accessed again due to mem::forget
8993        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8994        // Prevent Drop from running (which would shut down the channel)
8995        std::mem::forget(self);
8996    }
8997}
8998
8999impl TerminaGuestManagerLaunchResponder {
9000    /// Sends a response to the FIDL transaction.
9001    ///
9002    /// Sets the channel to shutdown if an error occurs.
9003    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9004        let _result = self.send_raw(result);
9005        if _result.is_err() {
9006            self.control_handle.shutdown();
9007        }
9008        self.drop_without_shutdown();
9009        _result
9010    }
9011
9012    /// Similar to "send" but does not shutdown the channel if an error occurs.
9013    pub fn send_no_shutdown_on_err(
9014        self,
9015        mut result: Result<(), GuestManagerError>,
9016    ) -> Result<(), fidl::Error> {
9017        let _result = self.send_raw(result);
9018        self.drop_without_shutdown();
9019        _result
9020    }
9021
9022    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9023        self.control_handle.inner.send::<fidl::encoding::ResultType<
9024            fidl::encoding::EmptyStruct,
9025            GuestManagerError,
9026        >>(
9027            result,
9028            self.tx_id,
9029            0x394a2e29f750323e,
9030            fidl::encoding::DynamicFlags::empty(),
9031        )
9032    }
9033}
9034
9035#[must_use = "FIDL methods require a response to be sent"]
9036#[derive(Debug)]
9037pub struct TerminaGuestManagerForceShutdownResponder {
9038    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
9039    tx_id: u32,
9040}
9041
9042/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9043/// if the responder is dropped without sending a response, so that the client
9044/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9045impl std::ops::Drop for TerminaGuestManagerForceShutdownResponder {
9046    fn drop(&mut self) {
9047        self.control_handle.shutdown();
9048        // Safety: drops once, never accessed again
9049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9050    }
9051}
9052
9053impl fidl::endpoints::Responder for TerminaGuestManagerForceShutdownResponder {
9054    type ControlHandle = TerminaGuestManagerControlHandle;
9055
9056    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9057        &self.control_handle
9058    }
9059
9060    fn drop_without_shutdown(mut self) {
9061        // Safety: drops once, never accessed again due to mem::forget
9062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9063        // Prevent Drop from running (which would shut down the channel)
9064        std::mem::forget(self);
9065    }
9066}
9067
9068impl TerminaGuestManagerForceShutdownResponder {
9069    /// Sends a response to the FIDL transaction.
9070    ///
9071    /// Sets the channel to shutdown if an error occurs.
9072    pub fn send(self) -> Result<(), fidl::Error> {
9073        let _result = self.send_raw();
9074        if _result.is_err() {
9075            self.control_handle.shutdown();
9076        }
9077        self.drop_without_shutdown();
9078        _result
9079    }
9080
9081    /// Similar to "send" but does not shutdown the channel if an error occurs.
9082    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9083        let _result = self.send_raw();
9084        self.drop_without_shutdown();
9085        _result
9086    }
9087
9088    fn send_raw(&self) -> Result<(), fidl::Error> {
9089        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9090            (),
9091            self.tx_id,
9092            0x3ad9a012982f872d,
9093            fidl::encoding::DynamicFlags::empty(),
9094        )
9095    }
9096}
9097
9098#[must_use = "FIDL methods require a response to be sent"]
9099#[derive(Debug)]
9100pub struct TerminaGuestManagerConnectResponder {
9101    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
9102    tx_id: u32,
9103}
9104
9105/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9106/// if the responder is dropped without sending a response, so that the client
9107/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9108impl std::ops::Drop for TerminaGuestManagerConnectResponder {
9109    fn drop(&mut self) {
9110        self.control_handle.shutdown();
9111        // Safety: drops once, never accessed again
9112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9113    }
9114}
9115
9116impl fidl::endpoints::Responder for TerminaGuestManagerConnectResponder {
9117    type ControlHandle = TerminaGuestManagerControlHandle;
9118
9119    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9120        &self.control_handle
9121    }
9122
9123    fn drop_without_shutdown(mut self) {
9124        // Safety: drops once, never accessed again due to mem::forget
9125        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9126        // Prevent Drop from running (which would shut down the channel)
9127        std::mem::forget(self);
9128    }
9129}
9130
9131impl TerminaGuestManagerConnectResponder {
9132    /// Sends a response to the FIDL transaction.
9133    ///
9134    /// Sets the channel to shutdown if an error occurs.
9135    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9136        let _result = self.send_raw(result);
9137        if _result.is_err() {
9138            self.control_handle.shutdown();
9139        }
9140        self.drop_without_shutdown();
9141        _result
9142    }
9143
9144    /// Similar to "send" but does not shutdown the channel if an error occurs.
9145    pub fn send_no_shutdown_on_err(
9146        self,
9147        mut result: Result<(), GuestManagerError>,
9148    ) -> Result<(), fidl::Error> {
9149        let _result = self.send_raw(result);
9150        self.drop_without_shutdown();
9151        _result
9152    }
9153
9154    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9155        self.control_handle.inner.send::<fidl::encoding::ResultType<
9156            fidl::encoding::EmptyStruct,
9157            GuestManagerError,
9158        >>(
9159            result,
9160            self.tx_id,
9161            0x4e489076e3bb15b4,
9162            fidl::encoding::DynamicFlags::empty(),
9163        )
9164    }
9165}
9166
9167#[must_use = "FIDL methods require a response to be sent"]
9168#[derive(Debug)]
9169pub struct TerminaGuestManagerGetInfoResponder {
9170    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
9171    tx_id: u32,
9172}
9173
9174/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9175/// if the responder is dropped without sending a response, so that the client
9176/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9177impl std::ops::Drop for TerminaGuestManagerGetInfoResponder {
9178    fn drop(&mut self) {
9179        self.control_handle.shutdown();
9180        // Safety: drops once, never accessed again
9181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9182    }
9183}
9184
9185impl fidl::endpoints::Responder for TerminaGuestManagerGetInfoResponder {
9186    type ControlHandle = TerminaGuestManagerControlHandle;
9187
9188    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9189        &self.control_handle
9190    }
9191
9192    fn drop_without_shutdown(mut self) {
9193        // Safety: drops once, never accessed again due to mem::forget
9194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9195        // Prevent Drop from running (which would shut down the channel)
9196        std::mem::forget(self);
9197    }
9198}
9199
9200impl TerminaGuestManagerGetInfoResponder {
9201    /// Sends a response to the FIDL transaction.
9202    ///
9203    /// Sets the channel to shutdown if an error occurs.
9204    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9205        let _result = self.send_raw(guest_info);
9206        if _result.is_err() {
9207            self.control_handle.shutdown();
9208        }
9209        self.drop_without_shutdown();
9210        _result
9211    }
9212
9213    /// Similar to "send" but does not shutdown the channel if an error occurs.
9214    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9215        let _result = self.send_raw(guest_info);
9216        self.drop_without_shutdown();
9217        _result
9218    }
9219
9220    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9221        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
9222            (guest_info,),
9223            self.tx_id,
9224            0x76892614aea695dc,
9225            fidl::encoding::DynamicFlags::empty(),
9226        )
9227    }
9228}
9229
9230#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9231pub struct ZirconGuestManagerMarker;
9232
9233impl fidl::endpoints::ProtocolMarker for ZirconGuestManagerMarker {
9234    type Proxy = ZirconGuestManagerProxy;
9235    type RequestStream = ZirconGuestManagerRequestStream;
9236    #[cfg(target_os = "fuchsia")]
9237    type SynchronousProxy = ZirconGuestManagerSynchronousProxy;
9238
9239    const DEBUG_NAME: &'static str = "fuchsia.virtualization.ZirconGuestManager";
9240}
9241impl fidl::endpoints::DiscoverableProtocolMarker for ZirconGuestManagerMarker {}
9242
9243pub trait ZirconGuestManagerProxyInterface: Send + Sync {
9244    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
9245        + Send;
9246    fn r#launch(
9247        &self,
9248        guest_config: GuestConfig,
9249        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9250    ) -> Self::LaunchResponseFut;
9251    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9252    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
9253    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
9254        + Send;
9255    fn r#connect(
9256        &self,
9257        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9258    ) -> Self::ConnectResponseFut;
9259    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
9260    fn r#get_info(&self) -> Self::GetInfoResponseFut;
9261}
9262#[derive(Debug)]
9263#[cfg(target_os = "fuchsia")]
9264pub struct ZirconGuestManagerSynchronousProxy {
9265    client: fidl::client::sync::Client,
9266}
9267
9268#[cfg(target_os = "fuchsia")]
9269impl fidl::endpoints::SynchronousProxy for ZirconGuestManagerSynchronousProxy {
9270    type Proxy = ZirconGuestManagerProxy;
9271    type Protocol = ZirconGuestManagerMarker;
9272
9273    fn from_channel(inner: fidl::Channel) -> Self {
9274        Self::new(inner)
9275    }
9276
9277    fn into_channel(self) -> fidl::Channel {
9278        self.client.into_channel()
9279    }
9280
9281    fn as_channel(&self) -> &fidl::Channel {
9282        self.client.as_channel()
9283    }
9284}
9285
9286#[cfg(target_os = "fuchsia")]
9287impl ZirconGuestManagerSynchronousProxy {
9288    pub fn new(channel: fidl::Channel) -> Self {
9289        Self { client: fidl::client::sync::Client::new(channel) }
9290    }
9291
9292    pub fn into_channel(self) -> fidl::Channel {
9293        self.client.into_channel()
9294    }
9295
9296    /// Waits until an event arrives and returns it. It is safe for other
9297    /// threads to make concurrent requests while waiting for an event.
9298    pub fn wait_for_event(
9299        &self,
9300        deadline: zx::MonotonicInstant,
9301    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
9302        ZirconGuestManagerEvent::decode(
9303            self.client.wait_for_event::<ZirconGuestManagerMarker>(deadline)?,
9304        )
9305    }
9306
9307    /// Launch a new guest instance.
9308    ///
9309    /// Possible errors:
9310    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9311    ///         problems detected by the guest manager.
9312    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9313    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9314    ///         component logs for a more specific failure.
9315    pub fn r#launch(
9316        &self,
9317        mut guest_config: GuestConfig,
9318        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9319        ___deadline: zx::MonotonicInstant,
9320    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
9321        let _response =
9322            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
9323                fidl::encoding::EmptyStruct,
9324                GuestManagerError,
9325            >, ZirconGuestManagerMarker>(
9326                (&mut guest_config, controller),
9327                0x394a2e29f750323e,
9328                fidl::encoding::DynamicFlags::empty(),
9329                ___deadline,
9330            )?;
9331        Ok(_response.map(|x| x))
9332    }
9333
9334    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9335    /// be used to launch another guest.
9336    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9337        let _response = self.client.send_query::<
9338            fidl::encoding::EmptyPayload,
9339            fidl::encoding::EmptyPayload,
9340            ZirconGuestManagerMarker,
9341        >(
9342            (),
9343            0x3ad9a012982f872d,
9344            fidl::encoding::DynamicFlags::empty(),
9345            ___deadline,
9346        )?;
9347        Ok(_response)
9348    }
9349
9350    /// Connect to a currently running guest.
9351    ///
9352    /// Possible errors:
9353    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9354    ///         has launched before attempting to reconnect.
9355    pub fn r#connect(
9356        &self,
9357        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9358        ___deadline: zx::MonotonicInstant,
9359    ) -> Result<GuestManagerConnectResult, fidl::Error> {
9360        let _response =
9361            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
9362                fidl::encoding::EmptyStruct,
9363                GuestManagerError,
9364            >, ZirconGuestManagerMarker>(
9365                (controller,),
9366                0x4e489076e3bb15b4,
9367                fidl::encoding::DynamicFlags::empty(),
9368                ___deadline,
9369            )?;
9370        Ok(_response.map(|x| x))
9371    }
9372
9373    /// Query guest info
9374    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
9375        let _response = self.client.send_query::<
9376            fidl::encoding::EmptyPayload,
9377            GuestManagerGetInfoResponse,
9378            ZirconGuestManagerMarker,
9379        >(
9380            (),
9381            0x76892614aea695dc,
9382            fidl::encoding::DynamicFlags::empty(),
9383            ___deadline,
9384        )?;
9385        Ok(_response.guest_info)
9386    }
9387}
9388
9389#[cfg(target_os = "fuchsia")]
9390impl From<ZirconGuestManagerSynchronousProxy> for zx::NullableHandle {
9391    fn from(value: ZirconGuestManagerSynchronousProxy) -> Self {
9392        value.into_channel().into()
9393    }
9394}
9395
9396#[cfg(target_os = "fuchsia")]
9397impl From<fidl::Channel> for ZirconGuestManagerSynchronousProxy {
9398    fn from(value: fidl::Channel) -> Self {
9399        Self::new(value)
9400    }
9401}
9402
9403#[cfg(target_os = "fuchsia")]
9404impl fidl::endpoints::FromClient for ZirconGuestManagerSynchronousProxy {
9405    type Protocol = ZirconGuestManagerMarker;
9406
9407    fn from_client(value: fidl::endpoints::ClientEnd<ZirconGuestManagerMarker>) -> Self {
9408        Self::new(value.into_channel())
9409    }
9410}
9411
9412#[derive(Debug, Clone)]
9413pub struct ZirconGuestManagerProxy {
9414    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9415}
9416
9417impl fidl::endpoints::Proxy for ZirconGuestManagerProxy {
9418    type Protocol = ZirconGuestManagerMarker;
9419
9420    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9421        Self::new(inner)
9422    }
9423
9424    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9425        self.client.into_channel().map_err(|client| Self { client })
9426    }
9427
9428    fn as_channel(&self) -> &::fidl::AsyncChannel {
9429        self.client.as_channel()
9430    }
9431}
9432
9433impl ZirconGuestManagerProxy {
9434    /// Create a new Proxy for fuchsia.virtualization/ZirconGuestManager.
9435    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9436        let protocol_name =
9437            <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9438        Self { client: fidl::client::Client::new(channel, protocol_name) }
9439    }
9440
9441    /// Get a Stream of events from the remote end of the protocol.
9442    ///
9443    /// # Panics
9444    ///
9445    /// Panics if the event stream was already taken.
9446    pub fn take_event_stream(&self) -> ZirconGuestManagerEventStream {
9447        ZirconGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
9448    }
9449
9450    /// Launch a new guest instance.
9451    ///
9452    /// Possible errors:
9453    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9454    ///         problems detected by the guest manager.
9455    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9456    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9457    ///         component logs for a more specific failure.
9458    pub fn r#launch(
9459        &self,
9460        mut guest_config: GuestConfig,
9461        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9462    ) -> fidl::client::QueryResponseFut<
9463        GuestManagerLaunchResult,
9464        fidl::encoding::DefaultFuchsiaResourceDialect,
9465    > {
9466        ZirconGuestManagerProxyInterface::r#launch(self, guest_config, controller)
9467    }
9468
9469    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9470    /// be used to launch another guest.
9471    pub fn r#force_shutdown(
9472        &self,
9473    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9474        ZirconGuestManagerProxyInterface::r#force_shutdown(self)
9475    }
9476
9477    /// Connect to a currently running guest.
9478    ///
9479    /// Possible errors:
9480    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9481    ///         has launched before attempting to reconnect.
9482    pub fn r#connect(
9483        &self,
9484        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9485    ) -> fidl::client::QueryResponseFut<
9486        GuestManagerConnectResult,
9487        fidl::encoding::DefaultFuchsiaResourceDialect,
9488    > {
9489        ZirconGuestManagerProxyInterface::r#connect(self, controller)
9490    }
9491
9492    /// Query guest info
9493    pub fn r#get_info(
9494        &self,
9495    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9496    {
9497        ZirconGuestManagerProxyInterface::r#get_info(self)
9498    }
9499}
9500
9501impl ZirconGuestManagerProxyInterface for ZirconGuestManagerProxy {
9502    type LaunchResponseFut = fidl::client::QueryResponseFut<
9503        GuestManagerLaunchResult,
9504        fidl::encoding::DefaultFuchsiaResourceDialect,
9505    >;
9506    fn r#launch(
9507        &self,
9508        mut guest_config: GuestConfig,
9509        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9510    ) -> Self::LaunchResponseFut {
9511        fn _decode(
9512            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9513        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
9514            let _response = fidl::client::decode_transaction_body::<
9515                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
9516                fidl::encoding::DefaultFuchsiaResourceDialect,
9517                0x394a2e29f750323e,
9518            >(_buf?)?;
9519            Ok(_response.map(|x| x))
9520        }
9521        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
9522            (&mut guest_config, controller),
9523            0x394a2e29f750323e,
9524            fidl::encoding::DynamicFlags::empty(),
9525            _decode,
9526        )
9527    }
9528
9529    type ForceShutdownResponseFut =
9530        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9531    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
9532        fn _decode(
9533            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9534        ) -> Result<(), fidl::Error> {
9535            let _response = fidl::client::decode_transaction_body::<
9536                fidl::encoding::EmptyPayload,
9537                fidl::encoding::DefaultFuchsiaResourceDialect,
9538                0x3ad9a012982f872d,
9539            >(_buf?)?;
9540            Ok(_response)
9541        }
9542        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
9543            (),
9544            0x3ad9a012982f872d,
9545            fidl::encoding::DynamicFlags::empty(),
9546            _decode,
9547        )
9548    }
9549
9550    type ConnectResponseFut = fidl::client::QueryResponseFut<
9551        GuestManagerConnectResult,
9552        fidl::encoding::DefaultFuchsiaResourceDialect,
9553    >;
9554    fn r#connect(
9555        &self,
9556        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9557    ) -> Self::ConnectResponseFut {
9558        fn _decode(
9559            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9560        ) -> Result<GuestManagerConnectResult, fidl::Error> {
9561            let _response = fidl::client::decode_transaction_body::<
9562                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
9563                fidl::encoding::DefaultFuchsiaResourceDialect,
9564                0x4e489076e3bb15b4,
9565            >(_buf?)?;
9566            Ok(_response.map(|x| x))
9567        }
9568        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
9569            (controller,),
9570            0x4e489076e3bb15b4,
9571            fidl::encoding::DynamicFlags::empty(),
9572            _decode,
9573        )
9574    }
9575
9576    type GetInfoResponseFut =
9577        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
9578    fn r#get_info(&self) -> Self::GetInfoResponseFut {
9579        fn _decode(
9580            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9581        ) -> Result<GuestInfo, fidl::Error> {
9582            let _response = fidl::client::decode_transaction_body::<
9583                GuestManagerGetInfoResponse,
9584                fidl::encoding::DefaultFuchsiaResourceDialect,
9585                0x76892614aea695dc,
9586            >(_buf?)?;
9587            Ok(_response.guest_info)
9588        }
9589        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
9590            (),
9591            0x76892614aea695dc,
9592            fidl::encoding::DynamicFlags::empty(),
9593            _decode,
9594        )
9595    }
9596}
9597
9598pub struct ZirconGuestManagerEventStream {
9599    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9600}
9601
9602impl std::marker::Unpin for ZirconGuestManagerEventStream {}
9603
9604impl futures::stream::FusedStream for ZirconGuestManagerEventStream {
9605    fn is_terminated(&self) -> bool {
9606        self.event_receiver.is_terminated()
9607    }
9608}
9609
9610impl futures::Stream for ZirconGuestManagerEventStream {
9611    type Item = Result<ZirconGuestManagerEvent, fidl::Error>;
9612
9613    fn poll_next(
9614        mut self: std::pin::Pin<&mut Self>,
9615        cx: &mut std::task::Context<'_>,
9616    ) -> std::task::Poll<Option<Self::Item>> {
9617        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9618            &mut self.event_receiver,
9619            cx
9620        )?) {
9621            Some(buf) => std::task::Poll::Ready(Some(ZirconGuestManagerEvent::decode(buf))),
9622            None => std::task::Poll::Ready(None),
9623        }
9624    }
9625}
9626
9627#[derive(Debug)]
9628pub enum ZirconGuestManagerEvent {}
9629
9630impl ZirconGuestManagerEvent {
9631    /// Decodes a message buffer as a [`ZirconGuestManagerEvent`].
9632    fn decode(
9633        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9634    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
9635        let (bytes, _handles) = buf.split_mut();
9636        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9637        debug_assert_eq!(tx_header.tx_id, 0);
9638        match tx_header.ordinal {
9639            _ => Err(fidl::Error::UnknownOrdinal {
9640                ordinal: tx_header.ordinal,
9641                protocol_name:
9642                    <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9643            }),
9644        }
9645    }
9646}
9647
9648/// A Stream of incoming requests for fuchsia.virtualization/ZirconGuestManager.
9649pub struct ZirconGuestManagerRequestStream {
9650    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9651    is_terminated: bool,
9652}
9653
9654impl std::marker::Unpin for ZirconGuestManagerRequestStream {}
9655
9656impl futures::stream::FusedStream for ZirconGuestManagerRequestStream {
9657    fn is_terminated(&self) -> bool {
9658        self.is_terminated
9659    }
9660}
9661
9662impl fidl::endpoints::RequestStream for ZirconGuestManagerRequestStream {
9663    type Protocol = ZirconGuestManagerMarker;
9664    type ControlHandle = ZirconGuestManagerControlHandle;
9665
9666    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9667        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9668    }
9669
9670    fn control_handle(&self) -> Self::ControlHandle {
9671        ZirconGuestManagerControlHandle { inner: self.inner.clone() }
9672    }
9673
9674    fn into_inner(
9675        self,
9676    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9677    {
9678        (self.inner, self.is_terminated)
9679    }
9680
9681    fn from_inner(
9682        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9683        is_terminated: bool,
9684    ) -> Self {
9685        Self { inner, is_terminated }
9686    }
9687}
9688
9689impl futures::Stream for ZirconGuestManagerRequestStream {
9690    type Item = Result<ZirconGuestManagerRequest, fidl::Error>;
9691
9692    fn poll_next(
9693        mut self: std::pin::Pin<&mut Self>,
9694        cx: &mut std::task::Context<'_>,
9695    ) -> std::task::Poll<Option<Self::Item>> {
9696        let this = &mut *self;
9697        if this.inner.check_shutdown(cx) {
9698            this.is_terminated = true;
9699            return std::task::Poll::Ready(None);
9700        }
9701        if this.is_terminated {
9702            panic!("polled ZirconGuestManagerRequestStream after completion");
9703        }
9704        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9705            |bytes, handles| {
9706                match this.inner.channel().read_etc(cx, bytes, handles) {
9707                    std::task::Poll::Ready(Ok(())) => {}
9708                    std::task::Poll::Pending => return std::task::Poll::Pending,
9709                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9710                        this.is_terminated = true;
9711                        return std::task::Poll::Ready(None);
9712                    }
9713                    std::task::Poll::Ready(Err(e)) => {
9714                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9715                            e.into(),
9716                        ))));
9717                    }
9718                }
9719
9720                // A message has been received from the channel
9721                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9722
9723                std::task::Poll::Ready(Some(match header.ordinal {
9724                0x394a2e29f750323e => {
9725                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9726                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9727                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
9728                    let control_handle = ZirconGuestManagerControlHandle {
9729                        inner: this.inner.clone(),
9730                    };
9731                    Ok(ZirconGuestManagerRequest::Launch {guest_config: req.guest_config,
9732controller: req.controller,
9733
9734                        responder: ZirconGuestManagerLaunchResponder {
9735                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9736                            tx_id: header.tx_id,
9737                        },
9738                    })
9739                }
9740                0x3ad9a012982f872d => {
9741                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9742                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
9743                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9744                    let control_handle = ZirconGuestManagerControlHandle {
9745                        inner: this.inner.clone(),
9746                    };
9747                    Ok(ZirconGuestManagerRequest::ForceShutdown {
9748                        responder: ZirconGuestManagerForceShutdownResponder {
9749                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9750                            tx_id: header.tx_id,
9751                        },
9752                    })
9753                }
9754                0x4e489076e3bb15b4 => {
9755                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9756                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9757                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9758                    let control_handle = ZirconGuestManagerControlHandle {
9759                        inner: this.inner.clone(),
9760                    };
9761                    Ok(ZirconGuestManagerRequest::Connect {controller: req.controller,
9762
9763                        responder: ZirconGuestManagerConnectResponder {
9764                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9765                            tx_id: header.tx_id,
9766                        },
9767                    })
9768                }
9769                0x76892614aea695dc => {
9770                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9771                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
9772                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9773                    let control_handle = ZirconGuestManagerControlHandle {
9774                        inner: this.inner.clone(),
9775                    };
9776                    Ok(ZirconGuestManagerRequest::GetInfo {
9777                        responder: ZirconGuestManagerGetInfoResponder {
9778                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9779                            tx_id: header.tx_id,
9780                        },
9781                    })
9782                }
9783                _ => Err(fidl::Error::UnknownOrdinal {
9784                    ordinal: header.ordinal,
9785                    protocol_name: <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9786                }),
9787            }))
9788            },
9789        )
9790    }
9791}
9792
9793#[derive(Debug)]
9794pub enum ZirconGuestManagerRequest {
9795    /// Launch a new guest instance.
9796    ///
9797    /// Possible errors:
9798    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9799    ///         problems detected by the guest manager.
9800    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9801    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9802    ///         component logs for a more specific failure.
9803    Launch {
9804        guest_config: GuestConfig,
9805        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9806        responder: ZirconGuestManagerLaunchResponder,
9807    },
9808    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9809    /// be used to launch another guest.
9810    ForceShutdown { responder: ZirconGuestManagerForceShutdownResponder },
9811    /// Connect to a currently running guest.
9812    ///
9813    /// Possible errors:
9814    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9815    ///         has launched before attempting to reconnect.
9816    Connect {
9817        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9818        responder: ZirconGuestManagerConnectResponder,
9819    },
9820    /// Query guest info
9821    GetInfo { responder: ZirconGuestManagerGetInfoResponder },
9822}
9823
9824impl ZirconGuestManagerRequest {
9825    #[allow(irrefutable_let_patterns)]
9826    pub fn into_launch(
9827        self,
9828    ) -> Option<(
9829        GuestConfig,
9830        fidl::endpoints::ServerEnd<GuestMarker>,
9831        ZirconGuestManagerLaunchResponder,
9832    )> {
9833        if let ZirconGuestManagerRequest::Launch { guest_config, controller, responder } = self {
9834            Some((guest_config, controller, responder))
9835        } else {
9836            None
9837        }
9838    }
9839
9840    #[allow(irrefutable_let_patterns)]
9841    pub fn into_force_shutdown(self) -> Option<(ZirconGuestManagerForceShutdownResponder)> {
9842        if let ZirconGuestManagerRequest::ForceShutdown { responder } = self {
9843            Some((responder))
9844        } else {
9845            None
9846        }
9847    }
9848
9849    #[allow(irrefutable_let_patterns)]
9850    pub fn into_connect(
9851        self,
9852    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, ZirconGuestManagerConnectResponder)> {
9853        if let ZirconGuestManagerRequest::Connect { controller, responder } = self {
9854            Some((controller, responder))
9855        } else {
9856            None
9857        }
9858    }
9859
9860    #[allow(irrefutable_let_patterns)]
9861    pub fn into_get_info(self) -> Option<(ZirconGuestManagerGetInfoResponder)> {
9862        if let ZirconGuestManagerRequest::GetInfo { responder } = self {
9863            Some((responder))
9864        } else {
9865            None
9866        }
9867    }
9868
9869    /// Name of the method defined in FIDL
9870    pub fn method_name(&self) -> &'static str {
9871        match *self {
9872            ZirconGuestManagerRequest::Launch { .. } => "launch",
9873            ZirconGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
9874            ZirconGuestManagerRequest::Connect { .. } => "connect",
9875            ZirconGuestManagerRequest::GetInfo { .. } => "get_info",
9876        }
9877    }
9878}
9879
9880#[derive(Debug, Clone)]
9881pub struct ZirconGuestManagerControlHandle {
9882    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9883}
9884
9885impl fidl::endpoints::ControlHandle for ZirconGuestManagerControlHandle {
9886    fn shutdown(&self) {
9887        self.inner.shutdown()
9888    }
9889
9890    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9891        self.inner.shutdown_with_epitaph(status)
9892    }
9893
9894    fn is_closed(&self) -> bool {
9895        self.inner.channel().is_closed()
9896    }
9897    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9898        self.inner.channel().on_closed()
9899    }
9900
9901    #[cfg(target_os = "fuchsia")]
9902    fn signal_peer(
9903        &self,
9904        clear_mask: zx::Signals,
9905        set_mask: zx::Signals,
9906    ) -> Result<(), zx_status::Status> {
9907        use fidl::Peered;
9908        self.inner.channel().signal_peer(clear_mask, set_mask)
9909    }
9910}
9911
9912impl ZirconGuestManagerControlHandle {}
9913
9914#[must_use = "FIDL methods require a response to be sent"]
9915#[derive(Debug)]
9916pub struct ZirconGuestManagerLaunchResponder {
9917    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9918    tx_id: u32,
9919}
9920
9921/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9922/// if the responder is dropped without sending a response, so that the client
9923/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9924impl std::ops::Drop for ZirconGuestManagerLaunchResponder {
9925    fn drop(&mut self) {
9926        self.control_handle.shutdown();
9927        // Safety: drops once, never accessed again
9928        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9929    }
9930}
9931
9932impl fidl::endpoints::Responder for ZirconGuestManagerLaunchResponder {
9933    type ControlHandle = ZirconGuestManagerControlHandle;
9934
9935    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9936        &self.control_handle
9937    }
9938
9939    fn drop_without_shutdown(mut self) {
9940        // Safety: drops once, never accessed again due to mem::forget
9941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9942        // Prevent Drop from running (which would shut down the channel)
9943        std::mem::forget(self);
9944    }
9945}
9946
9947impl ZirconGuestManagerLaunchResponder {
9948    /// Sends a response to the FIDL transaction.
9949    ///
9950    /// Sets the channel to shutdown if an error occurs.
9951    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9952        let _result = self.send_raw(result);
9953        if _result.is_err() {
9954            self.control_handle.shutdown();
9955        }
9956        self.drop_without_shutdown();
9957        _result
9958    }
9959
9960    /// Similar to "send" but does not shutdown the channel if an error occurs.
9961    pub fn send_no_shutdown_on_err(
9962        self,
9963        mut result: Result<(), GuestManagerError>,
9964    ) -> Result<(), fidl::Error> {
9965        let _result = self.send_raw(result);
9966        self.drop_without_shutdown();
9967        _result
9968    }
9969
9970    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9971        self.control_handle.inner.send::<fidl::encoding::ResultType<
9972            fidl::encoding::EmptyStruct,
9973            GuestManagerError,
9974        >>(
9975            result,
9976            self.tx_id,
9977            0x394a2e29f750323e,
9978            fidl::encoding::DynamicFlags::empty(),
9979        )
9980    }
9981}
9982
9983#[must_use = "FIDL methods require a response to be sent"]
9984#[derive(Debug)]
9985pub struct ZirconGuestManagerForceShutdownResponder {
9986    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9987    tx_id: u32,
9988}
9989
9990/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9991/// if the responder is dropped without sending a response, so that the client
9992/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9993impl std::ops::Drop for ZirconGuestManagerForceShutdownResponder {
9994    fn drop(&mut self) {
9995        self.control_handle.shutdown();
9996        // Safety: drops once, never accessed again
9997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9998    }
9999}
10000
10001impl fidl::endpoints::Responder for ZirconGuestManagerForceShutdownResponder {
10002    type ControlHandle = ZirconGuestManagerControlHandle;
10003
10004    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
10005        &self.control_handle
10006    }
10007
10008    fn drop_without_shutdown(mut self) {
10009        // Safety: drops once, never accessed again due to mem::forget
10010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10011        // Prevent Drop from running (which would shut down the channel)
10012        std::mem::forget(self);
10013    }
10014}
10015
10016impl ZirconGuestManagerForceShutdownResponder {
10017    /// Sends a response to the FIDL transaction.
10018    ///
10019    /// Sets the channel to shutdown if an error occurs.
10020    pub fn send(self) -> Result<(), fidl::Error> {
10021        let _result = self.send_raw();
10022        if _result.is_err() {
10023            self.control_handle.shutdown();
10024        }
10025        self.drop_without_shutdown();
10026        _result
10027    }
10028
10029    /// Similar to "send" but does not shutdown the channel if an error occurs.
10030    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10031        let _result = self.send_raw();
10032        self.drop_without_shutdown();
10033        _result
10034    }
10035
10036    fn send_raw(&self) -> Result<(), fidl::Error> {
10037        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10038            (),
10039            self.tx_id,
10040            0x3ad9a012982f872d,
10041            fidl::encoding::DynamicFlags::empty(),
10042        )
10043    }
10044}
10045
10046#[must_use = "FIDL methods require a response to be sent"]
10047#[derive(Debug)]
10048pub struct ZirconGuestManagerConnectResponder {
10049    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
10050    tx_id: u32,
10051}
10052
10053/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
10054/// if the responder is dropped without sending a response, so that the client
10055/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10056impl std::ops::Drop for ZirconGuestManagerConnectResponder {
10057    fn drop(&mut self) {
10058        self.control_handle.shutdown();
10059        // Safety: drops once, never accessed again
10060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10061    }
10062}
10063
10064impl fidl::endpoints::Responder for ZirconGuestManagerConnectResponder {
10065    type ControlHandle = ZirconGuestManagerControlHandle;
10066
10067    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
10068        &self.control_handle
10069    }
10070
10071    fn drop_without_shutdown(mut self) {
10072        // Safety: drops once, never accessed again due to mem::forget
10073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10074        // Prevent Drop from running (which would shut down the channel)
10075        std::mem::forget(self);
10076    }
10077}
10078
10079impl ZirconGuestManagerConnectResponder {
10080    /// Sends a response to the FIDL transaction.
10081    ///
10082    /// Sets the channel to shutdown if an error occurs.
10083    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
10084        let _result = self.send_raw(result);
10085        if _result.is_err() {
10086            self.control_handle.shutdown();
10087        }
10088        self.drop_without_shutdown();
10089        _result
10090    }
10091
10092    /// Similar to "send" but does not shutdown the channel if an error occurs.
10093    pub fn send_no_shutdown_on_err(
10094        self,
10095        mut result: Result<(), GuestManagerError>,
10096    ) -> Result<(), fidl::Error> {
10097        let _result = self.send_raw(result);
10098        self.drop_without_shutdown();
10099        _result
10100    }
10101
10102    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
10103        self.control_handle.inner.send::<fidl::encoding::ResultType<
10104            fidl::encoding::EmptyStruct,
10105            GuestManagerError,
10106        >>(
10107            result,
10108            self.tx_id,
10109            0x4e489076e3bb15b4,
10110            fidl::encoding::DynamicFlags::empty(),
10111        )
10112    }
10113}
10114
10115#[must_use = "FIDL methods require a response to be sent"]
10116#[derive(Debug)]
10117pub struct ZirconGuestManagerGetInfoResponder {
10118    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
10119    tx_id: u32,
10120}
10121
10122/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
10123/// if the responder is dropped without sending a response, so that the client
10124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10125impl std::ops::Drop for ZirconGuestManagerGetInfoResponder {
10126    fn drop(&mut self) {
10127        self.control_handle.shutdown();
10128        // Safety: drops once, never accessed again
10129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10130    }
10131}
10132
10133impl fidl::endpoints::Responder for ZirconGuestManagerGetInfoResponder {
10134    type ControlHandle = ZirconGuestManagerControlHandle;
10135
10136    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
10137        &self.control_handle
10138    }
10139
10140    fn drop_without_shutdown(mut self) {
10141        // Safety: drops once, never accessed again due to mem::forget
10142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10143        // Prevent Drop from running (which would shut down the channel)
10144        std::mem::forget(self);
10145    }
10146}
10147
10148impl ZirconGuestManagerGetInfoResponder {
10149    /// Sends a response to the FIDL transaction.
10150    ///
10151    /// Sets the channel to shutdown if an error occurs.
10152    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10153        let _result = self.send_raw(guest_info);
10154        if _result.is_err() {
10155            self.control_handle.shutdown();
10156        }
10157        self.drop_without_shutdown();
10158        _result
10159    }
10160
10161    /// Similar to "send" but does not shutdown the channel if an error occurs.
10162    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10163        let _result = self.send_raw(guest_info);
10164        self.drop_without_shutdown();
10165        _result
10166    }
10167
10168    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10169        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
10170            (guest_info,),
10171            self.tx_id,
10172            0x76892614aea695dc,
10173            fidl::encoding::DynamicFlags::empty(),
10174        )
10175    }
10176}
10177
10178mod internal {
10179    use super::*;
10180
10181    impl fidl::encoding::ResourceTypeMarker for BlockSpec {
10182        type Borrowed<'a> = &'a mut Self;
10183        fn take_or_borrow<'a>(
10184            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10185        ) -> Self::Borrowed<'a> {
10186            value
10187        }
10188    }
10189
10190    unsafe impl fidl::encoding::TypeMarker for BlockSpec {
10191        type Owned = Self;
10192
10193        #[inline(always)]
10194        fn inline_align(_context: fidl::encoding::Context) -> usize {
10195            8
10196        }
10197
10198        #[inline(always)]
10199        fn inline_size(_context: fidl::encoding::Context) -> usize {
10200            40
10201        }
10202    }
10203
10204    unsafe impl fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
10205        for &mut BlockSpec
10206    {
10207        #[inline]
10208        unsafe fn encode(
10209            self,
10210            encoder: &mut fidl::encoding::Encoder<
10211                '_,
10212                fidl::encoding::DefaultFuchsiaResourceDialect,
10213            >,
10214            offset: usize,
10215            _depth: fidl::encoding::Depth,
10216        ) -> fidl::Result<()> {
10217            encoder.debug_check_bounds::<BlockSpec>(offset);
10218            // Delegate to tuple encoding.
10219            fidl::encoding::Encode::<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10220                (
10221                    <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
10222                    <BlockMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
10223                    <BlockFormat as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.format),
10224                ),
10225                encoder, offset, _depth
10226            )
10227        }
10228    }
10229    unsafe impl<
10230        T0: fidl::encoding::Encode<
10231                fidl::encoding::BoundedString<20>,
10232                fidl::encoding::DefaultFuchsiaResourceDialect,
10233            >,
10234        T1: fidl::encoding::Encode<BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
10235        T2: fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
10236    > fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
10237        for (T0, T1, T2)
10238    {
10239        #[inline]
10240        unsafe fn encode(
10241            self,
10242            encoder: &mut fidl::encoding::Encoder<
10243                '_,
10244                fidl::encoding::DefaultFuchsiaResourceDialect,
10245            >,
10246            offset: usize,
10247            depth: fidl::encoding::Depth,
10248        ) -> fidl::Result<()> {
10249            encoder.debug_check_bounds::<BlockSpec>(offset);
10250            // Zero out padding regions. There's no need to apply masks
10251            // because the unmasked parts will be overwritten by fields.
10252            unsafe {
10253                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10254                (ptr as *mut u64).write_unaligned(0);
10255            }
10256            // Write the fields.
10257            self.0.encode(encoder, offset + 0, depth)?;
10258            self.1.encode(encoder, offset + 16, depth)?;
10259            self.2.encode(encoder, offset + 24, depth)?;
10260            Ok(())
10261        }
10262    }
10263
10264    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {
10265        #[inline(always)]
10266        fn new_empty() -> Self {
10267            Self {
10268                id: fidl::new_empty!(
10269                    fidl::encoding::BoundedString<20>,
10270                    fidl::encoding::DefaultFuchsiaResourceDialect
10271                ),
10272                mode: fidl::new_empty!(BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect),
10273                format: fidl::new_empty!(
10274                    BlockFormat,
10275                    fidl::encoding::DefaultFuchsiaResourceDialect
10276                ),
10277            }
10278        }
10279
10280        #[inline]
10281        unsafe fn decode(
10282            &mut self,
10283            decoder: &mut fidl::encoding::Decoder<
10284                '_,
10285                fidl::encoding::DefaultFuchsiaResourceDialect,
10286            >,
10287            offset: usize,
10288            _depth: fidl::encoding::Depth,
10289        ) -> fidl::Result<()> {
10290            decoder.debug_check_bounds::<Self>(offset);
10291            // Verify that padding bytes are zero.
10292            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10293            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10294            let mask = 0xffffffff00000000u64;
10295            let maskedval = padval & mask;
10296            if maskedval != 0 {
10297                return Err(fidl::Error::NonZeroPadding {
10298                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10299                });
10300            }
10301            fidl::decode!(
10302                fidl::encoding::BoundedString<20>,
10303                fidl::encoding::DefaultFuchsiaResourceDialect,
10304                &mut self.id,
10305                decoder,
10306                offset + 0,
10307                _depth
10308            )?;
10309            fidl::decode!(
10310                BlockMode,
10311                fidl::encoding::DefaultFuchsiaResourceDialect,
10312                &mut self.mode,
10313                decoder,
10314                offset + 16,
10315                _depth
10316            )?;
10317            fidl::decode!(
10318                BlockFormat,
10319                fidl::encoding::DefaultFuchsiaResourceDialect,
10320                &mut self.format,
10321                decoder,
10322                offset + 24,
10323                _depth
10324            )?;
10325            Ok(())
10326        }
10327    }
10328
10329    impl fidl::encoding::ResourceTypeMarker for GuestGetBalloonControllerRequest {
10330        type Borrowed<'a> = &'a mut Self;
10331        fn take_or_borrow<'a>(
10332            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10333        ) -> Self::Borrowed<'a> {
10334            value
10335        }
10336    }
10337
10338    unsafe impl fidl::encoding::TypeMarker for GuestGetBalloonControllerRequest {
10339        type Owned = Self;
10340
10341        #[inline(always)]
10342        fn inline_align(_context: fidl::encoding::Context) -> usize {
10343            4
10344        }
10345
10346        #[inline(always)]
10347        fn inline_size(_context: fidl::encoding::Context) -> usize {
10348            4
10349        }
10350    }
10351
10352    unsafe impl
10353        fidl::encoding::Encode<
10354            GuestGetBalloonControllerRequest,
10355            fidl::encoding::DefaultFuchsiaResourceDialect,
10356        > for &mut GuestGetBalloonControllerRequest
10357    {
10358        #[inline]
10359        unsafe fn encode(
10360            self,
10361            encoder: &mut fidl::encoding::Encoder<
10362                '_,
10363                fidl::encoding::DefaultFuchsiaResourceDialect,
10364            >,
10365            offset: usize,
10366            _depth: fidl::encoding::Depth,
10367        ) -> fidl::Result<()> {
10368            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
10369            // Delegate to tuple encoding.
10370            fidl::encoding::Encode::<GuestGetBalloonControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10371                (
10372                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10373                ),
10374                encoder, offset, _depth
10375            )
10376        }
10377    }
10378    unsafe impl<
10379        T0: fidl::encoding::Encode<
10380                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10381                fidl::encoding::DefaultFuchsiaResourceDialect,
10382            >,
10383    >
10384        fidl::encoding::Encode<
10385            GuestGetBalloonControllerRequest,
10386            fidl::encoding::DefaultFuchsiaResourceDialect,
10387        > for (T0,)
10388    {
10389        #[inline]
10390        unsafe fn encode(
10391            self,
10392            encoder: &mut fidl::encoding::Encoder<
10393                '_,
10394                fidl::encoding::DefaultFuchsiaResourceDialect,
10395            >,
10396            offset: usize,
10397            depth: fidl::encoding::Depth,
10398        ) -> fidl::Result<()> {
10399            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
10400            // Zero out padding regions. There's no need to apply masks
10401            // because the unmasked parts will be overwritten by fields.
10402            // Write the fields.
10403            self.0.encode(encoder, offset + 0, depth)?;
10404            Ok(())
10405        }
10406    }
10407
10408    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10409        for GuestGetBalloonControllerRequest
10410    {
10411        #[inline(always)]
10412        fn new_empty() -> Self {
10413            Self {
10414                controller: fidl::new_empty!(
10415                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10416                    fidl::encoding::DefaultFuchsiaResourceDialect
10417                ),
10418            }
10419        }
10420
10421        #[inline]
10422        unsafe fn decode(
10423            &mut self,
10424            decoder: &mut fidl::encoding::Decoder<
10425                '_,
10426                fidl::encoding::DefaultFuchsiaResourceDialect,
10427            >,
10428            offset: usize,
10429            _depth: fidl::encoding::Depth,
10430        ) -> fidl::Result<()> {
10431            decoder.debug_check_bounds::<Self>(offset);
10432            // Verify that padding bytes are zero.
10433            fidl::decode!(
10434                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10435                fidl::encoding::DefaultFuchsiaResourceDialect,
10436                &mut self.controller,
10437                decoder,
10438                offset + 0,
10439                _depth
10440            )?;
10441            Ok(())
10442        }
10443    }
10444
10445    impl fidl::encoding::ResourceTypeMarker for GuestGetHostVsockEndpointRequest {
10446        type Borrowed<'a> = &'a mut Self;
10447        fn take_or_borrow<'a>(
10448            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10449        ) -> Self::Borrowed<'a> {
10450            value
10451        }
10452    }
10453
10454    unsafe impl fidl::encoding::TypeMarker for GuestGetHostVsockEndpointRequest {
10455        type Owned = Self;
10456
10457        #[inline(always)]
10458        fn inline_align(_context: fidl::encoding::Context) -> usize {
10459            4
10460        }
10461
10462        #[inline(always)]
10463        fn inline_size(_context: fidl::encoding::Context) -> usize {
10464            4
10465        }
10466    }
10467
10468    unsafe impl
10469        fidl::encoding::Encode<
10470            GuestGetHostVsockEndpointRequest,
10471            fidl::encoding::DefaultFuchsiaResourceDialect,
10472        > for &mut GuestGetHostVsockEndpointRequest
10473    {
10474        #[inline]
10475        unsafe fn encode(
10476            self,
10477            encoder: &mut fidl::encoding::Encoder<
10478                '_,
10479                fidl::encoding::DefaultFuchsiaResourceDialect,
10480            >,
10481            offset: usize,
10482            _depth: fidl::encoding::Depth,
10483        ) -> fidl::Result<()> {
10484            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
10485            // Delegate to tuple encoding.
10486            fidl::encoding::Encode::<GuestGetHostVsockEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10487                (
10488                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
10489                ),
10490                encoder, offset, _depth
10491            )
10492        }
10493    }
10494    unsafe impl<
10495        T0: fidl::encoding::Encode<
10496                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10497                fidl::encoding::DefaultFuchsiaResourceDialect,
10498            >,
10499    >
10500        fidl::encoding::Encode<
10501            GuestGetHostVsockEndpointRequest,
10502            fidl::encoding::DefaultFuchsiaResourceDialect,
10503        > for (T0,)
10504    {
10505        #[inline]
10506        unsafe fn encode(
10507            self,
10508            encoder: &mut fidl::encoding::Encoder<
10509                '_,
10510                fidl::encoding::DefaultFuchsiaResourceDialect,
10511            >,
10512            offset: usize,
10513            depth: fidl::encoding::Depth,
10514        ) -> fidl::Result<()> {
10515            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
10516            // Zero out padding regions. There's no need to apply masks
10517            // because the unmasked parts will be overwritten by fields.
10518            // Write the fields.
10519            self.0.encode(encoder, offset + 0, depth)?;
10520            Ok(())
10521        }
10522    }
10523
10524    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10525        for GuestGetHostVsockEndpointRequest
10526    {
10527        #[inline(always)]
10528        fn new_empty() -> Self {
10529            Self {
10530                endpoint: fidl::new_empty!(
10531                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10532                    fidl::encoding::DefaultFuchsiaResourceDialect
10533                ),
10534            }
10535        }
10536
10537        #[inline]
10538        unsafe fn decode(
10539            &mut self,
10540            decoder: &mut fidl::encoding::Decoder<
10541                '_,
10542                fidl::encoding::DefaultFuchsiaResourceDialect,
10543            >,
10544            offset: usize,
10545            _depth: fidl::encoding::Depth,
10546        ) -> fidl::Result<()> {
10547            decoder.debug_check_bounds::<Self>(offset);
10548            // Verify that padding bytes are zero.
10549            fidl::decode!(
10550                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10551                fidl::encoding::DefaultFuchsiaResourceDialect,
10552                &mut self.endpoint,
10553                decoder,
10554                offset + 0,
10555                _depth
10556            )?;
10557            Ok(())
10558        }
10559    }
10560
10561    impl fidl::encoding::ResourceTypeMarker for GuestGetMemControllerRequest {
10562        type Borrowed<'a> = &'a mut Self;
10563        fn take_or_borrow<'a>(
10564            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10565        ) -> Self::Borrowed<'a> {
10566            value
10567        }
10568    }
10569
10570    unsafe impl fidl::encoding::TypeMarker for GuestGetMemControllerRequest {
10571        type Owned = Self;
10572
10573        #[inline(always)]
10574        fn inline_align(_context: fidl::encoding::Context) -> usize {
10575            4
10576        }
10577
10578        #[inline(always)]
10579        fn inline_size(_context: fidl::encoding::Context) -> usize {
10580            4
10581        }
10582    }
10583
10584    unsafe impl
10585        fidl::encoding::Encode<
10586            GuestGetMemControllerRequest,
10587            fidl::encoding::DefaultFuchsiaResourceDialect,
10588        > for &mut GuestGetMemControllerRequest
10589    {
10590        #[inline]
10591        unsafe fn encode(
10592            self,
10593            encoder: &mut fidl::encoding::Encoder<
10594                '_,
10595                fidl::encoding::DefaultFuchsiaResourceDialect,
10596            >,
10597            offset: usize,
10598            _depth: fidl::encoding::Depth,
10599        ) -> fidl::Result<()> {
10600            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
10601            // Delegate to tuple encoding.
10602            fidl::encoding::Encode::<GuestGetMemControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10603                (
10604                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10605                ),
10606                encoder, offset, _depth
10607            )
10608        }
10609    }
10610    unsafe impl<
10611        T0: fidl::encoding::Encode<
10612                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10613                fidl::encoding::DefaultFuchsiaResourceDialect,
10614            >,
10615    >
10616        fidl::encoding::Encode<
10617            GuestGetMemControllerRequest,
10618            fidl::encoding::DefaultFuchsiaResourceDialect,
10619        > for (T0,)
10620    {
10621        #[inline]
10622        unsafe fn encode(
10623            self,
10624            encoder: &mut fidl::encoding::Encoder<
10625                '_,
10626                fidl::encoding::DefaultFuchsiaResourceDialect,
10627            >,
10628            offset: usize,
10629            depth: fidl::encoding::Depth,
10630        ) -> fidl::Result<()> {
10631            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
10632            // Zero out padding regions. There's no need to apply masks
10633            // because the unmasked parts will be overwritten by fields.
10634            // Write the fields.
10635            self.0.encode(encoder, offset + 0, depth)?;
10636            Ok(())
10637        }
10638    }
10639
10640    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10641        for GuestGetMemControllerRequest
10642    {
10643        #[inline(always)]
10644        fn new_empty() -> Self {
10645            Self {
10646                controller: fidl::new_empty!(
10647                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10648                    fidl::encoding::DefaultFuchsiaResourceDialect
10649                ),
10650            }
10651        }
10652
10653        #[inline]
10654        unsafe fn decode(
10655            &mut self,
10656            decoder: &mut fidl::encoding::Decoder<
10657                '_,
10658                fidl::encoding::DefaultFuchsiaResourceDialect,
10659            >,
10660            offset: usize,
10661            _depth: fidl::encoding::Depth,
10662        ) -> fidl::Result<()> {
10663            decoder.debug_check_bounds::<Self>(offset);
10664            // Verify that padding bytes are zero.
10665            fidl::decode!(
10666                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10667                fidl::encoding::DefaultFuchsiaResourceDialect,
10668                &mut self.controller,
10669                decoder,
10670                offset + 0,
10671                _depth
10672            )?;
10673            Ok(())
10674        }
10675    }
10676
10677    impl fidl::encoding::ResourceTypeMarker for GuestGetSerialResponse {
10678        type Borrowed<'a> = &'a mut Self;
10679        fn take_or_borrow<'a>(
10680            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10681        ) -> Self::Borrowed<'a> {
10682            value
10683        }
10684    }
10685
10686    unsafe impl fidl::encoding::TypeMarker for GuestGetSerialResponse {
10687        type Owned = Self;
10688
10689        #[inline(always)]
10690        fn inline_align(_context: fidl::encoding::Context) -> usize {
10691            4
10692        }
10693
10694        #[inline(always)]
10695        fn inline_size(_context: fidl::encoding::Context) -> usize {
10696            4
10697        }
10698    }
10699
10700    unsafe impl
10701        fidl::encoding::Encode<
10702            GuestGetSerialResponse,
10703            fidl::encoding::DefaultFuchsiaResourceDialect,
10704        > for &mut GuestGetSerialResponse
10705    {
10706        #[inline]
10707        unsafe fn encode(
10708            self,
10709            encoder: &mut fidl::encoding::Encoder<
10710                '_,
10711                fidl::encoding::DefaultFuchsiaResourceDialect,
10712            >,
10713            offset: usize,
10714            _depth: fidl::encoding::Depth,
10715        ) -> fidl::Result<()> {
10716            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
10717            // Delegate to tuple encoding.
10718            fidl::encoding::Encode::<
10719                GuestGetSerialResponse,
10720                fidl::encoding::DefaultFuchsiaResourceDialect,
10721            >::encode(
10722                (<fidl::encoding::HandleType<
10723                    fidl::Socket,
10724                    { fidl::ObjectType::SOCKET.into_raw() },
10725                    2147483648,
10726                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10727                    &mut self.socket
10728                ),),
10729                encoder,
10730                offset,
10731                _depth,
10732            )
10733        }
10734    }
10735    unsafe impl<
10736        T0: fidl::encoding::Encode<
10737                fidl::encoding::HandleType<
10738                    fidl::Socket,
10739                    { fidl::ObjectType::SOCKET.into_raw() },
10740                    2147483648,
10741                >,
10742                fidl::encoding::DefaultFuchsiaResourceDialect,
10743            >,
10744    >
10745        fidl::encoding::Encode<
10746            GuestGetSerialResponse,
10747            fidl::encoding::DefaultFuchsiaResourceDialect,
10748        > for (T0,)
10749    {
10750        #[inline]
10751        unsafe fn encode(
10752            self,
10753            encoder: &mut fidl::encoding::Encoder<
10754                '_,
10755                fidl::encoding::DefaultFuchsiaResourceDialect,
10756            >,
10757            offset: usize,
10758            depth: fidl::encoding::Depth,
10759        ) -> fidl::Result<()> {
10760            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
10761            // Zero out padding regions. There's no need to apply masks
10762            // because the unmasked parts will be overwritten by fields.
10763            // Write the fields.
10764            self.0.encode(encoder, offset + 0, depth)?;
10765            Ok(())
10766        }
10767    }
10768
10769    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10770        for GuestGetSerialResponse
10771    {
10772        #[inline(always)]
10773        fn new_empty() -> Self {
10774            Self {
10775                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10776            }
10777        }
10778
10779        #[inline]
10780        unsafe fn decode(
10781            &mut self,
10782            decoder: &mut fidl::encoding::Decoder<
10783                '_,
10784                fidl::encoding::DefaultFuchsiaResourceDialect,
10785            >,
10786            offset: usize,
10787            _depth: fidl::encoding::Depth,
10788        ) -> fidl::Result<()> {
10789            decoder.debug_check_bounds::<Self>(offset);
10790            // Verify that padding bytes are zero.
10791            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10792            Ok(())
10793        }
10794    }
10795
10796    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleBindRequest {
10797        type Borrowed<'a> = &'a mut Self;
10798        fn take_or_borrow<'a>(
10799            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10800        ) -> Self::Borrowed<'a> {
10801            value
10802        }
10803    }
10804
10805    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleBindRequest {
10806        type Owned = Self;
10807
10808        #[inline(always)]
10809        fn inline_align(_context: fidl::encoding::Context) -> usize {
10810            4
10811        }
10812
10813        #[inline(always)]
10814        fn inline_size(_context: fidl::encoding::Context) -> usize {
10815            4
10816        }
10817    }
10818
10819    unsafe impl
10820        fidl::encoding::Encode<
10821            GuestLifecycleBindRequest,
10822            fidl::encoding::DefaultFuchsiaResourceDialect,
10823        > for &mut GuestLifecycleBindRequest
10824    {
10825        #[inline]
10826        unsafe fn encode(
10827            self,
10828            encoder: &mut fidl::encoding::Encoder<
10829                '_,
10830                fidl::encoding::DefaultFuchsiaResourceDialect,
10831            >,
10832            offset: usize,
10833            _depth: fidl::encoding::Depth,
10834        ) -> fidl::Result<()> {
10835            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
10836            // Delegate to tuple encoding.
10837            fidl::encoding::Encode::<GuestLifecycleBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10838                (
10839                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
10840                ),
10841                encoder, offset, _depth
10842            )
10843        }
10844    }
10845    unsafe impl<
10846        T0: fidl::encoding::Encode<
10847                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10848                fidl::encoding::DefaultFuchsiaResourceDialect,
10849            >,
10850    >
10851        fidl::encoding::Encode<
10852            GuestLifecycleBindRequest,
10853            fidl::encoding::DefaultFuchsiaResourceDialect,
10854        > for (T0,)
10855    {
10856        #[inline]
10857        unsafe fn encode(
10858            self,
10859            encoder: &mut fidl::encoding::Encoder<
10860                '_,
10861                fidl::encoding::DefaultFuchsiaResourceDialect,
10862            >,
10863            offset: usize,
10864            depth: fidl::encoding::Depth,
10865        ) -> fidl::Result<()> {
10866            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
10867            // Zero out padding regions. There's no need to apply masks
10868            // because the unmasked parts will be overwritten by fields.
10869            // Write the fields.
10870            self.0.encode(encoder, offset + 0, depth)?;
10871            Ok(())
10872        }
10873    }
10874
10875    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10876        for GuestLifecycleBindRequest
10877    {
10878        #[inline(always)]
10879        fn new_empty() -> Self {
10880            Self {
10881                guest: fidl::new_empty!(
10882                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10883                    fidl::encoding::DefaultFuchsiaResourceDialect
10884                ),
10885            }
10886        }
10887
10888        #[inline]
10889        unsafe fn decode(
10890            &mut self,
10891            decoder: &mut fidl::encoding::Decoder<
10892                '_,
10893                fidl::encoding::DefaultFuchsiaResourceDialect,
10894            >,
10895            offset: usize,
10896            _depth: fidl::encoding::Depth,
10897        ) -> fidl::Result<()> {
10898            decoder.debug_check_bounds::<Self>(offset);
10899            // Verify that padding bytes are zero.
10900            fidl::decode!(
10901                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10902                fidl::encoding::DefaultFuchsiaResourceDialect,
10903                &mut self.guest,
10904                decoder,
10905                offset + 0,
10906                _depth
10907            )?;
10908            Ok(())
10909        }
10910    }
10911
10912    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleCreateRequest {
10913        type Borrowed<'a> = &'a mut Self;
10914        fn take_or_borrow<'a>(
10915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10916        ) -> Self::Borrowed<'a> {
10917            value
10918        }
10919    }
10920
10921    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleCreateRequest {
10922        type Owned = Self;
10923
10924        #[inline(always)]
10925        fn inline_align(_context: fidl::encoding::Context) -> usize {
10926            8
10927        }
10928
10929        #[inline(always)]
10930        fn inline_size(_context: fidl::encoding::Context) -> usize {
10931            16
10932        }
10933    }
10934
10935    unsafe impl
10936        fidl::encoding::Encode<
10937            GuestLifecycleCreateRequest,
10938            fidl::encoding::DefaultFuchsiaResourceDialect,
10939        > for &mut GuestLifecycleCreateRequest
10940    {
10941        #[inline]
10942        unsafe fn encode(
10943            self,
10944            encoder: &mut fidl::encoding::Encoder<
10945                '_,
10946                fidl::encoding::DefaultFuchsiaResourceDialect,
10947            >,
10948            offset: usize,
10949            _depth: fidl::encoding::Depth,
10950        ) -> fidl::Result<()> {
10951            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
10952            // Delegate to tuple encoding.
10953            fidl::encoding::Encode::<
10954                GuestLifecycleCreateRequest,
10955                fidl::encoding::DefaultFuchsiaResourceDialect,
10956            >::encode(
10957                (<GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10958                    &mut self.guest_config,
10959                ),),
10960                encoder,
10961                offset,
10962                _depth,
10963            )
10964        }
10965    }
10966    unsafe impl<
10967        T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
10968    >
10969        fidl::encoding::Encode<
10970            GuestLifecycleCreateRequest,
10971            fidl::encoding::DefaultFuchsiaResourceDialect,
10972        > for (T0,)
10973    {
10974        #[inline]
10975        unsafe fn encode(
10976            self,
10977            encoder: &mut fidl::encoding::Encoder<
10978                '_,
10979                fidl::encoding::DefaultFuchsiaResourceDialect,
10980            >,
10981            offset: usize,
10982            depth: fidl::encoding::Depth,
10983        ) -> fidl::Result<()> {
10984            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
10985            // Zero out padding regions. There's no need to apply masks
10986            // because the unmasked parts will be overwritten by fields.
10987            // Write the fields.
10988            self.0.encode(encoder, offset + 0, depth)?;
10989            Ok(())
10990        }
10991    }
10992
10993    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10994        for GuestLifecycleCreateRequest
10995    {
10996        #[inline(always)]
10997        fn new_empty() -> Self {
10998            Self {
10999                guest_config: fidl::new_empty!(
11000                    GuestConfig,
11001                    fidl::encoding::DefaultFuchsiaResourceDialect
11002                ),
11003            }
11004        }
11005
11006        #[inline]
11007        unsafe fn decode(
11008            &mut self,
11009            decoder: &mut fidl::encoding::Decoder<
11010                '_,
11011                fidl::encoding::DefaultFuchsiaResourceDialect,
11012            >,
11013            offset: usize,
11014            _depth: fidl::encoding::Depth,
11015        ) -> fidl::Result<()> {
11016            decoder.debug_check_bounds::<Self>(offset);
11017            // Verify that padding bytes are zero.
11018            fidl::decode!(
11019                GuestConfig,
11020                fidl::encoding::DefaultFuchsiaResourceDialect,
11021                &mut self.guest_config,
11022                decoder,
11023                offset + 0,
11024                _depth
11025            )?;
11026            Ok(())
11027        }
11028    }
11029
11030    impl fidl::encoding::ResourceTypeMarker for GuestManagerConnectRequest {
11031        type Borrowed<'a> = &'a mut Self;
11032        fn take_or_borrow<'a>(
11033            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11034        ) -> Self::Borrowed<'a> {
11035            value
11036        }
11037    }
11038
11039    unsafe impl fidl::encoding::TypeMarker for GuestManagerConnectRequest {
11040        type Owned = Self;
11041
11042        #[inline(always)]
11043        fn inline_align(_context: fidl::encoding::Context) -> usize {
11044            4
11045        }
11046
11047        #[inline(always)]
11048        fn inline_size(_context: fidl::encoding::Context) -> usize {
11049            4
11050        }
11051    }
11052
11053    unsafe impl
11054        fidl::encoding::Encode<
11055            GuestManagerConnectRequest,
11056            fidl::encoding::DefaultFuchsiaResourceDialect,
11057        > for &mut GuestManagerConnectRequest
11058    {
11059        #[inline]
11060        unsafe fn encode(
11061            self,
11062            encoder: &mut fidl::encoding::Encoder<
11063                '_,
11064                fidl::encoding::DefaultFuchsiaResourceDialect,
11065            >,
11066            offset: usize,
11067            _depth: fidl::encoding::Depth,
11068        ) -> fidl::Result<()> {
11069            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
11070            // Delegate to tuple encoding.
11071            fidl::encoding::Encode::<GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11072                (
11073                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
11074                ),
11075                encoder, offset, _depth
11076            )
11077        }
11078    }
11079    unsafe impl<
11080        T0: fidl::encoding::Encode<
11081                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11082                fidl::encoding::DefaultFuchsiaResourceDialect,
11083            >,
11084    >
11085        fidl::encoding::Encode<
11086            GuestManagerConnectRequest,
11087            fidl::encoding::DefaultFuchsiaResourceDialect,
11088        > for (T0,)
11089    {
11090        #[inline]
11091        unsafe fn encode(
11092            self,
11093            encoder: &mut fidl::encoding::Encoder<
11094                '_,
11095                fidl::encoding::DefaultFuchsiaResourceDialect,
11096            >,
11097            offset: usize,
11098            depth: fidl::encoding::Depth,
11099        ) -> fidl::Result<()> {
11100            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
11101            // Zero out padding regions. There's no need to apply masks
11102            // because the unmasked parts will be overwritten by fields.
11103            // Write the fields.
11104            self.0.encode(encoder, offset + 0, depth)?;
11105            Ok(())
11106        }
11107    }
11108
11109    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11110        for GuestManagerConnectRequest
11111    {
11112        #[inline(always)]
11113        fn new_empty() -> Self {
11114            Self {
11115                controller: fidl::new_empty!(
11116                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11117                    fidl::encoding::DefaultFuchsiaResourceDialect
11118                ),
11119            }
11120        }
11121
11122        #[inline]
11123        unsafe fn decode(
11124            &mut self,
11125            decoder: &mut fidl::encoding::Decoder<
11126                '_,
11127                fidl::encoding::DefaultFuchsiaResourceDialect,
11128            >,
11129            offset: usize,
11130            _depth: fidl::encoding::Depth,
11131        ) -> fidl::Result<()> {
11132            decoder.debug_check_bounds::<Self>(offset);
11133            // Verify that padding bytes are zero.
11134            fidl::decode!(
11135                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11136                fidl::encoding::DefaultFuchsiaResourceDialect,
11137                &mut self.controller,
11138                decoder,
11139                offset + 0,
11140                _depth
11141            )?;
11142            Ok(())
11143        }
11144    }
11145
11146    impl fidl::encoding::ResourceTypeMarker for GuestManagerGetInfoResponse {
11147        type Borrowed<'a> = &'a mut Self;
11148        fn take_or_borrow<'a>(
11149            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11150        ) -> Self::Borrowed<'a> {
11151            value
11152        }
11153    }
11154
11155    unsafe impl fidl::encoding::TypeMarker for GuestManagerGetInfoResponse {
11156        type Owned = Self;
11157
11158        #[inline(always)]
11159        fn inline_align(_context: fidl::encoding::Context) -> usize {
11160            8
11161        }
11162
11163        #[inline(always)]
11164        fn inline_size(_context: fidl::encoding::Context) -> usize {
11165            16
11166        }
11167    }
11168
11169    unsafe impl
11170        fidl::encoding::Encode<
11171            GuestManagerGetInfoResponse,
11172            fidl::encoding::DefaultFuchsiaResourceDialect,
11173        > for &mut GuestManagerGetInfoResponse
11174    {
11175        #[inline]
11176        unsafe fn encode(
11177            self,
11178            encoder: &mut fidl::encoding::Encoder<
11179                '_,
11180                fidl::encoding::DefaultFuchsiaResourceDialect,
11181            >,
11182            offset: usize,
11183            _depth: fidl::encoding::Depth,
11184        ) -> fidl::Result<()> {
11185            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
11186            // Delegate to tuple encoding.
11187            fidl::encoding::Encode::<
11188                GuestManagerGetInfoResponse,
11189                fidl::encoding::DefaultFuchsiaResourceDialect,
11190            >::encode(
11191                (<GuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_info),),
11192                encoder,
11193                offset,
11194                _depth,
11195            )
11196        }
11197    }
11198    unsafe impl<
11199        T0: fidl::encoding::Encode<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
11200    >
11201        fidl::encoding::Encode<
11202            GuestManagerGetInfoResponse,
11203            fidl::encoding::DefaultFuchsiaResourceDialect,
11204        > for (T0,)
11205    {
11206        #[inline]
11207        unsafe fn encode(
11208            self,
11209            encoder: &mut fidl::encoding::Encoder<
11210                '_,
11211                fidl::encoding::DefaultFuchsiaResourceDialect,
11212            >,
11213            offset: usize,
11214            depth: fidl::encoding::Depth,
11215        ) -> fidl::Result<()> {
11216            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
11217            // Zero out padding regions. There's no need to apply masks
11218            // because the unmasked parts will be overwritten by fields.
11219            // Write the fields.
11220            self.0.encode(encoder, offset + 0, depth)?;
11221            Ok(())
11222        }
11223    }
11224
11225    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11226        for GuestManagerGetInfoResponse
11227    {
11228        #[inline(always)]
11229        fn new_empty() -> Self {
11230            Self {
11231                guest_info: fidl::new_empty!(
11232                    GuestInfo,
11233                    fidl::encoding::DefaultFuchsiaResourceDialect
11234                ),
11235            }
11236        }
11237
11238        #[inline]
11239        unsafe fn decode(
11240            &mut self,
11241            decoder: &mut fidl::encoding::Decoder<
11242                '_,
11243                fidl::encoding::DefaultFuchsiaResourceDialect,
11244            >,
11245            offset: usize,
11246            _depth: fidl::encoding::Depth,
11247        ) -> fidl::Result<()> {
11248            decoder.debug_check_bounds::<Self>(offset);
11249            // Verify that padding bytes are zero.
11250            fidl::decode!(
11251                GuestInfo,
11252                fidl::encoding::DefaultFuchsiaResourceDialect,
11253                &mut self.guest_info,
11254                decoder,
11255                offset + 0,
11256                _depth
11257            )?;
11258            Ok(())
11259        }
11260    }
11261
11262    impl fidl::encoding::ResourceTypeMarker for GuestManagerLaunchRequest {
11263        type Borrowed<'a> = &'a mut Self;
11264        fn take_or_borrow<'a>(
11265            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11266        ) -> Self::Borrowed<'a> {
11267            value
11268        }
11269    }
11270
11271    unsafe impl fidl::encoding::TypeMarker for GuestManagerLaunchRequest {
11272        type Owned = Self;
11273
11274        #[inline(always)]
11275        fn inline_align(_context: fidl::encoding::Context) -> usize {
11276            8
11277        }
11278
11279        #[inline(always)]
11280        fn inline_size(_context: fidl::encoding::Context) -> usize {
11281            24
11282        }
11283    }
11284
11285    unsafe impl
11286        fidl::encoding::Encode<
11287            GuestManagerLaunchRequest,
11288            fidl::encoding::DefaultFuchsiaResourceDialect,
11289        > for &mut GuestManagerLaunchRequest
11290    {
11291        #[inline]
11292        unsafe fn encode(
11293            self,
11294            encoder: &mut fidl::encoding::Encoder<
11295                '_,
11296                fidl::encoding::DefaultFuchsiaResourceDialect,
11297            >,
11298            offset: usize,
11299            _depth: fidl::encoding::Depth,
11300        ) -> fidl::Result<()> {
11301            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
11302            // Delegate to tuple encoding.
11303            fidl::encoding::Encode::<GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11304                (
11305                    <GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest_config),
11306                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
11307                ),
11308                encoder, offset, _depth
11309            )
11310        }
11311    }
11312    unsafe impl<
11313        T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
11314        T1: fidl::encoding::Encode<
11315                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11316                fidl::encoding::DefaultFuchsiaResourceDialect,
11317            >,
11318    >
11319        fidl::encoding::Encode<
11320            GuestManagerLaunchRequest,
11321            fidl::encoding::DefaultFuchsiaResourceDialect,
11322        > for (T0, T1)
11323    {
11324        #[inline]
11325        unsafe fn encode(
11326            self,
11327            encoder: &mut fidl::encoding::Encoder<
11328                '_,
11329                fidl::encoding::DefaultFuchsiaResourceDialect,
11330            >,
11331            offset: usize,
11332            depth: fidl::encoding::Depth,
11333        ) -> fidl::Result<()> {
11334            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
11335            // Zero out padding regions. There's no need to apply masks
11336            // because the unmasked parts will be overwritten by fields.
11337            unsafe {
11338                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11339                (ptr as *mut u64).write_unaligned(0);
11340            }
11341            // Write the fields.
11342            self.0.encode(encoder, offset + 0, depth)?;
11343            self.1.encode(encoder, offset + 16, depth)?;
11344            Ok(())
11345        }
11346    }
11347
11348    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11349        for GuestManagerLaunchRequest
11350    {
11351        #[inline(always)]
11352        fn new_empty() -> Self {
11353            Self {
11354                guest_config: fidl::new_empty!(
11355                    GuestConfig,
11356                    fidl::encoding::DefaultFuchsiaResourceDialect
11357                ),
11358                controller: fidl::new_empty!(
11359                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11360                    fidl::encoding::DefaultFuchsiaResourceDialect
11361                ),
11362            }
11363        }
11364
11365        #[inline]
11366        unsafe fn decode(
11367            &mut self,
11368            decoder: &mut fidl::encoding::Decoder<
11369                '_,
11370                fidl::encoding::DefaultFuchsiaResourceDialect,
11371            >,
11372            offset: usize,
11373            _depth: fidl::encoding::Depth,
11374        ) -> fidl::Result<()> {
11375            decoder.debug_check_bounds::<Self>(offset);
11376            // Verify that padding bytes are zero.
11377            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11378            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11379            let mask = 0xffffffff00000000u64;
11380            let maskedval = padval & mask;
11381            if maskedval != 0 {
11382                return Err(fidl::Error::NonZeroPadding {
11383                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11384                });
11385            }
11386            fidl::decode!(
11387                GuestConfig,
11388                fidl::encoding::DefaultFuchsiaResourceDialect,
11389                &mut self.guest_config,
11390                decoder,
11391                offset + 0,
11392                _depth
11393            )?;
11394            fidl::decode!(
11395                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11396                fidl::encoding::DefaultFuchsiaResourceDialect,
11397                &mut self.controller,
11398                decoder,
11399                offset + 16,
11400                _depth
11401            )?;
11402            Ok(())
11403        }
11404    }
11405
11406    impl fidl::encoding::ResourceTypeMarker for GuestGetConsoleResponse {
11407        type Borrowed<'a> = &'a mut Self;
11408        fn take_or_borrow<'a>(
11409            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11410        ) -> Self::Borrowed<'a> {
11411            value
11412        }
11413    }
11414
11415    unsafe impl fidl::encoding::TypeMarker for GuestGetConsoleResponse {
11416        type Owned = Self;
11417
11418        #[inline(always)]
11419        fn inline_align(_context: fidl::encoding::Context) -> usize {
11420            4
11421        }
11422
11423        #[inline(always)]
11424        fn inline_size(_context: fidl::encoding::Context) -> usize {
11425            4
11426        }
11427    }
11428
11429    unsafe impl
11430        fidl::encoding::Encode<
11431            GuestGetConsoleResponse,
11432            fidl::encoding::DefaultFuchsiaResourceDialect,
11433        > for &mut GuestGetConsoleResponse
11434    {
11435        #[inline]
11436        unsafe fn encode(
11437            self,
11438            encoder: &mut fidl::encoding::Encoder<
11439                '_,
11440                fidl::encoding::DefaultFuchsiaResourceDialect,
11441            >,
11442            offset: usize,
11443            _depth: fidl::encoding::Depth,
11444        ) -> fidl::Result<()> {
11445            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
11446            // Delegate to tuple encoding.
11447            fidl::encoding::Encode::<
11448                GuestGetConsoleResponse,
11449                fidl::encoding::DefaultFuchsiaResourceDialect,
11450            >::encode(
11451                (<fidl::encoding::HandleType<
11452                    fidl::Socket,
11453                    { fidl::ObjectType::SOCKET.into_raw() },
11454                    2147483648,
11455                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11456                    &mut self.socket
11457                ),),
11458                encoder,
11459                offset,
11460                _depth,
11461            )
11462        }
11463    }
11464    unsafe impl<
11465        T0: fidl::encoding::Encode<
11466                fidl::encoding::HandleType<
11467                    fidl::Socket,
11468                    { fidl::ObjectType::SOCKET.into_raw() },
11469                    2147483648,
11470                >,
11471                fidl::encoding::DefaultFuchsiaResourceDialect,
11472            >,
11473    >
11474        fidl::encoding::Encode<
11475            GuestGetConsoleResponse,
11476            fidl::encoding::DefaultFuchsiaResourceDialect,
11477        > for (T0,)
11478    {
11479        #[inline]
11480        unsafe fn encode(
11481            self,
11482            encoder: &mut fidl::encoding::Encoder<
11483                '_,
11484                fidl::encoding::DefaultFuchsiaResourceDialect,
11485            >,
11486            offset: usize,
11487            depth: fidl::encoding::Depth,
11488        ) -> fidl::Result<()> {
11489            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
11490            // Zero out padding regions. There's no need to apply masks
11491            // because the unmasked parts will be overwritten by fields.
11492            // Write the fields.
11493            self.0.encode(encoder, offset + 0, depth)?;
11494            Ok(())
11495        }
11496    }
11497
11498    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11499        for GuestGetConsoleResponse
11500    {
11501        #[inline(always)]
11502        fn new_empty() -> Self {
11503            Self {
11504                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11505            }
11506        }
11507
11508        #[inline]
11509        unsafe fn decode(
11510            &mut self,
11511            decoder: &mut fidl::encoding::Decoder<
11512                '_,
11513                fidl::encoding::DefaultFuchsiaResourceDialect,
11514            >,
11515            offset: usize,
11516            _depth: fidl::encoding::Depth,
11517        ) -> fidl::Result<()> {
11518            decoder.debug_check_bounds::<Self>(offset);
11519            // Verify that padding bytes are zero.
11520            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11521            Ok(())
11522        }
11523    }
11524
11525    impl fidl::encoding::ResourceTypeMarker for HostVsockAcceptorAcceptResponse {
11526        type Borrowed<'a> = &'a mut Self;
11527        fn take_or_borrow<'a>(
11528            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11529        ) -> Self::Borrowed<'a> {
11530            value
11531        }
11532    }
11533
11534    unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptResponse {
11535        type Owned = Self;
11536
11537        #[inline(always)]
11538        fn inline_align(_context: fidl::encoding::Context) -> usize {
11539            4
11540        }
11541
11542        #[inline(always)]
11543        fn inline_size(_context: fidl::encoding::Context) -> usize {
11544            4
11545        }
11546    }
11547
11548    unsafe impl
11549        fidl::encoding::Encode<
11550            HostVsockAcceptorAcceptResponse,
11551            fidl::encoding::DefaultFuchsiaResourceDialect,
11552        > for &mut HostVsockAcceptorAcceptResponse
11553    {
11554        #[inline]
11555        unsafe fn encode(
11556            self,
11557            encoder: &mut fidl::encoding::Encoder<
11558                '_,
11559                fidl::encoding::DefaultFuchsiaResourceDialect,
11560            >,
11561            offset: usize,
11562            _depth: fidl::encoding::Depth,
11563        ) -> fidl::Result<()> {
11564            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
11565            // Delegate to tuple encoding.
11566            fidl::encoding::Encode::<
11567                HostVsockAcceptorAcceptResponse,
11568                fidl::encoding::DefaultFuchsiaResourceDialect,
11569            >::encode(
11570                (<fidl::encoding::HandleType<
11571                    fidl::Socket,
11572                    { fidl::ObjectType::SOCKET.into_raw() },
11573                    2147483648,
11574                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11575                    &mut self.socket
11576                ),),
11577                encoder,
11578                offset,
11579                _depth,
11580            )
11581        }
11582    }
11583    unsafe impl<
11584        T0: fidl::encoding::Encode<
11585                fidl::encoding::HandleType<
11586                    fidl::Socket,
11587                    { fidl::ObjectType::SOCKET.into_raw() },
11588                    2147483648,
11589                >,
11590                fidl::encoding::DefaultFuchsiaResourceDialect,
11591            >,
11592    >
11593        fidl::encoding::Encode<
11594            HostVsockAcceptorAcceptResponse,
11595            fidl::encoding::DefaultFuchsiaResourceDialect,
11596        > for (T0,)
11597    {
11598        #[inline]
11599        unsafe fn encode(
11600            self,
11601            encoder: &mut fidl::encoding::Encoder<
11602                '_,
11603                fidl::encoding::DefaultFuchsiaResourceDialect,
11604            >,
11605            offset: usize,
11606            depth: fidl::encoding::Depth,
11607        ) -> fidl::Result<()> {
11608            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
11609            // Zero out padding regions. There's no need to apply masks
11610            // because the unmasked parts will be overwritten by fields.
11611            // Write the fields.
11612            self.0.encode(encoder, offset + 0, depth)?;
11613            Ok(())
11614        }
11615    }
11616
11617    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11618        for HostVsockAcceptorAcceptResponse
11619    {
11620        #[inline(always)]
11621        fn new_empty() -> Self {
11622            Self {
11623                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11624            }
11625        }
11626
11627        #[inline]
11628        unsafe fn decode(
11629            &mut self,
11630            decoder: &mut fidl::encoding::Decoder<
11631                '_,
11632                fidl::encoding::DefaultFuchsiaResourceDialect,
11633            >,
11634            offset: usize,
11635            _depth: fidl::encoding::Depth,
11636        ) -> fidl::Result<()> {
11637            decoder.debug_check_bounds::<Self>(offset);
11638            // Verify that padding bytes are zero.
11639            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11640            Ok(())
11641        }
11642    }
11643
11644    impl fidl::encoding::ResourceTypeMarker for HostVsockEndpointConnectResponse {
11645        type Borrowed<'a> = &'a mut Self;
11646        fn take_or_borrow<'a>(
11647            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11648        ) -> Self::Borrowed<'a> {
11649            value
11650        }
11651    }
11652
11653    unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectResponse {
11654        type Owned = Self;
11655
11656        #[inline(always)]
11657        fn inline_align(_context: fidl::encoding::Context) -> usize {
11658            4
11659        }
11660
11661        #[inline(always)]
11662        fn inline_size(_context: fidl::encoding::Context) -> usize {
11663            4
11664        }
11665    }
11666
11667    unsafe impl
11668        fidl::encoding::Encode<
11669            HostVsockEndpointConnectResponse,
11670            fidl::encoding::DefaultFuchsiaResourceDialect,
11671        > for &mut HostVsockEndpointConnectResponse
11672    {
11673        #[inline]
11674        unsafe fn encode(
11675            self,
11676            encoder: &mut fidl::encoding::Encoder<
11677                '_,
11678                fidl::encoding::DefaultFuchsiaResourceDialect,
11679            >,
11680            offset: usize,
11681            _depth: fidl::encoding::Depth,
11682        ) -> fidl::Result<()> {
11683            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
11684            // Delegate to tuple encoding.
11685            fidl::encoding::Encode::<
11686                HostVsockEndpointConnectResponse,
11687                fidl::encoding::DefaultFuchsiaResourceDialect,
11688            >::encode(
11689                (<fidl::encoding::HandleType<
11690                    fidl::Socket,
11691                    { fidl::ObjectType::SOCKET.into_raw() },
11692                    2147483648,
11693                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11694                    &mut self.socket
11695                ),),
11696                encoder,
11697                offset,
11698                _depth,
11699            )
11700        }
11701    }
11702    unsafe impl<
11703        T0: fidl::encoding::Encode<
11704                fidl::encoding::HandleType<
11705                    fidl::Socket,
11706                    { fidl::ObjectType::SOCKET.into_raw() },
11707                    2147483648,
11708                >,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710            >,
11711    >
11712        fidl::encoding::Encode<
11713            HostVsockEndpointConnectResponse,
11714            fidl::encoding::DefaultFuchsiaResourceDialect,
11715        > for (T0,)
11716    {
11717        #[inline]
11718        unsafe fn encode(
11719            self,
11720            encoder: &mut fidl::encoding::Encoder<
11721                '_,
11722                fidl::encoding::DefaultFuchsiaResourceDialect,
11723            >,
11724            offset: usize,
11725            depth: fidl::encoding::Depth,
11726        ) -> fidl::Result<()> {
11727            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
11728            // Zero out padding regions. There's no need to apply masks
11729            // because the unmasked parts will be overwritten by fields.
11730            // Write the fields.
11731            self.0.encode(encoder, offset + 0, depth)?;
11732            Ok(())
11733        }
11734    }
11735
11736    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11737        for HostVsockEndpointConnectResponse
11738    {
11739        #[inline(always)]
11740        fn new_empty() -> Self {
11741            Self {
11742                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11743            }
11744        }
11745
11746        #[inline]
11747        unsafe fn decode(
11748            &mut self,
11749            decoder: &mut fidl::encoding::Decoder<
11750                '_,
11751                fidl::encoding::DefaultFuchsiaResourceDialect,
11752            >,
11753            offset: usize,
11754            _depth: fidl::encoding::Depth,
11755        ) -> fidl::Result<()> {
11756            decoder.debug_check_bounds::<Self>(offset);
11757            // Verify that padding bytes are zero.
11758            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11759            Ok(())
11760        }
11761    }
11762
11763    impl fidl::encoding::ResourceTypeMarker for Listener {
11764        type Borrowed<'a> = &'a mut Self;
11765        fn take_or_borrow<'a>(
11766            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11767        ) -> Self::Borrowed<'a> {
11768            value
11769        }
11770    }
11771
11772    unsafe impl fidl::encoding::TypeMarker for Listener {
11773        type Owned = Self;
11774
11775        #[inline(always)]
11776        fn inline_align(_context: fidl::encoding::Context) -> usize {
11777            4
11778        }
11779
11780        #[inline(always)]
11781        fn inline_size(_context: fidl::encoding::Context) -> usize {
11782            8
11783        }
11784    }
11785
11786    unsafe impl fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
11787        for &mut Listener
11788    {
11789        #[inline]
11790        unsafe fn encode(
11791            self,
11792            encoder: &mut fidl::encoding::Encoder<
11793                '_,
11794                fidl::encoding::DefaultFuchsiaResourceDialect,
11795            >,
11796            offset: usize,
11797            _depth: fidl::encoding::Depth,
11798        ) -> fidl::Result<()> {
11799            encoder.debug_check_bounds::<Listener>(offset);
11800            // Delegate to tuple encoding.
11801            fidl::encoding::Encode::<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11802                (
11803                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
11804                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
11805                ),
11806                encoder, offset, _depth
11807            )
11808        }
11809    }
11810    unsafe impl<
11811        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11812        T1: fidl::encoding::Encode<
11813                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11814                fidl::encoding::DefaultFuchsiaResourceDialect,
11815            >,
11816    > fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
11817    {
11818        #[inline]
11819        unsafe fn encode(
11820            self,
11821            encoder: &mut fidl::encoding::Encoder<
11822                '_,
11823                fidl::encoding::DefaultFuchsiaResourceDialect,
11824            >,
11825            offset: usize,
11826            depth: fidl::encoding::Depth,
11827        ) -> fidl::Result<()> {
11828            encoder.debug_check_bounds::<Listener>(offset);
11829            // Zero out padding regions. There's no need to apply masks
11830            // because the unmasked parts will be overwritten by fields.
11831            // Write the fields.
11832            self.0.encode(encoder, offset + 0, depth)?;
11833            self.1.encode(encoder, offset + 4, depth)?;
11834            Ok(())
11835        }
11836    }
11837
11838    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {
11839        #[inline(always)]
11840        fn new_empty() -> Self {
11841            Self {
11842                port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11843                acceptor: fidl::new_empty!(
11844                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11845                    fidl::encoding::DefaultFuchsiaResourceDialect
11846                ),
11847            }
11848        }
11849
11850        #[inline]
11851        unsafe fn decode(
11852            &mut self,
11853            decoder: &mut fidl::encoding::Decoder<
11854                '_,
11855                fidl::encoding::DefaultFuchsiaResourceDialect,
11856            >,
11857            offset: usize,
11858            _depth: fidl::encoding::Depth,
11859        ) -> fidl::Result<()> {
11860            decoder.debug_check_bounds::<Self>(offset);
11861            // Verify that padding bytes are zero.
11862            fidl::decode!(
11863                u32,
11864                fidl::encoding::DefaultFuchsiaResourceDialect,
11865                &mut self.port,
11866                decoder,
11867                offset + 0,
11868                _depth
11869            )?;
11870            fidl::decode!(
11871                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11872                fidl::encoding::DefaultFuchsiaResourceDialect,
11873                &mut self.acceptor,
11874                decoder,
11875                offset + 4,
11876                _depth
11877            )?;
11878            Ok(())
11879        }
11880    }
11881
11882    impl GuestConfig {
11883        #[inline(always)]
11884        fn max_ordinal_present(&self) -> u64 {
11885            if let Some(_) = self.virtio_mem_region_alignment {
11886                return 25;
11887            }
11888            if let Some(_) = self.virtio_mem_region_size {
11889                return 24;
11890            }
11891            if let Some(_) = self.virtio_mem_block_size {
11892                return 23;
11893            }
11894            if let Some(_) = self.virtio_mem {
11895                return 22;
11896            }
11897            if let Some(_) = self.vsock_listeners {
11898                return 21;
11899            }
11900            if let Some(_) = self.virtio_sound_input {
11901                return 20;
11902            }
11903            if let Some(_) = self.virtio_sound {
11904                return 19;
11905            }
11906            if let Some(_) = self.virtio_vsock {
11907                return 18;
11908            }
11909            if let Some(_) = self.virtio_rng {
11910                return 17;
11911            }
11912            if let Some(_) = self.virtio_gpu {
11913                return 16;
11914            }
11915            if let Some(_) = self.virtio_console {
11916                return 15;
11917            }
11918            if let Some(_) = self.virtio_balloon {
11919                return 14;
11920            }
11921            if let Some(_) = self.default_net {
11922                return 13;
11923            }
11924            if let Some(_) = self.net_devices {
11925                return 10;
11926            }
11927            if let Some(_) = self.block_devices {
11928                return 9;
11929            }
11930            if let Some(_) = self.guest_memory {
11931                return 8;
11932            }
11933            if let Some(_) = self.cpus {
11934                return 7;
11935            }
11936            if let Some(_) = self.cmdline_add {
11937                return 6;
11938            }
11939            if let Some(_) = self.cmdline {
11940                return 5;
11941            }
11942            if let Some(_) = self.dtb_overlay {
11943                return 4;
11944            }
11945            if let Some(_) = self.ramdisk {
11946                return 3;
11947            }
11948            if let Some(_) = self.kernel {
11949                return 2;
11950            }
11951            if let Some(_) = self.kernel_type {
11952                return 1;
11953            }
11954            0
11955        }
11956    }
11957
11958    impl fidl::encoding::ResourceTypeMarker for GuestConfig {
11959        type Borrowed<'a> = &'a mut Self;
11960        fn take_or_borrow<'a>(
11961            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11962        ) -> Self::Borrowed<'a> {
11963            value
11964        }
11965    }
11966
11967    unsafe impl fidl::encoding::TypeMarker for GuestConfig {
11968        type Owned = Self;
11969
11970        #[inline(always)]
11971        fn inline_align(_context: fidl::encoding::Context) -> usize {
11972            8
11973        }
11974
11975        #[inline(always)]
11976        fn inline_size(_context: fidl::encoding::Context) -> usize {
11977            16
11978        }
11979    }
11980
11981    unsafe impl fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
11982        for &mut GuestConfig
11983    {
11984        unsafe fn encode(
11985            self,
11986            encoder: &mut fidl::encoding::Encoder<
11987                '_,
11988                fidl::encoding::DefaultFuchsiaResourceDialect,
11989            >,
11990            offset: usize,
11991            mut depth: fidl::encoding::Depth,
11992        ) -> fidl::Result<()> {
11993            encoder.debug_check_bounds::<GuestConfig>(offset);
11994            // Vector header
11995            let max_ordinal: u64 = self.max_ordinal_present();
11996            encoder.write_num(max_ordinal, offset);
11997            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11998            // Calling encoder.out_of_line_offset(0) is not allowed.
11999            if max_ordinal == 0 {
12000                return Ok(());
12001            }
12002            depth.increment()?;
12003            let envelope_size = 8;
12004            let bytes_len = max_ordinal as usize * envelope_size;
12005            #[allow(unused_variables)]
12006            let offset = encoder.out_of_line_offset(bytes_len);
12007            let mut _prev_end_offset: usize = 0;
12008            if 1 > max_ordinal {
12009                return Ok(());
12010            }
12011
12012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12013            // are envelope_size bytes.
12014            let cur_offset: usize = (1 - 1) * envelope_size;
12015
12016            // Zero reserved fields.
12017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12018
12019            // Safety:
12020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12022            //   envelope_size bytes, there is always sufficient room.
12023            fidl::encoding::encode_in_envelope_optional::<
12024                KernelType,
12025                fidl::encoding::DefaultFuchsiaResourceDialect,
12026            >(
12027                self.kernel_type
12028                    .as_ref()
12029                    .map(<KernelType as fidl::encoding::ValueTypeMarker>::borrow),
12030                encoder,
12031                offset + cur_offset,
12032                depth,
12033            )?;
12034
12035            _prev_end_offset = cur_offset + envelope_size;
12036            if 2 > max_ordinal {
12037                return Ok(());
12038            }
12039
12040            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12041            // are envelope_size bytes.
12042            let cur_offset: usize = (2 - 1) * envelope_size;
12043
12044            // Zero reserved fields.
12045            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12046
12047            // Safety:
12048            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12049            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12050            //   envelope_size bytes, there is always sufficient room.
12051            fidl::encoding::encode_in_envelope_optional::<
12052                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12053                fidl::encoding::DefaultFuchsiaResourceDialect,
12054            >(
12055                self.kernel.as_mut().map(
12056                    <fidl::encoding::Endpoint<
12057                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12058                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12059                ),
12060                encoder,
12061                offset + cur_offset,
12062                depth,
12063            )?;
12064
12065            _prev_end_offset = cur_offset + envelope_size;
12066            if 3 > max_ordinal {
12067                return Ok(());
12068            }
12069
12070            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12071            // are envelope_size bytes.
12072            let cur_offset: usize = (3 - 1) * envelope_size;
12073
12074            // Zero reserved fields.
12075            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12076
12077            // Safety:
12078            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12079            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12080            //   envelope_size bytes, there is always sufficient room.
12081            fidl::encoding::encode_in_envelope_optional::<
12082                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12083                fidl::encoding::DefaultFuchsiaResourceDialect,
12084            >(
12085                self.ramdisk.as_mut().map(
12086                    <fidl::encoding::Endpoint<
12087                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12088                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12089                ),
12090                encoder,
12091                offset + cur_offset,
12092                depth,
12093            )?;
12094
12095            _prev_end_offset = cur_offset + envelope_size;
12096            if 4 > max_ordinal {
12097                return Ok(());
12098            }
12099
12100            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12101            // are envelope_size bytes.
12102            let cur_offset: usize = (4 - 1) * envelope_size;
12103
12104            // Zero reserved fields.
12105            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12106
12107            // Safety:
12108            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12109            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12110            //   envelope_size bytes, there is always sufficient room.
12111            fidl::encoding::encode_in_envelope_optional::<
12112                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12113                fidl::encoding::DefaultFuchsiaResourceDialect,
12114            >(
12115                self.dtb_overlay.as_mut().map(
12116                    <fidl::encoding::Endpoint<
12117                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12118                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12119                ),
12120                encoder,
12121                offset + cur_offset,
12122                depth,
12123            )?;
12124
12125            _prev_end_offset = cur_offset + envelope_size;
12126            if 5 > max_ordinal {
12127                return Ok(());
12128            }
12129
12130            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12131            // are envelope_size bytes.
12132            let cur_offset: usize = (5 - 1) * envelope_size;
12133
12134            // Zero reserved fields.
12135            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12136
12137            // Safety:
12138            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12139            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12140            //   envelope_size bytes, there is always sufficient room.
12141            fidl::encoding::encode_in_envelope_optional::<
12142                fidl::encoding::UnboundedString,
12143                fidl::encoding::DefaultFuchsiaResourceDialect,
12144            >(
12145                self.cmdline.as_ref().map(
12146                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
12147                ),
12148                encoder,
12149                offset + cur_offset,
12150                depth,
12151            )?;
12152
12153            _prev_end_offset = cur_offset + envelope_size;
12154            if 6 > max_ordinal {
12155                return Ok(());
12156            }
12157
12158            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12159            // are envelope_size bytes.
12160            let cur_offset: usize = (6 - 1) * envelope_size;
12161
12162            // Zero reserved fields.
12163            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12164
12165            // Safety:
12166            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12167            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12168            //   envelope_size bytes, there is always sufficient room.
12169            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12170            self.cmdline_add.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
12171            encoder, offset + cur_offset, depth
12172        )?;
12173
12174            _prev_end_offset = cur_offset + envelope_size;
12175            if 7 > max_ordinal {
12176                return Ok(());
12177            }
12178
12179            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12180            // are envelope_size bytes.
12181            let cur_offset: usize = (7 - 1) * envelope_size;
12182
12183            // Zero reserved fields.
12184            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12185
12186            // Safety:
12187            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12188            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12189            //   envelope_size bytes, there is always sufficient room.
12190            fidl::encoding::encode_in_envelope_optional::<
12191                u8,
12192                fidl::encoding::DefaultFuchsiaResourceDialect,
12193            >(
12194                self.cpus.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
12195                encoder,
12196                offset + cur_offset,
12197                depth,
12198            )?;
12199
12200            _prev_end_offset = cur_offset + envelope_size;
12201            if 8 > max_ordinal {
12202                return Ok(());
12203            }
12204
12205            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12206            // are envelope_size bytes.
12207            let cur_offset: usize = (8 - 1) * envelope_size;
12208
12209            // Zero reserved fields.
12210            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12211
12212            // Safety:
12213            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12214            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12215            //   envelope_size bytes, there is always sufficient room.
12216            fidl::encoding::encode_in_envelope_optional::<
12217                u64,
12218                fidl::encoding::DefaultFuchsiaResourceDialect,
12219            >(
12220                self.guest_memory.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12221                encoder,
12222                offset + cur_offset,
12223                depth,
12224            )?;
12225
12226            _prev_end_offset = cur_offset + envelope_size;
12227            if 9 > max_ordinal {
12228                return Ok(());
12229            }
12230
12231            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12232            // are envelope_size bytes.
12233            let cur_offset: usize = (9 - 1) * envelope_size;
12234
12235            // Zero reserved fields.
12236            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12237
12238            // Safety:
12239            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12240            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12241            //   envelope_size bytes, there is always sufficient room.
12242            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12243            self.block_devices.as_mut().map(<fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12244            encoder, offset + cur_offset, depth
12245        )?;
12246
12247            _prev_end_offset = cur_offset + envelope_size;
12248            if 10 > max_ordinal {
12249                return Ok(());
12250            }
12251
12252            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12253            // are envelope_size bytes.
12254            let cur_offset: usize = (10 - 1) * envelope_size;
12255
12256            // Zero reserved fields.
12257            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12258
12259            // Safety:
12260            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12261            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12262            //   envelope_size bytes, there is always sufficient room.
12263            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12264            self.net_devices.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
12265            encoder, offset + cur_offset, depth
12266        )?;
12267
12268            _prev_end_offset = cur_offset + envelope_size;
12269            if 13 > max_ordinal {
12270                return Ok(());
12271            }
12272
12273            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12274            // are envelope_size bytes.
12275            let cur_offset: usize = (13 - 1) * envelope_size;
12276
12277            // Zero reserved fields.
12278            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12279
12280            // Safety:
12281            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12282            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12283            //   envelope_size bytes, there is always sufficient room.
12284            fidl::encoding::encode_in_envelope_optional::<
12285                bool,
12286                fidl::encoding::DefaultFuchsiaResourceDialect,
12287            >(
12288                self.default_net.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12289                encoder,
12290                offset + cur_offset,
12291                depth,
12292            )?;
12293
12294            _prev_end_offset = cur_offset + envelope_size;
12295            if 14 > max_ordinal {
12296                return Ok(());
12297            }
12298
12299            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12300            // are envelope_size bytes.
12301            let cur_offset: usize = (14 - 1) * envelope_size;
12302
12303            // Zero reserved fields.
12304            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12305
12306            // Safety:
12307            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12308            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12309            //   envelope_size bytes, there is always sufficient room.
12310            fidl::encoding::encode_in_envelope_optional::<
12311                bool,
12312                fidl::encoding::DefaultFuchsiaResourceDialect,
12313            >(
12314                self.virtio_balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12315                encoder,
12316                offset + cur_offset,
12317                depth,
12318            )?;
12319
12320            _prev_end_offset = cur_offset + envelope_size;
12321            if 15 > max_ordinal {
12322                return Ok(());
12323            }
12324
12325            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12326            // are envelope_size bytes.
12327            let cur_offset: usize = (15 - 1) * envelope_size;
12328
12329            // Zero reserved fields.
12330            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12331
12332            // Safety:
12333            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12334            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12335            //   envelope_size bytes, there is always sufficient room.
12336            fidl::encoding::encode_in_envelope_optional::<
12337                bool,
12338                fidl::encoding::DefaultFuchsiaResourceDialect,
12339            >(
12340                self.virtio_console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12341                encoder,
12342                offset + cur_offset,
12343                depth,
12344            )?;
12345
12346            _prev_end_offset = cur_offset + envelope_size;
12347            if 16 > max_ordinal {
12348                return Ok(());
12349            }
12350
12351            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12352            // are envelope_size bytes.
12353            let cur_offset: usize = (16 - 1) * envelope_size;
12354
12355            // Zero reserved fields.
12356            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12357
12358            // Safety:
12359            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12360            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12361            //   envelope_size bytes, there is always sufficient room.
12362            fidl::encoding::encode_in_envelope_optional::<
12363                bool,
12364                fidl::encoding::DefaultFuchsiaResourceDialect,
12365            >(
12366                self.virtio_gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12367                encoder,
12368                offset + cur_offset,
12369                depth,
12370            )?;
12371
12372            _prev_end_offset = cur_offset + envelope_size;
12373            if 17 > max_ordinal {
12374                return Ok(());
12375            }
12376
12377            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12378            // are envelope_size bytes.
12379            let cur_offset: usize = (17 - 1) * envelope_size;
12380
12381            // Zero reserved fields.
12382            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12383
12384            // Safety:
12385            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12386            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12387            //   envelope_size bytes, there is always sufficient room.
12388            fidl::encoding::encode_in_envelope_optional::<
12389                bool,
12390                fidl::encoding::DefaultFuchsiaResourceDialect,
12391            >(
12392                self.virtio_rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12393                encoder,
12394                offset + cur_offset,
12395                depth,
12396            )?;
12397
12398            _prev_end_offset = cur_offset + envelope_size;
12399            if 18 > max_ordinal {
12400                return Ok(());
12401            }
12402
12403            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12404            // are envelope_size bytes.
12405            let cur_offset: usize = (18 - 1) * envelope_size;
12406
12407            // Zero reserved fields.
12408            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12409
12410            // Safety:
12411            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12412            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12413            //   envelope_size bytes, there is always sufficient room.
12414            fidl::encoding::encode_in_envelope_optional::<
12415                bool,
12416                fidl::encoding::DefaultFuchsiaResourceDialect,
12417            >(
12418                self.virtio_vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12419                encoder,
12420                offset + cur_offset,
12421                depth,
12422            )?;
12423
12424            _prev_end_offset = cur_offset + envelope_size;
12425            if 19 > max_ordinal {
12426                return Ok(());
12427            }
12428
12429            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12430            // are envelope_size bytes.
12431            let cur_offset: usize = (19 - 1) * envelope_size;
12432
12433            // Zero reserved fields.
12434            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12435
12436            // Safety:
12437            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12438            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12439            //   envelope_size bytes, there is always sufficient room.
12440            fidl::encoding::encode_in_envelope_optional::<
12441                bool,
12442                fidl::encoding::DefaultFuchsiaResourceDialect,
12443            >(
12444                self.virtio_sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12445                encoder,
12446                offset + cur_offset,
12447                depth,
12448            )?;
12449
12450            _prev_end_offset = cur_offset + envelope_size;
12451            if 20 > max_ordinal {
12452                return Ok(());
12453            }
12454
12455            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12456            // are envelope_size bytes.
12457            let cur_offset: usize = (20 - 1) * envelope_size;
12458
12459            // Zero reserved fields.
12460            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12461
12462            // Safety:
12463            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12464            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12465            //   envelope_size bytes, there is always sufficient room.
12466            fidl::encoding::encode_in_envelope_optional::<
12467                bool,
12468                fidl::encoding::DefaultFuchsiaResourceDialect,
12469            >(
12470                self.virtio_sound_input
12471                    .as_ref()
12472                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12473                encoder,
12474                offset + cur_offset,
12475                depth,
12476            )?;
12477
12478            _prev_end_offset = cur_offset + envelope_size;
12479            if 21 > max_ordinal {
12480                return Ok(());
12481            }
12482
12483            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12484            // are envelope_size bytes.
12485            let cur_offset: usize = (21 - 1) * envelope_size;
12486
12487            // Zero reserved fields.
12488            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12489
12490            // Safety:
12491            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12492            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12493            //   envelope_size bytes, there is always sufficient room.
12494            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Listener>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12495            self.vsock_listeners.as_mut().map(<fidl::encoding::UnboundedVector<Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12496            encoder, offset + cur_offset, depth
12497        )?;
12498
12499            _prev_end_offset = cur_offset + envelope_size;
12500            if 22 > max_ordinal {
12501                return Ok(());
12502            }
12503
12504            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12505            // are envelope_size bytes.
12506            let cur_offset: usize = (22 - 1) * envelope_size;
12507
12508            // Zero reserved fields.
12509            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12510
12511            // Safety:
12512            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12513            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12514            //   envelope_size bytes, there is always sufficient room.
12515            fidl::encoding::encode_in_envelope_optional::<
12516                bool,
12517                fidl::encoding::DefaultFuchsiaResourceDialect,
12518            >(
12519                self.virtio_mem.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12520                encoder,
12521                offset + cur_offset,
12522                depth,
12523            )?;
12524
12525            _prev_end_offset = cur_offset + envelope_size;
12526            if 23 > max_ordinal {
12527                return Ok(());
12528            }
12529
12530            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12531            // are envelope_size bytes.
12532            let cur_offset: usize = (23 - 1) * envelope_size;
12533
12534            // Zero reserved fields.
12535            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12536
12537            // Safety:
12538            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12539            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12540            //   envelope_size bytes, there is always sufficient room.
12541            fidl::encoding::encode_in_envelope_optional::<
12542                u64,
12543                fidl::encoding::DefaultFuchsiaResourceDialect,
12544            >(
12545                self.virtio_mem_block_size
12546                    .as_ref()
12547                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12548                encoder,
12549                offset + cur_offset,
12550                depth,
12551            )?;
12552
12553            _prev_end_offset = cur_offset + envelope_size;
12554            if 24 > max_ordinal {
12555                return Ok(());
12556            }
12557
12558            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12559            // are envelope_size bytes.
12560            let cur_offset: usize = (24 - 1) * envelope_size;
12561
12562            // Zero reserved fields.
12563            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12564
12565            // Safety:
12566            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12567            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12568            //   envelope_size bytes, there is always sufficient room.
12569            fidl::encoding::encode_in_envelope_optional::<
12570                u64,
12571                fidl::encoding::DefaultFuchsiaResourceDialect,
12572            >(
12573                self.virtio_mem_region_size
12574                    .as_ref()
12575                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12576                encoder,
12577                offset + cur_offset,
12578                depth,
12579            )?;
12580
12581            _prev_end_offset = cur_offset + envelope_size;
12582            if 25 > max_ordinal {
12583                return Ok(());
12584            }
12585
12586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12587            // are envelope_size bytes.
12588            let cur_offset: usize = (25 - 1) * envelope_size;
12589
12590            // Zero reserved fields.
12591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12592
12593            // Safety:
12594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12596            //   envelope_size bytes, there is always sufficient room.
12597            fidl::encoding::encode_in_envelope_optional::<
12598                u64,
12599                fidl::encoding::DefaultFuchsiaResourceDialect,
12600            >(
12601                self.virtio_mem_region_alignment
12602                    .as_ref()
12603                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12604                encoder,
12605                offset + cur_offset,
12606                depth,
12607            )?;
12608
12609            _prev_end_offset = cur_offset + envelope_size;
12610
12611            Ok(())
12612        }
12613    }
12614
12615    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {
12616        #[inline(always)]
12617        fn new_empty() -> Self {
12618            Self::default()
12619        }
12620
12621        unsafe fn decode(
12622            &mut self,
12623            decoder: &mut fidl::encoding::Decoder<
12624                '_,
12625                fidl::encoding::DefaultFuchsiaResourceDialect,
12626            >,
12627            offset: usize,
12628            mut depth: fidl::encoding::Depth,
12629        ) -> fidl::Result<()> {
12630            decoder.debug_check_bounds::<Self>(offset);
12631            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12632                None => return Err(fidl::Error::NotNullable),
12633                Some(len) => len,
12634            };
12635            // Calling decoder.out_of_line_offset(0) is not allowed.
12636            if len == 0 {
12637                return Ok(());
12638            };
12639            depth.increment()?;
12640            let envelope_size = 8;
12641            let bytes_len = len * envelope_size;
12642            let offset = decoder.out_of_line_offset(bytes_len)?;
12643            // Decode the envelope for each type.
12644            let mut _next_ordinal_to_read = 0;
12645            let mut next_offset = offset;
12646            let end_offset = offset + bytes_len;
12647            _next_ordinal_to_read += 1;
12648            if next_offset >= end_offset {
12649                return Ok(());
12650            }
12651
12652            // Decode unknown envelopes for gaps in ordinals.
12653            while _next_ordinal_to_read < 1 {
12654                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12655                _next_ordinal_to_read += 1;
12656                next_offset += envelope_size;
12657            }
12658
12659            let next_out_of_line = decoder.next_out_of_line();
12660            let handles_before = decoder.remaining_handles();
12661            if let Some((inlined, num_bytes, num_handles)) =
12662                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12663            {
12664                let member_inline_size =
12665                    <KernelType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12666                if inlined != (member_inline_size <= 4) {
12667                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12668                }
12669                let inner_offset;
12670                let mut inner_depth = depth.clone();
12671                if inlined {
12672                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12673                    inner_offset = next_offset;
12674                } else {
12675                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12676                    inner_depth.increment()?;
12677                }
12678                let val_ref = self.kernel_type.get_or_insert_with(|| {
12679                    fidl::new_empty!(KernelType, fidl::encoding::DefaultFuchsiaResourceDialect)
12680                });
12681                fidl::decode!(
12682                    KernelType,
12683                    fidl::encoding::DefaultFuchsiaResourceDialect,
12684                    val_ref,
12685                    decoder,
12686                    inner_offset,
12687                    inner_depth
12688                )?;
12689                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12690                {
12691                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12692                }
12693                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12694                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12695                }
12696            }
12697
12698            next_offset += envelope_size;
12699            _next_ordinal_to_read += 1;
12700            if next_offset >= end_offset {
12701                return Ok(());
12702            }
12703
12704            // Decode unknown envelopes for gaps in ordinals.
12705            while _next_ordinal_to_read < 2 {
12706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12707                _next_ordinal_to_read += 1;
12708                next_offset += envelope_size;
12709            }
12710
12711            let next_out_of_line = decoder.next_out_of_line();
12712            let handles_before = decoder.remaining_handles();
12713            if let Some((inlined, num_bytes, num_handles)) =
12714                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12715            {
12716                let member_inline_size = <fidl::encoding::Endpoint<
12717                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12718                > as fidl::encoding::TypeMarker>::inline_size(
12719                    decoder.context
12720                );
12721                if inlined != (member_inline_size <= 4) {
12722                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12723                }
12724                let inner_offset;
12725                let mut inner_depth = depth.clone();
12726                if inlined {
12727                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12728                    inner_offset = next_offset;
12729                } else {
12730                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12731                    inner_depth.increment()?;
12732                }
12733                let val_ref = self.kernel.get_or_insert_with(|| {
12734                    fidl::new_empty!(
12735                        fidl::encoding::Endpoint<
12736                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12737                        >,
12738                        fidl::encoding::DefaultFuchsiaResourceDialect
12739                    )
12740                });
12741                fidl::decode!(
12742                    fidl::encoding::Endpoint<
12743                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12744                    >,
12745                    fidl::encoding::DefaultFuchsiaResourceDialect,
12746                    val_ref,
12747                    decoder,
12748                    inner_offset,
12749                    inner_depth
12750                )?;
12751                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12752                {
12753                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12754                }
12755                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12756                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12757                }
12758            }
12759
12760            next_offset += envelope_size;
12761            _next_ordinal_to_read += 1;
12762            if next_offset >= end_offset {
12763                return Ok(());
12764            }
12765
12766            // Decode unknown envelopes for gaps in ordinals.
12767            while _next_ordinal_to_read < 3 {
12768                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12769                _next_ordinal_to_read += 1;
12770                next_offset += envelope_size;
12771            }
12772
12773            let next_out_of_line = decoder.next_out_of_line();
12774            let handles_before = decoder.remaining_handles();
12775            if let Some((inlined, num_bytes, num_handles)) =
12776                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12777            {
12778                let member_inline_size = <fidl::encoding::Endpoint<
12779                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12780                > as fidl::encoding::TypeMarker>::inline_size(
12781                    decoder.context
12782                );
12783                if inlined != (member_inline_size <= 4) {
12784                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12785                }
12786                let inner_offset;
12787                let mut inner_depth = depth.clone();
12788                if inlined {
12789                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12790                    inner_offset = next_offset;
12791                } else {
12792                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12793                    inner_depth.increment()?;
12794                }
12795                let val_ref = self.ramdisk.get_or_insert_with(|| {
12796                    fidl::new_empty!(
12797                        fidl::encoding::Endpoint<
12798                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12799                        >,
12800                        fidl::encoding::DefaultFuchsiaResourceDialect
12801                    )
12802                });
12803                fidl::decode!(
12804                    fidl::encoding::Endpoint<
12805                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12806                    >,
12807                    fidl::encoding::DefaultFuchsiaResourceDialect,
12808                    val_ref,
12809                    decoder,
12810                    inner_offset,
12811                    inner_depth
12812                )?;
12813                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12814                {
12815                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12816                }
12817                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12818                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12819                }
12820            }
12821
12822            next_offset += envelope_size;
12823            _next_ordinal_to_read += 1;
12824            if next_offset >= end_offset {
12825                return Ok(());
12826            }
12827
12828            // Decode unknown envelopes for gaps in ordinals.
12829            while _next_ordinal_to_read < 4 {
12830                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12831                _next_ordinal_to_read += 1;
12832                next_offset += envelope_size;
12833            }
12834
12835            let next_out_of_line = decoder.next_out_of_line();
12836            let handles_before = decoder.remaining_handles();
12837            if let Some((inlined, num_bytes, num_handles)) =
12838                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12839            {
12840                let member_inline_size = <fidl::encoding::Endpoint<
12841                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12842                > as fidl::encoding::TypeMarker>::inline_size(
12843                    decoder.context
12844                );
12845                if inlined != (member_inline_size <= 4) {
12846                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12847                }
12848                let inner_offset;
12849                let mut inner_depth = depth.clone();
12850                if inlined {
12851                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12852                    inner_offset = next_offset;
12853                } else {
12854                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12855                    inner_depth.increment()?;
12856                }
12857                let val_ref = self.dtb_overlay.get_or_insert_with(|| {
12858                    fidl::new_empty!(
12859                        fidl::encoding::Endpoint<
12860                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12861                        >,
12862                        fidl::encoding::DefaultFuchsiaResourceDialect
12863                    )
12864                });
12865                fidl::decode!(
12866                    fidl::encoding::Endpoint<
12867                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12868                    >,
12869                    fidl::encoding::DefaultFuchsiaResourceDialect,
12870                    val_ref,
12871                    decoder,
12872                    inner_offset,
12873                    inner_depth
12874                )?;
12875                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12876                {
12877                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12878                }
12879                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12880                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12881                }
12882            }
12883
12884            next_offset += envelope_size;
12885            _next_ordinal_to_read += 1;
12886            if next_offset >= end_offset {
12887                return Ok(());
12888            }
12889
12890            // Decode unknown envelopes for gaps in ordinals.
12891            while _next_ordinal_to_read < 5 {
12892                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12893                _next_ordinal_to_read += 1;
12894                next_offset += envelope_size;
12895            }
12896
12897            let next_out_of_line = decoder.next_out_of_line();
12898            let handles_before = decoder.remaining_handles();
12899            if let Some((inlined, num_bytes, num_handles)) =
12900                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12901            {
12902                let member_inline_size =
12903                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
12904                        decoder.context,
12905                    );
12906                if inlined != (member_inline_size <= 4) {
12907                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12908                }
12909                let inner_offset;
12910                let mut inner_depth = depth.clone();
12911                if inlined {
12912                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12913                    inner_offset = next_offset;
12914                } else {
12915                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12916                    inner_depth.increment()?;
12917                }
12918                let val_ref = self.cmdline.get_or_insert_with(|| {
12919                    fidl::new_empty!(
12920                        fidl::encoding::UnboundedString,
12921                        fidl::encoding::DefaultFuchsiaResourceDialect
12922                    )
12923                });
12924                fidl::decode!(
12925                    fidl::encoding::UnboundedString,
12926                    fidl::encoding::DefaultFuchsiaResourceDialect,
12927                    val_ref,
12928                    decoder,
12929                    inner_offset,
12930                    inner_depth
12931                )?;
12932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12933                {
12934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12935                }
12936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12938                }
12939            }
12940
12941            next_offset += envelope_size;
12942            _next_ordinal_to_read += 1;
12943            if next_offset >= end_offset {
12944                return Ok(());
12945            }
12946
12947            // Decode unknown envelopes for gaps in ordinals.
12948            while _next_ordinal_to_read < 6 {
12949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12950                _next_ordinal_to_read += 1;
12951                next_offset += envelope_size;
12952            }
12953
12954            let next_out_of_line = decoder.next_out_of_line();
12955            let handles_before = decoder.remaining_handles();
12956            if let Some((inlined, num_bytes, num_handles)) =
12957                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12958            {
12959                let member_inline_size = <fidl::encoding::UnboundedVector<
12960                    fidl::encoding::UnboundedString,
12961                > as fidl::encoding::TypeMarker>::inline_size(
12962                    decoder.context
12963                );
12964                if inlined != (member_inline_size <= 4) {
12965                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12966                }
12967                let inner_offset;
12968                let mut inner_depth = depth.clone();
12969                if inlined {
12970                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12971                    inner_offset = next_offset;
12972                } else {
12973                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12974                    inner_depth.increment()?;
12975                }
12976                let val_ref = self.cmdline_add.get_or_insert_with(|| {
12977                    fidl::new_empty!(
12978                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12979                        fidl::encoding::DefaultFuchsiaResourceDialect
12980                    )
12981                });
12982                fidl::decode!(
12983                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12984                    fidl::encoding::DefaultFuchsiaResourceDialect,
12985                    val_ref,
12986                    decoder,
12987                    inner_offset,
12988                    inner_depth
12989                )?;
12990                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12991                {
12992                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12993                }
12994                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12995                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12996                }
12997            }
12998
12999            next_offset += envelope_size;
13000            _next_ordinal_to_read += 1;
13001            if next_offset >= end_offset {
13002                return Ok(());
13003            }
13004
13005            // Decode unknown envelopes for gaps in ordinals.
13006            while _next_ordinal_to_read < 7 {
13007                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13008                _next_ordinal_to_read += 1;
13009                next_offset += envelope_size;
13010            }
13011
13012            let next_out_of_line = decoder.next_out_of_line();
13013            let handles_before = decoder.remaining_handles();
13014            if let Some((inlined, num_bytes, num_handles)) =
13015                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13016            {
13017                let member_inline_size =
13018                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13019                if inlined != (member_inline_size <= 4) {
13020                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13021                }
13022                let inner_offset;
13023                let mut inner_depth = depth.clone();
13024                if inlined {
13025                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13026                    inner_offset = next_offset;
13027                } else {
13028                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13029                    inner_depth.increment()?;
13030                }
13031                let val_ref = self.cpus.get_or_insert_with(|| {
13032                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
13033                });
13034                fidl::decode!(
13035                    u8,
13036                    fidl::encoding::DefaultFuchsiaResourceDialect,
13037                    val_ref,
13038                    decoder,
13039                    inner_offset,
13040                    inner_depth
13041                )?;
13042                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13043                {
13044                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13045                }
13046                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13047                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13048                }
13049            }
13050
13051            next_offset += envelope_size;
13052            _next_ordinal_to_read += 1;
13053            if next_offset >= end_offset {
13054                return Ok(());
13055            }
13056
13057            // Decode unknown envelopes for gaps in ordinals.
13058            while _next_ordinal_to_read < 8 {
13059                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13060                _next_ordinal_to_read += 1;
13061                next_offset += envelope_size;
13062            }
13063
13064            let next_out_of_line = decoder.next_out_of_line();
13065            let handles_before = decoder.remaining_handles();
13066            if let Some((inlined, num_bytes, num_handles)) =
13067                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13068            {
13069                let member_inline_size =
13070                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13071                if inlined != (member_inline_size <= 4) {
13072                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13073                }
13074                let inner_offset;
13075                let mut inner_depth = depth.clone();
13076                if inlined {
13077                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13078                    inner_offset = next_offset;
13079                } else {
13080                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13081                    inner_depth.increment()?;
13082                }
13083                let val_ref = self.guest_memory.get_or_insert_with(|| {
13084                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13085                });
13086                fidl::decode!(
13087                    u64,
13088                    fidl::encoding::DefaultFuchsiaResourceDialect,
13089                    val_ref,
13090                    decoder,
13091                    inner_offset,
13092                    inner_depth
13093                )?;
13094                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13095                {
13096                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13097                }
13098                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13099                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13100                }
13101            }
13102
13103            next_offset += envelope_size;
13104            _next_ordinal_to_read += 1;
13105            if next_offset >= end_offset {
13106                return Ok(());
13107            }
13108
13109            // Decode unknown envelopes for gaps in ordinals.
13110            while _next_ordinal_to_read < 9 {
13111                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13112                _next_ordinal_to_read += 1;
13113                next_offset += envelope_size;
13114            }
13115
13116            let next_out_of_line = decoder.next_out_of_line();
13117            let handles_before = decoder.remaining_handles();
13118            if let Some((inlined, num_bytes, num_handles)) =
13119                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13120            {
13121                let member_inline_size = <fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13122                if inlined != (member_inline_size <= 4) {
13123                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13124                }
13125                let inner_offset;
13126                let mut inner_depth = depth.clone();
13127                if inlined {
13128                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13129                    inner_offset = next_offset;
13130                } else {
13131                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13132                    inner_depth.increment()?;
13133                }
13134                let val_ref =
13135                self.block_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13136                fidl::decode!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13137                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13138                {
13139                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13140                }
13141                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13142                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13143                }
13144            }
13145
13146            next_offset += envelope_size;
13147            _next_ordinal_to_read += 1;
13148            if next_offset >= end_offset {
13149                return Ok(());
13150            }
13151
13152            // Decode unknown envelopes for gaps in ordinals.
13153            while _next_ordinal_to_read < 10 {
13154                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13155                _next_ordinal_to_read += 1;
13156                next_offset += envelope_size;
13157            }
13158
13159            let next_out_of_line = decoder.next_out_of_line();
13160            let handles_before = decoder.remaining_handles();
13161            if let Some((inlined, num_bytes, num_handles)) =
13162                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13163            {
13164                let member_inline_size = <fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13165                if inlined != (member_inline_size <= 4) {
13166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13167                }
13168                let inner_offset;
13169                let mut inner_depth = depth.clone();
13170                if inlined {
13171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13172                    inner_offset = next_offset;
13173                } else {
13174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13175                    inner_depth.increment()?;
13176                }
13177                let val_ref =
13178                self.net_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13179                fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13180                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13181                {
13182                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13183                }
13184                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13185                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13186                }
13187            }
13188
13189            next_offset += envelope_size;
13190            _next_ordinal_to_read += 1;
13191            if next_offset >= end_offset {
13192                return Ok(());
13193            }
13194
13195            // Decode unknown envelopes for gaps in ordinals.
13196            while _next_ordinal_to_read < 13 {
13197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13198                _next_ordinal_to_read += 1;
13199                next_offset += envelope_size;
13200            }
13201
13202            let next_out_of_line = decoder.next_out_of_line();
13203            let handles_before = decoder.remaining_handles();
13204            if let Some((inlined, num_bytes, num_handles)) =
13205                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13206            {
13207                let member_inline_size =
13208                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13209                if inlined != (member_inline_size <= 4) {
13210                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13211                }
13212                let inner_offset;
13213                let mut inner_depth = depth.clone();
13214                if inlined {
13215                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13216                    inner_offset = next_offset;
13217                } else {
13218                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13219                    inner_depth.increment()?;
13220                }
13221                let val_ref = self.default_net.get_or_insert_with(|| {
13222                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13223                });
13224                fidl::decode!(
13225                    bool,
13226                    fidl::encoding::DefaultFuchsiaResourceDialect,
13227                    val_ref,
13228                    decoder,
13229                    inner_offset,
13230                    inner_depth
13231                )?;
13232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13233                {
13234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13235                }
13236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13238                }
13239            }
13240
13241            next_offset += envelope_size;
13242            _next_ordinal_to_read += 1;
13243            if next_offset >= end_offset {
13244                return Ok(());
13245            }
13246
13247            // Decode unknown envelopes for gaps in ordinals.
13248            while _next_ordinal_to_read < 14 {
13249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13250                _next_ordinal_to_read += 1;
13251                next_offset += envelope_size;
13252            }
13253
13254            let next_out_of_line = decoder.next_out_of_line();
13255            let handles_before = decoder.remaining_handles();
13256            if let Some((inlined, num_bytes, num_handles)) =
13257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13258            {
13259                let member_inline_size =
13260                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13261                if inlined != (member_inline_size <= 4) {
13262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13263                }
13264                let inner_offset;
13265                let mut inner_depth = depth.clone();
13266                if inlined {
13267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13268                    inner_offset = next_offset;
13269                } else {
13270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13271                    inner_depth.increment()?;
13272                }
13273                let val_ref = self.virtio_balloon.get_or_insert_with(|| {
13274                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13275                });
13276                fidl::decode!(
13277                    bool,
13278                    fidl::encoding::DefaultFuchsiaResourceDialect,
13279                    val_ref,
13280                    decoder,
13281                    inner_offset,
13282                    inner_depth
13283                )?;
13284                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13285                {
13286                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13287                }
13288                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13289                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13290                }
13291            }
13292
13293            next_offset += envelope_size;
13294            _next_ordinal_to_read += 1;
13295            if next_offset >= end_offset {
13296                return Ok(());
13297            }
13298
13299            // Decode unknown envelopes for gaps in ordinals.
13300            while _next_ordinal_to_read < 15 {
13301                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13302                _next_ordinal_to_read += 1;
13303                next_offset += envelope_size;
13304            }
13305
13306            let next_out_of_line = decoder.next_out_of_line();
13307            let handles_before = decoder.remaining_handles();
13308            if let Some((inlined, num_bytes, num_handles)) =
13309                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13310            {
13311                let member_inline_size =
13312                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13313                if inlined != (member_inline_size <= 4) {
13314                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13315                }
13316                let inner_offset;
13317                let mut inner_depth = depth.clone();
13318                if inlined {
13319                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13320                    inner_offset = next_offset;
13321                } else {
13322                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13323                    inner_depth.increment()?;
13324                }
13325                let val_ref = self.virtio_console.get_or_insert_with(|| {
13326                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13327                });
13328                fidl::decode!(
13329                    bool,
13330                    fidl::encoding::DefaultFuchsiaResourceDialect,
13331                    val_ref,
13332                    decoder,
13333                    inner_offset,
13334                    inner_depth
13335                )?;
13336                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13337                {
13338                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13339                }
13340                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13341                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13342                }
13343            }
13344
13345            next_offset += envelope_size;
13346            _next_ordinal_to_read += 1;
13347            if next_offset >= end_offset {
13348                return Ok(());
13349            }
13350
13351            // Decode unknown envelopes for gaps in ordinals.
13352            while _next_ordinal_to_read < 16 {
13353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13354                _next_ordinal_to_read += 1;
13355                next_offset += envelope_size;
13356            }
13357
13358            let next_out_of_line = decoder.next_out_of_line();
13359            let handles_before = decoder.remaining_handles();
13360            if let Some((inlined, num_bytes, num_handles)) =
13361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13362            {
13363                let member_inline_size =
13364                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13365                if inlined != (member_inline_size <= 4) {
13366                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13367                }
13368                let inner_offset;
13369                let mut inner_depth = depth.clone();
13370                if inlined {
13371                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13372                    inner_offset = next_offset;
13373                } else {
13374                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13375                    inner_depth.increment()?;
13376                }
13377                let val_ref = self.virtio_gpu.get_or_insert_with(|| {
13378                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13379                });
13380                fidl::decode!(
13381                    bool,
13382                    fidl::encoding::DefaultFuchsiaResourceDialect,
13383                    val_ref,
13384                    decoder,
13385                    inner_offset,
13386                    inner_depth
13387                )?;
13388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13389                {
13390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13391                }
13392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13394                }
13395            }
13396
13397            next_offset += envelope_size;
13398            _next_ordinal_to_read += 1;
13399            if next_offset >= end_offset {
13400                return Ok(());
13401            }
13402
13403            // Decode unknown envelopes for gaps in ordinals.
13404            while _next_ordinal_to_read < 17 {
13405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13406                _next_ordinal_to_read += 1;
13407                next_offset += envelope_size;
13408            }
13409
13410            let next_out_of_line = decoder.next_out_of_line();
13411            let handles_before = decoder.remaining_handles();
13412            if let Some((inlined, num_bytes, num_handles)) =
13413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13414            {
13415                let member_inline_size =
13416                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13417                if inlined != (member_inline_size <= 4) {
13418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13419                }
13420                let inner_offset;
13421                let mut inner_depth = depth.clone();
13422                if inlined {
13423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13424                    inner_offset = next_offset;
13425                } else {
13426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13427                    inner_depth.increment()?;
13428                }
13429                let val_ref = self.virtio_rng.get_or_insert_with(|| {
13430                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13431                });
13432                fidl::decode!(
13433                    bool,
13434                    fidl::encoding::DefaultFuchsiaResourceDialect,
13435                    val_ref,
13436                    decoder,
13437                    inner_offset,
13438                    inner_depth
13439                )?;
13440                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13441                {
13442                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13443                }
13444                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13445                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13446                }
13447            }
13448
13449            next_offset += envelope_size;
13450            _next_ordinal_to_read += 1;
13451            if next_offset >= end_offset {
13452                return Ok(());
13453            }
13454
13455            // Decode unknown envelopes for gaps in ordinals.
13456            while _next_ordinal_to_read < 18 {
13457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13458                _next_ordinal_to_read += 1;
13459                next_offset += envelope_size;
13460            }
13461
13462            let next_out_of_line = decoder.next_out_of_line();
13463            let handles_before = decoder.remaining_handles();
13464            if let Some((inlined, num_bytes, num_handles)) =
13465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13466            {
13467                let member_inline_size =
13468                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13469                if inlined != (member_inline_size <= 4) {
13470                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13471                }
13472                let inner_offset;
13473                let mut inner_depth = depth.clone();
13474                if inlined {
13475                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13476                    inner_offset = next_offset;
13477                } else {
13478                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13479                    inner_depth.increment()?;
13480                }
13481                let val_ref = self.virtio_vsock.get_or_insert_with(|| {
13482                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13483                });
13484                fidl::decode!(
13485                    bool,
13486                    fidl::encoding::DefaultFuchsiaResourceDialect,
13487                    val_ref,
13488                    decoder,
13489                    inner_offset,
13490                    inner_depth
13491                )?;
13492                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13493                {
13494                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13495                }
13496                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13497                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13498                }
13499            }
13500
13501            next_offset += envelope_size;
13502            _next_ordinal_to_read += 1;
13503            if next_offset >= end_offset {
13504                return Ok(());
13505            }
13506
13507            // Decode unknown envelopes for gaps in ordinals.
13508            while _next_ordinal_to_read < 19 {
13509                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13510                _next_ordinal_to_read += 1;
13511                next_offset += envelope_size;
13512            }
13513
13514            let next_out_of_line = decoder.next_out_of_line();
13515            let handles_before = decoder.remaining_handles();
13516            if let Some((inlined, num_bytes, num_handles)) =
13517                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13518            {
13519                let member_inline_size =
13520                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13521                if inlined != (member_inline_size <= 4) {
13522                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13523                }
13524                let inner_offset;
13525                let mut inner_depth = depth.clone();
13526                if inlined {
13527                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13528                    inner_offset = next_offset;
13529                } else {
13530                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13531                    inner_depth.increment()?;
13532                }
13533                let val_ref = self.virtio_sound.get_or_insert_with(|| {
13534                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13535                });
13536                fidl::decode!(
13537                    bool,
13538                    fidl::encoding::DefaultFuchsiaResourceDialect,
13539                    val_ref,
13540                    decoder,
13541                    inner_offset,
13542                    inner_depth
13543                )?;
13544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13545                {
13546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13547                }
13548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13550                }
13551            }
13552
13553            next_offset += envelope_size;
13554            _next_ordinal_to_read += 1;
13555            if next_offset >= end_offset {
13556                return Ok(());
13557            }
13558
13559            // Decode unknown envelopes for gaps in ordinals.
13560            while _next_ordinal_to_read < 20 {
13561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13562                _next_ordinal_to_read += 1;
13563                next_offset += envelope_size;
13564            }
13565
13566            let next_out_of_line = decoder.next_out_of_line();
13567            let handles_before = decoder.remaining_handles();
13568            if let Some((inlined, num_bytes, num_handles)) =
13569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13570            {
13571                let member_inline_size =
13572                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13573                if inlined != (member_inline_size <= 4) {
13574                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13575                }
13576                let inner_offset;
13577                let mut inner_depth = depth.clone();
13578                if inlined {
13579                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13580                    inner_offset = next_offset;
13581                } else {
13582                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13583                    inner_depth.increment()?;
13584                }
13585                let val_ref = self.virtio_sound_input.get_or_insert_with(|| {
13586                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13587                });
13588                fidl::decode!(
13589                    bool,
13590                    fidl::encoding::DefaultFuchsiaResourceDialect,
13591                    val_ref,
13592                    decoder,
13593                    inner_offset,
13594                    inner_depth
13595                )?;
13596                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13597                {
13598                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13599                }
13600                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13601                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13602                }
13603            }
13604
13605            next_offset += envelope_size;
13606            _next_ordinal_to_read += 1;
13607            if next_offset >= end_offset {
13608                return Ok(());
13609            }
13610
13611            // Decode unknown envelopes for gaps in ordinals.
13612            while _next_ordinal_to_read < 21 {
13613                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13614                _next_ordinal_to_read += 1;
13615                next_offset += envelope_size;
13616            }
13617
13618            let next_out_of_line = decoder.next_out_of_line();
13619            let handles_before = decoder.remaining_handles();
13620            if let Some((inlined, num_bytes, num_handles)) =
13621                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13622            {
13623                let member_inline_size = <fidl::encoding::UnboundedVector<Listener> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13624                if inlined != (member_inline_size <= 4) {
13625                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13626                }
13627                let inner_offset;
13628                let mut inner_depth = depth.clone();
13629                if inlined {
13630                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13631                    inner_offset = next_offset;
13632                } else {
13633                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13634                    inner_depth.increment()?;
13635                }
13636                let val_ref = self.vsock_listeners.get_or_insert_with(|| {
13637                    fidl::new_empty!(
13638                        fidl::encoding::UnboundedVector<Listener>,
13639                        fidl::encoding::DefaultFuchsiaResourceDialect
13640                    )
13641                });
13642                fidl::decode!(
13643                    fidl::encoding::UnboundedVector<Listener>,
13644                    fidl::encoding::DefaultFuchsiaResourceDialect,
13645                    val_ref,
13646                    decoder,
13647                    inner_offset,
13648                    inner_depth
13649                )?;
13650                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13651                {
13652                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13653                }
13654                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13655                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13656                }
13657            }
13658
13659            next_offset += envelope_size;
13660            _next_ordinal_to_read += 1;
13661            if next_offset >= end_offset {
13662                return Ok(());
13663            }
13664
13665            // Decode unknown envelopes for gaps in ordinals.
13666            while _next_ordinal_to_read < 22 {
13667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13668                _next_ordinal_to_read += 1;
13669                next_offset += envelope_size;
13670            }
13671
13672            let next_out_of_line = decoder.next_out_of_line();
13673            let handles_before = decoder.remaining_handles();
13674            if let Some((inlined, num_bytes, num_handles)) =
13675                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13676            {
13677                let member_inline_size =
13678                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13679                if inlined != (member_inline_size <= 4) {
13680                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13681                }
13682                let inner_offset;
13683                let mut inner_depth = depth.clone();
13684                if inlined {
13685                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13686                    inner_offset = next_offset;
13687                } else {
13688                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13689                    inner_depth.increment()?;
13690                }
13691                let val_ref = self.virtio_mem.get_or_insert_with(|| {
13692                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13693                });
13694                fidl::decode!(
13695                    bool,
13696                    fidl::encoding::DefaultFuchsiaResourceDialect,
13697                    val_ref,
13698                    decoder,
13699                    inner_offset,
13700                    inner_depth
13701                )?;
13702                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13703                {
13704                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13705                }
13706                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13707                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13708                }
13709            }
13710
13711            next_offset += envelope_size;
13712            _next_ordinal_to_read += 1;
13713            if next_offset >= end_offset {
13714                return Ok(());
13715            }
13716
13717            // Decode unknown envelopes for gaps in ordinals.
13718            while _next_ordinal_to_read < 23 {
13719                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13720                _next_ordinal_to_read += 1;
13721                next_offset += envelope_size;
13722            }
13723
13724            let next_out_of_line = decoder.next_out_of_line();
13725            let handles_before = decoder.remaining_handles();
13726            if let Some((inlined, num_bytes, num_handles)) =
13727                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13728            {
13729                let member_inline_size =
13730                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13731                if inlined != (member_inline_size <= 4) {
13732                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13733                }
13734                let inner_offset;
13735                let mut inner_depth = depth.clone();
13736                if inlined {
13737                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13738                    inner_offset = next_offset;
13739                } else {
13740                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13741                    inner_depth.increment()?;
13742                }
13743                let val_ref = self.virtio_mem_block_size.get_or_insert_with(|| {
13744                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13745                });
13746                fidl::decode!(
13747                    u64,
13748                    fidl::encoding::DefaultFuchsiaResourceDialect,
13749                    val_ref,
13750                    decoder,
13751                    inner_offset,
13752                    inner_depth
13753                )?;
13754                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13755                {
13756                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13757                }
13758                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13759                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13760                }
13761            }
13762
13763            next_offset += envelope_size;
13764            _next_ordinal_to_read += 1;
13765            if next_offset >= end_offset {
13766                return Ok(());
13767            }
13768
13769            // Decode unknown envelopes for gaps in ordinals.
13770            while _next_ordinal_to_read < 24 {
13771                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13772                _next_ordinal_to_read += 1;
13773                next_offset += envelope_size;
13774            }
13775
13776            let next_out_of_line = decoder.next_out_of_line();
13777            let handles_before = decoder.remaining_handles();
13778            if let Some((inlined, num_bytes, num_handles)) =
13779                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13780            {
13781                let member_inline_size =
13782                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13783                if inlined != (member_inline_size <= 4) {
13784                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13785                }
13786                let inner_offset;
13787                let mut inner_depth = depth.clone();
13788                if inlined {
13789                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13790                    inner_offset = next_offset;
13791                } else {
13792                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13793                    inner_depth.increment()?;
13794                }
13795                let val_ref = self.virtio_mem_region_size.get_or_insert_with(|| {
13796                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13797                });
13798                fidl::decode!(
13799                    u64,
13800                    fidl::encoding::DefaultFuchsiaResourceDialect,
13801                    val_ref,
13802                    decoder,
13803                    inner_offset,
13804                    inner_depth
13805                )?;
13806                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13807                {
13808                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13809                }
13810                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13811                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13812                }
13813            }
13814
13815            next_offset += envelope_size;
13816            _next_ordinal_to_read += 1;
13817            if next_offset >= end_offset {
13818                return Ok(());
13819            }
13820
13821            // Decode unknown envelopes for gaps in ordinals.
13822            while _next_ordinal_to_read < 25 {
13823                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13824                _next_ordinal_to_read += 1;
13825                next_offset += envelope_size;
13826            }
13827
13828            let next_out_of_line = decoder.next_out_of_line();
13829            let handles_before = decoder.remaining_handles();
13830            if let Some((inlined, num_bytes, num_handles)) =
13831                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13832            {
13833                let member_inline_size =
13834                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13835                if inlined != (member_inline_size <= 4) {
13836                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13837                }
13838                let inner_offset;
13839                let mut inner_depth = depth.clone();
13840                if inlined {
13841                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13842                    inner_offset = next_offset;
13843                } else {
13844                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13845                    inner_depth.increment()?;
13846                }
13847                let val_ref = self.virtio_mem_region_alignment.get_or_insert_with(|| {
13848                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13849                });
13850                fidl::decode!(
13851                    u64,
13852                    fidl::encoding::DefaultFuchsiaResourceDialect,
13853                    val_ref,
13854                    decoder,
13855                    inner_offset,
13856                    inner_depth
13857                )?;
13858                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13859                {
13860                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13861                }
13862                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13863                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13864                }
13865            }
13866
13867            next_offset += envelope_size;
13868
13869            // Decode the remaining unknown envelopes.
13870            while next_offset < end_offset {
13871                _next_ordinal_to_read += 1;
13872                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13873                next_offset += envelope_size;
13874            }
13875
13876            Ok(())
13877        }
13878    }
13879
13880    impl fidl::encoding::ResourceTypeMarker for BlockFormat {
13881        type Borrowed<'a> = &'a mut Self;
13882        fn take_or_borrow<'a>(
13883            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13884        ) -> Self::Borrowed<'a> {
13885            value
13886        }
13887    }
13888
13889    unsafe impl fidl::encoding::TypeMarker for BlockFormat {
13890        type Owned = Self;
13891
13892        #[inline(always)]
13893        fn inline_align(_context: fidl::encoding::Context) -> usize {
13894            8
13895        }
13896
13897        #[inline(always)]
13898        fn inline_size(_context: fidl::encoding::Context) -> usize {
13899            16
13900        }
13901    }
13902
13903    unsafe impl fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>
13904        for &mut BlockFormat
13905    {
13906        #[inline]
13907        unsafe fn encode(
13908            self,
13909            encoder: &mut fidl::encoding::Encoder<
13910                '_,
13911                fidl::encoding::DefaultFuchsiaResourceDialect,
13912            >,
13913            offset: usize,
13914            _depth: fidl::encoding::Depth,
13915        ) -> fidl::Result<()> {
13916            encoder.debug_check_bounds::<BlockFormat>(offset);
13917            encoder.write_num::<u64>(self.ordinal(), offset);
13918            match self {
13919                BlockFormat::File(ref mut val) => fidl::encoding::encode_in_envelope::<
13920                    fidl::encoding::Endpoint<
13921                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13922                    >,
13923                    fidl::encoding::DefaultFuchsiaResourceDialect,
13924                >(
13925                    <fidl::encoding::Endpoint<
13926                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13927                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13928                        val
13929                    ),
13930                    encoder,
13931                    offset + 8,
13932                    _depth,
13933                ),
13934                BlockFormat::Qcow(ref mut val) => fidl::encoding::encode_in_envelope::<
13935                    fidl::encoding::HandleType<
13936                        fidl::Channel,
13937                        { fidl::ObjectType::CHANNEL.into_raw() },
13938                        2147483648,
13939                    >,
13940                    fidl::encoding::DefaultFuchsiaResourceDialect,
13941                >(
13942                    <fidl::encoding::HandleType<
13943                        fidl::Channel,
13944                        { fidl::ObjectType::CHANNEL.into_raw() },
13945                        2147483648,
13946                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13947                        val
13948                    ),
13949                    encoder,
13950                    offset + 8,
13951                    _depth,
13952                ),
13953                BlockFormat::Block(ref mut val) => fidl::encoding::encode_in_envelope::<
13954                    fidl::encoding::Endpoint<
13955                        fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
13956                    >,
13957                    fidl::encoding::DefaultFuchsiaResourceDialect,
13958                >(
13959                    <fidl::encoding::Endpoint<
13960                        fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
13961                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13962                        val
13963                    ),
13964                    encoder,
13965                    offset + 8,
13966                    _depth,
13967                ),
13968            }
13969        }
13970    }
13971
13972    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {
13973        #[inline(always)]
13974        fn new_empty() -> Self {
13975            Self::File(fidl::new_empty!(
13976                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13977                fidl::encoding::DefaultFuchsiaResourceDialect
13978            ))
13979        }
13980
13981        #[inline]
13982        unsafe fn decode(
13983            &mut self,
13984            decoder: &mut fidl::encoding::Decoder<
13985                '_,
13986                fidl::encoding::DefaultFuchsiaResourceDialect,
13987            >,
13988            offset: usize,
13989            mut depth: fidl::encoding::Depth,
13990        ) -> fidl::Result<()> {
13991            decoder.debug_check_bounds::<Self>(offset);
13992            #[allow(unused_variables)]
13993            let next_out_of_line = decoder.next_out_of_line();
13994            let handles_before = decoder.remaining_handles();
13995            let (ordinal, inlined, num_bytes, num_handles) =
13996                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13997
13998            let member_inline_size = match ordinal {
13999                1 => <fidl::encoding::Endpoint<
14000                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14001                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14002                2 => <fidl::encoding::HandleType<
14003                    fidl::Channel,
14004                    { fidl::ObjectType::CHANNEL.into_raw() },
14005                    2147483648,
14006                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14007                3 => <fidl::encoding::Endpoint<
14008                    fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
14009                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14010                _ => return Err(fidl::Error::UnknownUnionTag),
14011            };
14012
14013            if inlined != (member_inline_size <= 4) {
14014                return Err(fidl::Error::InvalidInlineBitInEnvelope);
14015            }
14016            let _inner_offset;
14017            if inlined {
14018                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
14019                _inner_offset = offset + 8;
14020            } else {
14021                depth.increment()?;
14022                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14023            }
14024            match ordinal {
14025                1 => {
14026                    #[allow(irrefutable_let_patterns)]
14027                    if let BlockFormat::File(_) = self {
14028                        // Do nothing, read the value into the object
14029                    } else {
14030                        // Initialize `self` to the right variant
14031                        *self = BlockFormat::File(fidl::new_empty!(
14032                            fidl::encoding::Endpoint<
14033                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14034                            >,
14035                            fidl::encoding::DefaultFuchsiaResourceDialect
14036                        ));
14037                    }
14038                    #[allow(irrefutable_let_patterns)]
14039                    if let BlockFormat::File(ref mut val) = self {
14040                        fidl::decode!(
14041                            fidl::encoding::Endpoint<
14042                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14043                            >,
14044                            fidl::encoding::DefaultFuchsiaResourceDialect,
14045                            val,
14046                            decoder,
14047                            _inner_offset,
14048                            depth
14049                        )?;
14050                    } else {
14051                        unreachable!()
14052                    }
14053                }
14054                2 => {
14055                    #[allow(irrefutable_let_patterns)]
14056                    if let BlockFormat::Qcow(_) = self {
14057                        // Do nothing, read the value into the object
14058                    } else {
14059                        // Initialize `self` to the right variant
14060                        *self = BlockFormat::Qcow(
14061                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14062                        );
14063                    }
14064                    #[allow(irrefutable_let_patterns)]
14065                    if let BlockFormat::Qcow(ref mut val) = self {
14066                        fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
14067                    } else {
14068                        unreachable!()
14069                    }
14070                }
14071                3 => {
14072                    #[allow(irrefutable_let_patterns)]
14073                    if let BlockFormat::Block(_) = self {
14074                        // Do nothing, read the value into the object
14075                    } else {
14076                        // Initialize `self` to the right variant
14077                        *self = BlockFormat::Block(fidl::new_empty!(
14078                            fidl::encoding::Endpoint<
14079                                fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
14080                            >,
14081                            fidl::encoding::DefaultFuchsiaResourceDialect
14082                        ));
14083                    }
14084                    #[allow(irrefutable_let_patterns)]
14085                    if let BlockFormat::Block(ref mut val) = self {
14086                        fidl::decode!(
14087                            fidl::encoding::Endpoint<
14088                                fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
14089                            >,
14090                            fidl::encoding::DefaultFuchsiaResourceDialect,
14091                            val,
14092                            decoder,
14093                            _inner_offset,
14094                            depth
14095                        )?;
14096                    } else {
14097                        unreachable!()
14098                    }
14099                }
14100                ordinal => panic!("unexpected ordinal {:?}", ordinal),
14101            }
14102            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14103                return Err(fidl::Error::InvalidNumBytesInEnvelope);
14104            }
14105            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14106                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14107            }
14108            Ok(())
14109        }
14110    }
14111}