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        let protocol_name =
296            <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
297        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
298    }
299
300    pub fn into_channel(self) -> fidl::Channel {
301        self.client.into_channel()
302    }
303
304    /// Waits until an event arrives and returns it. It is safe for other
305    /// threads to make concurrent requests while waiting for an event.
306    pub fn wait_for_event(
307        &self,
308        deadline: zx::MonotonicInstant,
309    ) -> Result<AndroidGuestManagerEvent, fidl::Error> {
310        AndroidGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
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            >>(
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 =
344            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
345                (),
346                0x3ad9a012982f872d,
347                fidl::encoding::DynamicFlags::empty(),
348                ___deadline,
349            )?;
350        Ok(_response)
351    }
352
353    /// Connect to a currently running guest.
354    ///
355    /// Possible errors:
356    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
357    ///         has launched before attempting to reconnect.
358    pub fn r#connect(
359        &self,
360        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
361        ___deadline: zx::MonotonicInstant,
362    ) -> Result<GuestManagerConnectResult, fidl::Error> {
363        let _response =
364            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
365                fidl::encoding::EmptyStruct,
366                GuestManagerError,
367            >>(
368                (controller,),
369                0x4e489076e3bb15b4,
370                fidl::encoding::DynamicFlags::empty(),
371                ___deadline,
372            )?;
373        Ok(_response.map(|x| x))
374    }
375
376    /// Query guest info
377    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
378        let _response =
379            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
380                (),
381                0x76892614aea695dc,
382                fidl::encoding::DynamicFlags::empty(),
383                ___deadline,
384            )?;
385        Ok(_response.guest_info)
386    }
387}
388
389#[cfg(target_os = "fuchsia")]
390impl From<AndroidGuestManagerSynchronousProxy> for zx::NullableHandle {
391    fn from(value: AndroidGuestManagerSynchronousProxy) -> Self {
392        value.into_channel().into()
393    }
394}
395
396#[cfg(target_os = "fuchsia")]
397impl From<fidl::Channel> for AndroidGuestManagerSynchronousProxy {
398    fn from(value: fidl::Channel) -> Self {
399        Self::new(value)
400    }
401}
402
403#[cfg(target_os = "fuchsia")]
404impl fidl::endpoints::FromClient for AndroidGuestManagerSynchronousProxy {
405    type Protocol = AndroidGuestManagerMarker;
406
407    fn from_client(value: fidl::endpoints::ClientEnd<AndroidGuestManagerMarker>) -> Self {
408        Self::new(value.into_channel())
409    }
410}
411
412#[derive(Debug, Clone)]
413pub struct AndroidGuestManagerProxy {
414    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
415}
416
417impl fidl::endpoints::Proxy for AndroidGuestManagerProxy {
418    type Protocol = AndroidGuestManagerMarker;
419
420    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
421        Self::new(inner)
422    }
423
424    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
425        self.client.into_channel().map_err(|client| Self { client })
426    }
427
428    fn as_channel(&self) -> &::fidl::AsyncChannel {
429        self.client.as_channel()
430    }
431}
432
433impl AndroidGuestManagerProxy {
434    /// Create a new Proxy for fuchsia.virtualization/AndroidGuestManager.
435    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
436        let protocol_name =
437            <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
438        Self { client: fidl::client::Client::new(channel, protocol_name) }
439    }
440
441    /// Get a Stream of events from the remote end of the protocol.
442    ///
443    /// # Panics
444    ///
445    /// Panics if the event stream was already taken.
446    pub fn take_event_stream(&self) -> AndroidGuestManagerEventStream {
447        AndroidGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
448    }
449
450    /// Launch a new guest instance.
451    ///
452    /// Possible errors:
453    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
454    ///         problems detected by the guest manager.
455    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
456    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
457    ///         component logs for a more specific failure.
458    pub fn r#launch(
459        &self,
460        mut guest_config: GuestConfig,
461        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
462    ) -> fidl::client::QueryResponseFut<
463        GuestManagerLaunchResult,
464        fidl::encoding::DefaultFuchsiaResourceDialect,
465    > {
466        AndroidGuestManagerProxyInterface::r#launch(self, guest_config, controller)
467    }
468
469    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
470    /// be used to launch another guest.
471    pub fn r#force_shutdown(
472        &self,
473    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
474        AndroidGuestManagerProxyInterface::r#force_shutdown(self)
475    }
476
477    /// Connect to a currently running guest.
478    ///
479    /// Possible errors:
480    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
481    ///         has launched before attempting to reconnect.
482    pub fn r#connect(
483        &self,
484        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
485    ) -> fidl::client::QueryResponseFut<
486        GuestManagerConnectResult,
487        fidl::encoding::DefaultFuchsiaResourceDialect,
488    > {
489        AndroidGuestManagerProxyInterface::r#connect(self, controller)
490    }
491
492    /// Query guest info
493    pub fn r#get_info(
494        &self,
495    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
496    {
497        AndroidGuestManagerProxyInterface::r#get_info(self)
498    }
499}
500
501impl AndroidGuestManagerProxyInterface for AndroidGuestManagerProxy {
502    type LaunchResponseFut = fidl::client::QueryResponseFut<
503        GuestManagerLaunchResult,
504        fidl::encoding::DefaultFuchsiaResourceDialect,
505    >;
506    fn r#launch(
507        &self,
508        mut guest_config: GuestConfig,
509        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
510    ) -> Self::LaunchResponseFut {
511        fn _decode(
512            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
513        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
514            let _response = fidl::client::decode_transaction_body::<
515                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
516                fidl::encoding::DefaultFuchsiaResourceDialect,
517                0x394a2e29f750323e,
518            >(_buf?)?;
519            Ok(_response.map(|x| x))
520        }
521        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
522            (&mut guest_config, controller),
523            0x394a2e29f750323e,
524            fidl::encoding::DynamicFlags::empty(),
525            _decode,
526        )
527    }
528
529    type ForceShutdownResponseFut =
530        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
531    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
532        fn _decode(
533            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
534        ) -> Result<(), fidl::Error> {
535            let _response = fidl::client::decode_transaction_body::<
536                fidl::encoding::EmptyPayload,
537                fidl::encoding::DefaultFuchsiaResourceDialect,
538                0x3ad9a012982f872d,
539            >(_buf?)?;
540            Ok(_response)
541        }
542        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
543            (),
544            0x3ad9a012982f872d,
545            fidl::encoding::DynamicFlags::empty(),
546            _decode,
547        )
548    }
549
550    type ConnectResponseFut = fidl::client::QueryResponseFut<
551        GuestManagerConnectResult,
552        fidl::encoding::DefaultFuchsiaResourceDialect,
553    >;
554    fn r#connect(
555        &self,
556        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
557    ) -> Self::ConnectResponseFut {
558        fn _decode(
559            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
560        ) -> Result<GuestManagerConnectResult, fidl::Error> {
561            let _response = fidl::client::decode_transaction_body::<
562                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
563                fidl::encoding::DefaultFuchsiaResourceDialect,
564                0x4e489076e3bb15b4,
565            >(_buf?)?;
566            Ok(_response.map(|x| x))
567        }
568        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
569            (controller,),
570            0x4e489076e3bb15b4,
571            fidl::encoding::DynamicFlags::empty(),
572            _decode,
573        )
574    }
575
576    type GetInfoResponseFut =
577        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
578    fn r#get_info(&self) -> Self::GetInfoResponseFut {
579        fn _decode(
580            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
581        ) -> Result<GuestInfo, fidl::Error> {
582            let _response = fidl::client::decode_transaction_body::<
583                GuestManagerGetInfoResponse,
584                fidl::encoding::DefaultFuchsiaResourceDialect,
585                0x76892614aea695dc,
586            >(_buf?)?;
587            Ok(_response.guest_info)
588        }
589        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
590            (),
591            0x76892614aea695dc,
592            fidl::encoding::DynamicFlags::empty(),
593            _decode,
594        )
595    }
596}
597
598pub struct AndroidGuestManagerEventStream {
599    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
600}
601
602impl std::marker::Unpin for AndroidGuestManagerEventStream {}
603
604impl futures::stream::FusedStream for AndroidGuestManagerEventStream {
605    fn is_terminated(&self) -> bool {
606        self.event_receiver.is_terminated()
607    }
608}
609
610impl futures::Stream for AndroidGuestManagerEventStream {
611    type Item = Result<AndroidGuestManagerEvent, fidl::Error>;
612
613    fn poll_next(
614        mut self: std::pin::Pin<&mut Self>,
615        cx: &mut std::task::Context<'_>,
616    ) -> std::task::Poll<Option<Self::Item>> {
617        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
618            &mut self.event_receiver,
619            cx
620        )?) {
621            Some(buf) => std::task::Poll::Ready(Some(AndroidGuestManagerEvent::decode(buf))),
622            None => std::task::Poll::Ready(None),
623        }
624    }
625}
626
627#[derive(Debug)]
628pub enum AndroidGuestManagerEvent {}
629
630impl AndroidGuestManagerEvent {
631    /// Decodes a message buffer as a [`AndroidGuestManagerEvent`].
632    fn decode(
633        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
634    ) -> Result<AndroidGuestManagerEvent, fidl::Error> {
635        let (bytes, _handles) = buf.split_mut();
636        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
637        debug_assert_eq!(tx_header.tx_id, 0);
638        match tx_header.ordinal {
639            _ => Err(fidl::Error::UnknownOrdinal {
640                ordinal: tx_header.ordinal,
641                protocol_name:
642                    <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
643            }),
644        }
645    }
646}
647
648/// A Stream of incoming requests for fuchsia.virtualization/AndroidGuestManager.
649pub struct AndroidGuestManagerRequestStream {
650    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
651    is_terminated: bool,
652}
653
654impl std::marker::Unpin for AndroidGuestManagerRequestStream {}
655
656impl futures::stream::FusedStream for AndroidGuestManagerRequestStream {
657    fn is_terminated(&self) -> bool {
658        self.is_terminated
659    }
660}
661
662impl fidl::endpoints::RequestStream for AndroidGuestManagerRequestStream {
663    type Protocol = AndroidGuestManagerMarker;
664    type ControlHandle = AndroidGuestManagerControlHandle;
665
666    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
667        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
668    }
669
670    fn control_handle(&self) -> Self::ControlHandle {
671        AndroidGuestManagerControlHandle { inner: self.inner.clone() }
672    }
673
674    fn into_inner(
675        self,
676    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
677    {
678        (self.inner, self.is_terminated)
679    }
680
681    fn from_inner(
682        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
683        is_terminated: bool,
684    ) -> Self {
685        Self { inner, is_terminated }
686    }
687}
688
689impl futures::Stream for AndroidGuestManagerRequestStream {
690    type Item = Result<AndroidGuestManagerRequest, fidl::Error>;
691
692    fn poll_next(
693        mut self: std::pin::Pin<&mut Self>,
694        cx: &mut std::task::Context<'_>,
695    ) -> std::task::Poll<Option<Self::Item>> {
696        let this = &mut *self;
697        if this.inner.check_shutdown(cx) {
698            this.is_terminated = true;
699            return std::task::Poll::Ready(None);
700        }
701        if this.is_terminated {
702            panic!("polled AndroidGuestManagerRequestStream after completion");
703        }
704        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
705            |bytes, handles| {
706                match this.inner.channel().read_etc(cx, bytes, handles) {
707                    std::task::Poll::Ready(Ok(())) => {}
708                    std::task::Poll::Pending => return std::task::Poll::Pending,
709                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
710                        this.is_terminated = true;
711                        return std::task::Poll::Ready(None);
712                    }
713                    std::task::Poll::Ready(Err(e)) => {
714                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
715                            e.into(),
716                        ))));
717                    }
718                }
719
720                // A message has been received from the channel
721                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
722
723                std::task::Poll::Ready(Some(match header.ordinal {
724                0x394a2e29f750323e => {
725                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
726                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
727                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
728                    let control_handle = AndroidGuestManagerControlHandle {
729                        inner: this.inner.clone(),
730                    };
731                    Ok(AndroidGuestManagerRequest::Launch {guest_config: req.guest_config,
732controller: req.controller,
733
734                        responder: AndroidGuestManagerLaunchResponder {
735                            control_handle: std::mem::ManuallyDrop::new(control_handle),
736                            tx_id: header.tx_id,
737                        },
738                    })
739                }
740                0x3ad9a012982f872d => {
741                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
742                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
743                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
744                    let control_handle = AndroidGuestManagerControlHandle {
745                        inner: this.inner.clone(),
746                    };
747                    Ok(AndroidGuestManagerRequest::ForceShutdown {
748                        responder: AndroidGuestManagerForceShutdownResponder {
749                            control_handle: std::mem::ManuallyDrop::new(control_handle),
750                            tx_id: header.tx_id,
751                        },
752                    })
753                }
754                0x4e489076e3bb15b4 => {
755                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
756                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
757                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
758                    let control_handle = AndroidGuestManagerControlHandle {
759                        inner: this.inner.clone(),
760                    };
761                    Ok(AndroidGuestManagerRequest::Connect {controller: req.controller,
762
763                        responder: AndroidGuestManagerConnectResponder {
764                            control_handle: std::mem::ManuallyDrop::new(control_handle),
765                            tx_id: header.tx_id,
766                        },
767                    })
768                }
769                0x76892614aea695dc => {
770                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
771                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
772                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
773                    let control_handle = AndroidGuestManagerControlHandle {
774                        inner: this.inner.clone(),
775                    };
776                    Ok(AndroidGuestManagerRequest::GetInfo {
777                        responder: AndroidGuestManagerGetInfoResponder {
778                            control_handle: std::mem::ManuallyDrop::new(control_handle),
779                            tx_id: header.tx_id,
780                        },
781                    })
782                }
783                _ => Err(fidl::Error::UnknownOrdinal {
784                    ordinal: header.ordinal,
785                    protocol_name: <AndroidGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
786                }),
787            }))
788            },
789        )
790    }
791}
792
793#[derive(Debug)]
794pub enum AndroidGuestManagerRequest {
795    /// Launch a new guest instance.
796    ///
797    /// Possible errors:
798    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
799    ///         problems detected by the guest manager.
800    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
801    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
802    ///         component logs for a more specific failure.
803    Launch {
804        guest_config: GuestConfig,
805        controller: fidl::endpoints::ServerEnd<GuestMarker>,
806        responder: AndroidGuestManagerLaunchResponder,
807    },
808    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
809    /// be used to launch another guest.
810    ForceShutdown { responder: AndroidGuestManagerForceShutdownResponder },
811    /// Connect to a currently running guest.
812    ///
813    /// Possible errors:
814    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
815    ///         has launched before attempting to reconnect.
816    Connect {
817        controller: fidl::endpoints::ServerEnd<GuestMarker>,
818        responder: AndroidGuestManagerConnectResponder,
819    },
820    /// Query guest info
821    GetInfo { responder: AndroidGuestManagerGetInfoResponder },
822}
823
824impl AndroidGuestManagerRequest {
825    #[allow(irrefutable_let_patterns)]
826    pub fn into_launch(
827        self,
828    ) -> Option<(
829        GuestConfig,
830        fidl::endpoints::ServerEnd<GuestMarker>,
831        AndroidGuestManagerLaunchResponder,
832    )> {
833        if let AndroidGuestManagerRequest::Launch { guest_config, controller, responder } = self {
834            Some((guest_config, controller, responder))
835        } else {
836            None
837        }
838    }
839
840    #[allow(irrefutable_let_patterns)]
841    pub fn into_force_shutdown(self) -> Option<(AndroidGuestManagerForceShutdownResponder)> {
842        if let AndroidGuestManagerRequest::ForceShutdown { responder } = self {
843            Some((responder))
844        } else {
845            None
846        }
847    }
848
849    #[allow(irrefutable_let_patterns)]
850    pub fn into_connect(
851        self,
852    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, AndroidGuestManagerConnectResponder)>
853    {
854        if let AndroidGuestManagerRequest::Connect { controller, responder } = self {
855            Some((controller, responder))
856        } else {
857            None
858        }
859    }
860
861    #[allow(irrefutable_let_patterns)]
862    pub fn into_get_info(self) -> Option<(AndroidGuestManagerGetInfoResponder)> {
863        if let AndroidGuestManagerRequest::GetInfo { responder } = self {
864            Some((responder))
865        } else {
866            None
867        }
868    }
869
870    /// Name of the method defined in FIDL
871    pub fn method_name(&self) -> &'static str {
872        match *self {
873            AndroidGuestManagerRequest::Launch { .. } => "launch",
874            AndroidGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
875            AndroidGuestManagerRequest::Connect { .. } => "connect",
876            AndroidGuestManagerRequest::GetInfo { .. } => "get_info",
877        }
878    }
879}
880
881#[derive(Debug, Clone)]
882pub struct AndroidGuestManagerControlHandle {
883    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
884}
885
886impl fidl::endpoints::ControlHandle for AndroidGuestManagerControlHandle {
887    fn shutdown(&self) {
888        self.inner.shutdown()
889    }
890
891    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
892        self.inner.shutdown_with_epitaph(status)
893    }
894
895    fn is_closed(&self) -> bool {
896        self.inner.channel().is_closed()
897    }
898    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
899        self.inner.channel().on_closed()
900    }
901
902    #[cfg(target_os = "fuchsia")]
903    fn signal_peer(
904        &self,
905        clear_mask: zx::Signals,
906        set_mask: zx::Signals,
907    ) -> Result<(), zx_status::Status> {
908        use fidl::Peered;
909        self.inner.channel().signal_peer(clear_mask, set_mask)
910    }
911}
912
913impl AndroidGuestManagerControlHandle {}
914
915#[must_use = "FIDL methods require a response to be sent"]
916#[derive(Debug)]
917pub struct AndroidGuestManagerLaunchResponder {
918    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
919    tx_id: u32,
920}
921
922/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
923/// if the responder is dropped without sending a response, so that the client
924/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
925impl std::ops::Drop for AndroidGuestManagerLaunchResponder {
926    fn drop(&mut self) {
927        self.control_handle.shutdown();
928        // Safety: drops once, never accessed again
929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
930    }
931}
932
933impl fidl::endpoints::Responder for AndroidGuestManagerLaunchResponder {
934    type ControlHandle = AndroidGuestManagerControlHandle;
935
936    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
937        &self.control_handle
938    }
939
940    fn drop_without_shutdown(mut self) {
941        // Safety: drops once, never accessed again due to mem::forget
942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
943        // Prevent Drop from running (which would shut down the channel)
944        std::mem::forget(self);
945    }
946}
947
948impl AndroidGuestManagerLaunchResponder {
949    /// Sends a response to the FIDL transaction.
950    ///
951    /// Sets the channel to shutdown if an error occurs.
952    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
953        let _result = self.send_raw(result);
954        if _result.is_err() {
955            self.control_handle.shutdown();
956        }
957        self.drop_without_shutdown();
958        _result
959    }
960
961    /// Similar to "send" but does not shutdown the channel if an error occurs.
962    pub fn send_no_shutdown_on_err(
963        self,
964        mut result: Result<(), GuestManagerError>,
965    ) -> Result<(), fidl::Error> {
966        let _result = self.send_raw(result);
967        self.drop_without_shutdown();
968        _result
969    }
970
971    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
972        self.control_handle.inner.send::<fidl::encoding::ResultType<
973            fidl::encoding::EmptyStruct,
974            GuestManagerError,
975        >>(
976            result,
977            self.tx_id,
978            0x394a2e29f750323e,
979            fidl::encoding::DynamicFlags::empty(),
980        )
981    }
982}
983
984#[must_use = "FIDL methods require a response to be sent"]
985#[derive(Debug)]
986pub struct AndroidGuestManagerForceShutdownResponder {
987    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
988    tx_id: u32,
989}
990
991/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
992/// if the responder is dropped without sending a response, so that the client
993/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
994impl std::ops::Drop for AndroidGuestManagerForceShutdownResponder {
995    fn drop(&mut self) {
996        self.control_handle.shutdown();
997        // Safety: drops once, never accessed again
998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999    }
1000}
1001
1002impl fidl::endpoints::Responder for AndroidGuestManagerForceShutdownResponder {
1003    type ControlHandle = AndroidGuestManagerControlHandle;
1004
1005    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1006        &self.control_handle
1007    }
1008
1009    fn drop_without_shutdown(mut self) {
1010        // Safety: drops once, never accessed again due to mem::forget
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012        // Prevent Drop from running (which would shut down the channel)
1013        std::mem::forget(self);
1014    }
1015}
1016
1017impl AndroidGuestManagerForceShutdownResponder {
1018    /// Sends a response to the FIDL transaction.
1019    ///
1020    /// Sets the channel to shutdown if an error occurs.
1021    pub fn send(self) -> Result<(), fidl::Error> {
1022        let _result = self.send_raw();
1023        if _result.is_err() {
1024            self.control_handle.shutdown();
1025        }
1026        self.drop_without_shutdown();
1027        _result
1028    }
1029
1030    /// Similar to "send" but does not shutdown the channel if an error occurs.
1031    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1032        let _result = self.send_raw();
1033        self.drop_without_shutdown();
1034        _result
1035    }
1036
1037    fn send_raw(&self) -> Result<(), fidl::Error> {
1038        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1039            (),
1040            self.tx_id,
1041            0x3ad9a012982f872d,
1042            fidl::encoding::DynamicFlags::empty(),
1043        )
1044    }
1045}
1046
1047#[must_use = "FIDL methods require a response to be sent"]
1048#[derive(Debug)]
1049pub struct AndroidGuestManagerConnectResponder {
1050    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
1051    tx_id: u32,
1052}
1053
1054/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
1055/// if the responder is dropped without sending a response, so that the client
1056/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1057impl std::ops::Drop for AndroidGuestManagerConnectResponder {
1058    fn drop(&mut self) {
1059        self.control_handle.shutdown();
1060        // Safety: drops once, never accessed again
1061        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1062    }
1063}
1064
1065impl fidl::endpoints::Responder for AndroidGuestManagerConnectResponder {
1066    type ControlHandle = AndroidGuestManagerControlHandle;
1067
1068    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1069        &self.control_handle
1070    }
1071
1072    fn drop_without_shutdown(mut self) {
1073        // Safety: drops once, never accessed again due to mem::forget
1074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1075        // Prevent Drop from running (which would shut down the channel)
1076        std::mem::forget(self);
1077    }
1078}
1079
1080impl AndroidGuestManagerConnectResponder {
1081    /// Sends a response to the FIDL transaction.
1082    ///
1083    /// Sets the channel to shutdown if an error occurs.
1084    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1085        let _result = self.send_raw(result);
1086        if _result.is_err() {
1087            self.control_handle.shutdown();
1088        }
1089        self.drop_without_shutdown();
1090        _result
1091    }
1092
1093    /// Similar to "send" but does not shutdown the channel if an error occurs.
1094    pub fn send_no_shutdown_on_err(
1095        self,
1096        mut result: Result<(), GuestManagerError>,
1097    ) -> Result<(), fidl::Error> {
1098        let _result = self.send_raw(result);
1099        self.drop_without_shutdown();
1100        _result
1101    }
1102
1103    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1104        self.control_handle.inner.send::<fidl::encoding::ResultType<
1105            fidl::encoding::EmptyStruct,
1106            GuestManagerError,
1107        >>(
1108            result,
1109            self.tx_id,
1110            0x4e489076e3bb15b4,
1111            fidl::encoding::DynamicFlags::empty(),
1112        )
1113    }
1114}
1115
1116#[must_use = "FIDL methods require a response to be sent"]
1117#[derive(Debug)]
1118pub struct AndroidGuestManagerGetInfoResponder {
1119    control_handle: std::mem::ManuallyDrop<AndroidGuestManagerControlHandle>,
1120    tx_id: u32,
1121}
1122
1123/// Set the the channel to be shutdown (see [`AndroidGuestManagerControlHandle::shutdown`])
1124/// if the responder is dropped without sending a response, so that the client
1125/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1126impl std::ops::Drop for AndroidGuestManagerGetInfoResponder {
1127    fn drop(&mut self) {
1128        self.control_handle.shutdown();
1129        // Safety: drops once, never accessed again
1130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1131    }
1132}
1133
1134impl fidl::endpoints::Responder for AndroidGuestManagerGetInfoResponder {
1135    type ControlHandle = AndroidGuestManagerControlHandle;
1136
1137    fn control_handle(&self) -> &AndroidGuestManagerControlHandle {
1138        &self.control_handle
1139    }
1140
1141    fn drop_without_shutdown(mut self) {
1142        // Safety: drops once, never accessed again due to mem::forget
1143        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1144        // Prevent Drop from running (which would shut down the channel)
1145        std::mem::forget(self);
1146    }
1147}
1148
1149impl AndroidGuestManagerGetInfoResponder {
1150    /// Sends a response to the FIDL transaction.
1151    ///
1152    /// Sets the channel to shutdown if an error occurs.
1153    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1154        let _result = self.send_raw(guest_info);
1155        if _result.is_err() {
1156            self.control_handle.shutdown();
1157        }
1158        self.drop_without_shutdown();
1159        _result
1160    }
1161
1162    /// Similar to "send" but does not shutdown the channel if an error occurs.
1163    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1164        let _result = self.send_raw(guest_info);
1165        self.drop_without_shutdown();
1166        _result
1167    }
1168
1169    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1170        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
1171            (guest_info,),
1172            self.tx_id,
1173            0x76892614aea695dc,
1174            fidl::encoding::DynamicFlags::empty(),
1175        )
1176    }
1177}
1178
1179#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1180pub struct BalloonControllerMarker;
1181
1182impl fidl::endpoints::ProtocolMarker for BalloonControllerMarker {
1183    type Proxy = BalloonControllerProxy;
1184    type RequestStream = BalloonControllerRequestStream;
1185    #[cfg(target_os = "fuchsia")]
1186    type SynchronousProxy = BalloonControllerSynchronousProxy;
1187
1188    const DEBUG_NAME: &'static str = "fuchsia.virtualization.BalloonController";
1189}
1190impl fidl::endpoints::DiscoverableProtocolMarker for BalloonControllerMarker {}
1191
1192pub trait BalloonControllerProxyInterface: Send + Sync {
1193    type GetBalloonSizeResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>>
1194        + Send;
1195    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut;
1196    fn r#request_num_pages(&self, requested_num_pages: u32) -> Result<(), fidl::Error>;
1197    type GetMemStatsResponseFut: std::future::Future<Output = Result<(i32, Option<Vec<MemStat>>), fidl::Error>>
1198        + Send;
1199    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
1200}
1201#[derive(Debug)]
1202#[cfg(target_os = "fuchsia")]
1203pub struct BalloonControllerSynchronousProxy {
1204    client: fidl::client::sync::Client,
1205}
1206
1207#[cfg(target_os = "fuchsia")]
1208impl fidl::endpoints::SynchronousProxy for BalloonControllerSynchronousProxy {
1209    type Proxy = BalloonControllerProxy;
1210    type Protocol = BalloonControllerMarker;
1211
1212    fn from_channel(inner: fidl::Channel) -> Self {
1213        Self::new(inner)
1214    }
1215
1216    fn into_channel(self) -> fidl::Channel {
1217        self.client.into_channel()
1218    }
1219
1220    fn as_channel(&self) -> &fidl::Channel {
1221        self.client.as_channel()
1222    }
1223}
1224
1225#[cfg(target_os = "fuchsia")]
1226impl BalloonControllerSynchronousProxy {
1227    pub fn new(channel: fidl::Channel) -> Self {
1228        let protocol_name =
1229            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1230        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1231    }
1232
1233    pub fn into_channel(self) -> fidl::Channel {
1234        self.client.into_channel()
1235    }
1236
1237    /// Waits until an event arrives and returns it. It is safe for other
1238    /// threads to make concurrent requests while waiting for an event.
1239    pub fn wait_for_event(
1240        &self,
1241        deadline: zx::MonotonicInstant,
1242    ) -> Result<BalloonControllerEvent, fidl::Error> {
1243        BalloonControllerEvent::decode(self.client.wait_for_event(deadline)?)
1244    }
1245
1246    /// Get the current and requested number of pages in the memory balloon.
1247    ///
1248    /// current_num_pages is the number of pages balloon has right now.
1249    /// requested_num_pages is the desired number of pages in the balloon.
1250    ///
1251    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1252    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1253    pub fn r#get_balloon_size(
1254        &self,
1255        ___deadline: zx::MonotonicInstant,
1256    ) -> Result<(u32, u32), fidl::Error> {
1257        let _response = self
1258            .client
1259            .send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetBalloonSizeResponse>(
1260                (),
1261                0x2bb2ebaa6ff64d0b,
1262                fidl::encoding::DynamicFlags::empty(),
1263                ___deadline,
1264            )?;
1265        Ok((_response.current_num_pages, _response.requested_num_pages))
1266    }
1267
1268    /// Request a number of pages to be supplied to the memory balloon.
1269    ///
1270    /// If `requested_num_pages` is greater than the `current_num_pages` config
1271    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1272    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1273    /// the guest driver MAY reclaim pages from the memory balloon.
1274    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1275        self.client.send::<BalloonControllerRequestNumPagesRequest>(
1276            (requested_num_pages,),
1277            0x55c444d65e1df1e8,
1278            fidl::encoding::DynamicFlags::empty(),
1279        )
1280    }
1281
1282    /// Get memory statistics of the guest instance.
1283    pub fn r#get_mem_stats(
1284        &self,
1285        ___deadline: zx::MonotonicInstant,
1286    ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
1287        let _response = self
1288            .client
1289            .send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetMemStatsResponse>(
1290                (),
1291                0x676199795cc01142,
1292                fidl::encoding::DynamicFlags::empty(),
1293                ___deadline,
1294            )?;
1295        Ok((_response.status, _response.mem_stats))
1296    }
1297}
1298
1299#[cfg(target_os = "fuchsia")]
1300impl From<BalloonControllerSynchronousProxy> for zx::NullableHandle {
1301    fn from(value: BalloonControllerSynchronousProxy) -> Self {
1302        value.into_channel().into()
1303    }
1304}
1305
1306#[cfg(target_os = "fuchsia")]
1307impl From<fidl::Channel> for BalloonControllerSynchronousProxy {
1308    fn from(value: fidl::Channel) -> Self {
1309        Self::new(value)
1310    }
1311}
1312
1313#[cfg(target_os = "fuchsia")]
1314impl fidl::endpoints::FromClient for BalloonControllerSynchronousProxy {
1315    type Protocol = BalloonControllerMarker;
1316
1317    fn from_client(value: fidl::endpoints::ClientEnd<BalloonControllerMarker>) -> Self {
1318        Self::new(value.into_channel())
1319    }
1320}
1321
1322#[derive(Debug, Clone)]
1323pub struct BalloonControllerProxy {
1324    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1325}
1326
1327impl fidl::endpoints::Proxy for BalloonControllerProxy {
1328    type Protocol = BalloonControllerMarker;
1329
1330    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1331        Self::new(inner)
1332    }
1333
1334    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1335        self.client.into_channel().map_err(|client| Self { client })
1336    }
1337
1338    fn as_channel(&self) -> &::fidl::AsyncChannel {
1339        self.client.as_channel()
1340    }
1341}
1342
1343impl BalloonControllerProxy {
1344    /// Create a new Proxy for fuchsia.virtualization/BalloonController.
1345    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1346        let protocol_name =
1347            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1348        Self { client: fidl::client::Client::new(channel, protocol_name) }
1349    }
1350
1351    /// Get a Stream of events from the remote end of the protocol.
1352    ///
1353    /// # Panics
1354    ///
1355    /// Panics if the event stream was already taken.
1356    pub fn take_event_stream(&self) -> BalloonControllerEventStream {
1357        BalloonControllerEventStream { event_receiver: self.client.take_event_receiver() }
1358    }
1359
1360    /// Get the current and requested number of pages in the memory balloon.
1361    ///
1362    /// current_num_pages is the number of pages balloon has right now.
1363    /// requested_num_pages is the desired number of pages in the balloon.
1364    ///
1365    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1366    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1367    pub fn r#get_balloon_size(
1368        &self,
1369    ) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
1370    {
1371        BalloonControllerProxyInterface::r#get_balloon_size(self)
1372    }
1373
1374    /// Request a number of pages to be supplied to the memory balloon.
1375    ///
1376    /// If `requested_num_pages` is greater than the `current_num_pages` config
1377    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1378    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1379    /// the guest driver MAY reclaim pages from the memory balloon.
1380    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1381        BalloonControllerProxyInterface::r#request_num_pages(self, requested_num_pages)
1382    }
1383
1384    /// Get memory statistics of the guest instance.
1385    pub fn r#get_mem_stats(
1386        &self,
1387    ) -> fidl::client::QueryResponseFut<
1388        (i32, Option<Vec<MemStat>>),
1389        fidl::encoding::DefaultFuchsiaResourceDialect,
1390    > {
1391        BalloonControllerProxyInterface::r#get_mem_stats(self)
1392    }
1393}
1394
1395impl BalloonControllerProxyInterface for BalloonControllerProxy {
1396    type GetBalloonSizeResponseFut =
1397        fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
1398    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut {
1399        fn _decode(
1400            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1401        ) -> Result<(u32, u32), fidl::Error> {
1402            let _response = fidl::client::decode_transaction_body::<
1403                BalloonControllerGetBalloonSizeResponse,
1404                fidl::encoding::DefaultFuchsiaResourceDialect,
1405                0x2bb2ebaa6ff64d0b,
1406            >(_buf?)?;
1407            Ok((_response.current_num_pages, _response.requested_num_pages))
1408        }
1409        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, u32)>(
1410            (),
1411            0x2bb2ebaa6ff64d0b,
1412            fidl::encoding::DynamicFlags::empty(),
1413            _decode,
1414        )
1415    }
1416
1417    fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
1418        self.client.send::<BalloonControllerRequestNumPagesRequest>(
1419            (requested_num_pages,),
1420            0x55c444d65e1df1e8,
1421            fidl::encoding::DynamicFlags::empty(),
1422        )
1423    }
1424
1425    type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
1426        (i32, Option<Vec<MemStat>>),
1427        fidl::encoding::DefaultFuchsiaResourceDialect,
1428    >;
1429    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
1430        fn _decode(
1431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1432        ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
1433            let _response = fidl::client::decode_transaction_body::<
1434                BalloonControllerGetMemStatsResponse,
1435                fidl::encoding::DefaultFuchsiaResourceDialect,
1436                0x676199795cc01142,
1437            >(_buf?)?;
1438            Ok((_response.status, _response.mem_stats))
1439        }
1440        self.client
1441            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Vec<MemStat>>)>(
1442                (),
1443                0x676199795cc01142,
1444                fidl::encoding::DynamicFlags::empty(),
1445                _decode,
1446            )
1447    }
1448}
1449
1450pub struct BalloonControllerEventStream {
1451    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1452}
1453
1454impl std::marker::Unpin for BalloonControllerEventStream {}
1455
1456impl futures::stream::FusedStream for BalloonControllerEventStream {
1457    fn is_terminated(&self) -> bool {
1458        self.event_receiver.is_terminated()
1459    }
1460}
1461
1462impl futures::Stream for BalloonControllerEventStream {
1463    type Item = Result<BalloonControllerEvent, fidl::Error>;
1464
1465    fn poll_next(
1466        mut self: std::pin::Pin<&mut Self>,
1467        cx: &mut std::task::Context<'_>,
1468    ) -> std::task::Poll<Option<Self::Item>> {
1469        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1470            &mut self.event_receiver,
1471            cx
1472        )?) {
1473            Some(buf) => std::task::Poll::Ready(Some(BalloonControllerEvent::decode(buf))),
1474            None => std::task::Poll::Ready(None),
1475        }
1476    }
1477}
1478
1479#[derive(Debug)]
1480pub enum BalloonControllerEvent {}
1481
1482impl BalloonControllerEvent {
1483    /// Decodes a message buffer as a [`BalloonControllerEvent`].
1484    fn decode(
1485        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1486    ) -> Result<BalloonControllerEvent, fidl::Error> {
1487        let (bytes, _handles) = buf.split_mut();
1488        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1489        debug_assert_eq!(tx_header.tx_id, 0);
1490        match tx_header.ordinal {
1491            _ => Err(fidl::Error::UnknownOrdinal {
1492                ordinal: tx_header.ordinal,
1493                protocol_name:
1494                    <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1495            }),
1496        }
1497    }
1498}
1499
1500/// A Stream of incoming requests for fuchsia.virtualization/BalloonController.
1501pub struct BalloonControllerRequestStream {
1502    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1503    is_terminated: bool,
1504}
1505
1506impl std::marker::Unpin for BalloonControllerRequestStream {}
1507
1508impl futures::stream::FusedStream for BalloonControllerRequestStream {
1509    fn is_terminated(&self) -> bool {
1510        self.is_terminated
1511    }
1512}
1513
1514impl fidl::endpoints::RequestStream for BalloonControllerRequestStream {
1515    type Protocol = BalloonControllerMarker;
1516    type ControlHandle = BalloonControllerControlHandle;
1517
1518    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1519        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1520    }
1521
1522    fn control_handle(&self) -> Self::ControlHandle {
1523        BalloonControllerControlHandle { inner: self.inner.clone() }
1524    }
1525
1526    fn into_inner(
1527        self,
1528    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1529    {
1530        (self.inner, self.is_terminated)
1531    }
1532
1533    fn from_inner(
1534        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1535        is_terminated: bool,
1536    ) -> Self {
1537        Self { inner, is_terminated }
1538    }
1539}
1540
1541impl futures::Stream for BalloonControllerRequestStream {
1542    type Item = Result<BalloonControllerRequest, fidl::Error>;
1543
1544    fn poll_next(
1545        mut self: std::pin::Pin<&mut Self>,
1546        cx: &mut std::task::Context<'_>,
1547    ) -> std::task::Poll<Option<Self::Item>> {
1548        let this = &mut *self;
1549        if this.inner.check_shutdown(cx) {
1550            this.is_terminated = true;
1551            return std::task::Poll::Ready(None);
1552        }
1553        if this.is_terminated {
1554            panic!("polled BalloonControllerRequestStream after completion");
1555        }
1556        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1557            |bytes, handles| {
1558                match this.inner.channel().read_etc(cx, bytes, handles) {
1559                    std::task::Poll::Ready(Ok(())) => {}
1560                    std::task::Poll::Pending => return std::task::Poll::Pending,
1561                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1562                        this.is_terminated = true;
1563                        return std::task::Poll::Ready(None);
1564                    }
1565                    std::task::Poll::Ready(Err(e)) => {
1566                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1567                            e.into(),
1568                        ))));
1569                    }
1570                }
1571
1572                // A message has been received from the channel
1573                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1574
1575                std::task::Poll::Ready(Some(match header.ordinal {
1576                    0x2bb2ebaa6ff64d0b => {
1577                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1578                        let mut req = fidl::new_empty!(
1579                            fidl::encoding::EmptyPayload,
1580                            fidl::encoding::DefaultFuchsiaResourceDialect
1581                        );
1582                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1583                        let control_handle =
1584                            BalloonControllerControlHandle { inner: this.inner.clone() };
1585                        Ok(BalloonControllerRequest::GetBalloonSize {
1586                            responder: BalloonControllerGetBalloonSizeResponder {
1587                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1588                                tx_id: header.tx_id,
1589                            },
1590                        })
1591                    }
1592                    0x55c444d65e1df1e8 => {
1593                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1594                        let mut req = fidl::new_empty!(
1595                            BalloonControllerRequestNumPagesRequest,
1596                            fidl::encoding::DefaultFuchsiaResourceDialect
1597                        );
1598                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BalloonControllerRequestNumPagesRequest>(&header, _body_bytes, handles, &mut req)?;
1599                        let control_handle =
1600                            BalloonControllerControlHandle { inner: this.inner.clone() };
1601                        Ok(BalloonControllerRequest::RequestNumPages {
1602                            requested_num_pages: req.requested_num_pages,
1603
1604                            control_handle,
1605                        })
1606                    }
1607                    0x676199795cc01142 => {
1608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1609                        let mut req = fidl::new_empty!(
1610                            fidl::encoding::EmptyPayload,
1611                            fidl::encoding::DefaultFuchsiaResourceDialect
1612                        );
1613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1614                        let control_handle =
1615                            BalloonControllerControlHandle { inner: this.inner.clone() };
1616                        Ok(BalloonControllerRequest::GetMemStats {
1617                            responder: BalloonControllerGetMemStatsResponder {
1618                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1619                                tx_id: header.tx_id,
1620                            },
1621                        })
1622                    }
1623                    _ => Err(fidl::Error::UnknownOrdinal {
1624                        ordinal: header.ordinal,
1625                        protocol_name:
1626                            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1627                    }),
1628                }))
1629            },
1630        )
1631    }
1632}
1633
1634/// A `BalloonController` controls a guest instance's memory balloon.
1635#[derive(Debug)]
1636pub enum BalloonControllerRequest {
1637    /// Get the current and requested number of pages in the memory balloon.
1638    ///
1639    /// current_num_pages is the number of pages balloon has right now.
1640    /// requested_num_pages is the desired number of pages in the balloon.
1641    ///
1642    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
1643    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
1644    GetBalloonSize { responder: BalloonControllerGetBalloonSizeResponder },
1645    /// Request a number of pages to be supplied to the memory balloon.
1646    ///
1647    /// If `requested_num_pages` is greater than the `current_num_pages` config
1648    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
1649    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
1650    /// the guest driver MAY reclaim pages from the memory balloon.
1651    RequestNumPages { requested_num_pages: u32, control_handle: BalloonControllerControlHandle },
1652    /// Get memory statistics of the guest instance.
1653    GetMemStats { responder: BalloonControllerGetMemStatsResponder },
1654}
1655
1656impl BalloonControllerRequest {
1657    #[allow(irrefutable_let_patterns)]
1658    pub fn into_get_balloon_size(self) -> Option<(BalloonControllerGetBalloonSizeResponder)> {
1659        if let BalloonControllerRequest::GetBalloonSize { responder } = self {
1660            Some((responder))
1661        } else {
1662            None
1663        }
1664    }
1665
1666    #[allow(irrefutable_let_patterns)]
1667    pub fn into_request_num_pages(self) -> Option<(u32, BalloonControllerControlHandle)> {
1668        if let BalloonControllerRequest::RequestNumPages { requested_num_pages, control_handle } =
1669            self
1670        {
1671            Some((requested_num_pages, control_handle))
1672        } else {
1673            None
1674        }
1675    }
1676
1677    #[allow(irrefutable_let_patterns)]
1678    pub fn into_get_mem_stats(self) -> Option<(BalloonControllerGetMemStatsResponder)> {
1679        if let BalloonControllerRequest::GetMemStats { responder } = self {
1680            Some((responder))
1681        } else {
1682            None
1683        }
1684    }
1685
1686    /// Name of the method defined in FIDL
1687    pub fn method_name(&self) -> &'static str {
1688        match *self {
1689            BalloonControllerRequest::GetBalloonSize { .. } => "get_balloon_size",
1690            BalloonControllerRequest::RequestNumPages { .. } => "request_num_pages",
1691            BalloonControllerRequest::GetMemStats { .. } => "get_mem_stats",
1692        }
1693    }
1694}
1695
1696#[derive(Debug, Clone)]
1697pub struct BalloonControllerControlHandle {
1698    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1699}
1700
1701impl fidl::endpoints::ControlHandle for BalloonControllerControlHandle {
1702    fn shutdown(&self) {
1703        self.inner.shutdown()
1704    }
1705
1706    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1707        self.inner.shutdown_with_epitaph(status)
1708    }
1709
1710    fn is_closed(&self) -> bool {
1711        self.inner.channel().is_closed()
1712    }
1713    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1714        self.inner.channel().on_closed()
1715    }
1716
1717    #[cfg(target_os = "fuchsia")]
1718    fn signal_peer(
1719        &self,
1720        clear_mask: zx::Signals,
1721        set_mask: zx::Signals,
1722    ) -> Result<(), zx_status::Status> {
1723        use fidl::Peered;
1724        self.inner.channel().signal_peer(clear_mask, set_mask)
1725    }
1726}
1727
1728impl BalloonControllerControlHandle {}
1729
1730#[must_use = "FIDL methods require a response to be sent"]
1731#[derive(Debug)]
1732pub struct BalloonControllerGetBalloonSizeResponder {
1733    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
1734    tx_id: u32,
1735}
1736
1737/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
1738/// if the responder is dropped without sending a response, so that the client
1739/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1740impl std::ops::Drop for BalloonControllerGetBalloonSizeResponder {
1741    fn drop(&mut self) {
1742        self.control_handle.shutdown();
1743        // Safety: drops once, never accessed again
1744        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1745    }
1746}
1747
1748impl fidl::endpoints::Responder for BalloonControllerGetBalloonSizeResponder {
1749    type ControlHandle = BalloonControllerControlHandle;
1750
1751    fn control_handle(&self) -> &BalloonControllerControlHandle {
1752        &self.control_handle
1753    }
1754
1755    fn drop_without_shutdown(mut self) {
1756        // Safety: drops once, never accessed again due to mem::forget
1757        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1758        // Prevent Drop from running (which would shut down the channel)
1759        std::mem::forget(self);
1760    }
1761}
1762
1763impl BalloonControllerGetBalloonSizeResponder {
1764    /// Sends a response to the FIDL transaction.
1765    ///
1766    /// Sets the channel to shutdown if an error occurs.
1767    pub fn send(
1768        self,
1769        mut current_num_pages: u32,
1770        mut requested_num_pages: u32,
1771    ) -> Result<(), fidl::Error> {
1772        let _result = self.send_raw(current_num_pages, requested_num_pages);
1773        if _result.is_err() {
1774            self.control_handle.shutdown();
1775        }
1776        self.drop_without_shutdown();
1777        _result
1778    }
1779
1780    /// Similar to "send" but does not shutdown the channel if an error occurs.
1781    pub fn send_no_shutdown_on_err(
1782        self,
1783        mut current_num_pages: u32,
1784        mut requested_num_pages: u32,
1785    ) -> Result<(), fidl::Error> {
1786        let _result = self.send_raw(current_num_pages, requested_num_pages);
1787        self.drop_without_shutdown();
1788        _result
1789    }
1790
1791    fn send_raw(
1792        &self,
1793        mut current_num_pages: u32,
1794        mut requested_num_pages: u32,
1795    ) -> Result<(), fidl::Error> {
1796        self.control_handle.inner.send::<BalloonControllerGetBalloonSizeResponse>(
1797            (current_num_pages, requested_num_pages),
1798            self.tx_id,
1799            0x2bb2ebaa6ff64d0b,
1800            fidl::encoding::DynamicFlags::empty(),
1801        )
1802    }
1803}
1804
1805#[must_use = "FIDL methods require a response to be sent"]
1806#[derive(Debug)]
1807pub struct BalloonControllerGetMemStatsResponder {
1808    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
1809    tx_id: u32,
1810}
1811
1812/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
1813/// if the responder is dropped without sending a response, so that the client
1814/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1815impl std::ops::Drop for BalloonControllerGetMemStatsResponder {
1816    fn drop(&mut self) {
1817        self.control_handle.shutdown();
1818        // Safety: drops once, never accessed again
1819        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1820    }
1821}
1822
1823impl fidl::endpoints::Responder for BalloonControllerGetMemStatsResponder {
1824    type ControlHandle = BalloonControllerControlHandle;
1825
1826    fn control_handle(&self) -> &BalloonControllerControlHandle {
1827        &self.control_handle
1828    }
1829
1830    fn drop_without_shutdown(mut self) {
1831        // Safety: drops once, never accessed again due to mem::forget
1832        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1833        // Prevent Drop from running (which would shut down the channel)
1834        std::mem::forget(self);
1835    }
1836}
1837
1838impl BalloonControllerGetMemStatsResponder {
1839    /// Sends a response to the FIDL transaction.
1840    ///
1841    /// Sets the channel to shutdown if an error occurs.
1842    pub fn send(
1843        self,
1844        mut status: i32,
1845        mut mem_stats: Option<&[MemStat]>,
1846    ) -> Result<(), fidl::Error> {
1847        let _result = self.send_raw(status, mem_stats);
1848        if _result.is_err() {
1849            self.control_handle.shutdown();
1850        }
1851        self.drop_without_shutdown();
1852        _result
1853    }
1854
1855    /// Similar to "send" but does not shutdown the channel if an error occurs.
1856    pub fn send_no_shutdown_on_err(
1857        self,
1858        mut status: i32,
1859        mut mem_stats: Option<&[MemStat]>,
1860    ) -> Result<(), fidl::Error> {
1861        let _result = self.send_raw(status, mem_stats);
1862        self.drop_without_shutdown();
1863        _result
1864    }
1865
1866    fn send_raw(
1867        &self,
1868        mut status: i32,
1869        mut mem_stats: Option<&[MemStat]>,
1870    ) -> Result<(), fidl::Error> {
1871        self.control_handle.inner.send::<BalloonControllerGetMemStatsResponse>(
1872            (status, mem_stats),
1873            self.tx_id,
1874            0x676199795cc01142,
1875            fidl::encoding::DynamicFlags::empty(),
1876        )
1877    }
1878}
1879
1880#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1881pub struct DebianGuestManagerMarker;
1882
1883impl fidl::endpoints::ProtocolMarker for DebianGuestManagerMarker {
1884    type Proxy = DebianGuestManagerProxy;
1885    type RequestStream = DebianGuestManagerRequestStream;
1886    #[cfg(target_os = "fuchsia")]
1887    type SynchronousProxy = DebianGuestManagerSynchronousProxy;
1888
1889    const DEBUG_NAME: &'static str = "fuchsia.virtualization.DebianGuestManager";
1890}
1891impl fidl::endpoints::DiscoverableProtocolMarker for DebianGuestManagerMarker {}
1892
1893pub trait DebianGuestManagerProxyInterface: Send + Sync {
1894    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
1895        + Send;
1896    fn r#launch(
1897        &self,
1898        guest_config: GuestConfig,
1899        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1900    ) -> Self::LaunchResponseFut;
1901    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1902    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
1903    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
1904        + Send;
1905    fn r#connect(
1906        &self,
1907        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1908    ) -> Self::ConnectResponseFut;
1909    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
1910    fn r#get_info(&self) -> Self::GetInfoResponseFut;
1911}
1912#[derive(Debug)]
1913#[cfg(target_os = "fuchsia")]
1914pub struct DebianGuestManagerSynchronousProxy {
1915    client: fidl::client::sync::Client,
1916}
1917
1918#[cfg(target_os = "fuchsia")]
1919impl fidl::endpoints::SynchronousProxy for DebianGuestManagerSynchronousProxy {
1920    type Proxy = DebianGuestManagerProxy;
1921    type Protocol = DebianGuestManagerMarker;
1922
1923    fn from_channel(inner: fidl::Channel) -> Self {
1924        Self::new(inner)
1925    }
1926
1927    fn into_channel(self) -> fidl::Channel {
1928        self.client.into_channel()
1929    }
1930
1931    fn as_channel(&self) -> &fidl::Channel {
1932        self.client.as_channel()
1933    }
1934}
1935
1936#[cfg(target_os = "fuchsia")]
1937impl DebianGuestManagerSynchronousProxy {
1938    pub fn new(channel: fidl::Channel) -> Self {
1939        let protocol_name =
1940            <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1941        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1942    }
1943
1944    pub fn into_channel(self) -> fidl::Channel {
1945        self.client.into_channel()
1946    }
1947
1948    /// Waits until an event arrives and returns it. It is safe for other
1949    /// threads to make concurrent requests while waiting for an event.
1950    pub fn wait_for_event(
1951        &self,
1952        deadline: zx::MonotonicInstant,
1953    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
1954        DebianGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
1955    }
1956
1957    /// Launch a new guest instance.
1958    ///
1959    /// Possible errors:
1960    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
1961    ///         problems detected by the guest manager.
1962    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
1963    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
1964    ///         component logs for a more specific failure.
1965    pub fn r#launch(
1966        &self,
1967        mut guest_config: GuestConfig,
1968        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1969        ___deadline: zx::MonotonicInstant,
1970    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
1971        let _response =
1972            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
1973                fidl::encoding::EmptyStruct,
1974                GuestManagerError,
1975            >>(
1976                (&mut guest_config, controller),
1977                0x394a2e29f750323e,
1978                fidl::encoding::DynamicFlags::empty(),
1979                ___deadline,
1980            )?;
1981        Ok(_response.map(|x| x))
1982    }
1983
1984    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
1985    /// be used to launch another guest.
1986    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1987        let _response =
1988            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1989                (),
1990                0x3ad9a012982f872d,
1991                fidl::encoding::DynamicFlags::empty(),
1992                ___deadline,
1993            )?;
1994        Ok(_response)
1995    }
1996
1997    /// Connect to a currently running guest.
1998    ///
1999    /// Possible errors:
2000    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2001    ///         has launched before attempting to reconnect.
2002    pub fn r#connect(
2003        &self,
2004        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2005        ___deadline: zx::MonotonicInstant,
2006    ) -> Result<GuestManagerConnectResult, fidl::Error> {
2007        let _response =
2008            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
2009                fidl::encoding::EmptyStruct,
2010                GuestManagerError,
2011            >>(
2012                (controller,),
2013                0x4e489076e3bb15b4,
2014                fidl::encoding::DynamicFlags::empty(),
2015                ___deadline,
2016            )?;
2017        Ok(_response.map(|x| x))
2018    }
2019
2020    /// Query guest info
2021    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
2022        let _response =
2023            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
2024                (),
2025                0x76892614aea695dc,
2026                fidl::encoding::DynamicFlags::empty(),
2027                ___deadline,
2028            )?;
2029        Ok(_response.guest_info)
2030    }
2031}
2032
2033#[cfg(target_os = "fuchsia")]
2034impl From<DebianGuestManagerSynchronousProxy> for zx::NullableHandle {
2035    fn from(value: DebianGuestManagerSynchronousProxy) -> Self {
2036        value.into_channel().into()
2037    }
2038}
2039
2040#[cfg(target_os = "fuchsia")]
2041impl From<fidl::Channel> for DebianGuestManagerSynchronousProxy {
2042    fn from(value: fidl::Channel) -> Self {
2043        Self::new(value)
2044    }
2045}
2046
2047#[cfg(target_os = "fuchsia")]
2048impl fidl::endpoints::FromClient for DebianGuestManagerSynchronousProxy {
2049    type Protocol = DebianGuestManagerMarker;
2050
2051    fn from_client(value: fidl::endpoints::ClientEnd<DebianGuestManagerMarker>) -> Self {
2052        Self::new(value.into_channel())
2053    }
2054}
2055
2056#[derive(Debug, Clone)]
2057pub struct DebianGuestManagerProxy {
2058    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2059}
2060
2061impl fidl::endpoints::Proxy for DebianGuestManagerProxy {
2062    type Protocol = DebianGuestManagerMarker;
2063
2064    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2065        Self::new(inner)
2066    }
2067
2068    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2069        self.client.into_channel().map_err(|client| Self { client })
2070    }
2071
2072    fn as_channel(&self) -> &::fidl::AsyncChannel {
2073        self.client.as_channel()
2074    }
2075}
2076
2077impl DebianGuestManagerProxy {
2078    /// Create a new Proxy for fuchsia.virtualization/DebianGuestManager.
2079    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2080        let protocol_name =
2081            <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2082        Self { client: fidl::client::Client::new(channel, protocol_name) }
2083    }
2084
2085    /// Get a Stream of events from the remote end of the protocol.
2086    ///
2087    /// # Panics
2088    ///
2089    /// Panics if the event stream was already taken.
2090    pub fn take_event_stream(&self) -> DebianGuestManagerEventStream {
2091        DebianGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
2092    }
2093
2094    /// Launch a new guest instance.
2095    ///
2096    /// Possible errors:
2097    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
2098    ///         problems detected by the guest manager.
2099    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
2100    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
2101    ///         component logs for a more specific failure.
2102    pub fn r#launch(
2103        &self,
2104        mut guest_config: GuestConfig,
2105        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2106    ) -> fidl::client::QueryResponseFut<
2107        GuestManagerLaunchResult,
2108        fidl::encoding::DefaultFuchsiaResourceDialect,
2109    > {
2110        DebianGuestManagerProxyInterface::r#launch(self, guest_config, controller)
2111    }
2112
2113    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
2114    /// be used to launch another guest.
2115    pub fn r#force_shutdown(
2116        &self,
2117    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2118        DebianGuestManagerProxyInterface::r#force_shutdown(self)
2119    }
2120
2121    /// Connect to a currently running guest.
2122    ///
2123    /// Possible errors:
2124    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2125    ///         has launched before attempting to reconnect.
2126    pub fn r#connect(
2127        &self,
2128        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2129    ) -> fidl::client::QueryResponseFut<
2130        GuestManagerConnectResult,
2131        fidl::encoding::DefaultFuchsiaResourceDialect,
2132    > {
2133        DebianGuestManagerProxyInterface::r#connect(self, controller)
2134    }
2135
2136    /// Query guest info
2137    pub fn r#get_info(
2138        &self,
2139    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2140    {
2141        DebianGuestManagerProxyInterface::r#get_info(self)
2142    }
2143}
2144
2145impl DebianGuestManagerProxyInterface for DebianGuestManagerProxy {
2146    type LaunchResponseFut = fidl::client::QueryResponseFut<
2147        GuestManagerLaunchResult,
2148        fidl::encoding::DefaultFuchsiaResourceDialect,
2149    >;
2150    fn r#launch(
2151        &self,
2152        mut guest_config: GuestConfig,
2153        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2154    ) -> Self::LaunchResponseFut {
2155        fn _decode(
2156            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2157        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
2158            let _response = fidl::client::decode_transaction_body::<
2159                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
2160                fidl::encoding::DefaultFuchsiaResourceDialect,
2161                0x394a2e29f750323e,
2162            >(_buf?)?;
2163            Ok(_response.map(|x| x))
2164        }
2165        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
2166            (&mut guest_config, controller),
2167            0x394a2e29f750323e,
2168            fidl::encoding::DynamicFlags::empty(),
2169            _decode,
2170        )
2171    }
2172
2173    type ForceShutdownResponseFut =
2174        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2175    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
2176        fn _decode(
2177            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2178        ) -> Result<(), fidl::Error> {
2179            let _response = fidl::client::decode_transaction_body::<
2180                fidl::encoding::EmptyPayload,
2181                fidl::encoding::DefaultFuchsiaResourceDialect,
2182                0x3ad9a012982f872d,
2183            >(_buf?)?;
2184            Ok(_response)
2185        }
2186        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2187            (),
2188            0x3ad9a012982f872d,
2189            fidl::encoding::DynamicFlags::empty(),
2190            _decode,
2191        )
2192    }
2193
2194    type ConnectResponseFut = fidl::client::QueryResponseFut<
2195        GuestManagerConnectResult,
2196        fidl::encoding::DefaultFuchsiaResourceDialect,
2197    >;
2198    fn r#connect(
2199        &self,
2200        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
2201    ) -> Self::ConnectResponseFut {
2202        fn _decode(
2203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2204        ) -> Result<GuestManagerConnectResult, fidl::Error> {
2205            let _response = fidl::client::decode_transaction_body::<
2206                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
2207                fidl::encoding::DefaultFuchsiaResourceDialect,
2208                0x4e489076e3bb15b4,
2209            >(_buf?)?;
2210            Ok(_response.map(|x| x))
2211        }
2212        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
2213            (controller,),
2214            0x4e489076e3bb15b4,
2215            fidl::encoding::DynamicFlags::empty(),
2216            _decode,
2217        )
2218    }
2219
2220    type GetInfoResponseFut =
2221        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
2222    fn r#get_info(&self) -> Self::GetInfoResponseFut {
2223        fn _decode(
2224            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2225        ) -> Result<GuestInfo, fidl::Error> {
2226            let _response = fidl::client::decode_transaction_body::<
2227                GuestManagerGetInfoResponse,
2228                fidl::encoding::DefaultFuchsiaResourceDialect,
2229                0x76892614aea695dc,
2230            >(_buf?)?;
2231            Ok(_response.guest_info)
2232        }
2233        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
2234            (),
2235            0x76892614aea695dc,
2236            fidl::encoding::DynamicFlags::empty(),
2237            _decode,
2238        )
2239    }
2240}
2241
2242pub struct DebianGuestManagerEventStream {
2243    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2244}
2245
2246impl std::marker::Unpin for DebianGuestManagerEventStream {}
2247
2248impl futures::stream::FusedStream for DebianGuestManagerEventStream {
2249    fn is_terminated(&self) -> bool {
2250        self.event_receiver.is_terminated()
2251    }
2252}
2253
2254impl futures::Stream for DebianGuestManagerEventStream {
2255    type Item = Result<DebianGuestManagerEvent, fidl::Error>;
2256
2257    fn poll_next(
2258        mut self: std::pin::Pin<&mut Self>,
2259        cx: &mut std::task::Context<'_>,
2260    ) -> std::task::Poll<Option<Self::Item>> {
2261        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2262            &mut self.event_receiver,
2263            cx
2264        )?) {
2265            Some(buf) => std::task::Poll::Ready(Some(DebianGuestManagerEvent::decode(buf))),
2266            None => std::task::Poll::Ready(None),
2267        }
2268    }
2269}
2270
2271#[derive(Debug)]
2272pub enum DebianGuestManagerEvent {}
2273
2274impl DebianGuestManagerEvent {
2275    /// Decodes a message buffer as a [`DebianGuestManagerEvent`].
2276    fn decode(
2277        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2278    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
2279        let (bytes, _handles) = buf.split_mut();
2280        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2281        debug_assert_eq!(tx_header.tx_id, 0);
2282        match tx_header.ordinal {
2283            _ => Err(fidl::Error::UnknownOrdinal {
2284                ordinal: tx_header.ordinal,
2285                protocol_name:
2286                    <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2287            }),
2288        }
2289    }
2290}
2291
2292/// A Stream of incoming requests for fuchsia.virtualization/DebianGuestManager.
2293pub struct DebianGuestManagerRequestStream {
2294    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2295    is_terminated: bool,
2296}
2297
2298impl std::marker::Unpin for DebianGuestManagerRequestStream {}
2299
2300impl futures::stream::FusedStream for DebianGuestManagerRequestStream {
2301    fn is_terminated(&self) -> bool {
2302        self.is_terminated
2303    }
2304}
2305
2306impl fidl::endpoints::RequestStream for DebianGuestManagerRequestStream {
2307    type Protocol = DebianGuestManagerMarker;
2308    type ControlHandle = DebianGuestManagerControlHandle;
2309
2310    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2311        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2312    }
2313
2314    fn control_handle(&self) -> Self::ControlHandle {
2315        DebianGuestManagerControlHandle { inner: self.inner.clone() }
2316    }
2317
2318    fn into_inner(
2319        self,
2320    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2321    {
2322        (self.inner, self.is_terminated)
2323    }
2324
2325    fn from_inner(
2326        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2327        is_terminated: bool,
2328    ) -> Self {
2329        Self { inner, is_terminated }
2330    }
2331}
2332
2333impl futures::Stream for DebianGuestManagerRequestStream {
2334    type Item = Result<DebianGuestManagerRequest, fidl::Error>;
2335
2336    fn poll_next(
2337        mut self: std::pin::Pin<&mut Self>,
2338        cx: &mut std::task::Context<'_>,
2339    ) -> std::task::Poll<Option<Self::Item>> {
2340        let this = &mut *self;
2341        if this.inner.check_shutdown(cx) {
2342            this.is_terminated = true;
2343            return std::task::Poll::Ready(None);
2344        }
2345        if this.is_terminated {
2346            panic!("polled DebianGuestManagerRequestStream after completion");
2347        }
2348        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2349            |bytes, handles| {
2350                match this.inner.channel().read_etc(cx, bytes, handles) {
2351                    std::task::Poll::Ready(Ok(())) => {}
2352                    std::task::Poll::Pending => return std::task::Poll::Pending,
2353                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2354                        this.is_terminated = true;
2355                        return std::task::Poll::Ready(None);
2356                    }
2357                    std::task::Poll::Ready(Err(e)) => {
2358                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2359                            e.into(),
2360                        ))));
2361                    }
2362                }
2363
2364                // A message has been received from the channel
2365                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2366
2367                std::task::Poll::Ready(Some(match header.ordinal {
2368                0x394a2e29f750323e => {
2369                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2370                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2371                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
2372                    let control_handle = DebianGuestManagerControlHandle {
2373                        inner: this.inner.clone(),
2374                    };
2375                    Ok(DebianGuestManagerRequest::Launch {guest_config: req.guest_config,
2376controller: req.controller,
2377
2378                        responder: DebianGuestManagerLaunchResponder {
2379                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2380                            tx_id: header.tx_id,
2381                        },
2382                    })
2383                }
2384                0x3ad9a012982f872d => {
2385                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2386                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2387                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2388                    let control_handle = DebianGuestManagerControlHandle {
2389                        inner: this.inner.clone(),
2390                    };
2391                    Ok(DebianGuestManagerRequest::ForceShutdown {
2392                        responder: DebianGuestManagerForceShutdownResponder {
2393                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2394                            tx_id: header.tx_id,
2395                        },
2396                    })
2397                }
2398                0x4e489076e3bb15b4 => {
2399                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2400                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2401                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2402                    let control_handle = DebianGuestManagerControlHandle {
2403                        inner: this.inner.clone(),
2404                    };
2405                    Ok(DebianGuestManagerRequest::Connect {controller: req.controller,
2406
2407                        responder: DebianGuestManagerConnectResponder {
2408                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2409                            tx_id: header.tx_id,
2410                        },
2411                    })
2412                }
2413                0x76892614aea695dc => {
2414                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2415                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2416                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2417                    let control_handle = DebianGuestManagerControlHandle {
2418                        inner: this.inner.clone(),
2419                    };
2420                    Ok(DebianGuestManagerRequest::GetInfo {
2421                        responder: DebianGuestManagerGetInfoResponder {
2422                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2423                            tx_id: header.tx_id,
2424                        },
2425                    })
2426                }
2427                _ => Err(fidl::Error::UnknownOrdinal {
2428                    ordinal: header.ordinal,
2429                    protocol_name: <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2430                }),
2431            }))
2432            },
2433        )
2434    }
2435}
2436
2437#[derive(Debug)]
2438pub enum DebianGuestManagerRequest {
2439    /// Launch a new guest instance.
2440    ///
2441    /// Possible errors:
2442    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
2443    ///         problems detected by the guest manager.
2444    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
2445    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
2446    ///         component logs for a more specific failure.
2447    Launch {
2448        guest_config: GuestConfig,
2449        controller: fidl::endpoints::ServerEnd<GuestMarker>,
2450        responder: DebianGuestManagerLaunchResponder,
2451    },
2452    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
2453    /// be used to launch another guest.
2454    ForceShutdown { responder: DebianGuestManagerForceShutdownResponder },
2455    /// Connect to a currently running guest.
2456    ///
2457    /// Possible errors:
2458    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
2459    ///         has launched before attempting to reconnect.
2460    Connect {
2461        controller: fidl::endpoints::ServerEnd<GuestMarker>,
2462        responder: DebianGuestManagerConnectResponder,
2463    },
2464    /// Query guest info
2465    GetInfo { responder: DebianGuestManagerGetInfoResponder },
2466}
2467
2468impl DebianGuestManagerRequest {
2469    #[allow(irrefutable_let_patterns)]
2470    pub fn into_launch(
2471        self,
2472    ) -> Option<(
2473        GuestConfig,
2474        fidl::endpoints::ServerEnd<GuestMarker>,
2475        DebianGuestManagerLaunchResponder,
2476    )> {
2477        if let DebianGuestManagerRequest::Launch { guest_config, controller, responder } = self {
2478            Some((guest_config, controller, responder))
2479        } else {
2480            None
2481        }
2482    }
2483
2484    #[allow(irrefutable_let_patterns)]
2485    pub fn into_force_shutdown(self) -> Option<(DebianGuestManagerForceShutdownResponder)> {
2486        if let DebianGuestManagerRequest::ForceShutdown { responder } = self {
2487            Some((responder))
2488        } else {
2489            None
2490        }
2491    }
2492
2493    #[allow(irrefutable_let_patterns)]
2494    pub fn into_connect(
2495        self,
2496    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, DebianGuestManagerConnectResponder)> {
2497        if let DebianGuestManagerRequest::Connect { controller, responder } = self {
2498            Some((controller, responder))
2499        } else {
2500            None
2501        }
2502    }
2503
2504    #[allow(irrefutable_let_patterns)]
2505    pub fn into_get_info(self) -> Option<(DebianGuestManagerGetInfoResponder)> {
2506        if let DebianGuestManagerRequest::GetInfo { responder } = self {
2507            Some((responder))
2508        } else {
2509            None
2510        }
2511    }
2512
2513    /// Name of the method defined in FIDL
2514    pub fn method_name(&self) -> &'static str {
2515        match *self {
2516            DebianGuestManagerRequest::Launch { .. } => "launch",
2517            DebianGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
2518            DebianGuestManagerRequest::Connect { .. } => "connect",
2519            DebianGuestManagerRequest::GetInfo { .. } => "get_info",
2520        }
2521    }
2522}
2523
2524#[derive(Debug, Clone)]
2525pub struct DebianGuestManagerControlHandle {
2526    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2527}
2528
2529impl fidl::endpoints::ControlHandle for DebianGuestManagerControlHandle {
2530    fn shutdown(&self) {
2531        self.inner.shutdown()
2532    }
2533
2534    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2535        self.inner.shutdown_with_epitaph(status)
2536    }
2537
2538    fn is_closed(&self) -> bool {
2539        self.inner.channel().is_closed()
2540    }
2541    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2542        self.inner.channel().on_closed()
2543    }
2544
2545    #[cfg(target_os = "fuchsia")]
2546    fn signal_peer(
2547        &self,
2548        clear_mask: zx::Signals,
2549        set_mask: zx::Signals,
2550    ) -> Result<(), zx_status::Status> {
2551        use fidl::Peered;
2552        self.inner.channel().signal_peer(clear_mask, set_mask)
2553    }
2554}
2555
2556impl DebianGuestManagerControlHandle {}
2557
2558#[must_use = "FIDL methods require a response to be sent"]
2559#[derive(Debug)]
2560pub struct DebianGuestManagerLaunchResponder {
2561    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2562    tx_id: u32,
2563}
2564
2565/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2566/// if the responder is dropped without sending a response, so that the client
2567/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2568impl std::ops::Drop for DebianGuestManagerLaunchResponder {
2569    fn drop(&mut self) {
2570        self.control_handle.shutdown();
2571        // Safety: drops once, never accessed again
2572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2573    }
2574}
2575
2576impl fidl::endpoints::Responder for DebianGuestManagerLaunchResponder {
2577    type ControlHandle = DebianGuestManagerControlHandle;
2578
2579    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2580        &self.control_handle
2581    }
2582
2583    fn drop_without_shutdown(mut self) {
2584        // Safety: drops once, never accessed again due to mem::forget
2585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2586        // Prevent Drop from running (which would shut down the channel)
2587        std::mem::forget(self);
2588    }
2589}
2590
2591impl DebianGuestManagerLaunchResponder {
2592    /// Sends a response to the FIDL transaction.
2593    ///
2594    /// Sets the channel to shutdown if an error occurs.
2595    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2596        let _result = self.send_raw(result);
2597        if _result.is_err() {
2598            self.control_handle.shutdown();
2599        }
2600        self.drop_without_shutdown();
2601        _result
2602    }
2603
2604    /// Similar to "send" but does not shutdown the channel if an error occurs.
2605    pub fn send_no_shutdown_on_err(
2606        self,
2607        mut result: Result<(), GuestManagerError>,
2608    ) -> Result<(), fidl::Error> {
2609        let _result = self.send_raw(result);
2610        self.drop_without_shutdown();
2611        _result
2612    }
2613
2614    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2615        self.control_handle.inner.send::<fidl::encoding::ResultType<
2616            fidl::encoding::EmptyStruct,
2617            GuestManagerError,
2618        >>(
2619            result,
2620            self.tx_id,
2621            0x394a2e29f750323e,
2622            fidl::encoding::DynamicFlags::empty(),
2623        )
2624    }
2625}
2626
2627#[must_use = "FIDL methods require a response to be sent"]
2628#[derive(Debug)]
2629pub struct DebianGuestManagerForceShutdownResponder {
2630    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2631    tx_id: u32,
2632}
2633
2634/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2635/// if the responder is dropped without sending a response, so that the client
2636/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2637impl std::ops::Drop for DebianGuestManagerForceShutdownResponder {
2638    fn drop(&mut self) {
2639        self.control_handle.shutdown();
2640        // Safety: drops once, never accessed again
2641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2642    }
2643}
2644
2645impl fidl::endpoints::Responder for DebianGuestManagerForceShutdownResponder {
2646    type ControlHandle = DebianGuestManagerControlHandle;
2647
2648    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2649        &self.control_handle
2650    }
2651
2652    fn drop_without_shutdown(mut self) {
2653        // Safety: drops once, never accessed again due to mem::forget
2654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2655        // Prevent Drop from running (which would shut down the channel)
2656        std::mem::forget(self);
2657    }
2658}
2659
2660impl DebianGuestManagerForceShutdownResponder {
2661    /// Sends a response to the FIDL transaction.
2662    ///
2663    /// Sets the channel to shutdown if an error occurs.
2664    pub fn send(self) -> Result<(), fidl::Error> {
2665        let _result = self.send_raw();
2666        if _result.is_err() {
2667            self.control_handle.shutdown();
2668        }
2669        self.drop_without_shutdown();
2670        _result
2671    }
2672
2673    /// Similar to "send" but does not shutdown the channel if an error occurs.
2674    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2675        let _result = self.send_raw();
2676        self.drop_without_shutdown();
2677        _result
2678    }
2679
2680    fn send_raw(&self) -> Result<(), fidl::Error> {
2681        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2682            (),
2683            self.tx_id,
2684            0x3ad9a012982f872d,
2685            fidl::encoding::DynamicFlags::empty(),
2686        )
2687    }
2688}
2689
2690#[must_use = "FIDL methods require a response to be sent"]
2691#[derive(Debug)]
2692pub struct DebianGuestManagerConnectResponder {
2693    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2694    tx_id: u32,
2695}
2696
2697/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2698/// if the responder is dropped without sending a response, so that the client
2699/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2700impl std::ops::Drop for DebianGuestManagerConnectResponder {
2701    fn drop(&mut self) {
2702        self.control_handle.shutdown();
2703        // Safety: drops once, never accessed again
2704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2705    }
2706}
2707
2708impl fidl::endpoints::Responder for DebianGuestManagerConnectResponder {
2709    type ControlHandle = DebianGuestManagerControlHandle;
2710
2711    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2712        &self.control_handle
2713    }
2714
2715    fn drop_without_shutdown(mut self) {
2716        // Safety: drops once, never accessed again due to mem::forget
2717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2718        // Prevent Drop from running (which would shut down the channel)
2719        std::mem::forget(self);
2720    }
2721}
2722
2723impl DebianGuestManagerConnectResponder {
2724    /// Sends a response to the FIDL transaction.
2725    ///
2726    /// Sets the channel to shutdown if an error occurs.
2727    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2728        let _result = self.send_raw(result);
2729        if _result.is_err() {
2730            self.control_handle.shutdown();
2731        }
2732        self.drop_without_shutdown();
2733        _result
2734    }
2735
2736    /// Similar to "send" but does not shutdown the channel if an error occurs.
2737    pub fn send_no_shutdown_on_err(
2738        self,
2739        mut result: Result<(), GuestManagerError>,
2740    ) -> Result<(), fidl::Error> {
2741        let _result = self.send_raw(result);
2742        self.drop_without_shutdown();
2743        _result
2744    }
2745
2746    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
2747        self.control_handle.inner.send::<fidl::encoding::ResultType<
2748            fidl::encoding::EmptyStruct,
2749            GuestManagerError,
2750        >>(
2751            result,
2752            self.tx_id,
2753            0x4e489076e3bb15b4,
2754            fidl::encoding::DynamicFlags::empty(),
2755        )
2756    }
2757}
2758
2759#[must_use = "FIDL methods require a response to be sent"]
2760#[derive(Debug)]
2761pub struct DebianGuestManagerGetInfoResponder {
2762    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
2763    tx_id: u32,
2764}
2765
2766/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
2767/// if the responder is dropped without sending a response, so that the client
2768/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2769impl std::ops::Drop for DebianGuestManagerGetInfoResponder {
2770    fn drop(&mut self) {
2771        self.control_handle.shutdown();
2772        // Safety: drops once, never accessed again
2773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2774    }
2775}
2776
2777impl fidl::endpoints::Responder for DebianGuestManagerGetInfoResponder {
2778    type ControlHandle = DebianGuestManagerControlHandle;
2779
2780    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
2781        &self.control_handle
2782    }
2783
2784    fn drop_without_shutdown(mut self) {
2785        // Safety: drops once, never accessed again due to mem::forget
2786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2787        // Prevent Drop from running (which would shut down the channel)
2788        std::mem::forget(self);
2789    }
2790}
2791
2792impl DebianGuestManagerGetInfoResponder {
2793    /// Sends a response to the FIDL transaction.
2794    ///
2795    /// Sets the channel to shutdown if an error occurs.
2796    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2797        let _result = self.send_raw(guest_info);
2798        if _result.is_err() {
2799            self.control_handle.shutdown();
2800        }
2801        self.drop_without_shutdown();
2802        _result
2803    }
2804
2805    /// Similar to "send" but does not shutdown the channel if an error occurs.
2806    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2807        let _result = self.send_raw(guest_info);
2808        self.drop_without_shutdown();
2809        _result
2810    }
2811
2812    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
2813        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
2814            (guest_info,),
2815            self.tx_id,
2816            0x76892614aea695dc,
2817            fidl::encoding::DynamicFlags::empty(),
2818        )
2819    }
2820}
2821
2822#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2823pub struct GuestMarker;
2824
2825impl fidl::endpoints::ProtocolMarker for GuestMarker {
2826    type Proxy = GuestProxy;
2827    type RequestStream = GuestRequestStream;
2828    #[cfg(target_os = "fuchsia")]
2829    type SynchronousProxy = GuestSynchronousProxy;
2830
2831    const DEBUG_NAME: &'static str = "fuchsia.virtualization.Guest";
2832}
2833impl fidl::endpoints::DiscoverableProtocolMarker for GuestMarker {}
2834pub type GuestGetConsoleResult = Result<fidl::Socket, GuestError>;
2835pub type GuestGetHostVsockEndpointResult = Result<(), GuestError>;
2836pub type GuestGetBalloonControllerResult = Result<(), GuestError>;
2837pub type GuestGetMemControllerResult = Result<(), GuestError>;
2838
2839pub trait GuestProxyInterface: Send + Sync {
2840    type GetConsoleResponseFut: std::future::Future<Output = Result<GuestGetConsoleResult, fidl::Error>>
2841        + Send;
2842    fn r#get_console(&self) -> Self::GetConsoleResponseFut;
2843    type GetSerialResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
2844        + Send;
2845    fn r#get_serial(&self) -> Self::GetSerialResponseFut;
2846    type GetHostVsockEndpointResponseFut: std::future::Future<Output = Result<GuestGetHostVsockEndpointResult, fidl::Error>>
2847        + Send;
2848    fn r#get_host_vsock_endpoint(
2849        &self,
2850        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2851    ) -> Self::GetHostVsockEndpointResponseFut;
2852    type GetBalloonControllerResponseFut: std::future::Future<Output = Result<GuestGetBalloonControllerResult, fidl::Error>>
2853        + Send;
2854    fn r#get_balloon_controller(
2855        &self,
2856        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2857    ) -> Self::GetBalloonControllerResponseFut;
2858    type GetMemControllerResponseFut: std::future::Future<Output = Result<GuestGetMemControllerResult, fidl::Error>>
2859        + Send;
2860    fn r#get_mem_controller(
2861        &self,
2862        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2863    ) -> Self::GetMemControllerResponseFut;
2864}
2865#[derive(Debug)]
2866#[cfg(target_os = "fuchsia")]
2867pub struct GuestSynchronousProxy {
2868    client: fidl::client::sync::Client,
2869}
2870
2871#[cfg(target_os = "fuchsia")]
2872impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
2873    type Proxy = GuestProxy;
2874    type Protocol = GuestMarker;
2875
2876    fn from_channel(inner: fidl::Channel) -> Self {
2877        Self::new(inner)
2878    }
2879
2880    fn into_channel(self) -> fidl::Channel {
2881        self.client.into_channel()
2882    }
2883
2884    fn as_channel(&self) -> &fidl::Channel {
2885        self.client.as_channel()
2886    }
2887}
2888
2889#[cfg(target_os = "fuchsia")]
2890impl GuestSynchronousProxy {
2891    pub fn new(channel: fidl::Channel) -> Self {
2892        let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2893        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2894    }
2895
2896    pub fn into_channel(self) -> fidl::Channel {
2897        self.client.into_channel()
2898    }
2899
2900    /// Waits until an event arrives and returns it. It is safe for other
2901    /// threads to make concurrent requests while waiting for an event.
2902    pub fn wait_for_event(
2903        &self,
2904        deadline: zx::MonotonicInstant,
2905    ) -> Result<GuestEvent, fidl::Error> {
2906        GuestEvent::decode(self.client.wait_for_event(deadline)?)
2907    }
2908
2909    /// Get a guest console.
2910    ///
2911    /// The details regarding what output is produced and what input is accepted
2912    /// are determined by each guest, but will typically be a read/write socket
2913    /// with a shell.
2914    ///
2915    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
2916    pub fn r#get_console(
2917        &self,
2918        ___deadline: zx::MonotonicInstant,
2919    ) -> Result<GuestGetConsoleResult, fidl::Error> {
2920        let _response = self.client.send_query::<
2921            fidl::encoding::EmptyPayload,
2922            fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
2923        >(
2924            (),
2925            0x48cbcecb7793806e,
2926            fidl::encoding::DynamicFlags::empty(),
2927            ___deadline,
2928        )?;
2929        Ok(_response.map(|x| x.socket))
2930    }
2931
2932    /// Get the socket for low-level guest debug logs.
2933    ///
2934    /// The details regarding what output is produced and what input is accepted
2935    /// are determined by each guest, but will typically be a read-only socket
2936    /// with the guest kernel's serial logs.
2937    pub fn r#get_serial(
2938        &self,
2939        ___deadline: zx::MonotonicInstant,
2940    ) -> Result<fidl::Socket, fidl::Error> {
2941        let _response =
2942            self.client.send_query::<fidl::encoding::EmptyPayload, GuestGetSerialResponse>(
2943                (),
2944                0xcdd541a160d7044,
2945                fidl::encoding::DynamicFlags::empty(),
2946                ___deadline,
2947            )?;
2948        Ok(_response.socket)
2949    }
2950
2951    /// Get the vsock endpoint for the guest.
2952    ///
2953    /// This endpoint can be used to register listeners for guest initiated connections, and
2954    /// to initiate connections from a client. If listeners need to be registered before the guest
2955    /// starts so that they are immediately available, set them via the guest config instead of
2956    /// using this endpoint.
2957    ///
2958    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
2959    pub fn r#get_host_vsock_endpoint(
2960        &self,
2961        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2962        ___deadline: zx::MonotonicInstant,
2963    ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
2964        let _response = self.client.send_query::<
2965            GuestGetHostVsockEndpointRequest,
2966            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2967        >(
2968            (endpoint,),
2969            0x766e96aeb9c28ed1,
2970            fidl::encoding::DynamicFlags::empty(),
2971            ___deadline,
2972        )?;
2973        Ok(_response.map(|x| x))
2974    }
2975
2976    /// Get the balloon controller endpoint for the guest.
2977    ///
2978    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
2979    pub fn r#get_balloon_controller(
2980        &self,
2981        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2982        ___deadline: zx::MonotonicInstant,
2983    ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
2984        let _response = self.client.send_query::<
2985            GuestGetBalloonControllerRequest,
2986            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2987        >(
2988            (controller,),
2989            0x7b210bff219ac84e,
2990            fidl::encoding::DynamicFlags::empty(),
2991            ___deadline,
2992        )?;
2993        Ok(_response.map(|x| x))
2994    }
2995
2996    /// Get the mem controller endpoint for the guest.
2997    ///
2998    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
2999    pub fn r#get_mem_controller(
3000        &self,
3001        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3002        ___deadline: zx::MonotonicInstant,
3003    ) -> Result<GuestGetMemControllerResult, fidl::Error> {
3004        let _response = self.client.send_query::<
3005            GuestGetMemControllerRequest,
3006            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3007        >(
3008            (controller,),
3009            0x170b19f4b867a01c,
3010            fidl::encoding::DynamicFlags::empty(),
3011            ___deadline,
3012        )?;
3013        Ok(_response.map(|x| x))
3014    }
3015}
3016
3017#[cfg(target_os = "fuchsia")]
3018impl From<GuestSynchronousProxy> for zx::NullableHandle {
3019    fn from(value: GuestSynchronousProxy) -> Self {
3020        value.into_channel().into()
3021    }
3022}
3023
3024#[cfg(target_os = "fuchsia")]
3025impl From<fidl::Channel> for GuestSynchronousProxy {
3026    fn from(value: fidl::Channel) -> Self {
3027        Self::new(value)
3028    }
3029}
3030
3031#[cfg(target_os = "fuchsia")]
3032impl fidl::endpoints::FromClient for GuestSynchronousProxy {
3033    type Protocol = GuestMarker;
3034
3035    fn from_client(value: fidl::endpoints::ClientEnd<GuestMarker>) -> Self {
3036        Self::new(value.into_channel())
3037    }
3038}
3039
3040#[derive(Debug, Clone)]
3041pub struct GuestProxy {
3042    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3043}
3044
3045impl fidl::endpoints::Proxy for GuestProxy {
3046    type Protocol = GuestMarker;
3047
3048    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3049        Self::new(inner)
3050    }
3051
3052    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3053        self.client.into_channel().map_err(|client| Self { client })
3054    }
3055
3056    fn as_channel(&self) -> &::fidl::AsyncChannel {
3057        self.client.as_channel()
3058    }
3059}
3060
3061impl GuestProxy {
3062    /// Create a new Proxy for fuchsia.virtualization/Guest.
3063    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3064        let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3065        Self { client: fidl::client::Client::new(channel, protocol_name) }
3066    }
3067
3068    /// Get a Stream of events from the remote end of the protocol.
3069    ///
3070    /// # Panics
3071    ///
3072    /// Panics if the event stream was already taken.
3073    pub fn take_event_stream(&self) -> GuestEventStream {
3074        GuestEventStream { event_receiver: self.client.take_event_receiver() }
3075    }
3076
3077    /// Get a guest console.
3078    ///
3079    /// The details regarding what output is produced and what input is accepted
3080    /// are determined by each guest, but will typically be a read/write socket
3081    /// with a shell.
3082    ///
3083    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
3084    pub fn r#get_console(
3085        &self,
3086    ) -> fidl::client::QueryResponseFut<
3087        GuestGetConsoleResult,
3088        fidl::encoding::DefaultFuchsiaResourceDialect,
3089    > {
3090        GuestProxyInterface::r#get_console(self)
3091    }
3092
3093    /// Get the socket for low-level guest debug logs.
3094    ///
3095    /// The details regarding what output is produced and what input is accepted
3096    /// are determined by each guest, but will typically be a read-only socket
3097    /// with the guest kernel's serial logs.
3098    pub fn r#get_serial(
3099        &self,
3100    ) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
3101    {
3102        GuestProxyInterface::r#get_serial(self)
3103    }
3104
3105    /// Get the vsock endpoint for the guest.
3106    ///
3107    /// This endpoint can be used to register listeners for guest initiated connections, and
3108    /// to initiate connections from a client. If listeners need to be registered before the guest
3109    /// starts so that they are immediately available, set them via the guest config instead of
3110    /// using this endpoint.
3111    ///
3112    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
3113    pub fn r#get_host_vsock_endpoint(
3114        &self,
3115        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3116    ) -> fidl::client::QueryResponseFut<
3117        GuestGetHostVsockEndpointResult,
3118        fidl::encoding::DefaultFuchsiaResourceDialect,
3119    > {
3120        GuestProxyInterface::r#get_host_vsock_endpoint(self, endpoint)
3121    }
3122
3123    /// Get the balloon controller endpoint for the guest.
3124    ///
3125    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
3126    pub fn r#get_balloon_controller(
3127        &self,
3128        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3129    ) -> fidl::client::QueryResponseFut<
3130        GuestGetBalloonControllerResult,
3131        fidl::encoding::DefaultFuchsiaResourceDialect,
3132    > {
3133        GuestProxyInterface::r#get_balloon_controller(self, controller)
3134    }
3135
3136    /// Get the mem controller endpoint for the guest.
3137    ///
3138    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
3139    pub fn r#get_mem_controller(
3140        &self,
3141        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3142    ) -> fidl::client::QueryResponseFut<
3143        GuestGetMemControllerResult,
3144        fidl::encoding::DefaultFuchsiaResourceDialect,
3145    > {
3146        GuestProxyInterface::r#get_mem_controller(self, controller)
3147    }
3148}
3149
3150impl GuestProxyInterface for GuestProxy {
3151    type GetConsoleResponseFut = fidl::client::QueryResponseFut<
3152        GuestGetConsoleResult,
3153        fidl::encoding::DefaultFuchsiaResourceDialect,
3154    >;
3155    fn r#get_console(&self) -> Self::GetConsoleResponseFut {
3156        fn _decode(
3157            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3158        ) -> Result<GuestGetConsoleResult, fidl::Error> {
3159            let _response = fidl::client::decode_transaction_body::<
3160                fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
3161                fidl::encoding::DefaultFuchsiaResourceDialect,
3162                0x48cbcecb7793806e,
3163            >(_buf?)?;
3164            Ok(_response.map(|x| x.socket))
3165        }
3166        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestGetConsoleResult>(
3167            (),
3168            0x48cbcecb7793806e,
3169            fidl::encoding::DynamicFlags::empty(),
3170            _decode,
3171        )
3172    }
3173
3174    type GetSerialResponseFut =
3175        fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
3176    fn r#get_serial(&self) -> Self::GetSerialResponseFut {
3177        fn _decode(
3178            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3179        ) -> Result<fidl::Socket, fidl::Error> {
3180            let _response = fidl::client::decode_transaction_body::<
3181                GuestGetSerialResponse,
3182                fidl::encoding::DefaultFuchsiaResourceDialect,
3183                0xcdd541a160d7044,
3184            >(_buf?)?;
3185            Ok(_response.socket)
3186        }
3187        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Socket>(
3188            (),
3189            0xcdd541a160d7044,
3190            fidl::encoding::DynamicFlags::empty(),
3191            _decode,
3192        )
3193    }
3194
3195    type GetHostVsockEndpointResponseFut = fidl::client::QueryResponseFut<
3196        GuestGetHostVsockEndpointResult,
3197        fidl::encoding::DefaultFuchsiaResourceDialect,
3198    >;
3199    fn r#get_host_vsock_endpoint(
3200        &self,
3201        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3202    ) -> Self::GetHostVsockEndpointResponseFut {
3203        fn _decode(
3204            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3205        ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
3206            let _response = fidl::client::decode_transaction_body::<
3207                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3208                fidl::encoding::DefaultFuchsiaResourceDialect,
3209                0x766e96aeb9c28ed1,
3210            >(_buf?)?;
3211            Ok(_response.map(|x| x))
3212        }
3213        self.client.send_query_and_decode::<
3214            GuestGetHostVsockEndpointRequest,
3215            GuestGetHostVsockEndpointResult,
3216        >(
3217            (endpoint,),
3218            0x766e96aeb9c28ed1,
3219            fidl::encoding::DynamicFlags::empty(),
3220            _decode,
3221        )
3222    }
3223
3224    type GetBalloonControllerResponseFut = fidl::client::QueryResponseFut<
3225        GuestGetBalloonControllerResult,
3226        fidl::encoding::DefaultFuchsiaResourceDialect,
3227    >;
3228    fn r#get_balloon_controller(
3229        &self,
3230        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3231    ) -> Self::GetBalloonControllerResponseFut {
3232        fn _decode(
3233            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3234        ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
3235            let _response = fidl::client::decode_transaction_body::<
3236                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3237                fidl::encoding::DefaultFuchsiaResourceDialect,
3238                0x7b210bff219ac84e,
3239            >(_buf?)?;
3240            Ok(_response.map(|x| x))
3241        }
3242        self.client.send_query_and_decode::<
3243            GuestGetBalloonControllerRequest,
3244            GuestGetBalloonControllerResult,
3245        >(
3246            (controller,),
3247            0x7b210bff219ac84e,
3248            fidl::encoding::DynamicFlags::empty(),
3249            _decode,
3250        )
3251    }
3252
3253    type GetMemControllerResponseFut = fidl::client::QueryResponseFut<
3254        GuestGetMemControllerResult,
3255        fidl::encoding::DefaultFuchsiaResourceDialect,
3256    >;
3257    fn r#get_mem_controller(
3258        &self,
3259        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3260    ) -> Self::GetMemControllerResponseFut {
3261        fn _decode(
3262            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3263        ) -> Result<GuestGetMemControllerResult, fidl::Error> {
3264            let _response = fidl::client::decode_transaction_body::<
3265                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3266                fidl::encoding::DefaultFuchsiaResourceDialect,
3267                0x170b19f4b867a01c,
3268            >(_buf?)?;
3269            Ok(_response.map(|x| x))
3270        }
3271        self.client
3272            .send_query_and_decode::<GuestGetMemControllerRequest, GuestGetMemControllerResult>(
3273                (controller,),
3274                0x170b19f4b867a01c,
3275                fidl::encoding::DynamicFlags::empty(),
3276                _decode,
3277            )
3278    }
3279}
3280
3281pub struct GuestEventStream {
3282    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3283}
3284
3285impl std::marker::Unpin for GuestEventStream {}
3286
3287impl futures::stream::FusedStream for GuestEventStream {
3288    fn is_terminated(&self) -> bool {
3289        self.event_receiver.is_terminated()
3290    }
3291}
3292
3293impl futures::Stream for GuestEventStream {
3294    type Item = Result<GuestEvent, fidl::Error>;
3295
3296    fn poll_next(
3297        mut self: std::pin::Pin<&mut Self>,
3298        cx: &mut std::task::Context<'_>,
3299    ) -> std::task::Poll<Option<Self::Item>> {
3300        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3301            &mut self.event_receiver,
3302            cx
3303        )?) {
3304            Some(buf) => std::task::Poll::Ready(Some(GuestEvent::decode(buf))),
3305            None => std::task::Poll::Ready(None),
3306        }
3307    }
3308}
3309
3310#[derive(Debug)]
3311pub enum GuestEvent {}
3312
3313impl GuestEvent {
3314    /// Decodes a message buffer as a [`GuestEvent`].
3315    fn decode(
3316        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3317    ) -> Result<GuestEvent, fidl::Error> {
3318        let (bytes, _handles) = buf.split_mut();
3319        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3320        debug_assert_eq!(tx_header.tx_id, 0);
3321        match tx_header.ordinal {
3322            _ => Err(fidl::Error::UnknownOrdinal {
3323                ordinal: tx_header.ordinal,
3324                protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3325            }),
3326        }
3327    }
3328}
3329
3330/// A Stream of incoming requests for fuchsia.virtualization/Guest.
3331pub struct GuestRequestStream {
3332    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3333    is_terminated: bool,
3334}
3335
3336impl std::marker::Unpin for GuestRequestStream {}
3337
3338impl futures::stream::FusedStream for GuestRequestStream {
3339    fn is_terminated(&self) -> bool {
3340        self.is_terminated
3341    }
3342}
3343
3344impl fidl::endpoints::RequestStream for GuestRequestStream {
3345    type Protocol = GuestMarker;
3346    type ControlHandle = GuestControlHandle;
3347
3348    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3349        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3350    }
3351
3352    fn control_handle(&self) -> Self::ControlHandle {
3353        GuestControlHandle { inner: self.inner.clone() }
3354    }
3355
3356    fn into_inner(
3357        self,
3358    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3359    {
3360        (self.inner, self.is_terminated)
3361    }
3362
3363    fn from_inner(
3364        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3365        is_terminated: bool,
3366    ) -> Self {
3367        Self { inner, is_terminated }
3368    }
3369}
3370
3371impl futures::Stream for GuestRequestStream {
3372    type Item = Result<GuestRequest, fidl::Error>;
3373
3374    fn poll_next(
3375        mut self: std::pin::Pin<&mut Self>,
3376        cx: &mut std::task::Context<'_>,
3377    ) -> std::task::Poll<Option<Self::Item>> {
3378        let this = &mut *self;
3379        if this.inner.check_shutdown(cx) {
3380            this.is_terminated = true;
3381            return std::task::Poll::Ready(None);
3382        }
3383        if this.is_terminated {
3384            panic!("polled GuestRequestStream after completion");
3385        }
3386        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3387            |bytes, handles| {
3388                match this.inner.channel().read_etc(cx, bytes, handles) {
3389                    std::task::Poll::Ready(Ok(())) => {}
3390                    std::task::Poll::Pending => return std::task::Poll::Pending,
3391                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3392                        this.is_terminated = true;
3393                        return std::task::Poll::Ready(None);
3394                    }
3395                    std::task::Poll::Ready(Err(e)) => {
3396                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3397                            e.into(),
3398                        ))));
3399                    }
3400                }
3401
3402                // A message has been received from the channel
3403                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3404
3405                std::task::Poll::Ready(Some(match header.ordinal {
3406                    0x48cbcecb7793806e => {
3407                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3408                        let mut req = fidl::new_empty!(
3409                            fidl::encoding::EmptyPayload,
3410                            fidl::encoding::DefaultFuchsiaResourceDialect
3411                        );
3412                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3413                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3414                        Ok(GuestRequest::GetConsole {
3415                            responder: GuestGetConsoleResponder {
3416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3417                                tx_id: header.tx_id,
3418                            },
3419                        })
3420                    }
3421                    0xcdd541a160d7044 => {
3422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3423                        let mut req = fidl::new_empty!(
3424                            fidl::encoding::EmptyPayload,
3425                            fidl::encoding::DefaultFuchsiaResourceDialect
3426                        );
3427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3428                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3429                        Ok(GuestRequest::GetSerial {
3430                            responder: GuestGetSerialResponder {
3431                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3432                                tx_id: header.tx_id,
3433                            },
3434                        })
3435                    }
3436                    0x766e96aeb9c28ed1 => {
3437                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3438                        let mut req = fidl::new_empty!(
3439                            GuestGetHostVsockEndpointRequest,
3440                            fidl::encoding::DefaultFuchsiaResourceDialect
3441                        );
3442                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetHostVsockEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
3443                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3444                        Ok(GuestRequest::GetHostVsockEndpoint {
3445                            endpoint: req.endpoint,
3446
3447                            responder: GuestGetHostVsockEndpointResponder {
3448                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3449                                tx_id: header.tx_id,
3450                            },
3451                        })
3452                    }
3453                    0x7b210bff219ac84e => {
3454                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3455                        let mut req = fidl::new_empty!(
3456                            GuestGetBalloonControllerRequest,
3457                            fidl::encoding::DefaultFuchsiaResourceDialect
3458                        );
3459                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetBalloonControllerRequest>(&header, _body_bytes, handles, &mut req)?;
3460                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3461                        Ok(GuestRequest::GetBalloonController {
3462                            controller: req.controller,
3463
3464                            responder: GuestGetBalloonControllerResponder {
3465                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3466                                tx_id: header.tx_id,
3467                            },
3468                        })
3469                    }
3470                    0x170b19f4b867a01c => {
3471                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3472                        let mut req = fidl::new_empty!(
3473                            GuestGetMemControllerRequest,
3474                            fidl::encoding::DefaultFuchsiaResourceDialect
3475                        );
3476                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetMemControllerRequest>(&header, _body_bytes, handles, &mut req)?;
3477                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
3478                        Ok(GuestRequest::GetMemController {
3479                            controller: req.controller,
3480
3481                            responder: GuestGetMemControllerResponder {
3482                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3483                                tx_id: header.tx_id,
3484                            },
3485                        })
3486                    }
3487                    _ => Err(fidl::Error::UnknownOrdinal {
3488                        ordinal: header.ordinal,
3489                        protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3490                    }),
3491                }))
3492            },
3493        )
3494    }
3495}
3496
3497/// The guest client API providing high level access to guest features. When the guest terminates,
3498/// this channel will contain a ZX_OK epitaph on a clean shutdown, a ZX_ERR_INTERNAL epitaph on
3499/// an unexpected shutdown, and no epitaph if the component crashed.
3500#[derive(Debug)]
3501pub enum GuestRequest {
3502    /// Get a guest console.
3503    ///
3504    /// The details regarding what output is produced and what input is accepted
3505    /// are determined by each guest, but will typically be a read/write socket
3506    /// with a shell.
3507    ///
3508    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
3509    GetConsole { responder: GuestGetConsoleResponder },
3510    /// Get the socket for low-level guest debug logs.
3511    ///
3512    /// The details regarding what output is produced and what input is accepted
3513    /// are determined by each guest, but will typically be a read-only socket
3514    /// with the guest kernel's serial logs.
3515    GetSerial { responder: GuestGetSerialResponder },
3516    /// Get the vsock endpoint for the guest.
3517    ///
3518    /// This endpoint can be used to register listeners for guest initiated connections, and
3519    /// to initiate connections from a client. If listeners need to be registered before the guest
3520    /// starts so that they are immediately available, set them via the guest config instead of
3521    /// using this endpoint.
3522    ///
3523    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
3524    GetHostVsockEndpoint {
3525        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3526        responder: GuestGetHostVsockEndpointResponder,
3527    },
3528    /// Get the balloon controller endpoint for the guest.
3529    ///
3530    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
3531    GetBalloonController {
3532        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3533        responder: GuestGetBalloonControllerResponder,
3534    },
3535    /// Get the mem controller endpoint for the guest.
3536    ///
3537    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
3538    GetMemController {
3539        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
3540        responder: GuestGetMemControllerResponder,
3541    },
3542}
3543
3544impl GuestRequest {
3545    #[allow(irrefutable_let_patterns)]
3546    pub fn into_get_console(self) -> Option<(GuestGetConsoleResponder)> {
3547        if let GuestRequest::GetConsole { responder } = self { Some((responder)) } else { None }
3548    }
3549
3550    #[allow(irrefutable_let_patterns)]
3551    pub fn into_get_serial(self) -> Option<(GuestGetSerialResponder)> {
3552        if let GuestRequest::GetSerial { responder } = self { Some((responder)) } else { None }
3553    }
3554
3555    #[allow(irrefutable_let_patterns)]
3556    pub fn into_get_host_vsock_endpoint(
3557        self,
3558    ) -> Option<(
3559        fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
3560        GuestGetHostVsockEndpointResponder,
3561    )> {
3562        if let GuestRequest::GetHostVsockEndpoint { endpoint, responder } = self {
3563            Some((endpoint, responder))
3564        } else {
3565            None
3566        }
3567    }
3568
3569    #[allow(irrefutable_let_patterns)]
3570    pub fn into_get_balloon_controller(
3571        self,
3572    ) -> Option<(
3573        fidl::endpoints::ServerEnd<BalloonControllerMarker>,
3574        GuestGetBalloonControllerResponder,
3575    )> {
3576        if let GuestRequest::GetBalloonController { controller, responder } = self {
3577            Some((controller, responder))
3578        } else {
3579            None
3580        }
3581    }
3582
3583    #[allow(irrefutable_let_patterns)]
3584    pub fn into_get_mem_controller(
3585        self,
3586    ) -> Option<(fidl::endpoints::ServerEnd<MemControllerMarker>, GuestGetMemControllerResponder)>
3587    {
3588        if let GuestRequest::GetMemController { controller, responder } = self {
3589            Some((controller, responder))
3590        } else {
3591            None
3592        }
3593    }
3594
3595    /// Name of the method defined in FIDL
3596    pub fn method_name(&self) -> &'static str {
3597        match *self {
3598            GuestRequest::GetConsole { .. } => "get_console",
3599            GuestRequest::GetSerial { .. } => "get_serial",
3600            GuestRequest::GetHostVsockEndpoint { .. } => "get_host_vsock_endpoint",
3601            GuestRequest::GetBalloonController { .. } => "get_balloon_controller",
3602            GuestRequest::GetMemController { .. } => "get_mem_controller",
3603        }
3604    }
3605}
3606
3607#[derive(Debug, Clone)]
3608pub struct GuestControlHandle {
3609    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3610}
3611
3612impl fidl::endpoints::ControlHandle for GuestControlHandle {
3613    fn shutdown(&self) {
3614        self.inner.shutdown()
3615    }
3616
3617    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3618        self.inner.shutdown_with_epitaph(status)
3619    }
3620
3621    fn is_closed(&self) -> bool {
3622        self.inner.channel().is_closed()
3623    }
3624    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3625        self.inner.channel().on_closed()
3626    }
3627
3628    #[cfg(target_os = "fuchsia")]
3629    fn signal_peer(
3630        &self,
3631        clear_mask: zx::Signals,
3632        set_mask: zx::Signals,
3633    ) -> Result<(), zx_status::Status> {
3634        use fidl::Peered;
3635        self.inner.channel().signal_peer(clear_mask, set_mask)
3636    }
3637}
3638
3639impl GuestControlHandle {}
3640
3641#[must_use = "FIDL methods require a response to be sent"]
3642#[derive(Debug)]
3643pub struct GuestGetConsoleResponder {
3644    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3645    tx_id: u32,
3646}
3647
3648/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3649/// if the responder is dropped without sending a response, so that the client
3650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3651impl std::ops::Drop for GuestGetConsoleResponder {
3652    fn drop(&mut self) {
3653        self.control_handle.shutdown();
3654        // Safety: drops once, never accessed again
3655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3656    }
3657}
3658
3659impl fidl::endpoints::Responder for GuestGetConsoleResponder {
3660    type ControlHandle = GuestControlHandle;
3661
3662    fn control_handle(&self) -> &GuestControlHandle {
3663        &self.control_handle
3664    }
3665
3666    fn drop_without_shutdown(mut self) {
3667        // Safety: drops once, never accessed again due to mem::forget
3668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3669        // Prevent Drop from running (which would shut down the channel)
3670        std::mem::forget(self);
3671    }
3672}
3673
3674impl GuestGetConsoleResponder {
3675    /// Sends a response to the FIDL transaction.
3676    ///
3677    /// Sets the channel to shutdown if an error occurs.
3678    pub fn send(self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
3679        let _result = self.send_raw(result);
3680        if _result.is_err() {
3681            self.control_handle.shutdown();
3682        }
3683        self.drop_without_shutdown();
3684        _result
3685    }
3686
3687    /// Similar to "send" but does not shutdown the channel if an error occurs.
3688    pub fn send_no_shutdown_on_err(
3689        self,
3690        mut result: Result<fidl::Socket, GuestError>,
3691    ) -> Result<(), fidl::Error> {
3692        let _result = self.send_raw(result);
3693        self.drop_without_shutdown();
3694        _result
3695    }
3696
3697    fn send_raw(&self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
3698        self.control_handle
3699            .inner
3700            .send::<fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>>(
3701                result.map(|socket| (socket,)),
3702                self.tx_id,
3703                0x48cbcecb7793806e,
3704                fidl::encoding::DynamicFlags::empty(),
3705            )
3706    }
3707}
3708
3709#[must_use = "FIDL methods require a response to be sent"]
3710#[derive(Debug)]
3711pub struct GuestGetSerialResponder {
3712    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3713    tx_id: u32,
3714}
3715
3716/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3717/// if the responder is dropped without sending a response, so that the client
3718/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3719impl std::ops::Drop for GuestGetSerialResponder {
3720    fn drop(&mut self) {
3721        self.control_handle.shutdown();
3722        // Safety: drops once, never accessed again
3723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3724    }
3725}
3726
3727impl fidl::endpoints::Responder for GuestGetSerialResponder {
3728    type ControlHandle = GuestControlHandle;
3729
3730    fn control_handle(&self) -> &GuestControlHandle {
3731        &self.control_handle
3732    }
3733
3734    fn drop_without_shutdown(mut self) {
3735        // Safety: drops once, never accessed again due to mem::forget
3736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3737        // Prevent Drop from running (which would shut down the channel)
3738        std::mem::forget(self);
3739    }
3740}
3741
3742impl GuestGetSerialResponder {
3743    /// Sends a response to the FIDL transaction.
3744    ///
3745    /// Sets the channel to shutdown if an error occurs.
3746    pub fn send(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3747        let _result = self.send_raw(socket);
3748        if _result.is_err() {
3749            self.control_handle.shutdown();
3750        }
3751        self.drop_without_shutdown();
3752        _result
3753    }
3754
3755    /// Similar to "send" but does not shutdown the channel if an error occurs.
3756    pub fn send_no_shutdown_on_err(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3757        let _result = self.send_raw(socket);
3758        self.drop_without_shutdown();
3759        _result
3760    }
3761
3762    fn send_raw(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
3763        self.control_handle.inner.send::<GuestGetSerialResponse>(
3764            (socket,),
3765            self.tx_id,
3766            0xcdd541a160d7044,
3767            fidl::encoding::DynamicFlags::empty(),
3768        )
3769    }
3770}
3771
3772#[must_use = "FIDL methods require a response to be sent"]
3773#[derive(Debug)]
3774pub struct GuestGetHostVsockEndpointResponder {
3775    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3776    tx_id: u32,
3777}
3778
3779/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3780/// if the responder is dropped without sending a response, so that the client
3781/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3782impl std::ops::Drop for GuestGetHostVsockEndpointResponder {
3783    fn drop(&mut self) {
3784        self.control_handle.shutdown();
3785        // Safety: drops once, never accessed again
3786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3787    }
3788}
3789
3790impl fidl::endpoints::Responder for GuestGetHostVsockEndpointResponder {
3791    type ControlHandle = GuestControlHandle;
3792
3793    fn control_handle(&self) -> &GuestControlHandle {
3794        &self.control_handle
3795    }
3796
3797    fn drop_without_shutdown(mut self) {
3798        // Safety: drops once, never accessed again due to mem::forget
3799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3800        // Prevent Drop from running (which would shut down the channel)
3801        std::mem::forget(self);
3802    }
3803}
3804
3805impl GuestGetHostVsockEndpointResponder {
3806    /// Sends a response to the FIDL transaction.
3807    ///
3808    /// Sets the channel to shutdown if an error occurs.
3809    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3810        let _result = self.send_raw(result);
3811        if _result.is_err() {
3812            self.control_handle.shutdown();
3813        }
3814        self.drop_without_shutdown();
3815        _result
3816    }
3817
3818    /// Similar to "send" but does not shutdown the channel if an error occurs.
3819    pub fn send_no_shutdown_on_err(
3820        self,
3821        mut result: Result<(), GuestError>,
3822    ) -> Result<(), fidl::Error> {
3823        let _result = self.send_raw(result);
3824        self.drop_without_shutdown();
3825        _result
3826    }
3827
3828    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3829        self.control_handle
3830            .inner
3831            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3832                result,
3833                self.tx_id,
3834                0x766e96aeb9c28ed1,
3835                fidl::encoding::DynamicFlags::empty(),
3836            )
3837    }
3838}
3839
3840#[must_use = "FIDL methods require a response to be sent"]
3841#[derive(Debug)]
3842pub struct GuestGetBalloonControllerResponder {
3843    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3844    tx_id: u32,
3845}
3846
3847/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3848/// if the responder is dropped without sending a response, so that the client
3849/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3850impl std::ops::Drop for GuestGetBalloonControllerResponder {
3851    fn drop(&mut self) {
3852        self.control_handle.shutdown();
3853        // Safety: drops once, never accessed again
3854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3855    }
3856}
3857
3858impl fidl::endpoints::Responder for GuestGetBalloonControllerResponder {
3859    type ControlHandle = GuestControlHandle;
3860
3861    fn control_handle(&self) -> &GuestControlHandle {
3862        &self.control_handle
3863    }
3864
3865    fn drop_without_shutdown(mut self) {
3866        // Safety: drops once, never accessed again due to mem::forget
3867        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3868        // Prevent Drop from running (which would shut down the channel)
3869        std::mem::forget(self);
3870    }
3871}
3872
3873impl GuestGetBalloonControllerResponder {
3874    /// Sends a response to the FIDL transaction.
3875    ///
3876    /// Sets the channel to shutdown if an error occurs.
3877    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3878        let _result = self.send_raw(result);
3879        if _result.is_err() {
3880            self.control_handle.shutdown();
3881        }
3882        self.drop_without_shutdown();
3883        _result
3884    }
3885
3886    /// Similar to "send" but does not shutdown the channel if an error occurs.
3887    pub fn send_no_shutdown_on_err(
3888        self,
3889        mut result: Result<(), GuestError>,
3890    ) -> Result<(), fidl::Error> {
3891        let _result = self.send_raw(result);
3892        self.drop_without_shutdown();
3893        _result
3894    }
3895
3896    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3897        self.control_handle
3898            .inner
3899            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3900                result,
3901                self.tx_id,
3902                0x7b210bff219ac84e,
3903                fidl::encoding::DynamicFlags::empty(),
3904            )
3905    }
3906}
3907
3908#[must_use = "FIDL methods require a response to be sent"]
3909#[derive(Debug)]
3910pub struct GuestGetMemControllerResponder {
3911    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
3912    tx_id: u32,
3913}
3914
3915/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
3916/// if the responder is dropped without sending a response, so that the client
3917/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3918impl std::ops::Drop for GuestGetMemControllerResponder {
3919    fn drop(&mut self) {
3920        self.control_handle.shutdown();
3921        // Safety: drops once, never accessed again
3922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3923    }
3924}
3925
3926impl fidl::endpoints::Responder for GuestGetMemControllerResponder {
3927    type ControlHandle = GuestControlHandle;
3928
3929    fn control_handle(&self) -> &GuestControlHandle {
3930        &self.control_handle
3931    }
3932
3933    fn drop_without_shutdown(mut self) {
3934        // Safety: drops once, never accessed again due to mem::forget
3935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3936        // Prevent Drop from running (which would shut down the channel)
3937        std::mem::forget(self);
3938    }
3939}
3940
3941impl GuestGetMemControllerResponder {
3942    /// Sends a response to the FIDL transaction.
3943    ///
3944    /// Sets the channel to shutdown if an error occurs.
3945    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3946        let _result = self.send_raw(result);
3947        if _result.is_err() {
3948            self.control_handle.shutdown();
3949        }
3950        self.drop_without_shutdown();
3951        _result
3952    }
3953
3954    /// Similar to "send" but does not shutdown the channel if an error occurs.
3955    pub fn send_no_shutdown_on_err(
3956        self,
3957        mut result: Result<(), GuestError>,
3958    ) -> Result<(), fidl::Error> {
3959        let _result = self.send_raw(result);
3960        self.drop_without_shutdown();
3961        _result
3962    }
3963
3964    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3965        self.control_handle
3966            .inner
3967            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3968                result,
3969                self.tx_id,
3970                0x170b19f4b867a01c,
3971                fidl::encoding::DynamicFlags::empty(),
3972            )
3973    }
3974}
3975
3976#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3977pub struct GuestLifecycleMarker;
3978
3979impl fidl::endpoints::ProtocolMarker for GuestLifecycleMarker {
3980    type Proxy = GuestLifecycleProxy;
3981    type RequestStream = GuestLifecycleRequestStream;
3982    #[cfg(target_os = "fuchsia")]
3983    type SynchronousProxy = GuestLifecycleSynchronousProxy;
3984
3985    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestLifecycle";
3986}
3987impl fidl::endpoints::DiscoverableProtocolMarker for GuestLifecycleMarker {}
3988pub type GuestLifecycleCreateResult = Result<(), GuestError>;
3989pub type GuestLifecycleRunResult = Result<(), GuestError>;
3990
3991pub trait GuestLifecycleProxyInterface: Send + Sync {
3992    type CreateResponseFut: std::future::Future<Output = Result<GuestLifecycleCreateResult, fidl::Error>>
3993        + Send;
3994    fn r#create(&self, guest_config: GuestConfig) -> Self::CreateResponseFut;
3995    fn r#bind(&self, guest: fidl::endpoints::ServerEnd<GuestMarker>) -> Result<(), fidl::Error>;
3996    type RunResponseFut: std::future::Future<Output = Result<GuestLifecycleRunResult, fidl::Error>>
3997        + Send;
3998    fn r#run(&self) -> Self::RunResponseFut;
3999    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4000    fn r#stop(&self) -> Self::StopResponseFut;
4001}
4002#[derive(Debug)]
4003#[cfg(target_os = "fuchsia")]
4004pub struct GuestLifecycleSynchronousProxy {
4005    client: fidl::client::sync::Client,
4006}
4007
4008#[cfg(target_os = "fuchsia")]
4009impl fidl::endpoints::SynchronousProxy for GuestLifecycleSynchronousProxy {
4010    type Proxy = GuestLifecycleProxy;
4011    type Protocol = GuestLifecycleMarker;
4012
4013    fn from_channel(inner: fidl::Channel) -> Self {
4014        Self::new(inner)
4015    }
4016
4017    fn into_channel(self) -> fidl::Channel {
4018        self.client.into_channel()
4019    }
4020
4021    fn as_channel(&self) -> &fidl::Channel {
4022        self.client.as_channel()
4023    }
4024}
4025
4026#[cfg(target_os = "fuchsia")]
4027impl GuestLifecycleSynchronousProxy {
4028    pub fn new(channel: fidl::Channel) -> Self {
4029        let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4030        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4031    }
4032
4033    pub fn into_channel(self) -> fidl::Channel {
4034        self.client.into_channel()
4035    }
4036
4037    /// Waits until an event arrives and returns it. It is safe for other
4038    /// threads to make concurrent requests while waiting for an event.
4039    pub fn wait_for_event(
4040        &self,
4041        deadline: zx::MonotonicInstant,
4042    ) -> Result<GuestLifecycleEvent, fidl::Error> {
4043        GuestLifecycleEvent::decode(self.client.wait_for_event(deadline)?)
4044    }
4045
4046    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4047    /// the kernel without starting the VCPU or device dispatch loops.
4048    ///
4049    /// Possible errors:
4050    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4051    ///         recreated.
4052    ///
4053    /// All other errors are related to VMM initialization.
4054    pub fn r#create(
4055        &self,
4056        mut guest_config: GuestConfig,
4057        ___deadline: zx::MonotonicInstant,
4058    ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
4059        let _response = self.client.send_query::<
4060            GuestLifecycleCreateRequest,
4061            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4062        >(
4063            (&mut guest_config,),
4064            0x152719eed416ed41,
4065            fidl::encoding::DynamicFlags::empty(),
4066            ___deadline,
4067        )?;
4068        Ok(_response.map(|x| x))
4069    }
4070
4071    /// Binds to the Guest protocol for an initialized guest.
4072    ///
4073    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4074    /// will be immediately closed.
4075    pub fn r#bind(
4076        &self,
4077        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4078    ) -> Result<(), fidl::Error> {
4079        self.client.send::<GuestLifecycleBindRequest>(
4080            (guest,),
4081            0x57dd3e245f9598ed,
4082            fidl::encoding::DynamicFlags::empty(),
4083        )
4084    }
4085
4086    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4087    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4088    ///
4089    /// Possible errors:
4090    ///     - ALREADY_RUNING: The VMM has already been started.
4091    ///     - NOT_CREATED: Run was called before the VMM was created.
4092    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4093    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4094    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4095    pub fn r#run(
4096        &self,
4097        ___deadline: zx::MonotonicInstant,
4098    ) -> Result<GuestLifecycleRunResult, fidl::Error> {
4099        let _response = self.client.send_query::<
4100            fidl::encoding::EmptyPayload,
4101            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4102        >(
4103            (),
4104            0x2907fef2ac775657,
4105            fidl::encoding::DynamicFlags::empty(),
4106            ___deadline,
4107        )?;
4108        Ok(_response.map(|x| x))
4109    }
4110
4111    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4112    /// Create and then Run can be called again.
4113    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4114        let _response =
4115            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4116                (),
4117                0x27eef9c535ac8eb4,
4118                fidl::encoding::DynamicFlags::empty(),
4119                ___deadline,
4120            )?;
4121        Ok(_response)
4122    }
4123}
4124
4125#[cfg(target_os = "fuchsia")]
4126impl From<GuestLifecycleSynchronousProxy> for zx::NullableHandle {
4127    fn from(value: GuestLifecycleSynchronousProxy) -> Self {
4128        value.into_channel().into()
4129    }
4130}
4131
4132#[cfg(target_os = "fuchsia")]
4133impl From<fidl::Channel> for GuestLifecycleSynchronousProxy {
4134    fn from(value: fidl::Channel) -> Self {
4135        Self::new(value)
4136    }
4137}
4138
4139#[cfg(target_os = "fuchsia")]
4140impl fidl::endpoints::FromClient for GuestLifecycleSynchronousProxy {
4141    type Protocol = GuestLifecycleMarker;
4142
4143    fn from_client(value: fidl::endpoints::ClientEnd<GuestLifecycleMarker>) -> Self {
4144        Self::new(value.into_channel())
4145    }
4146}
4147
4148#[derive(Debug, Clone)]
4149pub struct GuestLifecycleProxy {
4150    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4151}
4152
4153impl fidl::endpoints::Proxy for GuestLifecycleProxy {
4154    type Protocol = GuestLifecycleMarker;
4155
4156    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4157        Self::new(inner)
4158    }
4159
4160    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4161        self.client.into_channel().map_err(|client| Self { client })
4162    }
4163
4164    fn as_channel(&self) -> &::fidl::AsyncChannel {
4165        self.client.as_channel()
4166    }
4167}
4168
4169impl GuestLifecycleProxy {
4170    /// Create a new Proxy for fuchsia.virtualization/GuestLifecycle.
4171    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4172        let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4173        Self { client: fidl::client::Client::new(channel, protocol_name) }
4174    }
4175
4176    /// Get a Stream of events from the remote end of the protocol.
4177    ///
4178    /// # Panics
4179    ///
4180    /// Panics if the event stream was already taken.
4181    pub fn take_event_stream(&self) -> GuestLifecycleEventStream {
4182        GuestLifecycleEventStream { event_receiver: self.client.take_event_receiver() }
4183    }
4184
4185    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4186    /// the kernel without starting the VCPU or device dispatch loops.
4187    ///
4188    /// Possible errors:
4189    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4190    ///         recreated.
4191    ///
4192    /// All other errors are related to VMM initialization.
4193    pub fn r#create(
4194        &self,
4195        mut guest_config: GuestConfig,
4196    ) -> fidl::client::QueryResponseFut<
4197        GuestLifecycleCreateResult,
4198        fidl::encoding::DefaultFuchsiaResourceDialect,
4199    > {
4200        GuestLifecycleProxyInterface::r#create(self, guest_config)
4201    }
4202
4203    /// Binds to the Guest protocol for an initialized guest.
4204    ///
4205    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4206    /// will be immediately closed.
4207    pub fn r#bind(
4208        &self,
4209        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4210    ) -> Result<(), fidl::Error> {
4211        GuestLifecycleProxyInterface::r#bind(self, guest)
4212    }
4213
4214    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4215    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4216    ///
4217    /// Possible errors:
4218    ///     - ALREADY_RUNING: The VMM has already been started.
4219    ///     - NOT_CREATED: Run was called before the VMM was created.
4220    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4221    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4222    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4223    pub fn r#run(
4224        &self,
4225    ) -> fidl::client::QueryResponseFut<
4226        GuestLifecycleRunResult,
4227        fidl::encoding::DefaultFuchsiaResourceDialect,
4228    > {
4229        GuestLifecycleProxyInterface::r#run(self)
4230    }
4231
4232    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4233    /// Create and then Run can be called again.
4234    pub fn r#stop(
4235        &self,
4236    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4237        GuestLifecycleProxyInterface::r#stop(self)
4238    }
4239}
4240
4241impl GuestLifecycleProxyInterface for GuestLifecycleProxy {
4242    type CreateResponseFut = fidl::client::QueryResponseFut<
4243        GuestLifecycleCreateResult,
4244        fidl::encoding::DefaultFuchsiaResourceDialect,
4245    >;
4246    fn r#create(&self, mut guest_config: GuestConfig) -> Self::CreateResponseFut {
4247        fn _decode(
4248            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4249        ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
4250            let _response = fidl::client::decode_transaction_body::<
4251                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4252                fidl::encoding::DefaultFuchsiaResourceDialect,
4253                0x152719eed416ed41,
4254            >(_buf?)?;
4255            Ok(_response.map(|x| x))
4256        }
4257        self.client
4258            .send_query_and_decode::<GuestLifecycleCreateRequest, GuestLifecycleCreateResult>(
4259                (&mut guest_config,),
4260                0x152719eed416ed41,
4261                fidl::encoding::DynamicFlags::empty(),
4262                _decode,
4263            )
4264    }
4265
4266    fn r#bind(
4267        &self,
4268        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
4269    ) -> Result<(), fidl::Error> {
4270        self.client.send::<GuestLifecycleBindRequest>(
4271            (guest,),
4272            0x57dd3e245f9598ed,
4273            fidl::encoding::DynamicFlags::empty(),
4274        )
4275    }
4276
4277    type RunResponseFut = fidl::client::QueryResponseFut<
4278        GuestLifecycleRunResult,
4279        fidl::encoding::DefaultFuchsiaResourceDialect,
4280    >;
4281    fn r#run(&self) -> Self::RunResponseFut {
4282        fn _decode(
4283            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4284        ) -> Result<GuestLifecycleRunResult, fidl::Error> {
4285            let _response = fidl::client::decode_transaction_body::<
4286                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
4287                fidl::encoding::DefaultFuchsiaResourceDialect,
4288                0x2907fef2ac775657,
4289            >(_buf?)?;
4290            Ok(_response.map(|x| x))
4291        }
4292        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestLifecycleRunResult>(
4293            (),
4294            0x2907fef2ac775657,
4295            fidl::encoding::DynamicFlags::empty(),
4296            _decode,
4297        )
4298    }
4299
4300    type StopResponseFut =
4301        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4302    fn r#stop(&self) -> Self::StopResponseFut {
4303        fn _decode(
4304            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4305        ) -> Result<(), fidl::Error> {
4306            let _response = fidl::client::decode_transaction_body::<
4307                fidl::encoding::EmptyPayload,
4308                fidl::encoding::DefaultFuchsiaResourceDialect,
4309                0x27eef9c535ac8eb4,
4310            >(_buf?)?;
4311            Ok(_response)
4312        }
4313        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4314            (),
4315            0x27eef9c535ac8eb4,
4316            fidl::encoding::DynamicFlags::empty(),
4317            _decode,
4318        )
4319    }
4320}
4321
4322pub struct GuestLifecycleEventStream {
4323    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4324}
4325
4326impl std::marker::Unpin for GuestLifecycleEventStream {}
4327
4328impl futures::stream::FusedStream for GuestLifecycleEventStream {
4329    fn is_terminated(&self) -> bool {
4330        self.event_receiver.is_terminated()
4331    }
4332}
4333
4334impl futures::Stream for GuestLifecycleEventStream {
4335    type Item = Result<GuestLifecycleEvent, fidl::Error>;
4336
4337    fn poll_next(
4338        mut self: std::pin::Pin<&mut Self>,
4339        cx: &mut std::task::Context<'_>,
4340    ) -> std::task::Poll<Option<Self::Item>> {
4341        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4342            &mut self.event_receiver,
4343            cx
4344        )?) {
4345            Some(buf) => std::task::Poll::Ready(Some(GuestLifecycleEvent::decode(buf))),
4346            None => std::task::Poll::Ready(None),
4347        }
4348    }
4349}
4350
4351#[derive(Debug)]
4352pub enum GuestLifecycleEvent {}
4353
4354impl GuestLifecycleEvent {
4355    /// Decodes a message buffer as a [`GuestLifecycleEvent`].
4356    fn decode(
4357        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4358    ) -> Result<GuestLifecycleEvent, fidl::Error> {
4359        let (bytes, _handles) = buf.split_mut();
4360        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4361        debug_assert_eq!(tx_header.tx_id, 0);
4362        match tx_header.ordinal {
4363            _ => Err(fidl::Error::UnknownOrdinal {
4364                ordinal: tx_header.ordinal,
4365                protocol_name:
4366                    <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4367            }),
4368        }
4369    }
4370}
4371
4372/// A Stream of incoming requests for fuchsia.virtualization/GuestLifecycle.
4373pub struct GuestLifecycleRequestStream {
4374    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4375    is_terminated: bool,
4376}
4377
4378impl std::marker::Unpin for GuestLifecycleRequestStream {}
4379
4380impl futures::stream::FusedStream for GuestLifecycleRequestStream {
4381    fn is_terminated(&self) -> bool {
4382        self.is_terminated
4383    }
4384}
4385
4386impl fidl::endpoints::RequestStream for GuestLifecycleRequestStream {
4387    type Protocol = GuestLifecycleMarker;
4388    type ControlHandle = GuestLifecycleControlHandle;
4389
4390    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4391        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4392    }
4393
4394    fn control_handle(&self) -> Self::ControlHandle {
4395        GuestLifecycleControlHandle { inner: self.inner.clone() }
4396    }
4397
4398    fn into_inner(
4399        self,
4400    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4401    {
4402        (self.inner, self.is_terminated)
4403    }
4404
4405    fn from_inner(
4406        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4407        is_terminated: bool,
4408    ) -> Self {
4409        Self { inner, is_terminated }
4410    }
4411}
4412
4413impl futures::Stream for GuestLifecycleRequestStream {
4414    type Item = Result<GuestLifecycleRequest, fidl::Error>;
4415
4416    fn poll_next(
4417        mut self: std::pin::Pin<&mut Self>,
4418        cx: &mut std::task::Context<'_>,
4419    ) -> std::task::Poll<Option<Self::Item>> {
4420        let this = &mut *self;
4421        if this.inner.check_shutdown(cx) {
4422            this.is_terminated = true;
4423            return std::task::Poll::Ready(None);
4424        }
4425        if this.is_terminated {
4426            panic!("polled GuestLifecycleRequestStream after completion");
4427        }
4428        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4429            |bytes, handles| {
4430                match this.inner.channel().read_etc(cx, bytes, handles) {
4431                    std::task::Poll::Ready(Ok(())) => {}
4432                    std::task::Poll::Pending => return std::task::Poll::Pending,
4433                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4434                        this.is_terminated = true;
4435                        return std::task::Poll::Ready(None);
4436                    }
4437                    std::task::Poll::Ready(Err(e)) => {
4438                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4439                            e.into(),
4440                        ))));
4441                    }
4442                }
4443
4444                // A message has been received from the channel
4445                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4446
4447                std::task::Poll::Ready(Some(match header.ordinal {
4448                    0x152719eed416ed41 => {
4449                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4450                        let mut req = fidl::new_empty!(
4451                            GuestLifecycleCreateRequest,
4452                            fidl::encoding::DefaultFuchsiaResourceDialect
4453                        );
4454                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4455                        let control_handle =
4456                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4457                        Ok(GuestLifecycleRequest::Create {
4458                            guest_config: req.guest_config,
4459
4460                            responder: GuestLifecycleCreateResponder {
4461                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4462                                tx_id: header.tx_id,
4463                            },
4464                        })
4465                    }
4466                    0x57dd3e245f9598ed => {
4467                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4468                        let mut req = fidl::new_empty!(
4469                            GuestLifecycleBindRequest,
4470                            fidl::encoding::DefaultFuchsiaResourceDialect
4471                        );
4472                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleBindRequest>(&header, _body_bytes, handles, &mut req)?;
4473                        let control_handle =
4474                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4475                        Ok(GuestLifecycleRequest::Bind { guest: req.guest, control_handle })
4476                    }
4477                    0x2907fef2ac775657 => {
4478                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4479                        let mut req = fidl::new_empty!(
4480                            fidl::encoding::EmptyPayload,
4481                            fidl::encoding::DefaultFuchsiaResourceDialect
4482                        );
4483                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4484                        let control_handle =
4485                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4486                        Ok(GuestLifecycleRequest::Run {
4487                            responder: GuestLifecycleRunResponder {
4488                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4489                                tx_id: header.tx_id,
4490                            },
4491                        })
4492                    }
4493                    0x27eef9c535ac8eb4 => {
4494                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4495                        let mut req = fidl::new_empty!(
4496                            fidl::encoding::EmptyPayload,
4497                            fidl::encoding::DefaultFuchsiaResourceDialect
4498                        );
4499                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4500                        let control_handle =
4501                            GuestLifecycleControlHandle { inner: this.inner.clone() };
4502                        Ok(GuestLifecycleRequest::Stop {
4503                            responder: GuestLifecycleStopResponder {
4504                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4505                                tx_id: header.tx_id,
4506                            },
4507                        })
4508                    }
4509                    _ => Err(fidl::Error::UnknownOrdinal {
4510                        ordinal: header.ordinal,
4511                        protocol_name:
4512                            <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4513                    }),
4514                }))
4515            },
4516        )
4517    }
4518}
4519
4520/// The guest control plane allowing for creating, starting, and stopping the guest.
4521#[derive(Debug)]
4522pub enum GuestLifecycleRequest {
4523    /// Create a VMM configured with the provided config. This instantiates all devices and loads
4524    /// the kernel without starting the VCPU or device dispatch loops.
4525    ///
4526    /// Possible errors:
4527    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
4528    ///         recreated.
4529    ///
4530    /// All other errors are related to VMM initialization.
4531    Create { guest_config: GuestConfig, responder: GuestLifecycleCreateResponder },
4532    /// Binds to the Guest protocol for an initialized guest.
4533    ///
4534    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
4535    /// will be immediately closed.
4536    Bind {
4537        guest: fidl::endpoints::ServerEnd<GuestMarker>,
4538        control_handle: GuestLifecycleControlHandle,
4539    },
4540    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
4541    /// running. On a clean shutdown (either guest or client initiated) this will return success.
4542    ///
4543    /// Possible errors:
4544    ///     - ALREADY_RUNING: The VMM has already been started.
4545    ///     - NOT_CREATED: Run was called before the VMM was created.
4546    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
4547    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
4548    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
4549    Run { responder: GuestLifecycleRunResponder },
4550    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
4551    /// Create and then Run can be called again.
4552    Stop { responder: GuestLifecycleStopResponder },
4553}
4554
4555impl GuestLifecycleRequest {
4556    #[allow(irrefutable_let_patterns)]
4557    pub fn into_create(self) -> Option<(GuestConfig, GuestLifecycleCreateResponder)> {
4558        if let GuestLifecycleRequest::Create { guest_config, responder } = self {
4559            Some((guest_config, responder))
4560        } else {
4561            None
4562        }
4563    }
4564
4565    #[allow(irrefutable_let_patterns)]
4566    pub fn into_bind(
4567        self,
4568    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestLifecycleControlHandle)> {
4569        if let GuestLifecycleRequest::Bind { guest, control_handle } = self {
4570            Some((guest, control_handle))
4571        } else {
4572            None
4573        }
4574    }
4575
4576    #[allow(irrefutable_let_patterns)]
4577    pub fn into_run(self) -> Option<(GuestLifecycleRunResponder)> {
4578        if let GuestLifecycleRequest::Run { responder } = self { Some((responder)) } else { None }
4579    }
4580
4581    #[allow(irrefutable_let_patterns)]
4582    pub fn into_stop(self) -> Option<(GuestLifecycleStopResponder)> {
4583        if let GuestLifecycleRequest::Stop { responder } = self { Some((responder)) } else { None }
4584    }
4585
4586    /// Name of the method defined in FIDL
4587    pub fn method_name(&self) -> &'static str {
4588        match *self {
4589            GuestLifecycleRequest::Create { .. } => "create",
4590            GuestLifecycleRequest::Bind { .. } => "bind",
4591            GuestLifecycleRequest::Run { .. } => "run",
4592            GuestLifecycleRequest::Stop { .. } => "stop",
4593        }
4594    }
4595}
4596
4597#[derive(Debug, Clone)]
4598pub struct GuestLifecycleControlHandle {
4599    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4600}
4601
4602impl fidl::endpoints::ControlHandle for GuestLifecycleControlHandle {
4603    fn shutdown(&self) {
4604        self.inner.shutdown()
4605    }
4606
4607    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4608        self.inner.shutdown_with_epitaph(status)
4609    }
4610
4611    fn is_closed(&self) -> bool {
4612        self.inner.channel().is_closed()
4613    }
4614    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4615        self.inner.channel().on_closed()
4616    }
4617
4618    #[cfg(target_os = "fuchsia")]
4619    fn signal_peer(
4620        &self,
4621        clear_mask: zx::Signals,
4622        set_mask: zx::Signals,
4623    ) -> Result<(), zx_status::Status> {
4624        use fidl::Peered;
4625        self.inner.channel().signal_peer(clear_mask, set_mask)
4626    }
4627}
4628
4629impl GuestLifecycleControlHandle {}
4630
4631#[must_use = "FIDL methods require a response to be sent"]
4632#[derive(Debug)]
4633pub struct GuestLifecycleCreateResponder {
4634    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4635    tx_id: u32,
4636}
4637
4638/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4639/// if the responder is dropped without sending a response, so that the client
4640/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4641impl std::ops::Drop for GuestLifecycleCreateResponder {
4642    fn drop(&mut self) {
4643        self.control_handle.shutdown();
4644        // Safety: drops once, never accessed again
4645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4646    }
4647}
4648
4649impl fidl::endpoints::Responder for GuestLifecycleCreateResponder {
4650    type ControlHandle = GuestLifecycleControlHandle;
4651
4652    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4653        &self.control_handle
4654    }
4655
4656    fn drop_without_shutdown(mut self) {
4657        // Safety: drops once, never accessed again due to mem::forget
4658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4659        // Prevent Drop from running (which would shut down the channel)
4660        std::mem::forget(self);
4661    }
4662}
4663
4664impl GuestLifecycleCreateResponder {
4665    /// Sends a response to the FIDL transaction.
4666    ///
4667    /// Sets the channel to shutdown if an error occurs.
4668    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4669        let _result = self.send_raw(result);
4670        if _result.is_err() {
4671            self.control_handle.shutdown();
4672        }
4673        self.drop_without_shutdown();
4674        _result
4675    }
4676
4677    /// Similar to "send" but does not shutdown the channel if an error occurs.
4678    pub fn send_no_shutdown_on_err(
4679        self,
4680        mut result: Result<(), GuestError>,
4681    ) -> Result<(), fidl::Error> {
4682        let _result = self.send_raw(result);
4683        self.drop_without_shutdown();
4684        _result
4685    }
4686
4687    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4688        self.control_handle
4689            .inner
4690            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
4691                result,
4692                self.tx_id,
4693                0x152719eed416ed41,
4694                fidl::encoding::DynamicFlags::empty(),
4695            )
4696    }
4697}
4698
4699#[must_use = "FIDL methods require a response to be sent"]
4700#[derive(Debug)]
4701pub struct GuestLifecycleRunResponder {
4702    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4703    tx_id: u32,
4704}
4705
4706/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4707/// if the responder is dropped without sending a response, so that the client
4708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4709impl std::ops::Drop for GuestLifecycleRunResponder {
4710    fn drop(&mut self) {
4711        self.control_handle.shutdown();
4712        // Safety: drops once, never accessed again
4713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4714    }
4715}
4716
4717impl fidl::endpoints::Responder for GuestLifecycleRunResponder {
4718    type ControlHandle = GuestLifecycleControlHandle;
4719
4720    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4721        &self.control_handle
4722    }
4723
4724    fn drop_without_shutdown(mut self) {
4725        // Safety: drops once, never accessed again due to mem::forget
4726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4727        // Prevent Drop from running (which would shut down the channel)
4728        std::mem::forget(self);
4729    }
4730}
4731
4732impl GuestLifecycleRunResponder {
4733    /// Sends a response to the FIDL transaction.
4734    ///
4735    /// Sets the channel to shutdown if an error occurs.
4736    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4737        let _result = self.send_raw(result);
4738        if _result.is_err() {
4739            self.control_handle.shutdown();
4740        }
4741        self.drop_without_shutdown();
4742        _result
4743    }
4744
4745    /// Similar to "send" but does not shutdown the channel if an error occurs.
4746    pub fn send_no_shutdown_on_err(
4747        self,
4748        mut result: Result<(), GuestError>,
4749    ) -> Result<(), fidl::Error> {
4750        let _result = self.send_raw(result);
4751        self.drop_without_shutdown();
4752        _result
4753    }
4754
4755    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
4756        self.control_handle
4757            .inner
4758            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
4759                result,
4760                self.tx_id,
4761                0x2907fef2ac775657,
4762                fidl::encoding::DynamicFlags::empty(),
4763            )
4764    }
4765}
4766
4767#[must_use = "FIDL methods require a response to be sent"]
4768#[derive(Debug)]
4769pub struct GuestLifecycleStopResponder {
4770    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
4771    tx_id: u32,
4772}
4773
4774/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
4775/// if the responder is dropped without sending a response, so that the client
4776/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4777impl std::ops::Drop for GuestLifecycleStopResponder {
4778    fn drop(&mut self) {
4779        self.control_handle.shutdown();
4780        // Safety: drops once, never accessed again
4781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4782    }
4783}
4784
4785impl fidl::endpoints::Responder for GuestLifecycleStopResponder {
4786    type ControlHandle = GuestLifecycleControlHandle;
4787
4788    fn control_handle(&self) -> &GuestLifecycleControlHandle {
4789        &self.control_handle
4790    }
4791
4792    fn drop_without_shutdown(mut self) {
4793        // Safety: drops once, never accessed again due to mem::forget
4794        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4795        // Prevent Drop from running (which would shut down the channel)
4796        std::mem::forget(self);
4797    }
4798}
4799
4800impl GuestLifecycleStopResponder {
4801    /// Sends a response to the FIDL transaction.
4802    ///
4803    /// Sets the channel to shutdown if an error occurs.
4804    pub fn send(self) -> Result<(), fidl::Error> {
4805        let _result = self.send_raw();
4806        if _result.is_err() {
4807            self.control_handle.shutdown();
4808        }
4809        self.drop_without_shutdown();
4810        _result
4811    }
4812
4813    /// Similar to "send" but does not shutdown the channel if an error occurs.
4814    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4815        let _result = self.send_raw();
4816        self.drop_without_shutdown();
4817        _result
4818    }
4819
4820    fn send_raw(&self) -> Result<(), fidl::Error> {
4821        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4822            (),
4823            self.tx_id,
4824            0x27eef9c535ac8eb4,
4825            fidl::encoding::DynamicFlags::empty(),
4826        )
4827    }
4828}
4829
4830#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4831pub struct GuestManagerMarker;
4832
4833impl fidl::endpoints::ProtocolMarker for GuestManagerMarker {
4834    type Proxy = GuestManagerProxy;
4835    type RequestStream = GuestManagerRequestStream;
4836    #[cfg(target_os = "fuchsia")]
4837    type SynchronousProxy = GuestManagerSynchronousProxy;
4838
4839    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestManager";
4840}
4841impl fidl::endpoints::DiscoverableProtocolMarker for GuestManagerMarker {}
4842pub type GuestManagerLaunchResult = Result<(), GuestManagerError>;
4843pub type GuestManagerConnectResult = Result<(), GuestManagerError>;
4844
4845pub trait GuestManagerProxyInterface: Send + Sync {
4846    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
4847        + Send;
4848    fn r#launch(
4849        &self,
4850        guest_config: GuestConfig,
4851        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4852    ) -> Self::LaunchResponseFut;
4853    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4854    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
4855    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
4856        + Send;
4857    fn r#connect(
4858        &self,
4859        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4860    ) -> Self::ConnectResponseFut;
4861    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
4862    fn r#get_info(&self) -> Self::GetInfoResponseFut;
4863}
4864#[derive(Debug)]
4865#[cfg(target_os = "fuchsia")]
4866pub struct GuestManagerSynchronousProxy {
4867    client: fidl::client::sync::Client,
4868}
4869
4870#[cfg(target_os = "fuchsia")]
4871impl fidl::endpoints::SynchronousProxy for GuestManagerSynchronousProxy {
4872    type Proxy = GuestManagerProxy;
4873    type Protocol = GuestManagerMarker;
4874
4875    fn from_channel(inner: fidl::Channel) -> Self {
4876        Self::new(inner)
4877    }
4878
4879    fn into_channel(self) -> fidl::Channel {
4880        self.client.into_channel()
4881    }
4882
4883    fn as_channel(&self) -> &fidl::Channel {
4884        self.client.as_channel()
4885    }
4886}
4887
4888#[cfg(target_os = "fuchsia")]
4889impl GuestManagerSynchronousProxy {
4890    pub fn new(channel: fidl::Channel) -> Self {
4891        let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4892        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4893    }
4894
4895    pub fn into_channel(self) -> fidl::Channel {
4896        self.client.into_channel()
4897    }
4898
4899    /// Waits until an event arrives and returns it. It is safe for other
4900    /// threads to make concurrent requests while waiting for an event.
4901    pub fn wait_for_event(
4902        &self,
4903        deadline: zx::MonotonicInstant,
4904    ) -> Result<GuestManagerEvent, fidl::Error> {
4905        GuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
4906    }
4907
4908    /// Launch a new guest instance.
4909    ///
4910    /// Possible errors:
4911    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
4912    ///         problems detected by the guest manager.
4913    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
4914    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
4915    ///         component logs for a more specific failure.
4916    pub fn r#launch(
4917        &self,
4918        mut guest_config: GuestConfig,
4919        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4920        ___deadline: zx::MonotonicInstant,
4921    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
4922        let _response =
4923            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
4924                fidl::encoding::EmptyStruct,
4925                GuestManagerError,
4926            >>(
4927                (&mut guest_config, controller),
4928                0x394a2e29f750323e,
4929                fidl::encoding::DynamicFlags::empty(),
4930                ___deadline,
4931            )?;
4932        Ok(_response.map(|x| x))
4933    }
4934
4935    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
4936    /// be used to launch another guest.
4937    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4938        let _response =
4939            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4940                (),
4941                0x3ad9a012982f872d,
4942                fidl::encoding::DynamicFlags::empty(),
4943                ___deadline,
4944            )?;
4945        Ok(_response)
4946    }
4947
4948    /// Connect to a currently running guest.
4949    ///
4950    /// Possible errors:
4951    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
4952    ///         has launched before attempting to reconnect.
4953    pub fn r#connect(
4954        &self,
4955        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4956        ___deadline: zx::MonotonicInstant,
4957    ) -> Result<GuestManagerConnectResult, fidl::Error> {
4958        let _response =
4959            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
4960                fidl::encoding::EmptyStruct,
4961                GuestManagerError,
4962            >>(
4963                (controller,),
4964                0x4e489076e3bb15b4,
4965                fidl::encoding::DynamicFlags::empty(),
4966                ___deadline,
4967            )?;
4968        Ok(_response.map(|x| x))
4969    }
4970
4971    /// Query guest info
4972    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
4973        let _response =
4974            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
4975                (),
4976                0x76892614aea695dc,
4977                fidl::encoding::DynamicFlags::empty(),
4978                ___deadline,
4979            )?;
4980        Ok(_response.guest_info)
4981    }
4982}
4983
4984#[cfg(target_os = "fuchsia")]
4985impl From<GuestManagerSynchronousProxy> for zx::NullableHandle {
4986    fn from(value: GuestManagerSynchronousProxy) -> Self {
4987        value.into_channel().into()
4988    }
4989}
4990
4991#[cfg(target_os = "fuchsia")]
4992impl From<fidl::Channel> for GuestManagerSynchronousProxy {
4993    fn from(value: fidl::Channel) -> Self {
4994        Self::new(value)
4995    }
4996}
4997
4998#[cfg(target_os = "fuchsia")]
4999impl fidl::endpoints::FromClient for GuestManagerSynchronousProxy {
5000    type Protocol = GuestManagerMarker;
5001
5002    fn from_client(value: fidl::endpoints::ClientEnd<GuestManagerMarker>) -> Self {
5003        Self::new(value.into_channel())
5004    }
5005}
5006
5007#[derive(Debug, Clone)]
5008pub struct GuestManagerProxy {
5009    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5010}
5011
5012impl fidl::endpoints::Proxy for GuestManagerProxy {
5013    type Protocol = GuestManagerMarker;
5014
5015    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5016        Self::new(inner)
5017    }
5018
5019    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5020        self.client.into_channel().map_err(|client| Self { client })
5021    }
5022
5023    fn as_channel(&self) -> &::fidl::AsyncChannel {
5024        self.client.as_channel()
5025    }
5026}
5027
5028impl GuestManagerProxy {
5029    /// Create a new Proxy for fuchsia.virtualization/GuestManager.
5030    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5031        let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5032        Self { client: fidl::client::Client::new(channel, protocol_name) }
5033    }
5034
5035    /// Get a Stream of events from the remote end of the protocol.
5036    ///
5037    /// # Panics
5038    ///
5039    /// Panics if the event stream was already taken.
5040    pub fn take_event_stream(&self) -> GuestManagerEventStream {
5041        GuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
5042    }
5043
5044    /// Launch a new guest instance.
5045    ///
5046    /// Possible errors:
5047    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
5048    ///         problems detected by the guest manager.
5049    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
5050    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
5051    ///         component logs for a more specific failure.
5052    pub fn r#launch(
5053        &self,
5054        mut guest_config: GuestConfig,
5055        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5056    ) -> fidl::client::QueryResponseFut<
5057        GuestManagerLaunchResult,
5058        fidl::encoding::DefaultFuchsiaResourceDialect,
5059    > {
5060        GuestManagerProxyInterface::r#launch(self, guest_config, controller)
5061    }
5062
5063    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
5064    /// be used to launch another guest.
5065    pub fn r#force_shutdown(
5066        &self,
5067    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5068        GuestManagerProxyInterface::r#force_shutdown(self)
5069    }
5070
5071    /// Connect to a currently running guest.
5072    ///
5073    /// Possible errors:
5074    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
5075    ///         has launched before attempting to reconnect.
5076    pub fn r#connect(
5077        &self,
5078        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5079    ) -> fidl::client::QueryResponseFut<
5080        GuestManagerConnectResult,
5081        fidl::encoding::DefaultFuchsiaResourceDialect,
5082    > {
5083        GuestManagerProxyInterface::r#connect(self, controller)
5084    }
5085
5086    /// Query guest info
5087    pub fn r#get_info(
5088        &self,
5089    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
5090    {
5091        GuestManagerProxyInterface::r#get_info(self)
5092    }
5093}
5094
5095impl GuestManagerProxyInterface for GuestManagerProxy {
5096    type LaunchResponseFut = fidl::client::QueryResponseFut<
5097        GuestManagerLaunchResult,
5098        fidl::encoding::DefaultFuchsiaResourceDialect,
5099    >;
5100    fn r#launch(
5101        &self,
5102        mut guest_config: GuestConfig,
5103        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5104    ) -> Self::LaunchResponseFut {
5105        fn _decode(
5106            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5107        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
5108            let _response = fidl::client::decode_transaction_body::<
5109                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
5110                fidl::encoding::DefaultFuchsiaResourceDialect,
5111                0x394a2e29f750323e,
5112            >(_buf?)?;
5113            Ok(_response.map(|x| x))
5114        }
5115        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
5116            (&mut guest_config, controller),
5117            0x394a2e29f750323e,
5118            fidl::encoding::DynamicFlags::empty(),
5119            _decode,
5120        )
5121    }
5122
5123    type ForceShutdownResponseFut =
5124        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5125    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
5126        fn _decode(
5127            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5128        ) -> Result<(), fidl::Error> {
5129            let _response = fidl::client::decode_transaction_body::<
5130                fidl::encoding::EmptyPayload,
5131                fidl::encoding::DefaultFuchsiaResourceDialect,
5132                0x3ad9a012982f872d,
5133            >(_buf?)?;
5134            Ok(_response)
5135        }
5136        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5137            (),
5138            0x3ad9a012982f872d,
5139            fidl::encoding::DynamicFlags::empty(),
5140            _decode,
5141        )
5142    }
5143
5144    type ConnectResponseFut = fidl::client::QueryResponseFut<
5145        GuestManagerConnectResult,
5146        fidl::encoding::DefaultFuchsiaResourceDialect,
5147    >;
5148    fn r#connect(
5149        &self,
5150        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
5151    ) -> Self::ConnectResponseFut {
5152        fn _decode(
5153            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5154        ) -> Result<GuestManagerConnectResult, fidl::Error> {
5155            let _response = fidl::client::decode_transaction_body::<
5156                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
5157                fidl::encoding::DefaultFuchsiaResourceDialect,
5158                0x4e489076e3bb15b4,
5159            >(_buf?)?;
5160            Ok(_response.map(|x| x))
5161        }
5162        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
5163            (controller,),
5164            0x4e489076e3bb15b4,
5165            fidl::encoding::DynamicFlags::empty(),
5166            _decode,
5167        )
5168    }
5169
5170    type GetInfoResponseFut =
5171        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
5172    fn r#get_info(&self) -> Self::GetInfoResponseFut {
5173        fn _decode(
5174            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5175        ) -> Result<GuestInfo, fidl::Error> {
5176            let _response = fidl::client::decode_transaction_body::<
5177                GuestManagerGetInfoResponse,
5178                fidl::encoding::DefaultFuchsiaResourceDialect,
5179                0x76892614aea695dc,
5180            >(_buf?)?;
5181            Ok(_response.guest_info)
5182        }
5183        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
5184            (),
5185            0x76892614aea695dc,
5186            fidl::encoding::DynamicFlags::empty(),
5187            _decode,
5188        )
5189    }
5190}
5191
5192pub struct GuestManagerEventStream {
5193    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5194}
5195
5196impl std::marker::Unpin for GuestManagerEventStream {}
5197
5198impl futures::stream::FusedStream for GuestManagerEventStream {
5199    fn is_terminated(&self) -> bool {
5200        self.event_receiver.is_terminated()
5201    }
5202}
5203
5204impl futures::Stream for GuestManagerEventStream {
5205    type Item = Result<GuestManagerEvent, fidl::Error>;
5206
5207    fn poll_next(
5208        mut self: std::pin::Pin<&mut Self>,
5209        cx: &mut std::task::Context<'_>,
5210    ) -> std::task::Poll<Option<Self::Item>> {
5211        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5212            &mut self.event_receiver,
5213            cx
5214        )?) {
5215            Some(buf) => std::task::Poll::Ready(Some(GuestManagerEvent::decode(buf))),
5216            None => std::task::Poll::Ready(None),
5217        }
5218    }
5219}
5220
5221#[derive(Debug)]
5222pub enum GuestManagerEvent {}
5223
5224impl GuestManagerEvent {
5225    /// Decodes a message buffer as a [`GuestManagerEvent`].
5226    fn decode(
5227        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5228    ) -> Result<GuestManagerEvent, fidl::Error> {
5229        let (bytes, _handles) = buf.split_mut();
5230        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5231        debug_assert_eq!(tx_header.tx_id, 0);
5232        match tx_header.ordinal {
5233            _ => Err(fidl::Error::UnknownOrdinal {
5234                ordinal: tx_header.ordinal,
5235                protocol_name: <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5236            }),
5237        }
5238    }
5239}
5240
5241/// A Stream of incoming requests for fuchsia.virtualization/GuestManager.
5242pub struct GuestManagerRequestStream {
5243    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5244    is_terminated: bool,
5245}
5246
5247impl std::marker::Unpin for GuestManagerRequestStream {}
5248
5249impl futures::stream::FusedStream for GuestManagerRequestStream {
5250    fn is_terminated(&self) -> bool {
5251        self.is_terminated
5252    }
5253}
5254
5255impl fidl::endpoints::RequestStream for GuestManagerRequestStream {
5256    type Protocol = GuestManagerMarker;
5257    type ControlHandle = GuestManagerControlHandle;
5258
5259    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5260        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5261    }
5262
5263    fn control_handle(&self) -> Self::ControlHandle {
5264        GuestManagerControlHandle { inner: self.inner.clone() }
5265    }
5266
5267    fn into_inner(
5268        self,
5269    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5270    {
5271        (self.inner, self.is_terminated)
5272    }
5273
5274    fn from_inner(
5275        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5276        is_terminated: bool,
5277    ) -> Self {
5278        Self { inner, is_terminated }
5279    }
5280}
5281
5282impl futures::Stream for GuestManagerRequestStream {
5283    type Item = Result<GuestManagerRequest, fidl::Error>;
5284
5285    fn poll_next(
5286        mut self: std::pin::Pin<&mut Self>,
5287        cx: &mut std::task::Context<'_>,
5288    ) -> std::task::Poll<Option<Self::Item>> {
5289        let this = &mut *self;
5290        if this.inner.check_shutdown(cx) {
5291            this.is_terminated = true;
5292            return std::task::Poll::Ready(None);
5293        }
5294        if this.is_terminated {
5295            panic!("polled GuestManagerRequestStream after completion");
5296        }
5297        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5298            |bytes, handles| {
5299                match this.inner.channel().read_etc(cx, bytes, handles) {
5300                    std::task::Poll::Ready(Ok(())) => {}
5301                    std::task::Poll::Pending => return std::task::Poll::Pending,
5302                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5303                        this.is_terminated = true;
5304                        return std::task::Poll::Ready(None);
5305                    }
5306                    std::task::Poll::Ready(Err(e)) => {
5307                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5308                            e.into(),
5309                        ))));
5310                    }
5311                }
5312
5313                // A message has been received from the channel
5314                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5315
5316                std::task::Poll::Ready(Some(match header.ordinal {
5317                    0x394a2e29f750323e => {
5318                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5319                        let mut req = fidl::new_empty!(
5320                            GuestManagerLaunchRequest,
5321                            fidl::encoding::DefaultFuchsiaResourceDialect
5322                        );
5323                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
5324                        let control_handle =
5325                            GuestManagerControlHandle { inner: this.inner.clone() };
5326                        Ok(GuestManagerRequest::Launch {
5327                            guest_config: req.guest_config,
5328                            controller: req.controller,
5329
5330                            responder: GuestManagerLaunchResponder {
5331                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5332                                tx_id: header.tx_id,
5333                            },
5334                        })
5335                    }
5336                    0x3ad9a012982f872d => {
5337                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5338                        let mut req = fidl::new_empty!(
5339                            fidl::encoding::EmptyPayload,
5340                            fidl::encoding::DefaultFuchsiaResourceDialect
5341                        );
5342                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5343                        let control_handle =
5344                            GuestManagerControlHandle { inner: this.inner.clone() };
5345                        Ok(GuestManagerRequest::ForceShutdown {
5346                            responder: GuestManagerForceShutdownResponder {
5347                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5348                                tx_id: header.tx_id,
5349                            },
5350                        })
5351                    }
5352                    0x4e489076e3bb15b4 => {
5353                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5354                        let mut req = fidl::new_empty!(
5355                            GuestManagerConnectRequest,
5356                            fidl::encoding::DefaultFuchsiaResourceDialect
5357                        );
5358                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5359                        let control_handle =
5360                            GuestManagerControlHandle { inner: this.inner.clone() };
5361                        Ok(GuestManagerRequest::Connect {
5362                            controller: req.controller,
5363
5364                            responder: GuestManagerConnectResponder {
5365                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5366                                tx_id: header.tx_id,
5367                            },
5368                        })
5369                    }
5370                    0x76892614aea695dc => {
5371                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5372                        let mut req = fidl::new_empty!(
5373                            fidl::encoding::EmptyPayload,
5374                            fidl::encoding::DefaultFuchsiaResourceDialect
5375                        );
5376                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5377                        let control_handle =
5378                            GuestManagerControlHandle { inner: this.inner.clone() };
5379                        Ok(GuestManagerRequest::GetInfo {
5380                            responder: GuestManagerGetInfoResponder {
5381                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5382                                tx_id: header.tx_id,
5383                            },
5384                        })
5385                    }
5386                    _ => Err(fidl::Error::UnknownOrdinal {
5387                        ordinal: header.ordinal,
5388                        protocol_name:
5389                            <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5390                    }),
5391                }))
5392            },
5393        )
5394    }
5395}
5396
5397#[derive(Debug)]
5398pub enum GuestManagerRequest {
5399    /// Launch a new guest instance.
5400    ///
5401    /// Possible errors:
5402    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
5403    ///         problems detected by the guest manager.
5404    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
5405    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
5406    ///         component logs for a more specific failure.
5407    Launch {
5408        guest_config: GuestConfig,
5409        controller: fidl::endpoints::ServerEnd<GuestMarker>,
5410        responder: GuestManagerLaunchResponder,
5411    },
5412    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
5413    /// be used to launch another guest.
5414    ForceShutdown { responder: GuestManagerForceShutdownResponder },
5415    /// Connect to a currently running guest.
5416    ///
5417    /// Possible errors:
5418    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
5419    ///         has launched before attempting to reconnect.
5420    Connect {
5421        controller: fidl::endpoints::ServerEnd<GuestMarker>,
5422        responder: GuestManagerConnectResponder,
5423    },
5424    /// Query guest info
5425    GetInfo { responder: GuestManagerGetInfoResponder },
5426}
5427
5428impl GuestManagerRequest {
5429    #[allow(irrefutable_let_patterns)]
5430    pub fn into_launch(
5431        self,
5432    ) -> Option<(GuestConfig, fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerLaunchResponder)>
5433    {
5434        if let GuestManagerRequest::Launch { guest_config, controller, responder } = self {
5435            Some((guest_config, controller, responder))
5436        } else {
5437            None
5438        }
5439    }
5440
5441    #[allow(irrefutable_let_patterns)]
5442    pub fn into_force_shutdown(self) -> Option<(GuestManagerForceShutdownResponder)> {
5443        if let GuestManagerRequest::ForceShutdown { responder } = self {
5444            Some((responder))
5445        } else {
5446            None
5447        }
5448    }
5449
5450    #[allow(irrefutable_let_patterns)]
5451    pub fn into_connect(
5452        self,
5453    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerConnectResponder)> {
5454        if let GuestManagerRequest::Connect { controller, responder } = self {
5455            Some((controller, responder))
5456        } else {
5457            None
5458        }
5459    }
5460
5461    #[allow(irrefutable_let_patterns)]
5462    pub fn into_get_info(self) -> Option<(GuestManagerGetInfoResponder)> {
5463        if let GuestManagerRequest::GetInfo { responder } = self { Some((responder)) } else { None }
5464    }
5465
5466    /// Name of the method defined in FIDL
5467    pub fn method_name(&self) -> &'static str {
5468        match *self {
5469            GuestManagerRequest::Launch { .. } => "launch",
5470            GuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
5471            GuestManagerRequest::Connect { .. } => "connect",
5472            GuestManagerRequest::GetInfo { .. } => "get_info",
5473        }
5474    }
5475}
5476
5477#[derive(Debug, Clone)]
5478pub struct GuestManagerControlHandle {
5479    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5480}
5481
5482impl fidl::endpoints::ControlHandle for GuestManagerControlHandle {
5483    fn shutdown(&self) {
5484        self.inner.shutdown()
5485    }
5486
5487    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5488        self.inner.shutdown_with_epitaph(status)
5489    }
5490
5491    fn is_closed(&self) -> bool {
5492        self.inner.channel().is_closed()
5493    }
5494    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5495        self.inner.channel().on_closed()
5496    }
5497
5498    #[cfg(target_os = "fuchsia")]
5499    fn signal_peer(
5500        &self,
5501        clear_mask: zx::Signals,
5502        set_mask: zx::Signals,
5503    ) -> Result<(), zx_status::Status> {
5504        use fidl::Peered;
5505        self.inner.channel().signal_peer(clear_mask, set_mask)
5506    }
5507}
5508
5509impl GuestManagerControlHandle {}
5510
5511#[must_use = "FIDL methods require a response to be sent"]
5512#[derive(Debug)]
5513pub struct GuestManagerLaunchResponder {
5514    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5515    tx_id: u32,
5516}
5517
5518/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5519/// if the responder is dropped without sending a response, so that the client
5520/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5521impl std::ops::Drop for GuestManagerLaunchResponder {
5522    fn drop(&mut self) {
5523        self.control_handle.shutdown();
5524        // Safety: drops once, never accessed again
5525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5526    }
5527}
5528
5529impl fidl::endpoints::Responder for GuestManagerLaunchResponder {
5530    type ControlHandle = GuestManagerControlHandle;
5531
5532    fn control_handle(&self) -> &GuestManagerControlHandle {
5533        &self.control_handle
5534    }
5535
5536    fn drop_without_shutdown(mut self) {
5537        // Safety: drops once, never accessed again due to mem::forget
5538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5539        // Prevent Drop from running (which would shut down the channel)
5540        std::mem::forget(self);
5541    }
5542}
5543
5544impl GuestManagerLaunchResponder {
5545    /// Sends a response to the FIDL transaction.
5546    ///
5547    /// Sets the channel to shutdown if an error occurs.
5548    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5549        let _result = self.send_raw(result);
5550        if _result.is_err() {
5551            self.control_handle.shutdown();
5552        }
5553        self.drop_without_shutdown();
5554        _result
5555    }
5556
5557    /// Similar to "send" but does not shutdown the channel if an error occurs.
5558    pub fn send_no_shutdown_on_err(
5559        self,
5560        mut result: Result<(), GuestManagerError>,
5561    ) -> Result<(), fidl::Error> {
5562        let _result = self.send_raw(result);
5563        self.drop_without_shutdown();
5564        _result
5565    }
5566
5567    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5568        self.control_handle.inner.send::<fidl::encoding::ResultType<
5569            fidl::encoding::EmptyStruct,
5570            GuestManagerError,
5571        >>(
5572            result,
5573            self.tx_id,
5574            0x394a2e29f750323e,
5575            fidl::encoding::DynamicFlags::empty(),
5576        )
5577    }
5578}
5579
5580#[must_use = "FIDL methods require a response to be sent"]
5581#[derive(Debug)]
5582pub struct GuestManagerForceShutdownResponder {
5583    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5584    tx_id: u32,
5585}
5586
5587/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5588/// if the responder is dropped without sending a response, so that the client
5589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5590impl std::ops::Drop for GuestManagerForceShutdownResponder {
5591    fn drop(&mut self) {
5592        self.control_handle.shutdown();
5593        // Safety: drops once, never accessed again
5594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5595    }
5596}
5597
5598impl fidl::endpoints::Responder for GuestManagerForceShutdownResponder {
5599    type ControlHandle = GuestManagerControlHandle;
5600
5601    fn control_handle(&self) -> &GuestManagerControlHandle {
5602        &self.control_handle
5603    }
5604
5605    fn drop_without_shutdown(mut self) {
5606        // Safety: drops once, never accessed again due to mem::forget
5607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5608        // Prevent Drop from running (which would shut down the channel)
5609        std::mem::forget(self);
5610    }
5611}
5612
5613impl GuestManagerForceShutdownResponder {
5614    /// Sends a response to the FIDL transaction.
5615    ///
5616    /// Sets the channel to shutdown if an error occurs.
5617    pub fn send(self) -> Result<(), fidl::Error> {
5618        let _result = self.send_raw();
5619        if _result.is_err() {
5620            self.control_handle.shutdown();
5621        }
5622        self.drop_without_shutdown();
5623        _result
5624    }
5625
5626    /// Similar to "send" but does not shutdown the channel if an error occurs.
5627    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5628        let _result = self.send_raw();
5629        self.drop_without_shutdown();
5630        _result
5631    }
5632
5633    fn send_raw(&self) -> Result<(), fidl::Error> {
5634        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5635            (),
5636            self.tx_id,
5637            0x3ad9a012982f872d,
5638            fidl::encoding::DynamicFlags::empty(),
5639        )
5640    }
5641}
5642
5643#[must_use = "FIDL methods require a response to be sent"]
5644#[derive(Debug)]
5645pub struct GuestManagerConnectResponder {
5646    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5647    tx_id: u32,
5648}
5649
5650/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5651/// if the responder is dropped without sending a response, so that the client
5652/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5653impl std::ops::Drop for GuestManagerConnectResponder {
5654    fn drop(&mut self) {
5655        self.control_handle.shutdown();
5656        // Safety: drops once, never accessed again
5657        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5658    }
5659}
5660
5661impl fidl::endpoints::Responder for GuestManagerConnectResponder {
5662    type ControlHandle = GuestManagerControlHandle;
5663
5664    fn control_handle(&self) -> &GuestManagerControlHandle {
5665        &self.control_handle
5666    }
5667
5668    fn drop_without_shutdown(mut self) {
5669        // Safety: drops once, never accessed again due to mem::forget
5670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5671        // Prevent Drop from running (which would shut down the channel)
5672        std::mem::forget(self);
5673    }
5674}
5675
5676impl GuestManagerConnectResponder {
5677    /// Sends a response to the FIDL transaction.
5678    ///
5679    /// Sets the channel to shutdown if an error occurs.
5680    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5681        let _result = self.send_raw(result);
5682        if _result.is_err() {
5683            self.control_handle.shutdown();
5684        }
5685        self.drop_without_shutdown();
5686        _result
5687    }
5688
5689    /// Similar to "send" but does not shutdown the channel if an error occurs.
5690    pub fn send_no_shutdown_on_err(
5691        self,
5692        mut result: Result<(), GuestManagerError>,
5693    ) -> Result<(), fidl::Error> {
5694        let _result = self.send_raw(result);
5695        self.drop_without_shutdown();
5696        _result
5697    }
5698
5699    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
5700        self.control_handle.inner.send::<fidl::encoding::ResultType<
5701            fidl::encoding::EmptyStruct,
5702            GuestManagerError,
5703        >>(
5704            result,
5705            self.tx_id,
5706            0x4e489076e3bb15b4,
5707            fidl::encoding::DynamicFlags::empty(),
5708        )
5709    }
5710}
5711
5712#[must_use = "FIDL methods require a response to be sent"]
5713#[derive(Debug)]
5714pub struct GuestManagerGetInfoResponder {
5715    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
5716    tx_id: u32,
5717}
5718
5719/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
5720/// if the responder is dropped without sending a response, so that the client
5721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5722impl std::ops::Drop for GuestManagerGetInfoResponder {
5723    fn drop(&mut self) {
5724        self.control_handle.shutdown();
5725        // Safety: drops once, never accessed again
5726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5727    }
5728}
5729
5730impl fidl::endpoints::Responder for GuestManagerGetInfoResponder {
5731    type ControlHandle = GuestManagerControlHandle;
5732
5733    fn control_handle(&self) -> &GuestManagerControlHandle {
5734        &self.control_handle
5735    }
5736
5737    fn drop_without_shutdown(mut self) {
5738        // Safety: drops once, never accessed again due to mem::forget
5739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5740        // Prevent Drop from running (which would shut down the channel)
5741        std::mem::forget(self);
5742    }
5743}
5744
5745impl GuestManagerGetInfoResponder {
5746    /// Sends a response to the FIDL transaction.
5747    ///
5748    /// Sets the channel to shutdown if an error occurs.
5749    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5750        let _result = self.send_raw(guest_info);
5751        if _result.is_err() {
5752            self.control_handle.shutdown();
5753        }
5754        self.drop_without_shutdown();
5755        _result
5756    }
5757
5758    /// Similar to "send" but does not shutdown the channel if an error occurs.
5759    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5760        let _result = self.send_raw(guest_info);
5761        self.drop_without_shutdown();
5762        _result
5763    }
5764
5765    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
5766        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
5767            (guest_info,),
5768            self.tx_id,
5769            0x76892614aea695dc,
5770            fidl::encoding::DynamicFlags::empty(),
5771        )
5772    }
5773}
5774
5775#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5776pub struct HostVsockAcceptorMarker;
5777
5778impl fidl::endpoints::ProtocolMarker for HostVsockAcceptorMarker {
5779    type Proxy = HostVsockAcceptorProxy;
5780    type RequestStream = HostVsockAcceptorRequestStream;
5781    #[cfg(target_os = "fuchsia")]
5782    type SynchronousProxy = HostVsockAcceptorSynchronousProxy;
5783
5784    const DEBUG_NAME: &'static str = "(anonymous) HostVsockAcceptor";
5785}
5786pub type HostVsockAcceptorAcceptResult = Result<fidl::Socket, i32>;
5787
5788pub trait HostVsockAcceptorProxyInterface: Send + Sync {
5789    type AcceptResponseFut: std::future::Future<Output = Result<HostVsockAcceptorAcceptResult, fidl::Error>>
5790        + Send;
5791    fn r#accept(&self, src_cid: u32, src_port: u32, port: u32) -> Self::AcceptResponseFut;
5792}
5793#[derive(Debug)]
5794#[cfg(target_os = "fuchsia")]
5795pub struct HostVsockAcceptorSynchronousProxy {
5796    client: fidl::client::sync::Client,
5797}
5798
5799#[cfg(target_os = "fuchsia")]
5800impl fidl::endpoints::SynchronousProxy for HostVsockAcceptorSynchronousProxy {
5801    type Proxy = HostVsockAcceptorProxy;
5802    type Protocol = HostVsockAcceptorMarker;
5803
5804    fn from_channel(inner: fidl::Channel) -> Self {
5805        Self::new(inner)
5806    }
5807
5808    fn into_channel(self) -> fidl::Channel {
5809        self.client.into_channel()
5810    }
5811
5812    fn as_channel(&self) -> &fidl::Channel {
5813        self.client.as_channel()
5814    }
5815}
5816
5817#[cfg(target_os = "fuchsia")]
5818impl HostVsockAcceptorSynchronousProxy {
5819    pub fn new(channel: fidl::Channel) -> Self {
5820        let protocol_name =
5821            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5822        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5823    }
5824
5825    pub fn into_channel(self) -> fidl::Channel {
5826        self.client.into_channel()
5827    }
5828
5829    /// Waits until an event arrives and returns it. It is safe for other
5830    /// threads to make concurrent requests while waiting for an event.
5831    pub fn wait_for_event(
5832        &self,
5833        deadline: zx::MonotonicInstant,
5834    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
5835        HostVsockAcceptorEvent::decode(self.client.wait_for_event(deadline)?)
5836    }
5837
5838    pub fn r#accept(
5839        &self,
5840        mut src_cid: u32,
5841        mut src_port: u32,
5842        mut port: u32,
5843        ___deadline: zx::MonotonicInstant,
5844    ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
5845        let _response = self.client.send_query::<
5846            HostVsockAcceptorAcceptRequest,
5847            fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
5848        >(
5849            (src_cid, src_port, port,),
5850            0x6996ed935beaa2d7,
5851            fidl::encoding::DynamicFlags::empty(),
5852            ___deadline,
5853        )?;
5854        Ok(_response.map(|x| x.socket))
5855    }
5856}
5857
5858#[cfg(target_os = "fuchsia")]
5859impl From<HostVsockAcceptorSynchronousProxy> for zx::NullableHandle {
5860    fn from(value: HostVsockAcceptorSynchronousProxy) -> Self {
5861        value.into_channel().into()
5862    }
5863}
5864
5865#[cfg(target_os = "fuchsia")]
5866impl From<fidl::Channel> for HostVsockAcceptorSynchronousProxy {
5867    fn from(value: fidl::Channel) -> Self {
5868        Self::new(value)
5869    }
5870}
5871
5872#[cfg(target_os = "fuchsia")]
5873impl fidl::endpoints::FromClient for HostVsockAcceptorSynchronousProxy {
5874    type Protocol = HostVsockAcceptorMarker;
5875
5876    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>) -> Self {
5877        Self::new(value.into_channel())
5878    }
5879}
5880
5881#[derive(Debug, Clone)]
5882pub struct HostVsockAcceptorProxy {
5883    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5884}
5885
5886impl fidl::endpoints::Proxy for HostVsockAcceptorProxy {
5887    type Protocol = HostVsockAcceptorMarker;
5888
5889    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5890        Self::new(inner)
5891    }
5892
5893    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5894        self.client.into_channel().map_err(|client| Self { client })
5895    }
5896
5897    fn as_channel(&self) -> &::fidl::AsyncChannel {
5898        self.client.as_channel()
5899    }
5900}
5901
5902impl HostVsockAcceptorProxy {
5903    /// Create a new Proxy for fuchsia.virtualization/HostVsockAcceptor.
5904    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5905        let protocol_name =
5906            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5907        Self { client: fidl::client::Client::new(channel, protocol_name) }
5908    }
5909
5910    /// Get a Stream of events from the remote end of the protocol.
5911    ///
5912    /// # Panics
5913    ///
5914    /// Panics if the event stream was already taken.
5915    pub fn take_event_stream(&self) -> HostVsockAcceptorEventStream {
5916        HostVsockAcceptorEventStream { event_receiver: self.client.take_event_receiver() }
5917    }
5918
5919    pub fn r#accept(
5920        &self,
5921        mut src_cid: u32,
5922        mut src_port: u32,
5923        mut port: u32,
5924    ) -> fidl::client::QueryResponseFut<
5925        HostVsockAcceptorAcceptResult,
5926        fidl::encoding::DefaultFuchsiaResourceDialect,
5927    > {
5928        HostVsockAcceptorProxyInterface::r#accept(self, src_cid, src_port, port)
5929    }
5930}
5931
5932impl HostVsockAcceptorProxyInterface for HostVsockAcceptorProxy {
5933    type AcceptResponseFut = fidl::client::QueryResponseFut<
5934        HostVsockAcceptorAcceptResult,
5935        fidl::encoding::DefaultFuchsiaResourceDialect,
5936    >;
5937    fn r#accept(
5938        &self,
5939        mut src_cid: u32,
5940        mut src_port: u32,
5941        mut port: u32,
5942    ) -> Self::AcceptResponseFut {
5943        fn _decode(
5944            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5945        ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
5946            let _response = fidl::client::decode_transaction_body::<
5947                fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
5948                fidl::encoding::DefaultFuchsiaResourceDialect,
5949                0x6996ed935beaa2d7,
5950            >(_buf?)?;
5951            Ok(_response.map(|x| x.socket))
5952        }
5953        self.client
5954            .send_query_and_decode::<HostVsockAcceptorAcceptRequest, HostVsockAcceptorAcceptResult>(
5955                (src_cid, src_port, port),
5956                0x6996ed935beaa2d7,
5957                fidl::encoding::DynamicFlags::empty(),
5958                _decode,
5959            )
5960    }
5961}
5962
5963pub struct HostVsockAcceptorEventStream {
5964    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5965}
5966
5967impl std::marker::Unpin for HostVsockAcceptorEventStream {}
5968
5969impl futures::stream::FusedStream for HostVsockAcceptorEventStream {
5970    fn is_terminated(&self) -> bool {
5971        self.event_receiver.is_terminated()
5972    }
5973}
5974
5975impl futures::Stream for HostVsockAcceptorEventStream {
5976    type Item = Result<HostVsockAcceptorEvent, fidl::Error>;
5977
5978    fn poll_next(
5979        mut self: std::pin::Pin<&mut Self>,
5980        cx: &mut std::task::Context<'_>,
5981    ) -> std::task::Poll<Option<Self::Item>> {
5982        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5983            &mut self.event_receiver,
5984            cx
5985        )?) {
5986            Some(buf) => std::task::Poll::Ready(Some(HostVsockAcceptorEvent::decode(buf))),
5987            None => std::task::Poll::Ready(None),
5988        }
5989    }
5990}
5991
5992#[derive(Debug)]
5993pub enum HostVsockAcceptorEvent {}
5994
5995impl HostVsockAcceptorEvent {
5996    /// Decodes a message buffer as a [`HostVsockAcceptorEvent`].
5997    fn decode(
5998        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5999    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
6000        let (bytes, _handles) = buf.split_mut();
6001        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6002        debug_assert_eq!(tx_header.tx_id, 0);
6003        match tx_header.ordinal {
6004            _ => Err(fidl::Error::UnknownOrdinal {
6005                ordinal: tx_header.ordinal,
6006                protocol_name:
6007                    <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6008            }),
6009        }
6010    }
6011}
6012
6013/// A Stream of incoming requests for fuchsia.virtualization/HostVsockAcceptor.
6014pub struct HostVsockAcceptorRequestStream {
6015    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6016    is_terminated: bool,
6017}
6018
6019impl std::marker::Unpin for HostVsockAcceptorRequestStream {}
6020
6021impl futures::stream::FusedStream for HostVsockAcceptorRequestStream {
6022    fn is_terminated(&self) -> bool {
6023        self.is_terminated
6024    }
6025}
6026
6027impl fidl::endpoints::RequestStream for HostVsockAcceptorRequestStream {
6028    type Protocol = HostVsockAcceptorMarker;
6029    type ControlHandle = HostVsockAcceptorControlHandle;
6030
6031    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6032        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6033    }
6034
6035    fn control_handle(&self) -> Self::ControlHandle {
6036        HostVsockAcceptorControlHandle { inner: self.inner.clone() }
6037    }
6038
6039    fn into_inner(
6040        self,
6041    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6042    {
6043        (self.inner, self.is_terminated)
6044    }
6045
6046    fn from_inner(
6047        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6048        is_terminated: bool,
6049    ) -> Self {
6050        Self { inner, is_terminated }
6051    }
6052}
6053
6054impl futures::Stream for HostVsockAcceptorRequestStream {
6055    type Item = Result<HostVsockAcceptorRequest, fidl::Error>;
6056
6057    fn poll_next(
6058        mut self: std::pin::Pin<&mut Self>,
6059        cx: &mut std::task::Context<'_>,
6060    ) -> std::task::Poll<Option<Self::Item>> {
6061        let this = &mut *self;
6062        if this.inner.check_shutdown(cx) {
6063            this.is_terminated = true;
6064            return std::task::Poll::Ready(None);
6065        }
6066        if this.is_terminated {
6067            panic!("polled HostVsockAcceptorRequestStream after completion");
6068        }
6069        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6070            |bytes, handles| {
6071                match this.inner.channel().read_etc(cx, bytes, handles) {
6072                    std::task::Poll::Ready(Ok(())) => {}
6073                    std::task::Poll::Pending => return std::task::Poll::Pending,
6074                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6075                        this.is_terminated = true;
6076                        return std::task::Poll::Ready(None);
6077                    }
6078                    std::task::Poll::Ready(Err(e)) => {
6079                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6080                            e.into(),
6081                        ))));
6082                    }
6083                }
6084
6085                // A message has been received from the channel
6086                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6087
6088                std::task::Poll::Ready(Some(match header.ordinal {
6089                    0x6996ed935beaa2d7 => {
6090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6091                        let mut req = fidl::new_empty!(
6092                            HostVsockAcceptorAcceptRequest,
6093                            fidl::encoding::DefaultFuchsiaResourceDialect
6094                        );
6095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockAcceptorAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
6096                        let control_handle =
6097                            HostVsockAcceptorControlHandle { inner: this.inner.clone() };
6098                        Ok(HostVsockAcceptorRequest::Accept {
6099                            src_cid: req.src_cid,
6100                            src_port: req.src_port,
6101                            port: req.port,
6102
6103                            responder: HostVsockAcceptorAcceptResponder {
6104                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6105                                tx_id: header.tx_id,
6106                            },
6107                        })
6108                    }
6109                    _ => Err(fidl::Error::UnknownOrdinal {
6110                        ordinal: header.ordinal,
6111                        protocol_name:
6112                            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6113                    }),
6114                }))
6115            },
6116        )
6117    }
6118}
6119
6120/// Exposed by a host capable of listening via vsocks. A variant of a
6121/// `GuestVsockAcceptor` that is responsible for creating the `socket` with which
6122/// to communicate.
6123#[derive(Debug)]
6124pub enum HostVsockAcceptorRequest {
6125    Accept { src_cid: u32, src_port: u32, port: u32, responder: HostVsockAcceptorAcceptResponder },
6126}
6127
6128impl HostVsockAcceptorRequest {
6129    #[allow(irrefutable_let_patterns)]
6130    pub fn into_accept(self) -> Option<(u32, u32, u32, HostVsockAcceptorAcceptResponder)> {
6131        if let HostVsockAcceptorRequest::Accept { src_cid, src_port, port, responder } = self {
6132            Some((src_cid, src_port, port, responder))
6133        } else {
6134            None
6135        }
6136    }
6137
6138    /// Name of the method defined in FIDL
6139    pub fn method_name(&self) -> &'static str {
6140        match *self {
6141            HostVsockAcceptorRequest::Accept { .. } => "accept",
6142        }
6143    }
6144}
6145
6146#[derive(Debug, Clone)]
6147pub struct HostVsockAcceptorControlHandle {
6148    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6149}
6150
6151impl fidl::endpoints::ControlHandle for HostVsockAcceptorControlHandle {
6152    fn shutdown(&self) {
6153        self.inner.shutdown()
6154    }
6155
6156    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6157        self.inner.shutdown_with_epitaph(status)
6158    }
6159
6160    fn is_closed(&self) -> bool {
6161        self.inner.channel().is_closed()
6162    }
6163    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6164        self.inner.channel().on_closed()
6165    }
6166
6167    #[cfg(target_os = "fuchsia")]
6168    fn signal_peer(
6169        &self,
6170        clear_mask: zx::Signals,
6171        set_mask: zx::Signals,
6172    ) -> Result<(), zx_status::Status> {
6173        use fidl::Peered;
6174        self.inner.channel().signal_peer(clear_mask, set_mask)
6175    }
6176}
6177
6178impl HostVsockAcceptorControlHandle {}
6179
6180#[must_use = "FIDL methods require a response to be sent"]
6181#[derive(Debug)]
6182pub struct HostVsockAcceptorAcceptResponder {
6183    control_handle: std::mem::ManuallyDrop<HostVsockAcceptorControlHandle>,
6184    tx_id: u32,
6185}
6186
6187/// Set the the channel to be shutdown (see [`HostVsockAcceptorControlHandle::shutdown`])
6188/// if the responder is dropped without sending a response, so that the client
6189/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6190impl std::ops::Drop for HostVsockAcceptorAcceptResponder {
6191    fn drop(&mut self) {
6192        self.control_handle.shutdown();
6193        // Safety: drops once, never accessed again
6194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6195    }
6196}
6197
6198impl fidl::endpoints::Responder for HostVsockAcceptorAcceptResponder {
6199    type ControlHandle = HostVsockAcceptorControlHandle;
6200
6201    fn control_handle(&self) -> &HostVsockAcceptorControlHandle {
6202        &self.control_handle
6203    }
6204
6205    fn drop_without_shutdown(mut self) {
6206        // Safety: drops once, never accessed again due to mem::forget
6207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6208        // Prevent Drop from running (which would shut down the channel)
6209        std::mem::forget(self);
6210    }
6211}
6212
6213impl HostVsockAcceptorAcceptResponder {
6214    /// Sends a response to the FIDL transaction.
6215    ///
6216    /// Sets the channel to shutdown if an error occurs.
6217    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6218        let _result = self.send_raw(result);
6219        if _result.is_err() {
6220            self.control_handle.shutdown();
6221        }
6222        self.drop_without_shutdown();
6223        _result
6224    }
6225
6226    /// Similar to "send" but does not shutdown the channel if an error occurs.
6227    pub fn send_no_shutdown_on_err(
6228        self,
6229        mut result: Result<fidl::Socket, i32>,
6230    ) -> Result<(), fidl::Error> {
6231        let _result = self.send_raw(result);
6232        self.drop_without_shutdown();
6233        _result
6234    }
6235
6236    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6237        self.control_handle
6238            .inner
6239            .send::<fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>>(
6240                result.map(|socket| (socket,)),
6241                self.tx_id,
6242                0x6996ed935beaa2d7,
6243                fidl::encoding::DynamicFlags::empty(),
6244            )
6245    }
6246}
6247
6248#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6249pub struct HostVsockEndpointMarker;
6250
6251impl fidl::endpoints::ProtocolMarker for HostVsockEndpointMarker {
6252    type Proxy = HostVsockEndpointProxy;
6253    type RequestStream = HostVsockEndpointRequestStream;
6254    #[cfg(target_os = "fuchsia")]
6255    type SynchronousProxy = HostVsockEndpointSynchronousProxy;
6256
6257    const DEBUG_NAME: &'static str = "fuchsia.virtualization.HostVsockEndpoint";
6258}
6259impl fidl::endpoints::DiscoverableProtocolMarker for HostVsockEndpointMarker {}
6260pub type HostVsockEndpointListenResult = Result<(), i32>;
6261pub type HostVsockEndpointConnectResult = Result<fidl::Socket, i32>;
6262
6263pub trait HostVsockEndpointProxyInterface: Send + Sync {
6264    type ListenResponseFut: std::future::Future<Output = Result<HostVsockEndpointListenResult, fidl::Error>>
6265        + Send;
6266    fn r#listen(
6267        &self,
6268        port: u32,
6269        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6270    ) -> Self::ListenResponseFut;
6271    type ConnectResponseFut: std::future::Future<Output = Result<HostVsockEndpointConnectResult, fidl::Error>>
6272        + Send;
6273    fn r#connect(&self, guest_port: u32) -> Self::ConnectResponseFut;
6274}
6275#[derive(Debug)]
6276#[cfg(target_os = "fuchsia")]
6277pub struct HostVsockEndpointSynchronousProxy {
6278    client: fidl::client::sync::Client,
6279}
6280
6281#[cfg(target_os = "fuchsia")]
6282impl fidl::endpoints::SynchronousProxy for HostVsockEndpointSynchronousProxy {
6283    type Proxy = HostVsockEndpointProxy;
6284    type Protocol = HostVsockEndpointMarker;
6285
6286    fn from_channel(inner: fidl::Channel) -> Self {
6287        Self::new(inner)
6288    }
6289
6290    fn into_channel(self) -> fidl::Channel {
6291        self.client.into_channel()
6292    }
6293
6294    fn as_channel(&self) -> &fidl::Channel {
6295        self.client.as_channel()
6296    }
6297}
6298
6299#[cfg(target_os = "fuchsia")]
6300impl HostVsockEndpointSynchronousProxy {
6301    pub fn new(channel: fidl::Channel) -> Self {
6302        let protocol_name =
6303            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6304        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6305    }
6306
6307    pub fn into_channel(self) -> fidl::Channel {
6308        self.client.into_channel()
6309    }
6310
6311    /// Waits until an event arrives and returns it. It is safe for other
6312    /// threads to make concurrent requests while waiting for an event.
6313    pub fn wait_for_event(
6314        &self,
6315        deadline: zx::MonotonicInstant,
6316    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
6317        HostVsockEndpointEvent::decode(self.client.wait_for_event(deadline)?)
6318    }
6319
6320    /// Instructs the device to listen for guest initiated connections to a given port by
6321    /// using `acceptor` when the guest creates a connection.
6322    ///
6323    /// Possible errors:
6324    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6325    pub fn r#listen(
6326        &self,
6327        mut port: u32,
6328        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6329        ___deadline: zx::MonotonicInstant,
6330    ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
6331        let _response = self
6332            .client
6333            .send_query::<Listener, fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6334                (port, acceptor),
6335                0xfd88f3b4767f2c7,
6336                fidl::encoding::DynamicFlags::empty(),
6337                ___deadline,
6338            )?;
6339        Ok(_response.map(|x| x))
6340    }
6341
6342    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6343    /// ephemeral host port.
6344    ///
6345    /// Possible errors:
6346    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6347    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6348    ///
6349    /// Other errors are related to socket creation, see
6350    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6351    pub fn r#connect(
6352        &self,
6353        mut guest_port: u32,
6354        ___deadline: zx::MonotonicInstant,
6355    ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
6356        let _response = self.client.send_query::<
6357            HostVsockEndpointConnectRequest,
6358            fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
6359        >(
6360            (guest_port,),
6361            0x4d12e10e946b43e4,
6362            fidl::encoding::DynamicFlags::empty(),
6363            ___deadline,
6364        )?;
6365        Ok(_response.map(|x| x.socket))
6366    }
6367}
6368
6369#[cfg(target_os = "fuchsia")]
6370impl From<HostVsockEndpointSynchronousProxy> for zx::NullableHandle {
6371    fn from(value: HostVsockEndpointSynchronousProxy) -> Self {
6372        value.into_channel().into()
6373    }
6374}
6375
6376#[cfg(target_os = "fuchsia")]
6377impl From<fidl::Channel> for HostVsockEndpointSynchronousProxy {
6378    fn from(value: fidl::Channel) -> Self {
6379        Self::new(value)
6380    }
6381}
6382
6383#[cfg(target_os = "fuchsia")]
6384impl fidl::endpoints::FromClient for HostVsockEndpointSynchronousProxy {
6385    type Protocol = HostVsockEndpointMarker;
6386
6387    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockEndpointMarker>) -> Self {
6388        Self::new(value.into_channel())
6389    }
6390}
6391
6392#[derive(Debug, Clone)]
6393pub struct HostVsockEndpointProxy {
6394    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6395}
6396
6397impl fidl::endpoints::Proxy for HostVsockEndpointProxy {
6398    type Protocol = HostVsockEndpointMarker;
6399
6400    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6401        Self::new(inner)
6402    }
6403
6404    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6405        self.client.into_channel().map_err(|client| Self { client })
6406    }
6407
6408    fn as_channel(&self) -> &::fidl::AsyncChannel {
6409        self.client.as_channel()
6410    }
6411}
6412
6413impl HostVsockEndpointProxy {
6414    /// Create a new Proxy for fuchsia.virtualization/HostVsockEndpoint.
6415    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6416        let protocol_name =
6417            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6418        Self { client: fidl::client::Client::new(channel, protocol_name) }
6419    }
6420
6421    /// Get a Stream of events from the remote end of the protocol.
6422    ///
6423    /// # Panics
6424    ///
6425    /// Panics if the event stream was already taken.
6426    pub fn take_event_stream(&self) -> HostVsockEndpointEventStream {
6427        HostVsockEndpointEventStream { event_receiver: self.client.take_event_receiver() }
6428    }
6429
6430    /// Instructs the device to listen for guest initiated connections to a given port by
6431    /// using `acceptor` when the guest creates a connection.
6432    ///
6433    /// Possible errors:
6434    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6435    pub fn r#listen(
6436        &self,
6437        mut port: u32,
6438        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6439    ) -> fidl::client::QueryResponseFut<
6440        HostVsockEndpointListenResult,
6441        fidl::encoding::DefaultFuchsiaResourceDialect,
6442    > {
6443        HostVsockEndpointProxyInterface::r#listen(self, port, acceptor)
6444    }
6445
6446    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6447    /// ephemeral host port.
6448    ///
6449    /// Possible errors:
6450    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6451    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6452    ///
6453    /// Other errors are related to socket creation, see
6454    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6455    pub fn r#connect(
6456        &self,
6457        mut guest_port: u32,
6458    ) -> fidl::client::QueryResponseFut<
6459        HostVsockEndpointConnectResult,
6460        fidl::encoding::DefaultFuchsiaResourceDialect,
6461    > {
6462        HostVsockEndpointProxyInterface::r#connect(self, guest_port)
6463    }
6464}
6465
6466impl HostVsockEndpointProxyInterface for HostVsockEndpointProxy {
6467    type ListenResponseFut = fidl::client::QueryResponseFut<
6468        HostVsockEndpointListenResult,
6469        fidl::encoding::DefaultFuchsiaResourceDialect,
6470    >;
6471    fn r#listen(
6472        &self,
6473        mut port: u32,
6474        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6475    ) -> Self::ListenResponseFut {
6476        fn _decode(
6477            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6478        ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
6479            let _response = fidl::client::decode_transaction_body::<
6480                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6481                fidl::encoding::DefaultFuchsiaResourceDialect,
6482                0xfd88f3b4767f2c7,
6483            >(_buf?)?;
6484            Ok(_response.map(|x| x))
6485        }
6486        self.client.send_query_and_decode::<Listener, HostVsockEndpointListenResult>(
6487            (port, acceptor),
6488            0xfd88f3b4767f2c7,
6489            fidl::encoding::DynamicFlags::empty(),
6490            _decode,
6491        )
6492    }
6493
6494    type ConnectResponseFut = fidl::client::QueryResponseFut<
6495        HostVsockEndpointConnectResult,
6496        fidl::encoding::DefaultFuchsiaResourceDialect,
6497    >;
6498    fn r#connect(&self, mut guest_port: u32) -> Self::ConnectResponseFut {
6499        fn _decode(
6500            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6501        ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
6502            let _response = fidl::client::decode_transaction_body::<
6503                fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
6504                fidl::encoding::DefaultFuchsiaResourceDialect,
6505                0x4d12e10e946b43e4,
6506            >(_buf?)?;
6507            Ok(_response.map(|x| x.socket))
6508        }
6509        self.client.send_query_and_decode::<
6510            HostVsockEndpointConnectRequest,
6511            HostVsockEndpointConnectResult,
6512        >(
6513            (guest_port,),
6514            0x4d12e10e946b43e4,
6515            fidl::encoding::DynamicFlags::empty(),
6516            _decode,
6517        )
6518    }
6519}
6520
6521pub struct HostVsockEndpointEventStream {
6522    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6523}
6524
6525impl std::marker::Unpin for HostVsockEndpointEventStream {}
6526
6527impl futures::stream::FusedStream for HostVsockEndpointEventStream {
6528    fn is_terminated(&self) -> bool {
6529        self.event_receiver.is_terminated()
6530    }
6531}
6532
6533impl futures::Stream for HostVsockEndpointEventStream {
6534    type Item = Result<HostVsockEndpointEvent, fidl::Error>;
6535
6536    fn poll_next(
6537        mut self: std::pin::Pin<&mut Self>,
6538        cx: &mut std::task::Context<'_>,
6539    ) -> std::task::Poll<Option<Self::Item>> {
6540        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6541            &mut self.event_receiver,
6542            cx
6543        )?) {
6544            Some(buf) => std::task::Poll::Ready(Some(HostVsockEndpointEvent::decode(buf))),
6545            None => std::task::Poll::Ready(None),
6546        }
6547    }
6548}
6549
6550#[derive(Debug)]
6551pub enum HostVsockEndpointEvent {}
6552
6553impl HostVsockEndpointEvent {
6554    /// Decodes a message buffer as a [`HostVsockEndpointEvent`].
6555    fn decode(
6556        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6557    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
6558        let (bytes, _handles) = buf.split_mut();
6559        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6560        debug_assert_eq!(tx_header.tx_id, 0);
6561        match tx_header.ordinal {
6562            _ => Err(fidl::Error::UnknownOrdinal {
6563                ordinal: tx_header.ordinal,
6564                protocol_name:
6565                    <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6566            }),
6567        }
6568    }
6569}
6570
6571/// A Stream of incoming requests for fuchsia.virtualization/HostVsockEndpoint.
6572pub struct HostVsockEndpointRequestStream {
6573    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6574    is_terminated: bool,
6575}
6576
6577impl std::marker::Unpin for HostVsockEndpointRequestStream {}
6578
6579impl futures::stream::FusedStream for HostVsockEndpointRequestStream {
6580    fn is_terminated(&self) -> bool {
6581        self.is_terminated
6582    }
6583}
6584
6585impl fidl::endpoints::RequestStream for HostVsockEndpointRequestStream {
6586    type Protocol = HostVsockEndpointMarker;
6587    type ControlHandle = HostVsockEndpointControlHandle;
6588
6589    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6590        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6591    }
6592
6593    fn control_handle(&self) -> Self::ControlHandle {
6594        HostVsockEndpointControlHandle { inner: self.inner.clone() }
6595    }
6596
6597    fn into_inner(
6598        self,
6599    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6600    {
6601        (self.inner, self.is_terminated)
6602    }
6603
6604    fn from_inner(
6605        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6606        is_terminated: bool,
6607    ) -> Self {
6608        Self { inner, is_terminated }
6609    }
6610}
6611
6612impl futures::Stream for HostVsockEndpointRequestStream {
6613    type Item = Result<HostVsockEndpointRequest, fidl::Error>;
6614
6615    fn poll_next(
6616        mut self: std::pin::Pin<&mut Self>,
6617        cx: &mut std::task::Context<'_>,
6618    ) -> std::task::Poll<Option<Self::Item>> {
6619        let this = &mut *self;
6620        if this.inner.check_shutdown(cx) {
6621            this.is_terminated = true;
6622            return std::task::Poll::Ready(None);
6623        }
6624        if this.is_terminated {
6625            panic!("polled HostVsockEndpointRequestStream after completion");
6626        }
6627        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6628            |bytes, handles| {
6629                match this.inner.channel().read_etc(cx, bytes, handles) {
6630                    std::task::Poll::Ready(Ok(())) => {}
6631                    std::task::Poll::Pending => return std::task::Poll::Pending,
6632                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6633                        this.is_terminated = true;
6634                        return std::task::Poll::Ready(None);
6635                    }
6636                    std::task::Poll::Ready(Err(e)) => {
6637                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6638                            e.into(),
6639                        ))));
6640                    }
6641                }
6642
6643                // A message has been received from the channel
6644                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6645
6646                std::task::Poll::Ready(Some(match header.ordinal {
6647                    0xfd88f3b4767f2c7 => {
6648                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6649                        let mut req = fidl::new_empty!(
6650                            Listener,
6651                            fidl::encoding::DefaultFuchsiaResourceDialect
6652                        );
6653                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Listener>(&header, _body_bytes, handles, &mut req)?;
6654                        let control_handle =
6655                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
6656                        Ok(HostVsockEndpointRequest::Listen {
6657                            port: req.port,
6658                            acceptor: req.acceptor,
6659
6660                            responder: HostVsockEndpointListenResponder {
6661                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6662                                tx_id: header.tx_id,
6663                            },
6664                        })
6665                    }
6666                    0x4d12e10e946b43e4 => {
6667                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6668                        let mut req = fidl::new_empty!(
6669                            HostVsockEndpointConnectRequest,
6670                            fidl::encoding::DefaultFuchsiaResourceDialect
6671                        );
6672                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockEndpointConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6673                        let control_handle =
6674                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
6675                        Ok(HostVsockEndpointRequest::Connect {
6676                            guest_port: req.guest_port,
6677
6678                            responder: HostVsockEndpointConnectResponder {
6679                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6680                                tx_id: header.tx_id,
6681                            },
6682                        })
6683                    }
6684                    _ => Err(fidl::Error::UnknownOrdinal {
6685                        ordinal: header.ordinal,
6686                        protocol_name:
6687                            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6688                    }),
6689                }))
6690            },
6691        )
6692    }
6693}
6694
6695/// Exposed by a host to provide the ability for listeners to be multiplexed by
6696/// port and to manage dynamic port allocation for outbound connections.
6697#[derive(Debug)]
6698pub enum HostVsockEndpointRequest {
6699    /// Instructs the device to listen for guest initiated connections to a given port by
6700    /// using `acceptor` when the guest creates a connection.
6701    ///
6702    /// Possible errors:
6703    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
6704    Listen {
6705        port: u32,
6706        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6707        responder: HostVsockEndpointListenResponder,
6708    },
6709    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
6710    /// ephemeral host port.
6711    ///
6712    /// Possible errors:
6713    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
6714    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
6715    ///
6716    /// Other errors are related to socket creation, see
6717    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
6718    Connect { guest_port: u32, responder: HostVsockEndpointConnectResponder },
6719}
6720
6721impl HostVsockEndpointRequest {
6722    #[allow(irrefutable_let_patterns)]
6723    pub fn into_listen(
6724        self,
6725    ) -> Option<(
6726        u32,
6727        fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
6728        HostVsockEndpointListenResponder,
6729    )> {
6730        if let HostVsockEndpointRequest::Listen { port, acceptor, responder } = self {
6731            Some((port, acceptor, responder))
6732        } else {
6733            None
6734        }
6735    }
6736
6737    #[allow(irrefutable_let_patterns)]
6738    pub fn into_connect(self) -> Option<(u32, HostVsockEndpointConnectResponder)> {
6739        if let HostVsockEndpointRequest::Connect { guest_port, responder } = self {
6740            Some((guest_port, responder))
6741        } else {
6742            None
6743        }
6744    }
6745
6746    /// Name of the method defined in FIDL
6747    pub fn method_name(&self) -> &'static str {
6748        match *self {
6749            HostVsockEndpointRequest::Listen { .. } => "listen",
6750            HostVsockEndpointRequest::Connect { .. } => "connect",
6751        }
6752    }
6753}
6754
6755#[derive(Debug, Clone)]
6756pub struct HostVsockEndpointControlHandle {
6757    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6758}
6759
6760impl fidl::endpoints::ControlHandle for HostVsockEndpointControlHandle {
6761    fn shutdown(&self) {
6762        self.inner.shutdown()
6763    }
6764
6765    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6766        self.inner.shutdown_with_epitaph(status)
6767    }
6768
6769    fn is_closed(&self) -> bool {
6770        self.inner.channel().is_closed()
6771    }
6772    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6773        self.inner.channel().on_closed()
6774    }
6775
6776    #[cfg(target_os = "fuchsia")]
6777    fn signal_peer(
6778        &self,
6779        clear_mask: zx::Signals,
6780        set_mask: zx::Signals,
6781    ) -> Result<(), zx_status::Status> {
6782        use fidl::Peered;
6783        self.inner.channel().signal_peer(clear_mask, set_mask)
6784    }
6785}
6786
6787impl HostVsockEndpointControlHandle {}
6788
6789#[must_use = "FIDL methods require a response to be sent"]
6790#[derive(Debug)]
6791pub struct HostVsockEndpointListenResponder {
6792    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
6793    tx_id: u32,
6794}
6795
6796/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
6797/// if the responder is dropped without sending a response, so that the client
6798/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6799impl std::ops::Drop for HostVsockEndpointListenResponder {
6800    fn drop(&mut self) {
6801        self.control_handle.shutdown();
6802        // Safety: drops once, never accessed again
6803        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6804    }
6805}
6806
6807impl fidl::endpoints::Responder for HostVsockEndpointListenResponder {
6808    type ControlHandle = HostVsockEndpointControlHandle;
6809
6810    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
6811        &self.control_handle
6812    }
6813
6814    fn drop_without_shutdown(mut self) {
6815        // Safety: drops once, never accessed again due to mem::forget
6816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6817        // Prevent Drop from running (which would shut down the channel)
6818        std::mem::forget(self);
6819    }
6820}
6821
6822impl HostVsockEndpointListenResponder {
6823    /// Sends a response to the FIDL transaction.
6824    ///
6825    /// Sets the channel to shutdown if an error occurs.
6826    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6827        let _result = self.send_raw(result);
6828        if _result.is_err() {
6829            self.control_handle.shutdown();
6830        }
6831        self.drop_without_shutdown();
6832        _result
6833    }
6834
6835    /// Similar to "send" but does not shutdown the channel if an error occurs.
6836    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6837        let _result = self.send_raw(result);
6838        self.drop_without_shutdown();
6839        _result
6840    }
6841
6842    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6843        self.control_handle
6844            .inner
6845            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6846                result,
6847                self.tx_id,
6848                0xfd88f3b4767f2c7,
6849                fidl::encoding::DynamicFlags::empty(),
6850            )
6851    }
6852}
6853
6854#[must_use = "FIDL methods require a response to be sent"]
6855#[derive(Debug)]
6856pub struct HostVsockEndpointConnectResponder {
6857    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
6858    tx_id: u32,
6859}
6860
6861/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
6862/// if the responder is dropped without sending a response, so that the client
6863/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6864impl std::ops::Drop for HostVsockEndpointConnectResponder {
6865    fn drop(&mut self) {
6866        self.control_handle.shutdown();
6867        // Safety: drops once, never accessed again
6868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6869    }
6870}
6871
6872impl fidl::endpoints::Responder for HostVsockEndpointConnectResponder {
6873    type ControlHandle = HostVsockEndpointControlHandle;
6874
6875    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
6876        &self.control_handle
6877    }
6878
6879    fn drop_without_shutdown(mut self) {
6880        // Safety: drops once, never accessed again due to mem::forget
6881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6882        // Prevent Drop from running (which would shut down the channel)
6883        std::mem::forget(self);
6884    }
6885}
6886
6887impl HostVsockEndpointConnectResponder {
6888    /// Sends a response to the FIDL transaction.
6889    ///
6890    /// Sets the channel to shutdown if an error occurs.
6891    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6892        let _result = self.send_raw(result);
6893        if _result.is_err() {
6894            self.control_handle.shutdown();
6895        }
6896        self.drop_without_shutdown();
6897        _result
6898    }
6899
6900    /// Similar to "send" but does not shutdown the channel if an error occurs.
6901    pub fn send_no_shutdown_on_err(
6902        self,
6903        mut result: Result<fidl::Socket, i32>,
6904    ) -> Result<(), fidl::Error> {
6905        let _result = self.send_raw(result);
6906        self.drop_without_shutdown();
6907        _result
6908    }
6909
6910    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
6911        self.control_handle
6912            .inner
6913            .send::<fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>>(
6914                result.map(|socket| (socket,)),
6915                self.tx_id,
6916                0x4d12e10e946b43e4,
6917                fidl::encoding::DynamicFlags::empty(),
6918            )
6919    }
6920}
6921
6922#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6923pub struct LinuxManagerMarker;
6924
6925impl fidl::endpoints::ProtocolMarker for LinuxManagerMarker {
6926    type Proxy = LinuxManagerProxy;
6927    type RequestStream = LinuxManagerRequestStream;
6928    #[cfg(target_os = "fuchsia")]
6929    type SynchronousProxy = LinuxManagerSynchronousProxy;
6930
6931    const DEBUG_NAME: &'static str = "fuchsia.virtualization.LinuxManager";
6932}
6933impl fidl::endpoints::DiscoverableProtocolMarker for LinuxManagerMarker {}
6934pub type LinuxManagerStartAndGetLinuxGuestInfoResult = Result<LinuxGuestInfo, i32>;
6935pub type LinuxManagerWipeDataResult = Result<(), i32>;
6936
6937pub trait LinuxManagerProxyInterface: Send + Sync {
6938    type StartAndGetLinuxGuestInfoResponseFut: std::future::Future<
6939            Output = Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error>,
6940        > + Send;
6941    fn r#start_and_get_linux_guest_info(
6942        &self,
6943        label: &str,
6944    ) -> Self::StartAndGetLinuxGuestInfoResponseFut;
6945    type WipeDataResponseFut: std::future::Future<Output = Result<LinuxManagerWipeDataResult, fidl::Error>>
6946        + Send;
6947    fn r#wipe_data(&self) -> Self::WipeDataResponseFut;
6948    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error>;
6949}
6950#[derive(Debug)]
6951#[cfg(target_os = "fuchsia")]
6952pub struct LinuxManagerSynchronousProxy {
6953    client: fidl::client::sync::Client,
6954}
6955
6956#[cfg(target_os = "fuchsia")]
6957impl fidl::endpoints::SynchronousProxy for LinuxManagerSynchronousProxy {
6958    type Proxy = LinuxManagerProxy;
6959    type Protocol = LinuxManagerMarker;
6960
6961    fn from_channel(inner: fidl::Channel) -> Self {
6962        Self::new(inner)
6963    }
6964
6965    fn into_channel(self) -> fidl::Channel {
6966        self.client.into_channel()
6967    }
6968
6969    fn as_channel(&self) -> &fidl::Channel {
6970        self.client.as_channel()
6971    }
6972}
6973
6974#[cfg(target_os = "fuchsia")]
6975impl LinuxManagerSynchronousProxy {
6976    pub fn new(channel: fidl::Channel) -> Self {
6977        let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6978        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6979    }
6980
6981    pub fn into_channel(self) -> fidl::Channel {
6982        self.client.into_channel()
6983    }
6984
6985    /// Waits until an event arrives and returns it. It is safe for other
6986    /// threads to make concurrent requests while waiting for an event.
6987    pub fn wait_for_event(
6988        &self,
6989        deadline: zx::MonotonicInstant,
6990    ) -> Result<LinuxManagerEvent, fidl::Error> {
6991        LinuxManagerEvent::decode(self.client.wait_for_event(deadline)?)
6992    }
6993
6994    /// Get Linux guest environment info.
6995    ///
6996    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
6997    pub fn r#start_and_get_linux_guest_info(
6998        &self,
6999        mut label: &str,
7000        ___deadline: zx::MonotonicInstant,
7001    ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
7002        let _response = self.client.send_query::<
7003            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7004            fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
7005        >(
7006            (label,),
7007            0x11809ced100a2bea,
7008            fidl::encoding::DynamicFlags::empty(),
7009            ___deadline,
7010        )?;
7011        Ok(_response.map(|x| x.info))
7012    }
7013
7014    /// Clears the stateful data. This includes any installed containers and any user data
7015    /// they may contain.
7016    ///
7017    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7018    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7019    /// operation.
7020    pub fn r#wipe_data(
7021        &self,
7022        ___deadline: zx::MonotonicInstant,
7023    ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
7024        let _response = self.client.send_query::<
7025            fidl::encoding::EmptyPayload,
7026            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7027        >(
7028            (),
7029            0x732c69394548a76a,
7030            fidl::encoding::DynamicFlags::empty(),
7031            ___deadline,
7032        )?;
7033        Ok(_response.map(|x| x))
7034    }
7035
7036    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7037    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7038    /// the epitaph) before attempting to launch another guest.
7039    ///
7040    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7041    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7042    /// a component crash).
7043    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7044        self.client.send::<fidl::encoding::EmptyPayload>(
7045            (),
7046            0x5dab12b50bc9909d,
7047            fidl::encoding::DynamicFlags::empty(),
7048        )
7049    }
7050}
7051
7052#[cfg(target_os = "fuchsia")]
7053impl From<LinuxManagerSynchronousProxy> for zx::NullableHandle {
7054    fn from(value: LinuxManagerSynchronousProxy) -> Self {
7055        value.into_channel().into()
7056    }
7057}
7058
7059#[cfg(target_os = "fuchsia")]
7060impl From<fidl::Channel> for LinuxManagerSynchronousProxy {
7061    fn from(value: fidl::Channel) -> Self {
7062        Self::new(value)
7063    }
7064}
7065
7066#[cfg(target_os = "fuchsia")]
7067impl fidl::endpoints::FromClient for LinuxManagerSynchronousProxy {
7068    type Protocol = LinuxManagerMarker;
7069
7070    fn from_client(value: fidl::endpoints::ClientEnd<LinuxManagerMarker>) -> Self {
7071        Self::new(value.into_channel())
7072    }
7073}
7074
7075#[derive(Debug, Clone)]
7076pub struct LinuxManagerProxy {
7077    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7078}
7079
7080impl fidl::endpoints::Proxy for LinuxManagerProxy {
7081    type Protocol = LinuxManagerMarker;
7082
7083    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7084        Self::new(inner)
7085    }
7086
7087    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7088        self.client.into_channel().map_err(|client| Self { client })
7089    }
7090
7091    fn as_channel(&self) -> &::fidl::AsyncChannel {
7092        self.client.as_channel()
7093    }
7094}
7095
7096impl LinuxManagerProxy {
7097    /// Create a new Proxy for fuchsia.virtualization/LinuxManager.
7098    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7099        let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7100        Self { client: fidl::client::Client::new(channel, protocol_name) }
7101    }
7102
7103    /// Get a Stream of events from the remote end of the protocol.
7104    ///
7105    /// # Panics
7106    ///
7107    /// Panics if the event stream was already taken.
7108    pub fn take_event_stream(&self) -> LinuxManagerEventStream {
7109        LinuxManagerEventStream { event_receiver: self.client.take_event_receiver() }
7110    }
7111
7112    /// Get Linux guest environment info.
7113    ///
7114    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
7115    pub fn r#start_and_get_linux_guest_info(
7116        &self,
7117        mut label: &str,
7118    ) -> fidl::client::QueryResponseFut<
7119        LinuxManagerStartAndGetLinuxGuestInfoResult,
7120        fidl::encoding::DefaultFuchsiaResourceDialect,
7121    > {
7122        LinuxManagerProxyInterface::r#start_and_get_linux_guest_info(self, label)
7123    }
7124
7125    /// Clears the stateful data. This includes any installed containers and any user data
7126    /// they may contain.
7127    ///
7128    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7129    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7130    /// operation.
7131    pub fn r#wipe_data(
7132        &self,
7133    ) -> fidl::client::QueryResponseFut<
7134        LinuxManagerWipeDataResult,
7135        fidl::encoding::DefaultFuchsiaResourceDialect,
7136    > {
7137        LinuxManagerProxyInterface::r#wipe_data(self)
7138    }
7139
7140    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7141    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7142    /// the epitaph) before attempting to launch another guest.
7143    ///
7144    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7145    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7146    /// a component crash).
7147    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7148        LinuxManagerProxyInterface::r#graceful_shutdown(self)
7149    }
7150}
7151
7152impl LinuxManagerProxyInterface for LinuxManagerProxy {
7153    type StartAndGetLinuxGuestInfoResponseFut = fidl::client::QueryResponseFut<
7154        LinuxManagerStartAndGetLinuxGuestInfoResult,
7155        fidl::encoding::DefaultFuchsiaResourceDialect,
7156    >;
7157    fn r#start_and_get_linux_guest_info(
7158        &self,
7159        mut label: &str,
7160    ) -> Self::StartAndGetLinuxGuestInfoResponseFut {
7161        fn _decode(
7162            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7163        ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
7164            let _response = fidl::client::decode_transaction_body::<
7165                fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
7166                fidl::encoding::DefaultFuchsiaResourceDialect,
7167                0x11809ced100a2bea,
7168            >(_buf?)?;
7169            Ok(_response.map(|x| x.info))
7170        }
7171        self.client.send_query_and_decode::<
7172            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7173            LinuxManagerStartAndGetLinuxGuestInfoResult,
7174        >(
7175            (label,),
7176            0x11809ced100a2bea,
7177            fidl::encoding::DynamicFlags::empty(),
7178            _decode,
7179        )
7180    }
7181
7182    type WipeDataResponseFut = fidl::client::QueryResponseFut<
7183        LinuxManagerWipeDataResult,
7184        fidl::encoding::DefaultFuchsiaResourceDialect,
7185    >;
7186    fn r#wipe_data(&self) -> Self::WipeDataResponseFut {
7187        fn _decode(
7188            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7189        ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
7190            let _response = fidl::client::decode_transaction_body::<
7191                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7192                fidl::encoding::DefaultFuchsiaResourceDialect,
7193                0x732c69394548a76a,
7194            >(_buf?)?;
7195            Ok(_response.map(|x| x))
7196        }
7197        self.client
7198            .send_query_and_decode::<fidl::encoding::EmptyPayload, LinuxManagerWipeDataResult>(
7199                (),
7200                0x732c69394548a76a,
7201                fidl::encoding::DynamicFlags::empty(),
7202                _decode,
7203            )
7204    }
7205
7206    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
7207        self.client.send::<fidl::encoding::EmptyPayload>(
7208            (),
7209            0x5dab12b50bc9909d,
7210            fidl::encoding::DynamicFlags::empty(),
7211        )
7212    }
7213}
7214
7215pub struct LinuxManagerEventStream {
7216    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7217}
7218
7219impl std::marker::Unpin for LinuxManagerEventStream {}
7220
7221impl futures::stream::FusedStream for LinuxManagerEventStream {
7222    fn is_terminated(&self) -> bool {
7223        self.event_receiver.is_terminated()
7224    }
7225}
7226
7227impl futures::Stream for LinuxManagerEventStream {
7228    type Item = Result<LinuxManagerEvent, fidl::Error>;
7229
7230    fn poll_next(
7231        mut self: std::pin::Pin<&mut Self>,
7232        cx: &mut std::task::Context<'_>,
7233    ) -> std::task::Poll<Option<Self::Item>> {
7234        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7235            &mut self.event_receiver,
7236            cx
7237        )?) {
7238            Some(buf) => std::task::Poll::Ready(Some(LinuxManagerEvent::decode(buf))),
7239            None => std::task::Poll::Ready(None),
7240        }
7241    }
7242}
7243
7244#[derive(Debug)]
7245pub enum LinuxManagerEvent {
7246    OnGuestInfoChanged { label: String, info: LinuxGuestInfo },
7247}
7248
7249impl LinuxManagerEvent {
7250    #[allow(irrefutable_let_patterns)]
7251    pub fn into_on_guest_info_changed(self) -> Option<(String, LinuxGuestInfo)> {
7252        if let LinuxManagerEvent::OnGuestInfoChanged { label, info } = self {
7253            Some((label, info))
7254        } else {
7255            None
7256        }
7257    }
7258
7259    /// Decodes a message buffer as a [`LinuxManagerEvent`].
7260    fn decode(
7261        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7262    ) -> Result<LinuxManagerEvent, fidl::Error> {
7263        let (bytes, _handles) = buf.split_mut();
7264        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7265        debug_assert_eq!(tx_header.tx_id, 0);
7266        match tx_header.ordinal {
7267            0x30a9be4c43d6a2d6 => {
7268                let mut out = fidl::new_empty!(
7269                    LinuxManagerOnGuestInfoChangedRequest,
7270                    fidl::encoding::DefaultFuchsiaResourceDialect
7271                );
7272                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerOnGuestInfoChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7273                Ok((LinuxManagerEvent::OnGuestInfoChanged { label: out.label, info: out.info }))
7274            }
7275            _ => Err(fidl::Error::UnknownOrdinal {
7276                ordinal: tx_header.ordinal,
7277                protocol_name: <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7278            }),
7279        }
7280    }
7281}
7282
7283/// A Stream of incoming requests for fuchsia.virtualization/LinuxManager.
7284pub struct LinuxManagerRequestStream {
7285    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7286    is_terminated: bool,
7287}
7288
7289impl std::marker::Unpin for LinuxManagerRequestStream {}
7290
7291impl futures::stream::FusedStream for LinuxManagerRequestStream {
7292    fn is_terminated(&self) -> bool {
7293        self.is_terminated
7294    }
7295}
7296
7297impl fidl::endpoints::RequestStream for LinuxManagerRequestStream {
7298    type Protocol = LinuxManagerMarker;
7299    type ControlHandle = LinuxManagerControlHandle;
7300
7301    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7302        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7303    }
7304
7305    fn control_handle(&self) -> Self::ControlHandle {
7306        LinuxManagerControlHandle { inner: self.inner.clone() }
7307    }
7308
7309    fn into_inner(
7310        self,
7311    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7312    {
7313        (self.inner, self.is_terminated)
7314    }
7315
7316    fn from_inner(
7317        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7318        is_terminated: bool,
7319    ) -> Self {
7320        Self { inner, is_terminated }
7321    }
7322}
7323
7324impl futures::Stream for LinuxManagerRequestStream {
7325    type Item = Result<LinuxManagerRequest, fidl::Error>;
7326
7327    fn poll_next(
7328        mut self: std::pin::Pin<&mut Self>,
7329        cx: &mut std::task::Context<'_>,
7330    ) -> std::task::Poll<Option<Self::Item>> {
7331        let this = &mut *self;
7332        if this.inner.check_shutdown(cx) {
7333            this.is_terminated = true;
7334            return std::task::Poll::Ready(None);
7335        }
7336        if this.is_terminated {
7337            panic!("polled LinuxManagerRequestStream after completion");
7338        }
7339        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7340            |bytes, handles| {
7341                match this.inner.channel().read_etc(cx, bytes, handles) {
7342                    std::task::Poll::Ready(Ok(())) => {}
7343                    std::task::Poll::Pending => return std::task::Poll::Pending,
7344                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7345                        this.is_terminated = true;
7346                        return std::task::Poll::Ready(None);
7347                    }
7348                    std::task::Poll::Ready(Err(e)) => {
7349                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7350                            e.into(),
7351                        ))));
7352                    }
7353                }
7354
7355                // A message has been received from the channel
7356                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7357
7358                std::task::Poll::Ready(Some(match header.ordinal {
7359                    0x11809ced100a2bea => {
7360                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7361                        let mut req = fidl::new_empty!(
7362                            LinuxManagerStartAndGetLinuxGuestInfoRequest,
7363                            fidl::encoding::DefaultFuchsiaResourceDialect
7364                        );
7365                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(&header, _body_bytes, handles, &mut req)?;
7366                        let control_handle =
7367                            LinuxManagerControlHandle { inner: this.inner.clone() };
7368                        Ok(LinuxManagerRequest::StartAndGetLinuxGuestInfo {
7369                            label: req.label,
7370
7371                            responder: LinuxManagerStartAndGetLinuxGuestInfoResponder {
7372                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7373                                tx_id: header.tx_id,
7374                            },
7375                        })
7376                    }
7377                    0x732c69394548a76a => {
7378                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7379                        let mut req = fidl::new_empty!(
7380                            fidl::encoding::EmptyPayload,
7381                            fidl::encoding::DefaultFuchsiaResourceDialect
7382                        );
7383                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7384                        let control_handle =
7385                            LinuxManagerControlHandle { inner: this.inner.clone() };
7386                        Ok(LinuxManagerRequest::WipeData {
7387                            responder: LinuxManagerWipeDataResponder {
7388                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7389                                tx_id: header.tx_id,
7390                            },
7391                        })
7392                    }
7393                    0x5dab12b50bc9909d => {
7394                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7395                        let mut req = fidl::new_empty!(
7396                            fidl::encoding::EmptyPayload,
7397                            fidl::encoding::DefaultFuchsiaResourceDialect
7398                        );
7399                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7400                        let control_handle =
7401                            LinuxManagerControlHandle { inner: this.inner.clone() };
7402                        Ok(LinuxManagerRequest::GracefulShutdown { control_handle })
7403                    }
7404                    _ => Err(fidl::Error::UnknownOrdinal {
7405                        ordinal: header.ordinal,
7406                        protocol_name:
7407                            <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7408                    }),
7409                }))
7410            },
7411        )
7412    }
7413}
7414
7415/// A `LinuxManager` provides access to the status of Linux guest instances.
7416#[derive(Debug)]
7417pub enum LinuxManagerRequest {
7418    /// Get Linux guest environment info.
7419    ///
7420    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
7421    StartAndGetLinuxGuestInfo {
7422        label: String,
7423        responder: LinuxManagerStartAndGetLinuxGuestInfoResponder,
7424    },
7425    /// Clears the stateful data. This includes any installed containers and any user data
7426    /// they may contain.
7427    ///
7428    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
7429    /// Returns ZX_ERR_IO if there was an IO failure while performing the
7430    /// operation.
7431    WipeData { responder: LinuxManagerWipeDataResponder },
7432    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
7433    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
7434    /// the epitaph) before attempting to launch another guest.
7435    ///
7436    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
7437    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
7438    /// a component crash).
7439    GracefulShutdown { control_handle: LinuxManagerControlHandle },
7440}
7441
7442impl LinuxManagerRequest {
7443    #[allow(irrefutable_let_patterns)]
7444    pub fn into_start_and_get_linux_guest_info(
7445        self,
7446    ) -> Option<(String, LinuxManagerStartAndGetLinuxGuestInfoResponder)> {
7447        if let LinuxManagerRequest::StartAndGetLinuxGuestInfo { label, responder } = self {
7448            Some((label, responder))
7449        } else {
7450            None
7451        }
7452    }
7453
7454    #[allow(irrefutable_let_patterns)]
7455    pub fn into_wipe_data(self) -> Option<(LinuxManagerWipeDataResponder)> {
7456        if let LinuxManagerRequest::WipeData { responder } = self {
7457            Some((responder))
7458        } else {
7459            None
7460        }
7461    }
7462
7463    #[allow(irrefutable_let_patterns)]
7464    pub fn into_graceful_shutdown(self) -> Option<(LinuxManagerControlHandle)> {
7465        if let LinuxManagerRequest::GracefulShutdown { control_handle } = self {
7466            Some((control_handle))
7467        } else {
7468            None
7469        }
7470    }
7471
7472    /// Name of the method defined in FIDL
7473    pub fn method_name(&self) -> &'static str {
7474        match *self {
7475            LinuxManagerRequest::StartAndGetLinuxGuestInfo { .. } => {
7476                "start_and_get_linux_guest_info"
7477            }
7478            LinuxManagerRequest::WipeData { .. } => "wipe_data",
7479            LinuxManagerRequest::GracefulShutdown { .. } => "graceful_shutdown",
7480        }
7481    }
7482}
7483
7484#[derive(Debug, Clone)]
7485pub struct LinuxManagerControlHandle {
7486    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7487}
7488
7489impl fidl::endpoints::ControlHandle for LinuxManagerControlHandle {
7490    fn shutdown(&self) {
7491        self.inner.shutdown()
7492    }
7493
7494    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7495        self.inner.shutdown_with_epitaph(status)
7496    }
7497
7498    fn is_closed(&self) -> bool {
7499        self.inner.channel().is_closed()
7500    }
7501    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7502        self.inner.channel().on_closed()
7503    }
7504
7505    #[cfg(target_os = "fuchsia")]
7506    fn signal_peer(
7507        &self,
7508        clear_mask: zx::Signals,
7509        set_mask: zx::Signals,
7510    ) -> Result<(), zx_status::Status> {
7511        use fidl::Peered;
7512        self.inner.channel().signal_peer(clear_mask, set_mask)
7513    }
7514}
7515
7516impl LinuxManagerControlHandle {
7517    pub fn send_on_guest_info_changed(
7518        &self,
7519        mut label: &str,
7520        mut info: &LinuxGuestInfo,
7521    ) -> Result<(), fidl::Error> {
7522        self.inner.send::<LinuxManagerOnGuestInfoChangedRequest>(
7523            (label, info),
7524            0,
7525            0x30a9be4c43d6a2d6,
7526            fidl::encoding::DynamicFlags::empty(),
7527        )
7528    }
7529}
7530
7531#[must_use = "FIDL methods require a response to be sent"]
7532#[derive(Debug)]
7533pub struct LinuxManagerStartAndGetLinuxGuestInfoResponder {
7534    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
7535    tx_id: u32,
7536}
7537
7538/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
7539/// if the responder is dropped without sending a response, so that the client
7540/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7541impl std::ops::Drop for LinuxManagerStartAndGetLinuxGuestInfoResponder {
7542    fn drop(&mut self) {
7543        self.control_handle.shutdown();
7544        // Safety: drops once, never accessed again
7545        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7546    }
7547}
7548
7549impl fidl::endpoints::Responder for LinuxManagerStartAndGetLinuxGuestInfoResponder {
7550    type ControlHandle = LinuxManagerControlHandle;
7551
7552    fn control_handle(&self) -> &LinuxManagerControlHandle {
7553        &self.control_handle
7554    }
7555
7556    fn drop_without_shutdown(mut self) {
7557        // Safety: drops once, never accessed again due to mem::forget
7558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7559        // Prevent Drop from running (which would shut down the channel)
7560        std::mem::forget(self);
7561    }
7562}
7563
7564impl LinuxManagerStartAndGetLinuxGuestInfoResponder {
7565    /// Sends a response to the FIDL transaction.
7566    ///
7567    /// Sets the channel to shutdown if an error occurs.
7568    pub fn send(self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
7569        let _result = self.send_raw(result);
7570        if _result.is_err() {
7571            self.control_handle.shutdown();
7572        }
7573        self.drop_without_shutdown();
7574        _result
7575    }
7576
7577    /// Similar to "send" but does not shutdown the channel if an error occurs.
7578    pub fn send_no_shutdown_on_err(
7579        self,
7580        mut result: Result<&LinuxGuestInfo, i32>,
7581    ) -> Result<(), fidl::Error> {
7582        let _result = self.send_raw(result);
7583        self.drop_without_shutdown();
7584        _result
7585    }
7586
7587    fn send_raw(&self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
7588        self.control_handle.inner.send::<fidl::encoding::ResultType<
7589            LinuxManagerStartAndGetLinuxGuestInfoResponse,
7590            i32,
7591        >>(
7592            result.map(|info| (info,)),
7593            self.tx_id,
7594            0x11809ced100a2bea,
7595            fidl::encoding::DynamicFlags::empty(),
7596        )
7597    }
7598}
7599
7600#[must_use = "FIDL methods require a response to be sent"]
7601#[derive(Debug)]
7602pub struct LinuxManagerWipeDataResponder {
7603    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
7604    tx_id: u32,
7605}
7606
7607/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
7608/// if the responder is dropped without sending a response, so that the client
7609/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7610impl std::ops::Drop for LinuxManagerWipeDataResponder {
7611    fn drop(&mut self) {
7612        self.control_handle.shutdown();
7613        // Safety: drops once, never accessed again
7614        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7615    }
7616}
7617
7618impl fidl::endpoints::Responder for LinuxManagerWipeDataResponder {
7619    type ControlHandle = LinuxManagerControlHandle;
7620
7621    fn control_handle(&self) -> &LinuxManagerControlHandle {
7622        &self.control_handle
7623    }
7624
7625    fn drop_without_shutdown(mut self) {
7626        // Safety: drops once, never accessed again due to mem::forget
7627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7628        // Prevent Drop from running (which would shut down the channel)
7629        std::mem::forget(self);
7630    }
7631}
7632
7633impl LinuxManagerWipeDataResponder {
7634    /// Sends a response to the FIDL transaction.
7635    ///
7636    /// Sets the channel to shutdown if an error occurs.
7637    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7638        let _result = self.send_raw(result);
7639        if _result.is_err() {
7640            self.control_handle.shutdown();
7641        }
7642        self.drop_without_shutdown();
7643        _result
7644    }
7645
7646    /// Similar to "send" but does not shutdown the channel if an error occurs.
7647    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7648        let _result = self.send_raw(result);
7649        self.drop_without_shutdown();
7650        _result
7651    }
7652
7653    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7654        self.control_handle
7655            .inner
7656            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7657                result,
7658                self.tx_id,
7659                0x732c69394548a76a,
7660                fidl::encoding::DynamicFlags::empty(),
7661            )
7662    }
7663}
7664
7665#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7666pub struct MemControllerMarker;
7667
7668impl fidl::endpoints::ProtocolMarker for MemControllerMarker {
7669    type Proxy = MemControllerProxy;
7670    type RequestStream = MemControllerRequestStream;
7671    #[cfg(target_os = "fuchsia")]
7672    type SynchronousProxy = MemControllerSynchronousProxy;
7673
7674    const DEBUG_NAME: &'static str = "fuchsia.virtualization.MemController";
7675}
7676impl fidl::endpoints::DiscoverableProtocolMarker for MemControllerMarker {}
7677
7678pub trait MemControllerProxyInterface: Send + Sync {
7679    type GetMemSizeResponseFut: std::future::Future<Output = Result<(u64, u64, u64, u64, u64), fidl::Error>>
7680        + Send;
7681    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut;
7682    fn r#request_size(&self, requested_size: u64) -> Result<(), fidl::Error>;
7683}
7684#[derive(Debug)]
7685#[cfg(target_os = "fuchsia")]
7686pub struct MemControllerSynchronousProxy {
7687    client: fidl::client::sync::Client,
7688}
7689
7690#[cfg(target_os = "fuchsia")]
7691impl fidl::endpoints::SynchronousProxy for MemControllerSynchronousProxy {
7692    type Proxy = MemControllerProxy;
7693    type Protocol = MemControllerMarker;
7694
7695    fn from_channel(inner: fidl::Channel) -> Self {
7696        Self::new(inner)
7697    }
7698
7699    fn into_channel(self) -> fidl::Channel {
7700        self.client.into_channel()
7701    }
7702
7703    fn as_channel(&self) -> &fidl::Channel {
7704        self.client.as_channel()
7705    }
7706}
7707
7708#[cfg(target_os = "fuchsia")]
7709impl MemControllerSynchronousProxy {
7710    pub fn new(channel: fidl::Channel) -> Self {
7711        let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7712        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7713    }
7714
7715    pub fn into_channel(self) -> fidl::Channel {
7716        self.client.into_channel()
7717    }
7718
7719    /// Waits until an event arrives and returns it. It is safe for other
7720    /// threads to make concurrent requests while waiting for an event.
7721    pub fn wait_for_event(
7722        &self,
7723        deadline: zx::MonotonicInstant,
7724    ) -> Result<MemControllerEvent, fidl::Error> {
7725        MemControllerEvent::decode(self.client.wait_for_event(deadline)?)
7726    }
7727
7728    /// Get the configured region size, usable region size, plugged size and requestd size
7729    ///
7730    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
7731    /// region_size is the size of device-managed memory region in bytes. Cannot change.
7732    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
7733    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
7734    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
7735    /// memory region.
7736    /// requested_size is the requested amount of plugged memory within the usable device-managed
7737    /// memory region.
7738    pub fn r#get_mem_size(
7739        &self,
7740        ___deadline: zx::MonotonicInstant,
7741    ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
7742        let _response = self
7743            .client
7744            .send_query::<fidl::encoding::EmptyPayload, MemControllerGetMemSizeResponse>(
7745                (),
7746                0x6e9d496f9b66ea56,
7747                fidl::encoding::DynamicFlags::empty(),
7748                ___deadline,
7749            )?;
7750        Ok((
7751            _response.block_size,
7752            _response.region_size,
7753            _response.usable_region_size,
7754            _response.plugged_size,
7755            _response.requested_size,
7756        ))
7757    }
7758
7759    /// Update the requested size to plug or unplug memory
7760    ///
7761    /// The driver SHOULD react to resize requests from the device (requested_size in the device
7762    /// configuration changed) by (un)plugging memory blocks.
7763    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7764        self.client.send::<MemControllerRequestSizeRequest>(
7765            (requested_size,),
7766            0x12f8e2cc21ee8102,
7767            fidl::encoding::DynamicFlags::empty(),
7768        )
7769    }
7770}
7771
7772#[cfg(target_os = "fuchsia")]
7773impl From<MemControllerSynchronousProxy> for zx::NullableHandle {
7774    fn from(value: MemControllerSynchronousProxy) -> Self {
7775        value.into_channel().into()
7776    }
7777}
7778
7779#[cfg(target_os = "fuchsia")]
7780impl From<fidl::Channel> for MemControllerSynchronousProxy {
7781    fn from(value: fidl::Channel) -> Self {
7782        Self::new(value)
7783    }
7784}
7785
7786#[cfg(target_os = "fuchsia")]
7787impl fidl::endpoints::FromClient for MemControllerSynchronousProxy {
7788    type Protocol = MemControllerMarker;
7789
7790    fn from_client(value: fidl::endpoints::ClientEnd<MemControllerMarker>) -> Self {
7791        Self::new(value.into_channel())
7792    }
7793}
7794
7795#[derive(Debug, Clone)]
7796pub struct MemControllerProxy {
7797    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7798}
7799
7800impl fidl::endpoints::Proxy for MemControllerProxy {
7801    type Protocol = MemControllerMarker;
7802
7803    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7804        Self::new(inner)
7805    }
7806
7807    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7808        self.client.into_channel().map_err(|client| Self { client })
7809    }
7810
7811    fn as_channel(&self) -> &::fidl::AsyncChannel {
7812        self.client.as_channel()
7813    }
7814}
7815
7816impl MemControllerProxy {
7817    /// Create a new Proxy for fuchsia.virtualization/MemController.
7818    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7819        let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7820        Self { client: fidl::client::Client::new(channel, protocol_name) }
7821    }
7822
7823    /// Get a Stream of events from the remote end of the protocol.
7824    ///
7825    /// # Panics
7826    ///
7827    /// Panics if the event stream was already taken.
7828    pub fn take_event_stream(&self) -> MemControllerEventStream {
7829        MemControllerEventStream { event_receiver: self.client.take_event_receiver() }
7830    }
7831
7832    /// Get the configured region size, usable region size, plugged size and requestd size
7833    ///
7834    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
7835    /// region_size is the size of device-managed memory region in bytes. Cannot change.
7836    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
7837    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
7838    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
7839    /// memory region.
7840    /// requested_size is the requested amount of plugged memory within the usable device-managed
7841    /// memory region.
7842    pub fn r#get_mem_size(
7843        &self,
7844    ) -> fidl::client::QueryResponseFut<
7845        (u64, u64, u64, u64, u64),
7846        fidl::encoding::DefaultFuchsiaResourceDialect,
7847    > {
7848        MemControllerProxyInterface::r#get_mem_size(self)
7849    }
7850
7851    /// Update the requested size to plug or unplug memory
7852    ///
7853    /// The driver SHOULD react to resize requests from the device (requested_size in the device
7854    /// configuration changed) by (un)plugging memory blocks.
7855    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7856        MemControllerProxyInterface::r#request_size(self, requested_size)
7857    }
7858}
7859
7860impl MemControllerProxyInterface for MemControllerProxy {
7861    type GetMemSizeResponseFut = fidl::client::QueryResponseFut<
7862        (u64, u64, u64, u64, u64),
7863        fidl::encoding::DefaultFuchsiaResourceDialect,
7864    >;
7865    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut {
7866        fn _decode(
7867            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7868        ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
7869            let _response = fidl::client::decode_transaction_body::<
7870                MemControllerGetMemSizeResponse,
7871                fidl::encoding::DefaultFuchsiaResourceDialect,
7872                0x6e9d496f9b66ea56,
7873            >(_buf?)?;
7874            Ok((
7875                _response.block_size,
7876                _response.region_size,
7877                _response.usable_region_size,
7878                _response.plugged_size,
7879                _response.requested_size,
7880            ))
7881        }
7882        self.client
7883            .send_query_and_decode::<fidl::encoding::EmptyPayload, (u64, u64, u64, u64, u64)>(
7884                (),
7885                0x6e9d496f9b66ea56,
7886                fidl::encoding::DynamicFlags::empty(),
7887                _decode,
7888            )
7889    }
7890
7891    fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
7892        self.client.send::<MemControllerRequestSizeRequest>(
7893            (requested_size,),
7894            0x12f8e2cc21ee8102,
7895            fidl::encoding::DynamicFlags::empty(),
7896        )
7897    }
7898}
7899
7900pub struct MemControllerEventStream {
7901    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7902}
7903
7904impl std::marker::Unpin for MemControllerEventStream {}
7905
7906impl futures::stream::FusedStream for MemControllerEventStream {
7907    fn is_terminated(&self) -> bool {
7908        self.event_receiver.is_terminated()
7909    }
7910}
7911
7912impl futures::Stream for MemControllerEventStream {
7913    type Item = Result<MemControllerEvent, fidl::Error>;
7914
7915    fn poll_next(
7916        mut self: std::pin::Pin<&mut Self>,
7917        cx: &mut std::task::Context<'_>,
7918    ) -> std::task::Poll<Option<Self::Item>> {
7919        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7920            &mut self.event_receiver,
7921            cx
7922        )?) {
7923            Some(buf) => std::task::Poll::Ready(Some(MemControllerEvent::decode(buf))),
7924            None => std::task::Poll::Ready(None),
7925        }
7926    }
7927}
7928
7929#[derive(Debug)]
7930pub enum MemControllerEvent {}
7931
7932impl MemControllerEvent {
7933    /// Decodes a message buffer as a [`MemControllerEvent`].
7934    fn decode(
7935        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7936    ) -> Result<MemControllerEvent, fidl::Error> {
7937        let (bytes, _handles) = buf.split_mut();
7938        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7939        debug_assert_eq!(tx_header.tx_id, 0);
7940        match tx_header.ordinal {
7941            _ => Err(fidl::Error::UnknownOrdinal {
7942                ordinal: tx_header.ordinal,
7943                protocol_name: <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7944            }),
7945        }
7946    }
7947}
7948
7949/// A Stream of incoming requests for fuchsia.virtualization/MemController.
7950pub struct MemControllerRequestStream {
7951    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7952    is_terminated: bool,
7953}
7954
7955impl std::marker::Unpin for MemControllerRequestStream {}
7956
7957impl futures::stream::FusedStream for MemControllerRequestStream {
7958    fn is_terminated(&self) -> bool {
7959        self.is_terminated
7960    }
7961}
7962
7963impl fidl::endpoints::RequestStream for MemControllerRequestStream {
7964    type Protocol = MemControllerMarker;
7965    type ControlHandle = MemControllerControlHandle;
7966
7967    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7968        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7969    }
7970
7971    fn control_handle(&self) -> Self::ControlHandle {
7972        MemControllerControlHandle { inner: self.inner.clone() }
7973    }
7974
7975    fn into_inner(
7976        self,
7977    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7978    {
7979        (self.inner, self.is_terminated)
7980    }
7981
7982    fn from_inner(
7983        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7984        is_terminated: bool,
7985    ) -> Self {
7986        Self { inner, is_terminated }
7987    }
7988}
7989
7990impl futures::Stream for MemControllerRequestStream {
7991    type Item = Result<MemControllerRequest, fidl::Error>;
7992
7993    fn poll_next(
7994        mut self: std::pin::Pin<&mut Self>,
7995        cx: &mut std::task::Context<'_>,
7996    ) -> std::task::Poll<Option<Self::Item>> {
7997        let this = &mut *self;
7998        if this.inner.check_shutdown(cx) {
7999            this.is_terminated = true;
8000            return std::task::Poll::Ready(None);
8001        }
8002        if this.is_terminated {
8003            panic!("polled MemControllerRequestStream after completion");
8004        }
8005        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8006            |bytes, handles| {
8007                match this.inner.channel().read_etc(cx, bytes, handles) {
8008                    std::task::Poll::Ready(Ok(())) => {}
8009                    std::task::Poll::Pending => return std::task::Poll::Pending,
8010                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8011                        this.is_terminated = true;
8012                        return std::task::Poll::Ready(None);
8013                    }
8014                    std::task::Poll::Ready(Err(e)) => {
8015                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8016                            e.into(),
8017                        ))));
8018                    }
8019                }
8020
8021                // A message has been received from the channel
8022                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8023
8024                std::task::Poll::Ready(Some(match header.ordinal {
8025                    0x6e9d496f9b66ea56 => {
8026                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8027                        let mut req = fidl::new_empty!(
8028                            fidl::encoding::EmptyPayload,
8029                            fidl::encoding::DefaultFuchsiaResourceDialect
8030                        );
8031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8032                        let control_handle =
8033                            MemControllerControlHandle { inner: this.inner.clone() };
8034                        Ok(MemControllerRequest::GetMemSize {
8035                            responder: MemControllerGetMemSizeResponder {
8036                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8037                                tx_id: header.tx_id,
8038                            },
8039                        })
8040                    }
8041                    0x12f8e2cc21ee8102 => {
8042                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8043                        let mut req = fidl::new_empty!(
8044                            MemControllerRequestSizeRequest,
8045                            fidl::encoding::DefaultFuchsiaResourceDialect
8046                        );
8047                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemControllerRequestSizeRequest>(&header, _body_bytes, handles, &mut req)?;
8048                        let control_handle =
8049                            MemControllerControlHandle { inner: this.inner.clone() };
8050                        Ok(MemControllerRequest::RequestSize {
8051                            requested_size: req.requested_size,
8052
8053                            control_handle,
8054                        })
8055                    }
8056                    _ => Err(fidl::Error::UnknownOrdinal {
8057                        ordinal: header.ordinal,
8058                        protocol_name:
8059                            <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8060                    }),
8061                }))
8062            },
8063        )
8064    }
8065}
8066
8067/// A `MemController` controls a guest's virtio-mem
8068#[derive(Debug)]
8069pub enum MemControllerRequest {
8070    /// Get the configured region size, usable region size, plugged size and requestd size
8071    ///
8072    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
8073    /// region_size is the size of device-managed memory region in bytes. Cannot change.
8074    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
8075    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
8076    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
8077    /// memory region.
8078    /// requested_size is the requested amount of plugged memory within the usable device-managed
8079    /// memory region.
8080    GetMemSize { responder: MemControllerGetMemSizeResponder },
8081    /// Update the requested size to plug or unplug memory
8082    ///
8083    /// The driver SHOULD react to resize requests from the device (requested_size in the device
8084    /// configuration changed) by (un)plugging memory blocks.
8085    RequestSize { requested_size: u64, control_handle: MemControllerControlHandle },
8086}
8087
8088impl MemControllerRequest {
8089    #[allow(irrefutable_let_patterns)]
8090    pub fn into_get_mem_size(self) -> Option<(MemControllerGetMemSizeResponder)> {
8091        if let MemControllerRequest::GetMemSize { responder } = self {
8092            Some((responder))
8093        } else {
8094            None
8095        }
8096    }
8097
8098    #[allow(irrefutable_let_patterns)]
8099    pub fn into_request_size(self) -> Option<(u64, MemControllerControlHandle)> {
8100        if let MemControllerRequest::RequestSize { requested_size, control_handle } = self {
8101            Some((requested_size, control_handle))
8102        } else {
8103            None
8104        }
8105    }
8106
8107    /// Name of the method defined in FIDL
8108    pub fn method_name(&self) -> &'static str {
8109        match *self {
8110            MemControllerRequest::GetMemSize { .. } => "get_mem_size",
8111            MemControllerRequest::RequestSize { .. } => "request_size",
8112        }
8113    }
8114}
8115
8116#[derive(Debug, Clone)]
8117pub struct MemControllerControlHandle {
8118    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8119}
8120
8121impl fidl::endpoints::ControlHandle for MemControllerControlHandle {
8122    fn shutdown(&self) {
8123        self.inner.shutdown()
8124    }
8125
8126    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8127        self.inner.shutdown_with_epitaph(status)
8128    }
8129
8130    fn is_closed(&self) -> bool {
8131        self.inner.channel().is_closed()
8132    }
8133    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8134        self.inner.channel().on_closed()
8135    }
8136
8137    #[cfg(target_os = "fuchsia")]
8138    fn signal_peer(
8139        &self,
8140        clear_mask: zx::Signals,
8141        set_mask: zx::Signals,
8142    ) -> Result<(), zx_status::Status> {
8143        use fidl::Peered;
8144        self.inner.channel().signal_peer(clear_mask, set_mask)
8145    }
8146}
8147
8148impl MemControllerControlHandle {}
8149
8150#[must_use = "FIDL methods require a response to be sent"]
8151#[derive(Debug)]
8152pub struct MemControllerGetMemSizeResponder {
8153    control_handle: std::mem::ManuallyDrop<MemControllerControlHandle>,
8154    tx_id: u32,
8155}
8156
8157/// Set the the channel to be shutdown (see [`MemControllerControlHandle::shutdown`])
8158/// if the responder is dropped without sending a response, so that the client
8159/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8160impl std::ops::Drop for MemControllerGetMemSizeResponder {
8161    fn drop(&mut self) {
8162        self.control_handle.shutdown();
8163        // Safety: drops once, never accessed again
8164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8165    }
8166}
8167
8168impl fidl::endpoints::Responder for MemControllerGetMemSizeResponder {
8169    type ControlHandle = MemControllerControlHandle;
8170
8171    fn control_handle(&self) -> &MemControllerControlHandle {
8172        &self.control_handle
8173    }
8174
8175    fn drop_without_shutdown(mut self) {
8176        // Safety: drops once, never accessed again due to mem::forget
8177        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8178        // Prevent Drop from running (which would shut down the channel)
8179        std::mem::forget(self);
8180    }
8181}
8182
8183impl MemControllerGetMemSizeResponder {
8184    /// Sends a response to the FIDL transaction.
8185    ///
8186    /// Sets the channel to shutdown if an error occurs.
8187    pub fn send(
8188        self,
8189        mut block_size: u64,
8190        mut region_size: u64,
8191        mut usable_region_size: u64,
8192        mut plugged_size: u64,
8193        mut requested_size: u64,
8194    ) -> Result<(), fidl::Error> {
8195        let _result = self.send_raw(
8196            block_size,
8197            region_size,
8198            usable_region_size,
8199            plugged_size,
8200            requested_size,
8201        );
8202        if _result.is_err() {
8203            self.control_handle.shutdown();
8204        }
8205        self.drop_without_shutdown();
8206        _result
8207    }
8208
8209    /// Similar to "send" but does not shutdown the channel if an error occurs.
8210    pub fn send_no_shutdown_on_err(
8211        self,
8212        mut block_size: u64,
8213        mut region_size: u64,
8214        mut usable_region_size: u64,
8215        mut plugged_size: u64,
8216        mut requested_size: u64,
8217    ) -> Result<(), fidl::Error> {
8218        let _result = self.send_raw(
8219            block_size,
8220            region_size,
8221            usable_region_size,
8222            plugged_size,
8223            requested_size,
8224        );
8225        self.drop_without_shutdown();
8226        _result
8227    }
8228
8229    fn send_raw(
8230        &self,
8231        mut block_size: u64,
8232        mut region_size: u64,
8233        mut usable_region_size: u64,
8234        mut plugged_size: u64,
8235        mut requested_size: u64,
8236    ) -> Result<(), fidl::Error> {
8237        self.control_handle.inner.send::<MemControllerGetMemSizeResponse>(
8238            (block_size, region_size, usable_region_size, plugged_size, requested_size),
8239            self.tx_id,
8240            0x6e9d496f9b66ea56,
8241            fidl::encoding::DynamicFlags::empty(),
8242        )
8243    }
8244}
8245
8246#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8247pub struct TerminaGuestManagerMarker;
8248
8249impl fidl::endpoints::ProtocolMarker for TerminaGuestManagerMarker {
8250    type Proxy = TerminaGuestManagerProxy;
8251    type RequestStream = TerminaGuestManagerRequestStream;
8252    #[cfg(target_os = "fuchsia")]
8253    type SynchronousProxy = TerminaGuestManagerSynchronousProxy;
8254
8255    const DEBUG_NAME: &'static str = "fuchsia.virtualization.TerminaGuestManager";
8256}
8257impl fidl::endpoints::DiscoverableProtocolMarker for TerminaGuestManagerMarker {}
8258
8259pub trait TerminaGuestManagerProxyInterface: Send + Sync {
8260    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
8261        + Send;
8262    fn r#launch(
8263        &self,
8264        guest_config: GuestConfig,
8265        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8266    ) -> Self::LaunchResponseFut;
8267    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8268    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
8269    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
8270        + Send;
8271    fn r#connect(
8272        &self,
8273        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8274    ) -> Self::ConnectResponseFut;
8275    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
8276    fn r#get_info(&self) -> Self::GetInfoResponseFut;
8277}
8278#[derive(Debug)]
8279#[cfg(target_os = "fuchsia")]
8280pub struct TerminaGuestManagerSynchronousProxy {
8281    client: fidl::client::sync::Client,
8282}
8283
8284#[cfg(target_os = "fuchsia")]
8285impl fidl::endpoints::SynchronousProxy for TerminaGuestManagerSynchronousProxy {
8286    type Proxy = TerminaGuestManagerProxy;
8287    type Protocol = TerminaGuestManagerMarker;
8288
8289    fn from_channel(inner: fidl::Channel) -> Self {
8290        Self::new(inner)
8291    }
8292
8293    fn into_channel(self) -> fidl::Channel {
8294        self.client.into_channel()
8295    }
8296
8297    fn as_channel(&self) -> &fidl::Channel {
8298        self.client.as_channel()
8299    }
8300}
8301
8302#[cfg(target_os = "fuchsia")]
8303impl TerminaGuestManagerSynchronousProxy {
8304    pub fn new(channel: fidl::Channel) -> Self {
8305        let protocol_name =
8306            <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8307        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8308    }
8309
8310    pub fn into_channel(self) -> fidl::Channel {
8311        self.client.into_channel()
8312    }
8313
8314    /// Waits until an event arrives and returns it. It is safe for other
8315    /// threads to make concurrent requests while waiting for an event.
8316    pub fn wait_for_event(
8317        &self,
8318        deadline: zx::MonotonicInstant,
8319    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
8320        TerminaGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
8321    }
8322
8323    /// Launch a new guest instance.
8324    ///
8325    /// Possible errors:
8326    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8327    ///         problems detected by the guest manager.
8328    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8329    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8330    ///         component logs for a more specific failure.
8331    pub fn r#launch(
8332        &self,
8333        mut guest_config: GuestConfig,
8334        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8335        ___deadline: zx::MonotonicInstant,
8336    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8337        let _response =
8338            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
8339                fidl::encoding::EmptyStruct,
8340                GuestManagerError,
8341            >>(
8342                (&mut guest_config, controller),
8343                0x394a2e29f750323e,
8344                fidl::encoding::DynamicFlags::empty(),
8345                ___deadline,
8346            )?;
8347        Ok(_response.map(|x| x))
8348    }
8349
8350    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8351    /// be used to launch another guest.
8352    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
8353        let _response =
8354            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
8355                (),
8356                0x3ad9a012982f872d,
8357                fidl::encoding::DynamicFlags::empty(),
8358                ___deadline,
8359            )?;
8360        Ok(_response)
8361    }
8362
8363    /// Connect to a currently running guest.
8364    ///
8365    /// Possible errors:
8366    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8367    ///         has launched before attempting to reconnect.
8368    pub fn r#connect(
8369        &self,
8370        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8371        ___deadline: zx::MonotonicInstant,
8372    ) -> Result<GuestManagerConnectResult, fidl::Error> {
8373        let _response =
8374            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
8375                fidl::encoding::EmptyStruct,
8376                GuestManagerError,
8377            >>(
8378                (controller,),
8379                0x4e489076e3bb15b4,
8380                fidl::encoding::DynamicFlags::empty(),
8381                ___deadline,
8382            )?;
8383        Ok(_response.map(|x| x))
8384    }
8385
8386    /// Query guest info
8387    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
8388        let _response =
8389            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
8390                (),
8391                0x76892614aea695dc,
8392                fidl::encoding::DynamicFlags::empty(),
8393                ___deadline,
8394            )?;
8395        Ok(_response.guest_info)
8396    }
8397}
8398
8399#[cfg(target_os = "fuchsia")]
8400impl From<TerminaGuestManagerSynchronousProxy> for zx::NullableHandle {
8401    fn from(value: TerminaGuestManagerSynchronousProxy) -> Self {
8402        value.into_channel().into()
8403    }
8404}
8405
8406#[cfg(target_os = "fuchsia")]
8407impl From<fidl::Channel> for TerminaGuestManagerSynchronousProxy {
8408    fn from(value: fidl::Channel) -> Self {
8409        Self::new(value)
8410    }
8411}
8412
8413#[cfg(target_os = "fuchsia")]
8414impl fidl::endpoints::FromClient for TerminaGuestManagerSynchronousProxy {
8415    type Protocol = TerminaGuestManagerMarker;
8416
8417    fn from_client(value: fidl::endpoints::ClientEnd<TerminaGuestManagerMarker>) -> Self {
8418        Self::new(value.into_channel())
8419    }
8420}
8421
8422#[derive(Debug, Clone)]
8423pub struct TerminaGuestManagerProxy {
8424    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8425}
8426
8427impl fidl::endpoints::Proxy for TerminaGuestManagerProxy {
8428    type Protocol = TerminaGuestManagerMarker;
8429
8430    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8431        Self::new(inner)
8432    }
8433
8434    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8435        self.client.into_channel().map_err(|client| Self { client })
8436    }
8437
8438    fn as_channel(&self) -> &::fidl::AsyncChannel {
8439        self.client.as_channel()
8440    }
8441}
8442
8443impl TerminaGuestManagerProxy {
8444    /// Create a new Proxy for fuchsia.virtualization/TerminaGuestManager.
8445    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8446        let protocol_name =
8447            <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8448        Self { client: fidl::client::Client::new(channel, protocol_name) }
8449    }
8450
8451    /// Get a Stream of events from the remote end of the protocol.
8452    ///
8453    /// # Panics
8454    ///
8455    /// Panics if the event stream was already taken.
8456    pub fn take_event_stream(&self) -> TerminaGuestManagerEventStream {
8457        TerminaGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
8458    }
8459
8460    /// Launch a new guest instance.
8461    ///
8462    /// Possible errors:
8463    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8464    ///         problems detected by the guest manager.
8465    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8466    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8467    ///         component logs for a more specific failure.
8468    pub fn r#launch(
8469        &self,
8470        mut guest_config: GuestConfig,
8471        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8472    ) -> fidl::client::QueryResponseFut<
8473        GuestManagerLaunchResult,
8474        fidl::encoding::DefaultFuchsiaResourceDialect,
8475    > {
8476        TerminaGuestManagerProxyInterface::r#launch(self, guest_config, controller)
8477    }
8478
8479    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8480    /// be used to launch another guest.
8481    pub fn r#force_shutdown(
8482        &self,
8483    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8484        TerminaGuestManagerProxyInterface::r#force_shutdown(self)
8485    }
8486
8487    /// Connect to a currently running guest.
8488    ///
8489    /// Possible errors:
8490    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8491    ///         has launched before attempting to reconnect.
8492    pub fn r#connect(
8493        &self,
8494        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8495    ) -> fidl::client::QueryResponseFut<
8496        GuestManagerConnectResult,
8497        fidl::encoding::DefaultFuchsiaResourceDialect,
8498    > {
8499        TerminaGuestManagerProxyInterface::r#connect(self, controller)
8500    }
8501
8502    /// Query guest info
8503    pub fn r#get_info(
8504        &self,
8505    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
8506    {
8507        TerminaGuestManagerProxyInterface::r#get_info(self)
8508    }
8509}
8510
8511impl TerminaGuestManagerProxyInterface for TerminaGuestManagerProxy {
8512    type LaunchResponseFut = fidl::client::QueryResponseFut<
8513        GuestManagerLaunchResult,
8514        fidl::encoding::DefaultFuchsiaResourceDialect,
8515    >;
8516    fn r#launch(
8517        &self,
8518        mut guest_config: GuestConfig,
8519        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8520    ) -> Self::LaunchResponseFut {
8521        fn _decode(
8522            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8523        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8524            let _response = fidl::client::decode_transaction_body::<
8525                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8526                fidl::encoding::DefaultFuchsiaResourceDialect,
8527                0x394a2e29f750323e,
8528            >(_buf?)?;
8529            Ok(_response.map(|x| x))
8530        }
8531        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
8532            (&mut guest_config, controller),
8533            0x394a2e29f750323e,
8534            fidl::encoding::DynamicFlags::empty(),
8535            _decode,
8536        )
8537    }
8538
8539    type ForceShutdownResponseFut =
8540        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8541    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
8542        fn _decode(
8543            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8544        ) -> Result<(), fidl::Error> {
8545            let _response = fidl::client::decode_transaction_body::<
8546                fidl::encoding::EmptyPayload,
8547                fidl::encoding::DefaultFuchsiaResourceDialect,
8548                0x3ad9a012982f872d,
8549            >(_buf?)?;
8550            Ok(_response)
8551        }
8552        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8553            (),
8554            0x3ad9a012982f872d,
8555            fidl::encoding::DynamicFlags::empty(),
8556            _decode,
8557        )
8558    }
8559
8560    type ConnectResponseFut = fidl::client::QueryResponseFut<
8561        GuestManagerConnectResult,
8562        fidl::encoding::DefaultFuchsiaResourceDialect,
8563    >;
8564    fn r#connect(
8565        &self,
8566        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8567    ) -> Self::ConnectResponseFut {
8568        fn _decode(
8569            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8570        ) -> Result<GuestManagerConnectResult, fidl::Error> {
8571            let _response = fidl::client::decode_transaction_body::<
8572                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8573                fidl::encoding::DefaultFuchsiaResourceDialect,
8574                0x4e489076e3bb15b4,
8575            >(_buf?)?;
8576            Ok(_response.map(|x| x))
8577        }
8578        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
8579            (controller,),
8580            0x4e489076e3bb15b4,
8581            fidl::encoding::DynamicFlags::empty(),
8582            _decode,
8583        )
8584    }
8585
8586    type GetInfoResponseFut =
8587        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
8588    fn r#get_info(&self) -> Self::GetInfoResponseFut {
8589        fn _decode(
8590            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8591        ) -> Result<GuestInfo, fidl::Error> {
8592            let _response = fidl::client::decode_transaction_body::<
8593                GuestManagerGetInfoResponse,
8594                fidl::encoding::DefaultFuchsiaResourceDialect,
8595                0x76892614aea695dc,
8596            >(_buf?)?;
8597            Ok(_response.guest_info)
8598        }
8599        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
8600            (),
8601            0x76892614aea695dc,
8602            fidl::encoding::DynamicFlags::empty(),
8603            _decode,
8604        )
8605    }
8606}
8607
8608pub struct TerminaGuestManagerEventStream {
8609    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8610}
8611
8612impl std::marker::Unpin for TerminaGuestManagerEventStream {}
8613
8614impl futures::stream::FusedStream for TerminaGuestManagerEventStream {
8615    fn is_terminated(&self) -> bool {
8616        self.event_receiver.is_terminated()
8617    }
8618}
8619
8620impl futures::Stream for TerminaGuestManagerEventStream {
8621    type Item = Result<TerminaGuestManagerEvent, fidl::Error>;
8622
8623    fn poll_next(
8624        mut self: std::pin::Pin<&mut Self>,
8625        cx: &mut std::task::Context<'_>,
8626    ) -> std::task::Poll<Option<Self::Item>> {
8627        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8628            &mut self.event_receiver,
8629            cx
8630        )?) {
8631            Some(buf) => std::task::Poll::Ready(Some(TerminaGuestManagerEvent::decode(buf))),
8632            None => std::task::Poll::Ready(None),
8633        }
8634    }
8635}
8636
8637#[derive(Debug)]
8638pub enum TerminaGuestManagerEvent {}
8639
8640impl TerminaGuestManagerEvent {
8641    /// Decodes a message buffer as a [`TerminaGuestManagerEvent`].
8642    fn decode(
8643        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8644    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
8645        let (bytes, _handles) = buf.split_mut();
8646        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8647        debug_assert_eq!(tx_header.tx_id, 0);
8648        match tx_header.ordinal {
8649            _ => Err(fidl::Error::UnknownOrdinal {
8650                ordinal: tx_header.ordinal,
8651                protocol_name:
8652                    <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8653            }),
8654        }
8655    }
8656}
8657
8658/// A Stream of incoming requests for fuchsia.virtualization/TerminaGuestManager.
8659pub struct TerminaGuestManagerRequestStream {
8660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8661    is_terminated: bool,
8662}
8663
8664impl std::marker::Unpin for TerminaGuestManagerRequestStream {}
8665
8666impl futures::stream::FusedStream for TerminaGuestManagerRequestStream {
8667    fn is_terminated(&self) -> bool {
8668        self.is_terminated
8669    }
8670}
8671
8672impl fidl::endpoints::RequestStream for TerminaGuestManagerRequestStream {
8673    type Protocol = TerminaGuestManagerMarker;
8674    type ControlHandle = TerminaGuestManagerControlHandle;
8675
8676    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8677        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8678    }
8679
8680    fn control_handle(&self) -> Self::ControlHandle {
8681        TerminaGuestManagerControlHandle { inner: self.inner.clone() }
8682    }
8683
8684    fn into_inner(
8685        self,
8686    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8687    {
8688        (self.inner, self.is_terminated)
8689    }
8690
8691    fn from_inner(
8692        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8693        is_terminated: bool,
8694    ) -> Self {
8695        Self { inner, is_terminated }
8696    }
8697}
8698
8699impl futures::Stream for TerminaGuestManagerRequestStream {
8700    type Item = Result<TerminaGuestManagerRequest, fidl::Error>;
8701
8702    fn poll_next(
8703        mut self: std::pin::Pin<&mut Self>,
8704        cx: &mut std::task::Context<'_>,
8705    ) -> std::task::Poll<Option<Self::Item>> {
8706        let this = &mut *self;
8707        if this.inner.check_shutdown(cx) {
8708            this.is_terminated = true;
8709            return std::task::Poll::Ready(None);
8710        }
8711        if this.is_terminated {
8712            panic!("polled TerminaGuestManagerRequestStream after completion");
8713        }
8714        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8715            |bytes, handles| {
8716                match this.inner.channel().read_etc(cx, bytes, handles) {
8717                    std::task::Poll::Ready(Ok(())) => {}
8718                    std::task::Poll::Pending => return std::task::Poll::Pending,
8719                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8720                        this.is_terminated = true;
8721                        return std::task::Poll::Ready(None);
8722                    }
8723                    std::task::Poll::Ready(Err(e)) => {
8724                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8725                            e.into(),
8726                        ))));
8727                    }
8728                }
8729
8730                // A message has been received from the channel
8731                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8732
8733                std::task::Poll::Ready(Some(match header.ordinal {
8734                0x394a2e29f750323e => {
8735                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8736                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8737                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
8738                    let control_handle = TerminaGuestManagerControlHandle {
8739                        inner: this.inner.clone(),
8740                    };
8741                    Ok(TerminaGuestManagerRequest::Launch {guest_config: req.guest_config,
8742controller: req.controller,
8743
8744                        responder: TerminaGuestManagerLaunchResponder {
8745                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8746                            tx_id: header.tx_id,
8747                        },
8748                    })
8749                }
8750                0x3ad9a012982f872d => {
8751                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8752                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8753                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8754                    let control_handle = TerminaGuestManagerControlHandle {
8755                        inner: this.inner.clone(),
8756                    };
8757                    Ok(TerminaGuestManagerRequest::ForceShutdown {
8758                        responder: TerminaGuestManagerForceShutdownResponder {
8759                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8760                            tx_id: header.tx_id,
8761                        },
8762                    })
8763                }
8764                0x4e489076e3bb15b4 => {
8765                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8766                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8767                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8768                    let control_handle = TerminaGuestManagerControlHandle {
8769                        inner: this.inner.clone(),
8770                    };
8771                    Ok(TerminaGuestManagerRequest::Connect {controller: req.controller,
8772
8773                        responder: TerminaGuestManagerConnectResponder {
8774                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8775                            tx_id: header.tx_id,
8776                        },
8777                    })
8778                }
8779                0x76892614aea695dc => {
8780                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8781                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8782                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8783                    let control_handle = TerminaGuestManagerControlHandle {
8784                        inner: this.inner.clone(),
8785                    };
8786                    Ok(TerminaGuestManagerRequest::GetInfo {
8787                        responder: TerminaGuestManagerGetInfoResponder {
8788                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8789                            tx_id: header.tx_id,
8790                        },
8791                    })
8792                }
8793                _ => Err(fidl::Error::UnknownOrdinal {
8794                    ordinal: header.ordinal,
8795                    protocol_name: <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8796                }),
8797            }))
8798            },
8799        )
8800    }
8801}
8802
8803#[derive(Debug)]
8804pub enum TerminaGuestManagerRequest {
8805    /// Launch a new guest instance.
8806    ///
8807    /// Possible errors:
8808    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8809    ///         problems detected by the guest manager.
8810    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8811    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8812    ///         component logs for a more specific failure.
8813    Launch {
8814        guest_config: GuestConfig,
8815        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8816        responder: TerminaGuestManagerLaunchResponder,
8817    },
8818    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8819    /// be used to launch another guest.
8820    ForceShutdown { responder: TerminaGuestManagerForceShutdownResponder },
8821    /// Connect to a currently running guest.
8822    ///
8823    /// Possible errors:
8824    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8825    ///         has launched before attempting to reconnect.
8826    Connect {
8827        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8828        responder: TerminaGuestManagerConnectResponder,
8829    },
8830    /// Query guest info
8831    GetInfo { responder: TerminaGuestManagerGetInfoResponder },
8832}
8833
8834impl TerminaGuestManagerRequest {
8835    #[allow(irrefutable_let_patterns)]
8836    pub fn into_launch(
8837        self,
8838    ) -> Option<(
8839        GuestConfig,
8840        fidl::endpoints::ServerEnd<GuestMarker>,
8841        TerminaGuestManagerLaunchResponder,
8842    )> {
8843        if let TerminaGuestManagerRequest::Launch { guest_config, controller, responder } = self {
8844            Some((guest_config, controller, responder))
8845        } else {
8846            None
8847        }
8848    }
8849
8850    #[allow(irrefutable_let_patterns)]
8851    pub fn into_force_shutdown(self) -> Option<(TerminaGuestManagerForceShutdownResponder)> {
8852        if let TerminaGuestManagerRequest::ForceShutdown { responder } = self {
8853            Some((responder))
8854        } else {
8855            None
8856        }
8857    }
8858
8859    #[allow(irrefutable_let_patterns)]
8860    pub fn into_connect(
8861        self,
8862    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, TerminaGuestManagerConnectResponder)>
8863    {
8864        if let TerminaGuestManagerRequest::Connect { controller, responder } = self {
8865            Some((controller, responder))
8866        } else {
8867            None
8868        }
8869    }
8870
8871    #[allow(irrefutable_let_patterns)]
8872    pub fn into_get_info(self) -> Option<(TerminaGuestManagerGetInfoResponder)> {
8873        if let TerminaGuestManagerRequest::GetInfo { responder } = self {
8874            Some((responder))
8875        } else {
8876            None
8877        }
8878    }
8879
8880    /// Name of the method defined in FIDL
8881    pub fn method_name(&self) -> &'static str {
8882        match *self {
8883            TerminaGuestManagerRequest::Launch { .. } => "launch",
8884            TerminaGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
8885            TerminaGuestManagerRequest::Connect { .. } => "connect",
8886            TerminaGuestManagerRequest::GetInfo { .. } => "get_info",
8887        }
8888    }
8889}
8890
8891#[derive(Debug, Clone)]
8892pub struct TerminaGuestManagerControlHandle {
8893    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8894}
8895
8896impl fidl::endpoints::ControlHandle for TerminaGuestManagerControlHandle {
8897    fn shutdown(&self) {
8898        self.inner.shutdown()
8899    }
8900
8901    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8902        self.inner.shutdown_with_epitaph(status)
8903    }
8904
8905    fn is_closed(&self) -> bool {
8906        self.inner.channel().is_closed()
8907    }
8908    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8909        self.inner.channel().on_closed()
8910    }
8911
8912    #[cfg(target_os = "fuchsia")]
8913    fn signal_peer(
8914        &self,
8915        clear_mask: zx::Signals,
8916        set_mask: zx::Signals,
8917    ) -> Result<(), zx_status::Status> {
8918        use fidl::Peered;
8919        self.inner.channel().signal_peer(clear_mask, set_mask)
8920    }
8921}
8922
8923impl TerminaGuestManagerControlHandle {}
8924
8925#[must_use = "FIDL methods require a response to be sent"]
8926#[derive(Debug)]
8927pub struct TerminaGuestManagerLaunchResponder {
8928    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8929    tx_id: u32,
8930}
8931
8932/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8933/// if the responder is dropped without sending a response, so that the client
8934/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8935impl std::ops::Drop for TerminaGuestManagerLaunchResponder {
8936    fn drop(&mut self) {
8937        self.control_handle.shutdown();
8938        // Safety: drops once, never accessed again
8939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8940    }
8941}
8942
8943impl fidl::endpoints::Responder for TerminaGuestManagerLaunchResponder {
8944    type ControlHandle = TerminaGuestManagerControlHandle;
8945
8946    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8947        &self.control_handle
8948    }
8949
8950    fn drop_without_shutdown(mut self) {
8951        // Safety: drops once, never accessed again due to mem::forget
8952        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8953        // Prevent Drop from running (which would shut down the channel)
8954        std::mem::forget(self);
8955    }
8956}
8957
8958impl TerminaGuestManagerLaunchResponder {
8959    /// Sends a response to the FIDL transaction.
8960    ///
8961    /// Sets the channel to shutdown if an error occurs.
8962    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8963        let _result = self.send_raw(result);
8964        if _result.is_err() {
8965            self.control_handle.shutdown();
8966        }
8967        self.drop_without_shutdown();
8968        _result
8969    }
8970
8971    /// Similar to "send" but does not shutdown the channel if an error occurs.
8972    pub fn send_no_shutdown_on_err(
8973        self,
8974        mut result: Result<(), GuestManagerError>,
8975    ) -> Result<(), fidl::Error> {
8976        let _result = self.send_raw(result);
8977        self.drop_without_shutdown();
8978        _result
8979    }
8980
8981    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8982        self.control_handle.inner.send::<fidl::encoding::ResultType<
8983            fidl::encoding::EmptyStruct,
8984            GuestManagerError,
8985        >>(
8986            result,
8987            self.tx_id,
8988            0x394a2e29f750323e,
8989            fidl::encoding::DynamicFlags::empty(),
8990        )
8991    }
8992}
8993
8994#[must_use = "FIDL methods require a response to be sent"]
8995#[derive(Debug)]
8996pub struct TerminaGuestManagerForceShutdownResponder {
8997    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8998    tx_id: u32,
8999}
9000
9001/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9002/// if the responder is dropped without sending a response, so that the client
9003/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9004impl std::ops::Drop for TerminaGuestManagerForceShutdownResponder {
9005    fn drop(&mut self) {
9006        self.control_handle.shutdown();
9007        // Safety: drops once, never accessed again
9008        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9009    }
9010}
9011
9012impl fidl::endpoints::Responder for TerminaGuestManagerForceShutdownResponder {
9013    type ControlHandle = TerminaGuestManagerControlHandle;
9014
9015    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9016        &self.control_handle
9017    }
9018
9019    fn drop_without_shutdown(mut self) {
9020        // Safety: drops once, never accessed again due to mem::forget
9021        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9022        // Prevent Drop from running (which would shut down the channel)
9023        std::mem::forget(self);
9024    }
9025}
9026
9027impl TerminaGuestManagerForceShutdownResponder {
9028    /// Sends a response to the FIDL transaction.
9029    ///
9030    /// Sets the channel to shutdown if an error occurs.
9031    pub fn send(self) -> Result<(), fidl::Error> {
9032        let _result = self.send_raw();
9033        if _result.is_err() {
9034            self.control_handle.shutdown();
9035        }
9036        self.drop_without_shutdown();
9037        _result
9038    }
9039
9040    /// Similar to "send" but does not shutdown the channel if an error occurs.
9041    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9042        let _result = self.send_raw();
9043        self.drop_without_shutdown();
9044        _result
9045    }
9046
9047    fn send_raw(&self) -> Result<(), fidl::Error> {
9048        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9049            (),
9050            self.tx_id,
9051            0x3ad9a012982f872d,
9052            fidl::encoding::DynamicFlags::empty(),
9053        )
9054    }
9055}
9056
9057#[must_use = "FIDL methods require a response to be sent"]
9058#[derive(Debug)]
9059pub struct TerminaGuestManagerConnectResponder {
9060    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
9061    tx_id: u32,
9062}
9063
9064/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9065/// if the responder is dropped without sending a response, so that the client
9066/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9067impl std::ops::Drop for TerminaGuestManagerConnectResponder {
9068    fn drop(&mut self) {
9069        self.control_handle.shutdown();
9070        // Safety: drops once, never accessed again
9071        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9072    }
9073}
9074
9075impl fidl::endpoints::Responder for TerminaGuestManagerConnectResponder {
9076    type ControlHandle = TerminaGuestManagerControlHandle;
9077
9078    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9079        &self.control_handle
9080    }
9081
9082    fn drop_without_shutdown(mut self) {
9083        // Safety: drops once, never accessed again due to mem::forget
9084        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9085        // Prevent Drop from running (which would shut down the channel)
9086        std::mem::forget(self);
9087    }
9088}
9089
9090impl TerminaGuestManagerConnectResponder {
9091    /// Sends a response to the FIDL transaction.
9092    ///
9093    /// Sets the channel to shutdown if an error occurs.
9094    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9095        let _result = self.send_raw(result);
9096        if _result.is_err() {
9097            self.control_handle.shutdown();
9098        }
9099        self.drop_without_shutdown();
9100        _result
9101    }
9102
9103    /// Similar to "send" but does not shutdown the channel if an error occurs.
9104    pub fn send_no_shutdown_on_err(
9105        self,
9106        mut result: Result<(), GuestManagerError>,
9107    ) -> Result<(), fidl::Error> {
9108        let _result = self.send_raw(result);
9109        self.drop_without_shutdown();
9110        _result
9111    }
9112
9113    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9114        self.control_handle.inner.send::<fidl::encoding::ResultType<
9115            fidl::encoding::EmptyStruct,
9116            GuestManagerError,
9117        >>(
9118            result,
9119            self.tx_id,
9120            0x4e489076e3bb15b4,
9121            fidl::encoding::DynamicFlags::empty(),
9122        )
9123    }
9124}
9125
9126#[must_use = "FIDL methods require a response to be sent"]
9127#[derive(Debug)]
9128pub struct TerminaGuestManagerGetInfoResponder {
9129    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
9130    tx_id: u32,
9131}
9132
9133/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
9134/// if the responder is dropped without sending a response, so that the client
9135/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9136impl std::ops::Drop for TerminaGuestManagerGetInfoResponder {
9137    fn drop(&mut self) {
9138        self.control_handle.shutdown();
9139        // Safety: drops once, never accessed again
9140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9141    }
9142}
9143
9144impl fidl::endpoints::Responder for TerminaGuestManagerGetInfoResponder {
9145    type ControlHandle = TerminaGuestManagerControlHandle;
9146
9147    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
9148        &self.control_handle
9149    }
9150
9151    fn drop_without_shutdown(mut self) {
9152        // Safety: drops once, never accessed again due to mem::forget
9153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9154        // Prevent Drop from running (which would shut down the channel)
9155        std::mem::forget(self);
9156    }
9157}
9158
9159impl TerminaGuestManagerGetInfoResponder {
9160    /// Sends a response to the FIDL transaction.
9161    ///
9162    /// Sets the channel to shutdown if an error occurs.
9163    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9164        let _result = self.send_raw(guest_info);
9165        if _result.is_err() {
9166            self.control_handle.shutdown();
9167        }
9168        self.drop_without_shutdown();
9169        _result
9170    }
9171
9172    /// Similar to "send" but does not shutdown the channel if an error occurs.
9173    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9174        let _result = self.send_raw(guest_info);
9175        self.drop_without_shutdown();
9176        _result
9177    }
9178
9179    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9180        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
9181            (guest_info,),
9182            self.tx_id,
9183            0x76892614aea695dc,
9184            fidl::encoding::DynamicFlags::empty(),
9185        )
9186    }
9187}
9188
9189#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9190pub struct ZirconGuestManagerMarker;
9191
9192impl fidl::endpoints::ProtocolMarker for ZirconGuestManagerMarker {
9193    type Proxy = ZirconGuestManagerProxy;
9194    type RequestStream = ZirconGuestManagerRequestStream;
9195    #[cfg(target_os = "fuchsia")]
9196    type SynchronousProxy = ZirconGuestManagerSynchronousProxy;
9197
9198    const DEBUG_NAME: &'static str = "fuchsia.virtualization.ZirconGuestManager";
9199}
9200impl fidl::endpoints::DiscoverableProtocolMarker for ZirconGuestManagerMarker {}
9201
9202pub trait ZirconGuestManagerProxyInterface: Send + Sync {
9203    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
9204        + Send;
9205    fn r#launch(
9206        &self,
9207        guest_config: GuestConfig,
9208        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9209    ) -> Self::LaunchResponseFut;
9210    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9211    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
9212    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
9213        + Send;
9214    fn r#connect(
9215        &self,
9216        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9217    ) -> Self::ConnectResponseFut;
9218    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
9219    fn r#get_info(&self) -> Self::GetInfoResponseFut;
9220}
9221#[derive(Debug)]
9222#[cfg(target_os = "fuchsia")]
9223pub struct ZirconGuestManagerSynchronousProxy {
9224    client: fidl::client::sync::Client,
9225}
9226
9227#[cfg(target_os = "fuchsia")]
9228impl fidl::endpoints::SynchronousProxy for ZirconGuestManagerSynchronousProxy {
9229    type Proxy = ZirconGuestManagerProxy;
9230    type Protocol = ZirconGuestManagerMarker;
9231
9232    fn from_channel(inner: fidl::Channel) -> Self {
9233        Self::new(inner)
9234    }
9235
9236    fn into_channel(self) -> fidl::Channel {
9237        self.client.into_channel()
9238    }
9239
9240    fn as_channel(&self) -> &fidl::Channel {
9241        self.client.as_channel()
9242    }
9243}
9244
9245#[cfg(target_os = "fuchsia")]
9246impl ZirconGuestManagerSynchronousProxy {
9247    pub fn new(channel: fidl::Channel) -> Self {
9248        let protocol_name =
9249            <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9250        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9251    }
9252
9253    pub fn into_channel(self) -> fidl::Channel {
9254        self.client.into_channel()
9255    }
9256
9257    /// Waits until an event arrives and returns it. It is safe for other
9258    /// threads to make concurrent requests while waiting for an event.
9259    pub fn wait_for_event(
9260        &self,
9261        deadline: zx::MonotonicInstant,
9262    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
9263        ZirconGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
9264    }
9265
9266    /// Launch a new guest instance.
9267    ///
9268    /// Possible errors:
9269    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9270    ///         problems detected by the guest manager.
9271    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9272    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9273    ///         component logs for a more specific failure.
9274    pub fn r#launch(
9275        &self,
9276        mut guest_config: GuestConfig,
9277        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9278        ___deadline: zx::MonotonicInstant,
9279    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
9280        let _response =
9281            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
9282                fidl::encoding::EmptyStruct,
9283                GuestManagerError,
9284            >>(
9285                (&mut guest_config, controller),
9286                0x394a2e29f750323e,
9287                fidl::encoding::DynamicFlags::empty(),
9288                ___deadline,
9289            )?;
9290        Ok(_response.map(|x| x))
9291    }
9292
9293    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9294    /// be used to launch another guest.
9295    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9296        let _response =
9297            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
9298                (),
9299                0x3ad9a012982f872d,
9300                fidl::encoding::DynamicFlags::empty(),
9301                ___deadline,
9302            )?;
9303        Ok(_response)
9304    }
9305
9306    /// Connect to a currently running guest.
9307    ///
9308    /// Possible errors:
9309    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9310    ///         has launched before attempting to reconnect.
9311    pub fn r#connect(
9312        &self,
9313        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9314        ___deadline: zx::MonotonicInstant,
9315    ) -> Result<GuestManagerConnectResult, fidl::Error> {
9316        let _response =
9317            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
9318                fidl::encoding::EmptyStruct,
9319                GuestManagerError,
9320            >>(
9321                (controller,),
9322                0x4e489076e3bb15b4,
9323                fidl::encoding::DynamicFlags::empty(),
9324                ___deadline,
9325            )?;
9326        Ok(_response.map(|x| x))
9327    }
9328
9329    /// Query guest info
9330    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
9331        let _response =
9332            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
9333                (),
9334                0x76892614aea695dc,
9335                fidl::encoding::DynamicFlags::empty(),
9336                ___deadline,
9337            )?;
9338        Ok(_response.guest_info)
9339    }
9340}
9341
9342#[cfg(target_os = "fuchsia")]
9343impl From<ZirconGuestManagerSynchronousProxy> for zx::NullableHandle {
9344    fn from(value: ZirconGuestManagerSynchronousProxy) -> Self {
9345        value.into_channel().into()
9346    }
9347}
9348
9349#[cfg(target_os = "fuchsia")]
9350impl From<fidl::Channel> for ZirconGuestManagerSynchronousProxy {
9351    fn from(value: fidl::Channel) -> Self {
9352        Self::new(value)
9353    }
9354}
9355
9356#[cfg(target_os = "fuchsia")]
9357impl fidl::endpoints::FromClient for ZirconGuestManagerSynchronousProxy {
9358    type Protocol = ZirconGuestManagerMarker;
9359
9360    fn from_client(value: fidl::endpoints::ClientEnd<ZirconGuestManagerMarker>) -> Self {
9361        Self::new(value.into_channel())
9362    }
9363}
9364
9365#[derive(Debug, Clone)]
9366pub struct ZirconGuestManagerProxy {
9367    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9368}
9369
9370impl fidl::endpoints::Proxy for ZirconGuestManagerProxy {
9371    type Protocol = ZirconGuestManagerMarker;
9372
9373    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9374        Self::new(inner)
9375    }
9376
9377    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9378        self.client.into_channel().map_err(|client| Self { client })
9379    }
9380
9381    fn as_channel(&self) -> &::fidl::AsyncChannel {
9382        self.client.as_channel()
9383    }
9384}
9385
9386impl ZirconGuestManagerProxy {
9387    /// Create a new Proxy for fuchsia.virtualization/ZirconGuestManager.
9388    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9389        let protocol_name =
9390            <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9391        Self { client: fidl::client::Client::new(channel, protocol_name) }
9392    }
9393
9394    /// Get a Stream of events from the remote end of the protocol.
9395    ///
9396    /// # Panics
9397    ///
9398    /// Panics if the event stream was already taken.
9399    pub fn take_event_stream(&self) -> ZirconGuestManagerEventStream {
9400        ZirconGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
9401    }
9402
9403    /// Launch a new guest instance.
9404    ///
9405    /// Possible errors:
9406    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9407    ///         problems detected by the guest manager.
9408    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9409    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9410    ///         component logs for a more specific failure.
9411    pub fn r#launch(
9412        &self,
9413        mut guest_config: GuestConfig,
9414        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9415    ) -> fidl::client::QueryResponseFut<
9416        GuestManagerLaunchResult,
9417        fidl::encoding::DefaultFuchsiaResourceDialect,
9418    > {
9419        ZirconGuestManagerProxyInterface::r#launch(self, guest_config, controller)
9420    }
9421
9422    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9423    /// be used to launch another guest.
9424    pub fn r#force_shutdown(
9425        &self,
9426    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9427        ZirconGuestManagerProxyInterface::r#force_shutdown(self)
9428    }
9429
9430    /// Connect to a currently running guest.
9431    ///
9432    /// Possible errors:
9433    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9434    ///         has launched before attempting to reconnect.
9435    pub fn r#connect(
9436        &self,
9437        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9438    ) -> fidl::client::QueryResponseFut<
9439        GuestManagerConnectResult,
9440        fidl::encoding::DefaultFuchsiaResourceDialect,
9441    > {
9442        ZirconGuestManagerProxyInterface::r#connect(self, controller)
9443    }
9444
9445    /// Query guest info
9446    pub fn r#get_info(
9447        &self,
9448    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9449    {
9450        ZirconGuestManagerProxyInterface::r#get_info(self)
9451    }
9452}
9453
9454impl ZirconGuestManagerProxyInterface for ZirconGuestManagerProxy {
9455    type LaunchResponseFut = fidl::client::QueryResponseFut<
9456        GuestManagerLaunchResult,
9457        fidl::encoding::DefaultFuchsiaResourceDialect,
9458    >;
9459    fn r#launch(
9460        &self,
9461        mut guest_config: GuestConfig,
9462        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9463    ) -> Self::LaunchResponseFut {
9464        fn _decode(
9465            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9466        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
9467            let _response = fidl::client::decode_transaction_body::<
9468                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
9469                fidl::encoding::DefaultFuchsiaResourceDialect,
9470                0x394a2e29f750323e,
9471            >(_buf?)?;
9472            Ok(_response.map(|x| x))
9473        }
9474        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
9475            (&mut guest_config, controller),
9476            0x394a2e29f750323e,
9477            fidl::encoding::DynamicFlags::empty(),
9478            _decode,
9479        )
9480    }
9481
9482    type ForceShutdownResponseFut =
9483        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9484    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
9485        fn _decode(
9486            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9487        ) -> Result<(), fidl::Error> {
9488            let _response = fidl::client::decode_transaction_body::<
9489                fidl::encoding::EmptyPayload,
9490                fidl::encoding::DefaultFuchsiaResourceDialect,
9491                0x3ad9a012982f872d,
9492            >(_buf?)?;
9493            Ok(_response)
9494        }
9495        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
9496            (),
9497            0x3ad9a012982f872d,
9498            fidl::encoding::DynamicFlags::empty(),
9499            _decode,
9500        )
9501    }
9502
9503    type ConnectResponseFut = fidl::client::QueryResponseFut<
9504        GuestManagerConnectResult,
9505        fidl::encoding::DefaultFuchsiaResourceDialect,
9506    >;
9507    fn r#connect(
9508        &self,
9509        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
9510    ) -> Self::ConnectResponseFut {
9511        fn _decode(
9512            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9513        ) -> Result<GuestManagerConnectResult, fidl::Error> {
9514            let _response = fidl::client::decode_transaction_body::<
9515                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
9516                fidl::encoding::DefaultFuchsiaResourceDialect,
9517                0x4e489076e3bb15b4,
9518            >(_buf?)?;
9519            Ok(_response.map(|x| x))
9520        }
9521        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
9522            (controller,),
9523            0x4e489076e3bb15b4,
9524            fidl::encoding::DynamicFlags::empty(),
9525            _decode,
9526        )
9527    }
9528
9529    type GetInfoResponseFut =
9530        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
9531    fn r#get_info(&self) -> Self::GetInfoResponseFut {
9532        fn _decode(
9533            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9534        ) -> Result<GuestInfo, fidl::Error> {
9535            let _response = fidl::client::decode_transaction_body::<
9536                GuestManagerGetInfoResponse,
9537                fidl::encoding::DefaultFuchsiaResourceDialect,
9538                0x76892614aea695dc,
9539            >(_buf?)?;
9540            Ok(_response.guest_info)
9541        }
9542        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
9543            (),
9544            0x76892614aea695dc,
9545            fidl::encoding::DynamicFlags::empty(),
9546            _decode,
9547        )
9548    }
9549}
9550
9551pub struct ZirconGuestManagerEventStream {
9552    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9553}
9554
9555impl std::marker::Unpin for ZirconGuestManagerEventStream {}
9556
9557impl futures::stream::FusedStream for ZirconGuestManagerEventStream {
9558    fn is_terminated(&self) -> bool {
9559        self.event_receiver.is_terminated()
9560    }
9561}
9562
9563impl futures::Stream for ZirconGuestManagerEventStream {
9564    type Item = Result<ZirconGuestManagerEvent, fidl::Error>;
9565
9566    fn poll_next(
9567        mut self: std::pin::Pin<&mut Self>,
9568        cx: &mut std::task::Context<'_>,
9569    ) -> std::task::Poll<Option<Self::Item>> {
9570        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9571            &mut self.event_receiver,
9572            cx
9573        )?) {
9574            Some(buf) => std::task::Poll::Ready(Some(ZirconGuestManagerEvent::decode(buf))),
9575            None => std::task::Poll::Ready(None),
9576        }
9577    }
9578}
9579
9580#[derive(Debug)]
9581pub enum ZirconGuestManagerEvent {}
9582
9583impl ZirconGuestManagerEvent {
9584    /// Decodes a message buffer as a [`ZirconGuestManagerEvent`].
9585    fn decode(
9586        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9587    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
9588        let (bytes, _handles) = buf.split_mut();
9589        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9590        debug_assert_eq!(tx_header.tx_id, 0);
9591        match tx_header.ordinal {
9592            _ => Err(fidl::Error::UnknownOrdinal {
9593                ordinal: tx_header.ordinal,
9594                protocol_name:
9595                    <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9596            }),
9597        }
9598    }
9599}
9600
9601/// A Stream of incoming requests for fuchsia.virtualization/ZirconGuestManager.
9602pub struct ZirconGuestManagerRequestStream {
9603    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9604    is_terminated: bool,
9605}
9606
9607impl std::marker::Unpin for ZirconGuestManagerRequestStream {}
9608
9609impl futures::stream::FusedStream for ZirconGuestManagerRequestStream {
9610    fn is_terminated(&self) -> bool {
9611        self.is_terminated
9612    }
9613}
9614
9615impl fidl::endpoints::RequestStream for ZirconGuestManagerRequestStream {
9616    type Protocol = ZirconGuestManagerMarker;
9617    type ControlHandle = ZirconGuestManagerControlHandle;
9618
9619    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9620        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9621    }
9622
9623    fn control_handle(&self) -> Self::ControlHandle {
9624        ZirconGuestManagerControlHandle { inner: self.inner.clone() }
9625    }
9626
9627    fn into_inner(
9628        self,
9629    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9630    {
9631        (self.inner, self.is_terminated)
9632    }
9633
9634    fn from_inner(
9635        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9636        is_terminated: bool,
9637    ) -> Self {
9638        Self { inner, is_terminated }
9639    }
9640}
9641
9642impl futures::Stream for ZirconGuestManagerRequestStream {
9643    type Item = Result<ZirconGuestManagerRequest, fidl::Error>;
9644
9645    fn poll_next(
9646        mut self: std::pin::Pin<&mut Self>,
9647        cx: &mut std::task::Context<'_>,
9648    ) -> std::task::Poll<Option<Self::Item>> {
9649        let this = &mut *self;
9650        if this.inner.check_shutdown(cx) {
9651            this.is_terminated = true;
9652            return std::task::Poll::Ready(None);
9653        }
9654        if this.is_terminated {
9655            panic!("polled ZirconGuestManagerRequestStream after completion");
9656        }
9657        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9658            |bytes, handles| {
9659                match this.inner.channel().read_etc(cx, bytes, handles) {
9660                    std::task::Poll::Ready(Ok(())) => {}
9661                    std::task::Poll::Pending => return std::task::Poll::Pending,
9662                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9663                        this.is_terminated = true;
9664                        return std::task::Poll::Ready(None);
9665                    }
9666                    std::task::Poll::Ready(Err(e)) => {
9667                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9668                            e.into(),
9669                        ))));
9670                    }
9671                }
9672
9673                // A message has been received from the channel
9674                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9675
9676                std::task::Poll::Ready(Some(match header.ordinal {
9677                0x394a2e29f750323e => {
9678                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9679                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9680                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
9681                    let control_handle = ZirconGuestManagerControlHandle {
9682                        inner: this.inner.clone(),
9683                    };
9684                    Ok(ZirconGuestManagerRequest::Launch {guest_config: req.guest_config,
9685controller: req.controller,
9686
9687                        responder: ZirconGuestManagerLaunchResponder {
9688                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9689                            tx_id: header.tx_id,
9690                        },
9691                    })
9692                }
9693                0x3ad9a012982f872d => {
9694                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9695                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
9696                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9697                    let control_handle = ZirconGuestManagerControlHandle {
9698                        inner: this.inner.clone(),
9699                    };
9700                    Ok(ZirconGuestManagerRequest::ForceShutdown {
9701                        responder: ZirconGuestManagerForceShutdownResponder {
9702                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9703                            tx_id: header.tx_id,
9704                        },
9705                    })
9706                }
9707                0x4e489076e3bb15b4 => {
9708                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9709                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9710                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9711                    let control_handle = ZirconGuestManagerControlHandle {
9712                        inner: this.inner.clone(),
9713                    };
9714                    Ok(ZirconGuestManagerRequest::Connect {controller: req.controller,
9715
9716                        responder: ZirconGuestManagerConnectResponder {
9717                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9718                            tx_id: header.tx_id,
9719                        },
9720                    })
9721                }
9722                0x76892614aea695dc => {
9723                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9724                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
9725                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9726                    let control_handle = ZirconGuestManagerControlHandle {
9727                        inner: this.inner.clone(),
9728                    };
9729                    Ok(ZirconGuestManagerRequest::GetInfo {
9730                        responder: ZirconGuestManagerGetInfoResponder {
9731                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9732                            tx_id: header.tx_id,
9733                        },
9734                    })
9735                }
9736                _ => Err(fidl::Error::UnknownOrdinal {
9737                    ordinal: header.ordinal,
9738                    protocol_name: <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9739                }),
9740            }))
9741            },
9742        )
9743    }
9744}
9745
9746#[derive(Debug)]
9747pub enum ZirconGuestManagerRequest {
9748    /// Launch a new guest instance.
9749    ///
9750    /// Possible errors:
9751    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
9752    ///         problems detected by the guest manager.
9753    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
9754    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
9755    ///         component logs for a more specific failure.
9756    Launch {
9757        guest_config: GuestConfig,
9758        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9759        responder: ZirconGuestManagerLaunchResponder,
9760    },
9761    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
9762    /// be used to launch another guest.
9763    ForceShutdown { responder: ZirconGuestManagerForceShutdownResponder },
9764    /// Connect to a currently running guest.
9765    ///
9766    /// Possible errors:
9767    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
9768    ///         has launched before attempting to reconnect.
9769    Connect {
9770        controller: fidl::endpoints::ServerEnd<GuestMarker>,
9771        responder: ZirconGuestManagerConnectResponder,
9772    },
9773    /// Query guest info
9774    GetInfo { responder: ZirconGuestManagerGetInfoResponder },
9775}
9776
9777impl ZirconGuestManagerRequest {
9778    #[allow(irrefutable_let_patterns)]
9779    pub fn into_launch(
9780        self,
9781    ) -> Option<(
9782        GuestConfig,
9783        fidl::endpoints::ServerEnd<GuestMarker>,
9784        ZirconGuestManagerLaunchResponder,
9785    )> {
9786        if let ZirconGuestManagerRequest::Launch { guest_config, controller, responder } = self {
9787            Some((guest_config, controller, responder))
9788        } else {
9789            None
9790        }
9791    }
9792
9793    #[allow(irrefutable_let_patterns)]
9794    pub fn into_force_shutdown(self) -> Option<(ZirconGuestManagerForceShutdownResponder)> {
9795        if let ZirconGuestManagerRequest::ForceShutdown { responder } = self {
9796            Some((responder))
9797        } else {
9798            None
9799        }
9800    }
9801
9802    #[allow(irrefutable_let_patterns)]
9803    pub fn into_connect(
9804        self,
9805    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, ZirconGuestManagerConnectResponder)> {
9806        if let ZirconGuestManagerRequest::Connect { controller, responder } = self {
9807            Some((controller, responder))
9808        } else {
9809            None
9810        }
9811    }
9812
9813    #[allow(irrefutable_let_patterns)]
9814    pub fn into_get_info(self) -> Option<(ZirconGuestManagerGetInfoResponder)> {
9815        if let ZirconGuestManagerRequest::GetInfo { responder } = self {
9816            Some((responder))
9817        } else {
9818            None
9819        }
9820    }
9821
9822    /// Name of the method defined in FIDL
9823    pub fn method_name(&self) -> &'static str {
9824        match *self {
9825            ZirconGuestManagerRequest::Launch { .. } => "launch",
9826            ZirconGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
9827            ZirconGuestManagerRequest::Connect { .. } => "connect",
9828            ZirconGuestManagerRequest::GetInfo { .. } => "get_info",
9829        }
9830    }
9831}
9832
9833#[derive(Debug, Clone)]
9834pub struct ZirconGuestManagerControlHandle {
9835    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9836}
9837
9838impl fidl::endpoints::ControlHandle for ZirconGuestManagerControlHandle {
9839    fn shutdown(&self) {
9840        self.inner.shutdown()
9841    }
9842
9843    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9844        self.inner.shutdown_with_epitaph(status)
9845    }
9846
9847    fn is_closed(&self) -> bool {
9848        self.inner.channel().is_closed()
9849    }
9850    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9851        self.inner.channel().on_closed()
9852    }
9853
9854    #[cfg(target_os = "fuchsia")]
9855    fn signal_peer(
9856        &self,
9857        clear_mask: zx::Signals,
9858        set_mask: zx::Signals,
9859    ) -> Result<(), zx_status::Status> {
9860        use fidl::Peered;
9861        self.inner.channel().signal_peer(clear_mask, set_mask)
9862    }
9863}
9864
9865impl ZirconGuestManagerControlHandle {}
9866
9867#[must_use = "FIDL methods require a response to be sent"]
9868#[derive(Debug)]
9869pub struct ZirconGuestManagerLaunchResponder {
9870    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9871    tx_id: u32,
9872}
9873
9874/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9875/// if the responder is dropped without sending a response, so that the client
9876/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9877impl std::ops::Drop for ZirconGuestManagerLaunchResponder {
9878    fn drop(&mut self) {
9879        self.control_handle.shutdown();
9880        // Safety: drops once, never accessed again
9881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9882    }
9883}
9884
9885impl fidl::endpoints::Responder for ZirconGuestManagerLaunchResponder {
9886    type ControlHandle = ZirconGuestManagerControlHandle;
9887
9888    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9889        &self.control_handle
9890    }
9891
9892    fn drop_without_shutdown(mut self) {
9893        // Safety: drops once, never accessed again due to mem::forget
9894        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9895        // Prevent Drop from running (which would shut down the channel)
9896        std::mem::forget(self);
9897    }
9898}
9899
9900impl ZirconGuestManagerLaunchResponder {
9901    /// Sends a response to the FIDL transaction.
9902    ///
9903    /// Sets the channel to shutdown if an error occurs.
9904    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9905        let _result = self.send_raw(result);
9906        if _result.is_err() {
9907            self.control_handle.shutdown();
9908        }
9909        self.drop_without_shutdown();
9910        _result
9911    }
9912
9913    /// Similar to "send" but does not shutdown the channel if an error occurs.
9914    pub fn send_no_shutdown_on_err(
9915        self,
9916        mut result: Result<(), GuestManagerError>,
9917    ) -> Result<(), fidl::Error> {
9918        let _result = self.send_raw(result);
9919        self.drop_without_shutdown();
9920        _result
9921    }
9922
9923    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9924        self.control_handle.inner.send::<fidl::encoding::ResultType<
9925            fidl::encoding::EmptyStruct,
9926            GuestManagerError,
9927        >>(
9928            result,
9929            self.tx_id,
9930            0x394a2e29f750323e,
9931            fidl::encoding::DynamicFlags::empty(),
9932        )
9933    }
9934}
9935
9936#[must_use = "FIDL methods require a response to be sent"]
9937#[derive(Debug)]
9938pub struct ZirconGuestManagerForceShutdownResponder {
9939    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9940    tx_id: u32,
9941}
9942
9943/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9944/// if the responder is dropped without sending a response, so that the client
9945/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9946impl std::ops::Drop for ZirconGuestManagerForceShutdownResponder {
9947    fn drop(&mut self) {
9948        self.control_handle.shutdown();
9949        // Safety: drops once, never accessed again
9950        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9951    }
9952}
9953
9954impl fidl::endpoints::Responder for ZirconGuestManagerForceShutdownResponder {
9955    type ControlHandle = ZirconGuestManagerControlHandle;
9956
9957    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9958        &self.control_handle
9959    }
9960
9961    fn drop_without_shutdown(mut self) {
9962        // Safety: drops once, never accessed again due to mem::forget
9963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9964        // Prevent Drop from running (which would shut down the channel)
9965        std::mem::forget(self);
9966    }
9967}
9968
9969impl ZirconGuestManagerForceShutdownResponder {
9970    /// Sends a response to the FIDL transaction.
9971    ///
9972    /// Sets the channel to shutdown if an error occurs.
9973    pub fn send(self) -> Result<(), fidl::Error> {
9974        let _result = self.send_raw();
9975        if _result.is_err() {
9976            self.control_handle.shutdown();
9977        }
9978        self.drop_without_shutdown();
9979        _result
9980    }
9981
9982    /// Similar to "send" but does not shutdown the channel if an error occurs.
9983    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9984        let _result = self.send_raw();
9985        self.drop_without_shutdown();
9986        _result
9987    }
9988
9989    fn send_raw(&self) -> Result<(), fidl::Error> {
9990        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9991            (),
9992            self.tx_id,
9993            0x3ad9a012982f872d,
9994            fidl::encoding::DynamicFlags::empty(),
9995        )
9996    }
9997}
9998
9999#[must_use = "FIDL methods require a response to be sent"]
10000#[derive(Debug)]
10001pub struct ZirconGuestManagerConnectResponder {
10002    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
10003    tx_id: u32,
10004}
10005
10006/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
10007/// if the responder is dropped without sending a response, so that the client
10008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10009impl std::ops::Drop for ZirconGuestManagerConnectResponder {
10010    fn drop(&mut self) {
10011        self.control_handle.shutdown();
10012        // Safety: drops once, never accessed again
10013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10014    }
10015}
10016
10017impl fidl::endpoints::Responder for ZirconGuestManagerConnectResponder {
10018    type ControlHandle = ZirconGuestManagerControlHandle;
10019
10020    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
10021        &self.control_handle
10022    }
10023
10024    fn drop_without_shutdown(mut self) {
10025        // Safety: drops once, never accessed again due to mem::forget
10026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10027        // Prevent Drop from running (which would shut down the channel)
10028        std::mem::forget(self);
10029    }
10030}
10031
10032impl ZirconGuestManagerConnectResponder {
10033    /// Sends a response to the FIDL transaction.
10034    ///
10035    /// Sets the channel to shutdown if an error occurs.
10036    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
10037        let _result = self.send_raw(result);
10038        if _result.is_err() {
10039            self.control_handle.shutdown();
10040        }
10041        self.drop_without_shutdown();
10042        _result
10043    }
10044
10045    /// Similar to "send" but does not shutdown the channel if an error occurs.
10046    pub fn send_no_shutdown_on_err(
10047        self,
10048        mut result: Result<(), GuestManagerError>,
10049    ) -> Result<(), fidl::Error> {
10050        let _result = self.send_raw(result);
10051        self.drop_without_shutdown();
10052        _result
10053    }
10054
10055    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
10056        self.control_handle.inner.send::<fidl::encoding::ResultType<
10057            fidl::encoding::EmptyStruct,
10058            GuestManagerError,
10059        >>(
10060            result,
10061            self.tx_id,
10062            0x4e489076e3bb15b4,
10063            fidl::encoding::DynamicFlags::empty(),
10064        )
10065    }
10066}
10067
10068#[must_use = "FIDL methods require a response to be sent"]
10069#[derive(Debug)]
10070pub struct ZirconGuestManagerGetInfoResponder {
10071    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
10072    tx_id: u32,
10073}
10074
10075/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
10076/// if the responder is dropped without sending a response, so that the client
10077/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10078impl std::ops::Drop for ZirconGuestManagerGetInfoResponder {
10079    fn drop(&mut self) {
10080        self.control_handle.shutdown();
10081        // Safety: drops once, never accessed again
10082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10083    }
10084}
10085
10086impl fidl::endpoints::Responder for ZirconGuestManagerGetInfoResponder {
10087    type ControlHandle = ZirconGuestManagerControlHandle;
10088
10089    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
10090        &self.control_handle
10091    }
10092
10093    fn drop_without_shutdown(mut self) {
10094        // Safety: drops once, never accessed again due to mem::forget
10095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10096        // Prevent Drop from running (which would shut down the channel)
10097        std::mem::forget(self);
10098    }
10099}
10100
10101impl ZirconGuestManagerGetInfoResponder {
10102    /// Sends a response to the FIDL transaction.
10103    ///
10104    /// Sets the channel to shutdown if an error occurs.
10105    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10106        let _result = self.send_raw(guest_info);
10107        if _result.is_err() {
10108            self.control_handle.shutdown();
10109        }
10110        self.drop_without_shutdown();
10111        _result
10112    }
10113
10114    /// Similar to "send" but does not shutdown the channel if an error occurs.
10115    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10116        let _result = self.send_raw(guest_info);
10117        self.drop_without_shutdown();
10118        _result
10119    }
10120
10121    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
10122        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
10123            (guest_info,),
10124            self.tx_id,
10125            0x76892614aea695dc,
10126            fidl::encoding::DynamicFlags::empty(),
10127        )
10128    }
10129}
10130
10131mod internal {
10132    use super::*;
10133
10134    impl fidl::encoding::ResourceTypeMarker for BlockSpec {
10135        type Borrowed<'a> = &'a mut Self;
10136        fn take_or_borrow<'a>(
10137            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10138        ) -> Self::Borrowed<'a> {
10139            value
10140        }
10141    }
10142
10143    unsafe impl fidl::encoding::TypeMarker for BlockSpec {
10144        type Owned = Self;
10145
10146        #[inline(always)]
10147        fn inline_align(_context: fidl::encoding::Context) -> usize {
10148            8
10149        }
10150
10151        #[inline(always)]
10152        fn inline_size(_context: fidl::encoding::Context) -> usize {
10153            40
10154        }
10155    }
10156
10157    unsafe impl fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
10158        for &mut BlockSpec
10159    {
10160        #[inline]
10161        unsafe fn encode(
10162            self,
10163            encoder: &mut fidl::encoding::Encoder<
10164                '_,
10165                fidl::encoding::DefaultFuchsiaResourceDialect,
10166            >,
10167            offset: usize,
10168            _depth: fidl::encoding::Depth,
10169        ) -> fidl::Result<()> {
10170            encoder.debug_check_bounds::<BlockSpec>(offset);
10171            // Delegate to tuple encoding.
10172            fidl::encoding::Encode::<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10173                (
10174                    <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
10175                    <BlockMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
10176                    <BlockFormat as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.format),
10177                ),
10178                encoder, offset, _depth
10179            )
10180        }
10181    }
10182    unsafe impl<
10183        T0: fidl::encoding::Encode<
10184                fidl::encoding::BoundedString<20>,
10185                fidl::encoding::DefaultFuchsiaResourceDialect,
10186            >,
10187        T1: fidl::encoding::Encode<BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
10188        T2: fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
10189    > fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
10190        for (T0, T1, T2)
10191    {
10192        #[inline]
10193        unsafe fn encode(
10194            self,
10195            encoder: &mut fidl::encoding::Encoder<
10196                '_,
10197                fidl::encoding::DefaultFuchsiaResourceDialect,
10198            >,
10199            offset: usize,
10200            depth: fidl::encoding::Depth,
10201        ) -> fidl::Result<()> {
10202            encoder.debug_check_bounds::<BlockSpec>(offset);
10203            // Zero out padding regions. There's no need to apply masks
10204            // because the unmasked parts will be overwritten by fields.
10205            unsafe {
10206                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10207                (ptr as *mut u64).write_unaligned(0);
10208            }
10209            // Write the fields.
10210            self.0.encode(encoder, offset + 0, depth)?;
10211            self.1.encode(encoder, offset + 16, depth)?;
10212            self.2.encode(encoder, offset + 24, depth)?;
10213            Ok(())
10214        }
10215    }
10216
10217    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {
10218        #[inline(always)]
10219        fn new_empty() -> Self {
10220            Self {
10221                id: fidl::new_empty!(
10222                    fidl::encoding::BoundedString<20>,
10223                    fidl::encoding::DefaultFuchsiaResourceDialect
10224                ),
10225                mode: fidl::new_empty!(BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect),
10226                format: fidl::new_empty!(
10227                    BlockFormat,
10228                    fidl::encoding::DefaultFuchsiaResourceDialect
10229                ),
10230            }
10231        }
10232
10233        #[inline]
10234        unsafe fn decode(
10235            &mut self,
10236            decoder: &mut fidl::encoding::Decoder<
10237                '_,
10238                fidl::encoding::DefaultFuchsiaResourceDialect,
10239            >,
10240            offset: usize,
10241            _depth: fidl::encoding::Depth,
10242        ) -> fidl::Result<()> {
10243            decoder.debug_check_bounds::<Self>(offset);
10244            // Verify that padding bytes are zero.
10245            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10246            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10247            let mask = 0xffffffff00000000u64;
10248            let maskedval = padval & mask;
10249            if maskedval != 0 {
10250                return Err(fidl::Error::NonZeroPadding {
10251                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10252                });
10253            }
10254            fidl::decode!(
10255                fidl::encoding::BoundedString<20>,
10256                fidl::encoding::DefaultFuchsiaResourceDialect,
10257                &mut self.id,
10258                decoder,
10259                offset + 0,
10260                _depth
10261            )?;
10262            fidl::decode!(
10263                BlockMode,
10264                fidl::encoding::DefaultFuchsiaResourceDialect,
10265                &mut self.mode,
10266                decoder,
10267                offset + 16,
10268                _depth
10269            )?;
10270            fidl::decode!(
10271                BlockFormat,
10272                fidl::encoding::DefaultFuchsiaResourceDialect,
10273                &mut self.format,
10274                decoder,
10275                offset + 24,
10276                _depth
10277            )?;
10278            Ok(())
10279        }
10280    }
10281
10282    impl fidl::encoding::ResourceTypeMarker for GuestGetBalloonControllerRequest {
10283        type Borrowed<'a> = &'a mut Self;
10284        fn take_or_borrow<'a>(
10285            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10286        ) -> Self::Borrowed<'a> {
10287            value
10288        }
10289    }
10290
10291    unsafe impl fidl::encoding::TypeMarker for GuestGetBalloonControllerRequest {
10292        type Owned = Self;
10293
10294        #[inline(always)]
10295        fn inline_align(_context: fidl::encoding::Context) -> usize {
10296            4
10297        }
10298
10299        #[inline(always)]
10300        fn inline_size(_context: fidl::encoding::Context) -> usize {
10301            4
10302        }
10303    }
10304
10305    unsafe impl
10306        fidl::encoding::Encode<
10307            GuestGetBalloonControllerRequest,
10308            fidl::encoding::DefaultFuchsiaResourceDialect,
10309        > for &mut GuestGetBalloonControllerRequest
10310    {
10311        #[inline]
10312        unsafe fn encode(
10313            self,
10314            encoder: &mut fidl::encoding::Encoder<
10315                '_,
10316                fidl::encoding::DefaultFuchsiaResourceDialect,
10317            >,
10318            offset: usize,
10319            _depth: fidl::encoding::Depth,
10320        ) -> fidl::Result<()> {
10321            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
10322            // Delegate to tuple encoding.
10323            fidl::encoding::Encode::<GuestGetBalloonControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10324                (
10325                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10326                ),
10327                encoder, offset, _depth
10328            )
10329        }
10330    }
10331    unsafe impl<
10332        T0: fidl::encoding::Encode<
10333                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10334                fidl::encoding::DefaultFuchsiaResourceDialect,
10335            >,
10336    >
10337        fidl::encoding::Encode<
10338            GuestGetBalloonControllerRequest,
10339            fidl::encoding::DefaultFuchsiaResourceDialect,
10340        > for (T0,)
10341    {
10342        #[inline]
10343        unsafe fn encode(
10344            self,
10345            encoder: &mut fidl::encoding::Encoder<
10346                '_,
10347                fidl::encoding::DefaultFuchsiaResourceDialect,
10348            >,
10349            offset: usize,
10350            depth: fidl::encoding::Depth,
10351        ) -> fidl::Result<()> {
10352            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
10353            // Zero out padding regions. There's no need to apply masks
10354            // because the unmasked parts will be overwritten by fields.
10355            // Write the fields.
10356            self.0.encode(encoder, offset + 0, depth)?;
10357            Ok(())
10358        }
10359    }
10360
10361    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10362        for GuestGetBalloonControllerRequest
10363    {
10364        #[inline(always)]
10365        fn new_empty() -> Self {
10366            Self {
10367                controller: fidl::new_empty!(
10368                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10369                    fidl::encoding::DefaultFuchsiaResourceDialect
10370                ),
10371            }
10372        }
10373
10374        #[inline]
10375        unsafe fn decode(
10376            &mut self,
10377            decoder: &mut fidl::encoding::Decoder<
10378                '_,
10379                fidl::encoding::DefaultFuchsiaResourceDialect,
10380            >,
10381            offset: usize,
10382            _depth: fidl::encoding::Depth,
10383        ) -> fidl::Result<()> {
10384            decoder.debug_check_bounds::<Self>(offset);
10385            // Verify that padding bytes are zero.
10386            fidl::decode!(
10387                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
10388                fidl::encoding::DefaultFuchsiaResourceDialect,
10389                &mut self.controller,
10390                decoder,
10391                offset + 0,
10392                _depth
10393            )?;
10394            Ok(())
10395        }
10396    }
10397
10398    impl fidl::encoding::ResourceTypeMarker for GuestGetHostVsockEndpointRequest {
10399        type Borrowed<'a> = &'a mut Self;
10400        fn take_or_borrow<'a>(
10401            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10402        ) -> Self::Borrowed<'a> {
10403            value
10404        }
10405    }
10406
10407    unsafe impl fidl::encoding::TypeMarker for GuestGetHostVsockEndpointRequest {
10408        type Owned = Self;
10409
10410        #[inline(always)]
10411        fn inline_align(_context: fidl::encoding::Context) -> usize {
10412            4
10413        }
10414
10415        #[inline(always)]
10416        fn inline_size(_context: fidl::encoding::Context) -> usize {
10417            4
10418        }
10419    }
10420
10421    unsafe impl
10422        fidl::encoding::Encode<
10423            GuestGetHostVsockEndpointRequest,
10424            fidl::encoding::DefaultFuchsiaResourceDialect,
10425        > for &mut GuestGetHostVsockEndpointRequest
10426    {
10427        #[inline]
10428        unsafe fn encode(
10429            self,
10430            encoder: &mut fidl::encoding::Encoder<
10431                '_,
10432                fidl::encoding::DefaultFuchsiaResourceDialect,
10433            >,
10434            offset: usize,
10435            _depth: fidl::encoding::Depth,
10436        ) -> fidl::Result<()> {
10437            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
10438            // Delegate to tuple encoding.
10439            fidl::encoding::Encode::<GuestGetHostVsockEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10440                (
10441                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
10442                ),
10443                encoder, offset, _depth
10444            )
10445        }
10446    }
10447    unsafe impl<
10448        T0: fidl::encoding::Encode<
10449                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10450                fidl::encoding::DefaultFuchsiaResourceDialect,
10451            >,
10452    >
10453        fidl::encoding::Encode<
10454            GuestGetHostVsockEndpointRequest,
10455            fidl::encoding::DefaultFuchsiaResourceDialect,
10456        > for (T0,)
10457    {
10458        #[inline]
10459        unsafe fn encode(
10460            self,
10461            encoder: &mut fidl::encoding::Encoder<
10462                '_,
10463                fidl::encoding::DefaultFuchsiaResourceDialect,
10464            >,
10465            offset: usize,
10466            depth: fidl::encoding::Depth,
10467        ) -> fidl::Result<()> {
10468            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
10469            // Zero out padding regions. There's no need to apply masks
10470            // because the unmasked parts will be overwritten by fields.
10471            // Write the fields.
10472            self.0.encode(encoder, offset + 0, depth)?;
10473            Ok(())
10474        }
10475    }
10476
10477    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10478        for GuestGetHostVsockEndpointRequest
10479    {
10480        #[inline(always)]
10481        fn new_empty() -> Self {
10482            Self {
10483                endpoint: fidl::new_empty!(
10484                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10485                    fidl::encoding::DefaultFuchsiaResourceDialect
10486                ),
10487            }
10488        }
10489
10490        #[inline]
10491        unsafe fn decode(
10492            &mut self,
10493            decoder: &mut fidl::encoding::Decoder<
10494                '_,
10495                fidl::encoding::DefaultFuchsiaResourceDialect,
10496            >,
10497            offset: usize,
10498            _depth: fidl::encoding::Depth,
10499        ) -> fidl::Result<()> {
10500            decoder.debug_check_bounds::<Self>(offset);
10501            // Verify that padding bytes are zero.
10502            fidl::decode!(
10503                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
10504                fidl::encoding::DefaultFuchsiaResourceDialect,
10505                &mut self.endpoint,
10506                decoder,
10507                offset + 0,
10508                _depth
10509            )?;
10510            Ok(())
10511        }
10512    }
10513
10514    impl fidl::encoding::ResourceTypeMarker for GuestGetMemControllerRequest {
10515        type Borrowed<'a> = &'a mut Self;
10516        fn take_or_borrow<'a>(
10517            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10518        ) -> Self::Borrowed<'a> {
10519            value
10520        }
10521    }
10522
10523    unsafe impl fidl::encoding::TypeMarker for GuestGetMemControllerRequest {
10524        type Owned = Self;
10525
10526        #[inline(always)]
10527        fn inline_align(_context: fidl::encoding::Context) -> usize {
10528            4
10529        }
10530
10531        #[inline(always)]
10532        fn inline_size(_context: fidl::encoding::Context) -> usize {
10533            4
10534        }
10535    }
10536
10537    unsafe impl
10538        fidl::encoding::Encode<
10539            GuestGetMemControllerRequest,
10540            fidl::encoding::DefaultFuchsiaResourceDialect,
10541        > for &mut GuestGetMemControllerRequest
10542    {
10543        #[inline]
10544        unsafe fn encode(
10545            self,
10546            encoder: &mut fidl::encoding::Encoder<
10547                '_,
10548                fidl::encoding::DefaultFuchsiaResourceDialect,
10549            >,
10550            offset: usize,
10551            _depth: fidl::encoding::Depth,
10552        ) -> fidl::Result<()> {
10553            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
10554            // Delegate to tuple encoding.
10555            fidl::encoding::Encode::<GuestGetMemControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10556                (
10557                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10558                ),
10559                encoder, offset, _depth
10560            )
10561        }
10562    }
10563    unsafe impl<
10564        T0: fidl::encoding::Encode<
10565                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10566                fidl::encoding::DefaultFuchsiaResourceDialect,
10567            >,
10568    >
10569        fidl::encoding::Encode<
10570            GuestGetMemControllerRequest,
10571            fidl::encoding::DefaultFuchsiaResourceDialect,
10572        > for (T0,)
10573    {
10574        #[inline]
10575        unsafe fn encode(
10576            self,
10577            encoder: &mut fidl::encoding::Encoder<
10578                '_,
10579                fidl::encoding::DefaultFuchsiaResourceDialect,
10580            >,
10581            offset: usize,
10582            depth: fidl::encoding::Depth,
10583        ) -> fidl::Result<()> {
10584            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
10585            // Zero out padding regions. There's no need to apply masks
10586            // because the unmasked parts will be overwritten by fields.
10587            // Write the fields.
10588            self.0.encode(encoder, offset + 0, depth)?;
10589            Ok(())
10590        }
10591    }
10592
10593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10594        for GuestGetMemControllerRequest
10595    {
10596        #[inline(always)]
10597        fn new_empty() -> Self {
10598            Self {
10599                controller: fidl::new_empty!(
10600                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10601                    fidl::encoding::DefaultFuchsiaResourceDialect
10602                ),
10603            }
10604        }
10605
10606        #[inline]
10607        unsafe fn decode(
10608            &mut self,
10609            decoder: &mut fidl::encoding::Decoder<
10610                '_,
10611                fidl::encoding::DefaultFuchsiaResourceDialect,
10612            >,
10613            offset: usize,
10614            _depth: fidl::encoding::Depth,
10615        ) -> fidl::Result<()> {
10616            decoder.debug_check_bounds::<Self>(offset);
10617            // Verify that padding bytes are zero.
10618            fidl::decode!(
10619                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
10620                fidl::encoding::DefaultFuchsiaResourceDialect,
10621                &mut self.controller,
10622                decoder,
10623                offset + 0,
10624                _depth
10625            )?;
10626            Ok(())
10627        }
10628    }
10629
10630    impl fidl::encoding::ResourceTypeMarker for GuestGetSerialResponse {
10631        type Borrowed<'a> = &'a mut Self;
10632        fn take_or_borrow<'a>(
10633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10634        ) -> Self::Borrowed<'a> {
10635            value
10636        }
10637    }
10638
10639    unsafe impl fidl::encoding::TypeMarker for GuestGetSerialResponse {
10640        type Owned = Self;
10641
10642        #[inline(always)]
10643        fn inline_align(_context: fidl::encoding::Context) -> usize {
10644            4
10645        }
10646
10647        #[inline(always)]
10648        fn inline_size(_context: fidl::encoding::Context) -> usize {
10649            4
10650        }
10651    }
10652
10653    unsafe impl
10654        fidl::encoding::Encode<
10655            GuestGetSerialResponse,
10656            fidl::encoding::DefaultFuchsiaResourceDialect,
10657        > for &mut GuestGetSerialResponse
10658    {
10659        #[inline]
10660        unsafe fn encode(
10661            self,
10662            encoder: &mut fidl::encoding::Encoder<
10663                '_,
10664                fidl::encoding::DefaultFuchsiaResourceDialect,
10665            >,
10666            offset: usize,
10667            _depth: fidl::encoding::Depth,
10668        ) -> fidl::Result<()> {
10669            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
10670            // Delegate to tuple encoding.
10671            fidl::encoding::Encode::<
10672                GuestGetSerialResponse,
10673                fidl::encoding::DefaultFuchsiaResourceDialect,
10674            >::encode(
10675                (<fidl::encoding::HandleType<
10676                    fidl::Socket,
10677                    { fidl::ObjectType::SOCKET.into_raw() },
10678                    2147483648,
10679                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10680                    &mut self.socket
10681                ),),
10682                encoder,
10683                offset,
10684                _depth,
10685            )
10686        }
10687    }
10688    unsafe impl<
10689        T0: fidl::encoding::Encode<
10690                fidl::encoding::HandleType<
10691                    fidl::Socket,
10692                    { fidl::ObjectType::SOCKET.into_raw() },
10693                    2147483648,
10694                >,
10695                fidl::encoding::DefaultFuchsiaResourceDialect,
10696            >,
10697    >
10698        fidl::encoding::Encode<
10699            GuestGetSerialResponse,
10700            fidl::encoding::DefaultFuchsiaResourceDialect,
10701        > for (T0,)
10702    {
10703        #[inline]
10704        unsafe fn encode(
10705            self,
10706            encoder: &mut fidl::encoding::Encoder<
10707                '_,
10708                fidl::encoding::DefaultFuchsiaResourceDialect,
10709            >,
10710            offset: usize,
10711            depth: fidl::encoding::Depth,
10712        ) -> fidl::Result<()> {
10713            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
10714            // Zero out padding regions. There's no need to apply masks
10715            // because the unmasked parts will be overwritten by fields.
10716            // Write the fields.
10717            self.0.encode(encoder, offset + 0, depth)?;
10718            Ok(())
10719        }
10720    }
10721
10722    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10723        for GuestGetSerialResponse
10724    {
10725        #[inline(always)]
10726        fn new_empty() -> Self {
10727            Self {
10728                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10729            }
10730        }
10731
10732        #[inline]
10733        unsafe fn decode(
10734            &mut self,
10735            decoder: &mut fidl::encoding::Decoder<
10736                '_,
10737                fidl::encoding::DefaultFuchsiaResourceDialect,
10738            >,
10739            offset: usize,
10740            _depth: fidl::encoding::Depth,
10741        ) -> fidl::Result<()> {
10742            decoder.debug_check_bounds::<Self>(offset);
10743            // Verify that padding bytes are zero.
10744            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10745            Ok(())
10746        }
10747    }
10748
10749    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleBindRequest {
10750        type Borrowed<'a> = &'a mut Self;
10751        fn take_or_borrow<'a>(
10752            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10753        ) -> Self::Borrowed<'a> {
10754            value
10755        }
10756    }
10757
10758    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleBindRequest {
10759        type Owned = Self;
10760
10761        #[inline(always)]
10762        fn inline_align(_context: fidl::encoding::Context) -> usize {
10763            4
10764        }
10765
10766        #[inline(always)]
10767        fn inline_size(_context: fidl::encoding::Context) -> usize {
10768            4
10769        }
10770    }
10771
10772    unsafe impl
10773        fidl::encoding::Encode<
10774            GuestLifecycleBindRequest,
10775            fidl::encoding::DefaultFuchsiaResourceDialect,
10776        > for &mut GuestLifecycleBindRequest
10777    {
10778        #[inline]
10779        unsafe fn encode(
10780            self,
10781            encoder: &mut fidl::encoding::Encoder<
10782                '_,
10783                fidl::encoding::DefaultFuchsiaResourceDialect,
10784            >,
10785            offset: usize,
10786            _depth: fidl::encoding::Depth,
10787        ) -> fidl::Result<()> {
10788            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
10789            // Delegate to tuple encoding.
10790            fidl::encoding::Encode::<GuestLifecycleBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10791                (
10792                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
10793                ),
10794                encoder, offset, _depth
10795            )
10796        }
10797    }
10798    unsafe impl<
10799        T0: fidl::encoding::Encode<
10800                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10801                fidl::encoding::DefaultFuchsiaResourceDialect,
10802            >,
10803    >
10804        fidl::encoding::Encode<
10805            GuestLifecycleBindRequest,
10806            fidl::encoding::DefaultFuchsiaResourceDialect,
10807        > for (T0,)
10808    {
10809        #[inline]
10810        unsafe fn encode(
10811            self,
10812            encoder: &mut fidl::encoding::Encoder<
10813                '_,
10814                fidl::encoding::DefaultFuchsiaResourceDialect,
10815            >,
10816            offset: usize,
10817            depth: fidl::encoding::Depth,
10818        ) -> fidl::Result<()> {
10819            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
10820            // Zero out padding regions. There's no need to apply masks
10821            // because the unmasked parts will be overwritten by fields.
10822            // Write the fields.
10823            self.0.encode(encoder, offset + 0, depth)?;
10824            Ok(())
10825        }
10826    }
10827
10828    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10829        for GuestLifecycleBindRequest
10830    {
10831        #[inline(always)]
10832        fn new_empty() -> Self {
10833            Self {
10834                guest: fidl::new_empty!(
10835                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10836                    fidl::encoding::DefaultFuchsiaResourceDialect
10837                ),
10838            }
10839        }
10840
10841        #[inline]
10842        unsafe fn decode(
10843            &mut self,
10844            decoder: &mut fidl::encoding::Decoder<
10845                '_,
10846                fidl::encoding::DefaultFuchsiaResourceDialect,
10847            >,
10848            offset: usize,
10849            _depth: fidl::encoding::Depth,
10850        ) -> fidl::Result<()> {
10851            decoder.debug_check_bounds::<Self>(offset);
10852            // Verify that padding bytes are zero.
10853            fidl::decode!(
10854                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10855                fidl::encoding::DefaultFuchsiaResourceDialect,
10856                &mut self.guest,
10857                decoder,
10858                offset + 0,
10859                _depth
10860            )?;
10861            Ok(())
10862        }
10863    }
10864
10865    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleCreateRequest {
10866        type Borrowed<'a> = &'a mut Self;
10867        fn take_or_borrow<'a>(
10868            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10869        ) -> Self::Borrowed<'a> {
10870            value
10871        }
10872    }
10873
10874    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleCreateRequest {
10875        type Owned = Self;
10876
10877        #[inline(always)]
10878        fn inline_align(_context: fidl::encoding::Context) -> usize {
10879            8
10880        }
10881
10882        #[inline(always)]
10883        fn inline_size(_context: fidl::encoding::Context) -> usize {
10884            16
10885        }
10886    }
10887
10888    unsafe impl
10889        fidl::encoding::Encode<
10890            GuestLifecycleCreateRequest,
10891            fidl::encoding::DefaultFuchsiaResourceDialect,
10892        > for &mut GuestLifecycleCreateRequest
10893    {
10894        #[inline]
10895        unsafe fn encode(
10896            self,
10897            encoder: &mut fidl::encoding::Encoder<
10898                '_,
10899                fidl::encoding::DefaultFuchsiaResourceDialect,
10900            >,
10901            offset: usize,
10902            _depth: fidl::encoding::Depth,
10903        ) -> fidl::Result<()> {
10904            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
10905            // Delegate to tuple encoding.
10906            fidl::encoding::Encode::<
10907                GuestLifecycleCreateRequest,
10908                fidl::encoding::DefaultFuchsiaResourceDialect,
10909            >::encode(
10910                (<GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10911                    &mut self.guest_config,
10912                ),),
10913                encoder,
10914                offset,
10915                _depth,
10916            )
10917        }
10918    }
10919    unsafe impl<
10920        T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
10921    >
10922        fidl::encoding::Encode<
10923            GuestLifecycleCreateRequest,
10924            fidl::encoding::DefaultFuchsiaResourceDialect,
10925        > for (T0,)
10926    {
10927        #[inline]
10928        unsafe fn encode(
10929            self,
10930            encoder: &mut fidl::encoding::Encoder<
10931                '_,
10932                fidl::encoding::DefaultFuchsiaResourceDialect,
10933            >,
10934            offset: usize,
10935            depth: fidl::encoding::Depth,
10936        ) -> fidl::Result<()> {
10937            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
10938            // Zero out padding regions. There's no need to apply masks
10939            // because the unmasked parts will be overwritten by fields.
10940            // Write the fields.
10941            self.0.encode(encoder, offset + 0, depth)?;
10942            Ok(())
10943        }
10944    }
10945
10946    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10947        for GuestLifecycleCreateRequest
10948    {
10949        #[inline(always)]
10950        fn new_empty() -> Self {
10951            Self {
10952                guest_config: fidl::new_empty!(
10953                    GuestConfig,
10954                    fidl::encoding::DefaultFuchsiaResourceDialect
10955                ),
10956            }
10957        }
10958
10959        #[inline]
10960        unsafe fn decode(
10961            &mut self,
10962            decoder: &mut fidl::encoding::Decoder<
10963                '_,
10964                fidl::encoding::DefaultFuchsiaResourceDialect,
10965            >,
10966            offset: usize,
10967            _depth: fidl::encoding::Depth,
10968        ) -> fidl::Result<()> {
10969            decoder.debug_check_bounds::<Self>(offset);
10970            // Verify that padding bytes are zero.
10971            fidl::decode!(
10972                GuestConfig,
10973                fidl::encoding::DefaultFuchsiaResourceDialect,
10974                &mut self.guest_config,
10975                decoder,
10976                offset + 0,
10977                _depth
10978            )?;
10979            Ok(())
10980        }
10981    }
10982
10983    impl fidl::encoding::ResourceTypeMarker for GuestManagerConnectRequest {
10984        type Borrowed<'a> = &'a mut Self;
10985        fn take_or_borrow<'a>(
10986            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10987        ) -> Self::Borrowed<'a> {
10988            value
10989        }
10990    }
10991
10992    unsafe impl fidl::encoding::TypeMarker for GuestManagerConnectRequest {
10993        type Owned = Self;
10994
10995        #[inline(always)]
10996        fn inline_align(_context: fidl::encoding::Context) -> usize {
10997            4
10998        }
10999
11000        #[inline(always)]
11001        fn inline_size(_context: fidl::encoding::Context) -> usize {
11002            4
11003        }
11004    }
11005
11006    unsafe impl
11007        fidl::encoding::Encode<
11008            GuestManagerConnectRequest,
11009            fidl::encoding::DefaultFuchsiaResourceDialect,
11010        > for &mut GuestManagerConnectRequest
11011    {
11012        #[inline]
11013        unsafe fn encode(
11014            self,
11015            encoder: &mut fidl::encoding::Encoder<
11016                '_,
11017                fidl::encoding::DefaultFuchsiaResourceDialect,
11018            >,
11019            offset: usize,
11020            _depth: fidl::encoding::Depth,
11021        ) -> fidl::Result<()> {
11022            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
11023            // Delegate to tuple encoding.
11024            fidl::encoding::Encode::<GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11025                (
11026                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
11027                ),
11028                encoder, offset, _depth
11029            )
11030        }
11031    }
11032    unsafe impl<
11033        T0: fidl::encoding::Encode<
11034                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11035                fidl::encoding::DefaultFuchsiaResourceDialect,
11036            >,
11037    >
11038        fidl::encoding::Encode<
11039            GuestManagerConnectRequest,
11040            fidl::encoding::DefaultFuchsiaResourceDialect,
11041        > for (T0,)
11042    {
11043        #[inline]
11044        unsafe fn encode(
11045            self,
11046            encoder: &mut fidl::encoding::Encoder<
11047                '_,
11048                fidl::encoding::DefaultFuchsiaResourceDialect,
11049            >,
11050            offset: usize,
11051            depth: fidl::encoding::Depth,
11052        ) -> fidl::Result<()> {
11053            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
11054            // Zero out padding regions. There's no need to apply masks
11055            // because the unmasked parts will be overwritten by fields.
11056            // Write the fields.
11057            self.0.encode(encoder, offset + 0, depth)?;
11058            Ok(())
11059        }
11060    }
11061
11062    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11063        for GuestManagerConnectRequest
11064    {
11065        #[inline(always)]
11066        fn new_empty() -> Self {
11067            Self {
11068                controller: fidl::new_empty!(
11069                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11070                    fidl::encoding::DefaultFuchsiaResourceDialect
11071                ),
11072            }
11073        }
11074
11075        #[inline]
11076        unsafe fn decode(
11077            &mut self,
11078            decoder: &mut fidl::encoding::Decoder<
11079                '_,
11080                fidl::encoding::DefaultFuchsiaResourceDialect,
11081            >,
11082            offset: usize,
11083            _depth: fidl::encoding::Depth,
11084        ) -> fidl::Result<()> {
11085            decoder.debug_check_bounds::<Self>(offset);
11086            // Verify that padding bytes are zero.
11087            fidl::decode!(
11088                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11089                fidl::encoding::DefaultFuchsiaResourceDialect,
11090                &mut self.controller,
11091                decoder,
11092                offset + 0,
11093                _depth
11094            )?;
11095            Ok(())
11096        }
11097    }
11098
11099    impl fidl::encoding::ResourceTypeMarker for GuestManagerGetInfoResponse {
11100        type Borrowed<'a> = &'a mut Self;
11101        fn take_or_borrow<'a>(
11102            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11103        ) -> Self::Borrowed<'a> {
11104            value
11105        }
11106    }
11107
11108    unsafe impl fidl::encoding::TypeMarker for GuestManagerGetInfoResponse {
11109        type Owned = Self;
11110
11111        #[inline(always)]
11112        fn inline_align(_context: fidl::encoding::Context) -> usize {
11113            8
11114        }
11115
11116        #[inline(always)]
11117        fn inline_size(_context: fidl::encoding::Context) -> usize {
11118            16
11119        }
11120    }
11121
11122    unsafe impl
11123        fidl::encoding::Encode<
11124            GuestManagerGetInfoResponse,
11125            fidl::encoding::DefaultFuchsiaResourceDialect,
11126        > for &mut GuestManagerGetInfoResponse
11127    {
11128        #[inline]
11129        unsafe fn encode(
11130            self,
11131            encoder: &mut fidl::encoding::Encoder<
11132                '_,
11133                fidl::encoding::DefaultFuchsiaResourceDialect,
11134            >,
11135            offset: usize,
11136            _depth: fidl::encoding::Depth,
11137        ) -> fidl::Result<()> {
11138            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
11139            // Delegate to tuple encoding.
11140            fidl::encoding::Encode::<
11141                GuestManagerGetInfoResponse,
11142                fidl::encoding::DefaultFuchsiaResourceDialect,
11143            >::encode(
11144                (<GuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_info),),
11145                encoder,
11146                offset,
11147                _depth,
11148            )
11149        }
11150    }
11151    unsafe impl<
11152        T0: fidl::encoding::Encode<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
11153    >
11154        fidl::encoding::Encode<
11155            GuestManagerGetInfoResponse,
11156            fidl::encoding::DefaultFuchsiaResourceDialect,
11157        > for (T0,)
11158    {
11159        #[inline]
11160        unsafe fn encode(
11161            self,
11162            encoder: &mut fidl::encoding::Encoder<
11163                '_,
11164                fidl::encoding::DefaultFuchsiaResourceDialect,
11165            >,
11166            offset: usize,
11167            depth: fidl::encoding::Depth,
11168        ) -> fidl::Result<()> {
11169            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
11170            // Zero out padding regions. There's no need to apply masks
11171            // because the unmasked parts will be overwritten by fields.
11172            // Write the fields.
11173            self.0.encode(encoder, offset + 0, depth)?;
11174            Ok(())
11175        }
11176    }
11177
11178    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11179        for GuestManagerGetInfoResponse
11180    {
11181        #[inline(always)]
11182        fn new_empty() -> Self {
11183            Self {
11184                guest_info: fidl::new_empty!(
11185                    GuestInfo,
11186                    fidl::encoding::DefaultFuchsiaResourceDialect
11187                ),
11188            }
11189        }
11190
11191        #[inline]
11192        unsafe fn decode(
11193            &mut self,
11194            decoder: &mut fidl::encoding::Decoder<
11195                '_,
11196                fidl::encoding::DefaultFuchsiaResourceDialect,
11197            >,
11198            offset: usize,
11199            _depth: fidl::encoding::Depth,
11200        ) -> fidl::Result<()> {
11201            decoder.debug_check_bounds::<Self>(offset);
11202            // Verify that padding bytes are zero.
11203            fidl::decode!(
11204                GuestInfo,
11205                fidl::encoding::DefaultFuchsiaResourceDialect,
11206                &mut self.guest_info,
11207                decoder,
11208                offset + 0,
11209                _depth
11210            )?;
11211            Ok(())
11212        }
11213    }
11214
11215    impl fidl::encoding::ResourceTypeMarker for GuestManagerLaunchRequest {
11216        type Borrowed<'a> = &'a mut Self;
11217        fn take_or_borrow<'a>(
11218            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11219        ) -> Self::Borrowed<'a> {
11220            value
11221        }
11222    }
11223
11224    unsafe impl fidl::encoding::TypeMarker for GuestManagerLaunchRequest {
11225        type Owned = Self;
11226
11227        #[inline(always)]
11228        fn inline_align(_context: fidl::encoding::Context) -> usize {
11229            8
11230        }
11231
11232        #[inline(always)]
11233        fn inline_size(_context: fidl::encoding::Context) -> usize {
11234            24
11235        }
11236    }
11237
11238    unsafe impl
11239        fidl::encoding::Encode<
11240            GuestManagerLaunchRequest,
11241            fidl::encoding::DefaultFuchsiaResourceDialect,
11242        > for &mut GuestManagerLaunchRequest
11243    {
11244        #[inline]
11245        unsafe fn encode(
11246            self,
11247            encoder: &mut fidl::encoding::Encoder<
11248                '_,
11249                fidl::encoding::DefaultFuchsiaResourceDialect,
11250            >,
11251            offset: usize,
11252            _depth: fidl::encoding::Depth,
11253        ) -> fidl::Result<()> {
11254            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
11255            // Delegate to tuple encoding.
11256            fidl::encoding::Encode::<GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11257                (
11258                    <GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest_config),
11259                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
11260                ),
11261                encoder, offset, _depth
11262            )
11263        }
11264    }
11265    unsafe impl<
11266        T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
11267        T1: fidl::encoding::Encode<
11268                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11269                fidl::encoding::DefaultFuchsiaResourceDialect,
11270            >,
11271    >
11272        fidl::encoding::Encode<
11273            GuestManagerLaunchRequest,
11274            fidl::encoding::DefaultFuchsiaResourceDialect,
11275        > for (T0, T1)
11276    {
11277        #[inline]
11278        unsafe fn encode(
11279            self,
11280            encoder: &mut fidl::encoding::Encoder<
11281                '_,
11282                fidl::encoding::DefaultFuchsiaResourceDialect,
11283            >,
11284            offset: usize,
11285            depth: fidl::encoding::Depth,
11286        ) -> fidl::Result<()> {
11287            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
11288            // Zero out padding regions. There's no need to apply masks
11289            // because the unmasked parts will be overwritten by fields.
11290            unsafe {
11291                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11292                (ptr as *mut u64).write_unaligned(0);
11293            }
11294            // Write the fields.
11295            self.0.encode(encoder, offset + 0, depth)?;
11296            self.1.encode(encoder, offset + 16, depth)?;
11297            Ok(())
11298        }
11299    }
11300
11301    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11302        for GuestManagerLaunchRequest
11303    {
11304        #[inline(always)]
11305        fn new_empty() -> Self {
11306            Self {
11307                guest_config: fidl::new_empty!(
11308                    GuestConfig,
11309                    fidl::encoding::DefaultFuchsiaResourceDialect
11310                ),
11311                controller: fidl::new_empty!(
11312                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11313                    fidl::encoding::DefaultFuchsiaResourceDialect
11314                ),
11315            }
11316        }
11317
11318        #[inline]
11319        unsafe fn decode(
11320            &mut self,
11321            decoder: &mut fidl::encoding::Decoder<
11322                '_,
11323                fidl::encoding::DefaultFuchsiaResourceDialect,
11324            >,
11325            offset: usize,
11326            _depth: fidl::encoding::Depth,
11327        ) -> fidl::Result<()> {
11328            decoder.debug_check_bounds::<Self>(offset);
11329            // Verify that padding bytes are zero.
11330            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11331            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11332            let mask = 0xffffffff00000000u64;
11333            let maskedval = padval & mask;
11334            if maskedval != 0 {
11335                return Err(fidl::Error::NonZeroPadding {
11336                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11337                });
11338            }
11339            fidl::decode!(
11340                GuestConfig,
11341                fidl::encoding::DefaultFuchsiaResourceDialect,
11342                &mut self.guest_config,
11343                decoder,
11344                offset + 0,
11345                _depth
11346            )?;
11347            fidl::decode!(
11348                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
11349                fidl::encoding::DefaultFuchsiaResourceDialect,
11350                &mut self.controller,
11351                decoder,
11352                offset + 16,
11353                _depth
11354            )?;
11355            Ok(())
11356        }
11357    }
11358
11359    impl fidl::encoding::ResourceTypeMarker for GuestGetConsoleResponse {
11360        type Borrowed<'a> = &'a mut Self;
11361        fn take_or_borrow<'a>(
11362            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11363        ) -> Self::Borrowed<'a> {
11364            value
11365        }
11366    }
11367
11368    unsafe impl fidl::encoding::TypeMarker for GuestGetConsoleResponse {
11369        type Owned = Self;
11370
11371        #[inline(always)]
11372        fn inline_align(_context: fidl::encoding::Context) -> usize {
11373            4
11374        }
11375
11376        #[inline(always)]
11377        fn inline_size(_context: fidl::encoding::Context) -> usize {
11378            4
11379        }
11380    }
11381
11382    unsafe impl
11383        fidl::encoding::Encode<
11384            GuestGetConsoleResponse,
11385            fidl::encoding::DefaultFuchsiaResourceDialect,
11386        > for &mut GuestGetConsoleResponse
11387    {
11388        #[inline]
11389        unsafe fn encode(
11390            self,
11391            encoder: &mut fidl::encoding::Encoder<
11392                '_,
11393                fidl::encoding::DefaultFuchsiaResourceDialect,
11394            >,
11395            offset: usize,
11396            _depth: fidl::encoding::Depth,
11397        ) -> fidl::Result<()> {
11398            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
11399            // Delegate to tuple encoding.
11400            fidl::encoding::Encode::<
11401                GuestGetConsoleResponse,
11402                fidl::encoding::DefaultFuchsiaResourceDialect,
11403            >::encode(
11404                (<fidl::encoding::HandleType<
11405                    fidl::Socket,
11406                    { fidl::ObjectType::SOCKET.into_raw() },
11407                    2147483648,
11408                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11409                    &mut self.socket
11410                ),),
11411                encoder,
11412                offset,
11413                _depth,
11414            )
11415        }
11416    }
11417    unsafe impl<
11418        T0: fidl::encoding::Encode<
11419                fidl::encoding::HandleType<
11420                    fidl::Socket,
11421                    { fidl::ObjectType::SOCKET.into_raw() },
11422                    2147483648,
11423                >,
11424                fidl::encoding::DefaultFuchsiaResourceDialect,
11425            >,
11426    >
11427        fidl::encoding::Encode<
11428            GuestGetConsoleResponse,
11429            fidl::encoding::DefaultFuchsiaResourceDialect,
11430        > for (T0,)
11431    {
11432        #[inline]
11433        unsafe fn encode(
11434            self,
11435            encoder: &mut fidl::encoding::Encoder<
11436                '_,
11437                fidl::encoding::DefaultFuchsiaResourceDialect,
11438            >,
11439            offset: usize,
11440            depth: fidl::encoding::Depth,
11441        ) -> fidl::Result<()> {
11442            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
11443            // Zero out padding regions. There's no need to apply masks
11444            // because the unmasked parts will be overwritten by fields.
11445            // Write the fields.
11446            self.0.encode(encoder, offset + 0, depth)?;
11447            Ok(())
11448        }
11449    }
11450
11451    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11452        for GuestGetConsoleResponse
11453    {
11454        #[inline(always)]
11455        fn new_empty() -> Self {
11456            Self {
11457                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11458            }
11459        }
11460
11461        #[inline]
11462        unsafe fn decode(
11463            &mut self,
11464            decoder: &mut fidl::encoding::Decoder<
11465                '_,
11466                fidl::encoding::DefaultFuchsiaResourceDialect,
11467            >,
11468            offset: usize,
11469            _depth: fidl::encoding::Depth,
11470        ) -> fidl::Result<()> {
11471            decoder.debug_check_bounds::<Self>(offset);
11472            // Verify that padding bytes are zero.
11473            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11474            Ok(())
11475        }
11476    }
11477
11478    impl fidl::encoding::ResourceTypeMarker for HostVsockAcceptorAcceptResponse {
11479        type Borrowed<'a> = &'a mut Self;
11480        fn take_or_borrow<'a>(
11481            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11482        ) -> Self::Borrowed<'a> {
11483            value
11484        }
11485    }
11486
11487    unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptResponse {
11488        type Owned = Self;
11489
11490        #[inline(always)]
11491        fn inline_align(_context: fidl::encoding::Context) -> usize {
11492            4
11493        }
11494
11495        #[inline(always)]
11496        fn inline_size(_context: fidl::encoding::Context) -> usize {
11497            4
11498        }
11499    }
11500
11501    unsafe impl
11502        fidl::encoding::Encode<
11503            HostVsockAcceptorAcceptResponse,
11504            fidl::encoding::DefaultFuchsiaResourceDialect,
11505        > for &mut HostVsockAcceptorAcceptResponse
11506    {
11507        #[inline]
11508        unsafe fn encode(
11509            self,
11510            encoder: &mut fidl::encoding::Encoder<
11511                '_,
11512                fidl::encoding::DefaultFuchsiaResourceDialect,
11513            >,
11514            offset: usize,
11515            _depth: fidl::encoding::Depth,
11516        ) -> fidl::Result<()> {
11517            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
11518            // Delegate to tuple encoding.
11519            fidl::encoding::Encode::<
11520                HostVsockAcceptorAcceptResponse,
11521                fidl::encoding::DefaultFuchsiaResourceDialect,
11522            >::encode(
11523                (<fidl::encoding::HandleType<
11524                    fidl::Socket,
11525                    { fidl::ObjectType::SOCKET.into_raw() },
11526                    2147483648,
11527                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11528                    &mut self.socket
11529                ),),
11530                encoder,
11531                offset,
11532                _depth,
11533            )
11534        }
11535    }
11536    unsafe impl<
11537        T0: fidl::encoding::Encode<
11538                fidl::encoding::HandleType<
11539                    fidl::Socket,
11540                    { fidl::ObjectType::SOCKET.into_raw() },
11541                    2147483648,
11542                >,
11543                fidl::encoding::DefaultFuchsiaResourceDialect,
11544            >,
11545    >
11546        fidl::encoding::Encode<
11547            HostVsockAcceptorAcceptResponse,
11548            fidl::encoding::DefaultFuchsiaResourceDialect,
11549        > for (T0,)
11550    {
11551        #[inline]
11552        unsafe fn encode(
11553            self,
11554            encoder: &mut fidl::encoding::Encoder<
11555                '_,
11556                fidl::encoding::DefaultFuchsiaResourceDialect,
11557            >,
11558            offset: usize,
11559            depth: fidl::encoding::Depth,
11560        ) -> fidl::Result<()> {
11561            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
11562            // Zero out padding regions. There's no need to apply masks
11563            // because the unmasked parts will be overwritten by fields.
11564            // Write the fields.
11565            self.0.encode(encoder, offset + 0, depth)?;
11566            Ok(())
11567        }
11568    }
11569
11570    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11571        for HostVsockAcceptorAcceptResponse
11572    {
11573        #[inline(always)]
11574        fn new_empty() -> Self {
11575            Self {
11576                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11577            }
11578        }
11579
11580        #[inline]
11581        unsafe fn decode(
11582            &mut self,
11583            decoder: &mut fidl::encoding::Decoder<
11584                '_,
11585                fidl::encoding::DefaultFuchsiaResourceDialect,
11586            >,
11587            offset: usize,
11588            _depth: fidl::encoding::Depth,
11589        ) -> fidl::Result<()> {
11590            decoder.debug_check_bounds::<Self>(offset);
11591            // Verify that padding bytes are zero.
11592            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11593            Ok(())
11594        }
11595    }
11596
11597    impl fidl::encoding::ResourceTypeMarker for HostVsockEndpointConnectResponse {
11598        type Borrowed<'a> = &'a mut Self;
11599        fn take_or_borrow<'a>(
11600            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11601        ) -> Self::Borrowed<'a> {
11602            value
11603        }
11604    }
11605
11606    unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectResponse {
11607        type Owned = Self;
11608
11609        #[inline(always)]
11610        fn inline_align(_context: fidl::encoding::Context) -> usize {
11611            4
11612        }
11613
11614        #[inline(always)]
11615        fn inline_size(_context: fidl::encoding::Context) -> usize {
11616            4
11617        }
11618    }
11619
11620    unsafe impl
11621        fidl::encoding::Encode<
11622            HostVsockEndpointConnectResponse,
11623            fidl::encoding::DefaultFuchsiaResourceDialect,
11624        > for &mut HostVsockEndpointConnectResponse
11625    {
11626        #[inline]
11627        unsafe fn encode(
11628            self,
11629            encoder: &mut fidl::encoding::Encoder<
11630                '_,
11631                fidl::encoding::DefaultFuchsiaResourceDialect,
11632            >,
11633            offset: usize,
11634            _depth: fidl::encoding::Depth,
11635        ) -> fidl::Result<()> {
11636            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
11637            // Delegate to tuple encoding.
11638            fidl::encoding::Encode::<
11639                HostVsockEndpointConnectResponse,
11640                fidl::encoding::DefaultFuchsiaResourceDialect,
11641            >::encode(
11642                (<fidl::encoding::HandleType<
11643                    fidl::Socket,
11644                    { fidl::ObjectType::SOCKET.into_raw() },
11645                    2147483648,
11646                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11647                    &mut self.socket
11648                ),),
11649                encoder,
11650                offset,
11651                _depth,
11652            )
11653        }
11654    }
11655    unsafe impl<
11656        T0: fidl::encoding::Encode<
11657                fidl::encoding::HandleType<
11658                    fidl::Socket,
11659                    { fidl::ObjectType::SOCKET.into_raw() },
11660                    2147483648,
11661                >,
11662                fidl::encoding::DefaultFuchsiaResourceDialect,
11663            >,
11664    >
11665        fidl::encoding::Encode<
11666            HostVsockEndpointConnectResponse,
11667            fidl::encoding::DefaultFuchsiaResourceDialect,
11668        > for (T0,)
11669    {
11670        #[inline]
11671        unsafe fn encode(
11672            self,
11673            encoder: &mut fidl::encoding::Encoder<
11674                '_,
11675                fidl::encoding::DefaultFuchsiaResourceDialect,
11676            >,
11677            offset: usize,
11678            depth: fidl::encoding::Depth,
11679        ) -> fidl::Result<()> {
11680            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
11681            // Zero out padding regions. There's no need to apply masks
11682            // because the unmasked parts will be overwritten by fields.
11683            // Write the fields.
11684            self.0.encode(encoder, offset + 0, depth)?;
11685            Ok(())
11686        }
11687    }
11688
11689    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11690        for HostVsockEndpointConnectResponse
11691    {
11692        #[inline(always)]
11693        fn new_empty() -> Self {
11694            Self {
11695                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11696            }
11697        }
11698
11699        #[inline]
11700        unsafe fn decode(
11701            &mut self,
11702            decoder: &mut fidl::encoding::Decoder<
11703                '_,
11704                fidl::encoding::DefaultFuchsiaResourceDialect,
11705            >,
11706            offset: usize,
11707            _depth: fidl::encoding::Depth,
11708        ) -> fidl::Result<()> {
11709            decoder.debug_check_bounds::<Self>(offset);
11710            // Verify that padding bytes are zero.
11711            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
11712            Ok(())
11713        }
11714    }
11715
11716    impl fidl::encoding::ResourceTypeMarker for Listener {
11717        type Borrowed<'a> = &'a mut Self;
11718        fn take_or_borrow<'a>(
11719            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11720        ) -> Self::Borrowed<'a> {
11721            value
11722        }
11723    }
11724
11725    unsafe impl fidl::encoding::TypeMarker for Listener {
11726        type Owned = Self;
11727
11728        #[inline(always)]
11729        fn inline_align(_context: fidl::encoding::Context) -> usize {
11730            4
11731        }
11732
11733        #[inline(always)]
11734        fn inline_size(_context: fidl::encoding::Context) -> usize {
11735            8
11736        }
11737    }
11738
11739    unsafe impl fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
11740        for &mut Listener
11741    {
11742        #[inline]
11743        unsafe fn encode(
11744            self,
11745            encoder: &mut fidl::encoding::Encoder<
11746                '_,
11747                fidl::encoding::DefaultFuchsiaResourceDialect,
11748            >,
11749            offset: usize,
11750            _depth: fidl::encoding::Depth,
11751        ) -> fidl::Result<()> {
11752            encoder.debug_check_bounds::<Listener>(offset);
11753            // Delegate to tuple encoding.
11754            fidl::encoding::Encode::<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11755                (
11756                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
11757                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
11758                ),
11759                encoder, offset, _depth
11760            )
11761        }
11762    }
11763    unsafe impl<
11764        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11765        T1: fidl::encoding::Encode<
11766                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11767                fidl::encoding::DefaultFuchsiaResourceDialect,
11768            >,
11769    > fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
11770    {
11771        #[inline]
11772        unsafe fn encode(
11773            self,
11774            encoder: &mut fidl::encoding::Encoder<
11775                '_,
11776                fidl::encoding::DefaultFuchsiaResourceDialect,
11777            >,
11778            offset: usize,
11779            depth: fidl::encoding::Depth,
11780        ) -> fidl::Result<()> {
11781            encoder.debug_check_bounds::<Listener>(offset);
11782            // Zero out padding regions. There's no need to apply masks
11783            // because the unmasked parts will be overwritten by fields.
11784            // Write the fields.
11785            self.0.encode(encoder, offset + 0, depth)?;
11786            self.1.encode(encoder, offset + 4, depth)?;
11787            Ok(())
11788        }
11789    }
11790
11791    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {
11792        #[inline(always)]
11793        fn new_empty() -> Self {
11794            Self {
11795                port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11796                acceptor: fidl::new_empty!(
11797                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11798                    fidl::encoding::DefaultFuchsiaResourceDialect
11799                ),
11800            }
11801        }
11802
11803        #[inline]
11804        unsafe fn decode(
11805            &mut self,
11806            decoder: &mut fidl::encoding::Decoder<
11807                '_,
11808                fidl::encoding::DefaultFuchsiaResourceDialect,
11809            >,
11810            offset: usize,
11811            _depth: fidl::encoding::Depth,
11812        ) -> fidl::Result<()> {
11813            decoder.debug_check_bounds::<Self>(offset);
11814            // Verify that padding bytes are zero.
11815            fidl::decode!(
11816                u32,
11817                fidl::encoding::DefaultFuchsiaResourceDialect,
11818                &mut self.port,
11819                decoder,
11820                offset + 0,
11821                _depth
11822            )?;
11823            fidl::decode!(
11824                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
11825                fidl::encoding::DefaultFuchsiaResourceDialect,
11826                &mut self.acceptor,
11827                decoder,
11828                offset + 4,
11829                _depth
11830            )?;
11831            Ok(())
11832        }
11833    }
11834
11835    impl GuestConfig {
11836        #[inline(always)]
11837        fn max_ordinal_present(&self) -> u64 {
11838            if let Some(_) = self.virtio_mem_region_alignment {
11839                return 25;
11840            }
11841            if let Some(_) = self.virtio_mem_region_size {
11842                return 24;
11843            }
11844            if let Some(_) = self.virtio_mem_block_size {
11845                return 23;
11846            }
11847            if let Some(_) = self.virtio_mem {
11848                return 22;
11849            }
11850            if let Some(_) = self.vsock_listeners {
11851                return 21;
11852            }
11853            if let Some(_) = self.virtio_sound_input {
11854                return 20;
11855            }
11856            if let Some(_) = self.virtio_sound {
11857                return 19;
11858            }
11859            if let Some(_) = self.virtio_vsock {
11860                return 18;
11861            }
11862            if let Some(_) = self.virtio_rng {
11863                return 17;
11864            }
11865            if let Some(_) = self.virtio_gpu {
11866                return 16;
11867            }
11868            if let Some(_) = self.virtio_console {
11869                return 15;
11870            }
11871            if let Some(_) = self.virtio_balloon {
11872                return 14;
11873            }
11874            if let Some(_) = self.default_net {
11875                return 13;
11876            }
11877            if let Some(_) = self.net_devices {
11878                return 10;
11879            }
11880            if let Some(_) = self.block_devices {
11881                return 9;
11882            }
11883            if let Some(_) = self.guest_memory {
11884                return 8;
11885            }
11886            if let Some(_) = self.cpus {
11887                return 7;
11888            }
11889            if let Some(_) = self.cmdline_add {
11890                return 6;
11891            }
11892            if let Some(_) = self.cmdline {
11893                return 5;
11894            }
11895            if let Some(_) = self.dtb_overlay {
11896                return 4;
11897            }
11898            if let Some(_) = self.ramdisk {
11899                return 3;
11900            }
11901            if let Some(_) = self.kernel {
11902                return 2;
11903            }
11904            if let Some(_) = self.kernel_type {
11905                return 1;
11906            }
11907            0
11908        }
11909    }
11910
11911    impl fidl::encoding::ResourceTypeMarker for GuestConfig {
11912        type Borrowed<'a> = &'a mut Self;
11913        fn take_or_borrow<'a>(
11914            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11915        ) -> Self::Borrowed<'a> {
11916            value
11917        }
11918    }
11919
11920    unsafe impl fidl::encoding::TypeMarker for GuestConfig {
11921        type Owned = Self;
11922
11923        #[inline(always)]
11924        fn inline_align(_context: fidl::encoding::Context) -> usize {
11925            8
11926        }
11927
11928        #[inline(always)]
11929        fn inline_size(_context: fidl::encoding::Context) -> usize {
11930            16
11931        }
11932    }
11933
11934    unsafe impl fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
11935        for &mut GuestConfig
11936    {
11937        unsafe fn encode(
11938            self,
11939            encoder: &mut fidl::encoding::Encoder<
11940                '_,
11941                fidl::encoding::DefaultFuchsiaResourceDialect,
11942            >,
11943            offset: usize,
11944            mut depth: fidl::encoding::Depth,
11945        ) -> fidl::Result<()> {
11946            encoder.debug_check_bounds::<GuestConfig>(offset);
11947            // Vector header
11948            let max_ordinal: u64 = self.max_ordinal_present();
11949            encoder.write_num(max_ordinal, offset);
11950            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11951            // Calling encoder.out_of_line_offset(0) is not allowed.
11952            if max_ordinal == 0 {
11953                return Ok(());
11954            }
11955            depth.increment()?;
11956            let envelope_size = 8;
11957            let bytes_len = max_ordinal as usize * envelope_size;
11958            #[allow(unused_variables)]
11959            let offset = encoder.out_of_line_offset(bytes_len);
11960            let mut _prev_end_offset: usize = 0;
11961            if 1 > max_ordinal {
11962                return Ok(());
11963            }
11964
11965            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11966            // are envelope_size bytes.
11967            let cur_offset: usize = (1 - 1) * envelope_size;
11968
11969            // Zero reserved fields.
11970            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11971
11972            // Safety:
11973            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11974            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11975            //   envelope_size bytes, there is always sufficient room.
11976            fidl::encoding::encode_in_envelope_optional::<
11977                KernelType,
11978                fidl::encoding::DefaultFuchsiaResourceDialect,
11979            >(
11980                self.kernel_type
11981                    .as_ref()
11982                    .map(<KernelType as fidl::encoding::ValueTypeMarker>::borrow),
11983                encoder,
11984                offset + cur_offset,
11985                depth,
11986            )?;
11987
11988            _prev_end_offset = cur_offset + envelope_size;
11989            if 2 > max_ordinal {
11990                return Ok(());
11991            }
11992
11993            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11994            // are envelope_size bytes.
11995            let cur_offset: usize = (2 - 1) * envelope_size;
11996
11997            // Zero reserved fields.
11998            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11999
12000            // Safety:
12001            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12002            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12003            //   envelope_size bytes, there is always sufficient room.
12004            fidl::encoding::encode_in_envelope_optional::<
12005                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12006                fidl::encoding::DefaultFuchsiaResourceDialect,
12007            >(
12008                self.kernel.as_mut().map(
12009                    <fidl::encoding::Endpoint<
12010                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12011                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12012                ),
12013                encoder,
12014                offset + cur_offset,
12015                depth,
12016            )?;
12017
12018            _prev_end_offset = cur_offset + envelope_size;
12019            if 3 > max_ordinal {
12020                return Ok(());
12021            }
12022
12023            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12024            // are envelope_size bytes.
12025            let cur_offset: usize = (3 - 1) * envelope_size;
12026
12027            // Zero reserved fields.
12028            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12029
12030            // Safety:
12031            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12032            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12033            //   envelope_size bytes, there is always sufficient room.
12034            fidl::encoding::encode_in_envelope_optional::<
12035                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12036                fidl::encoding::DefaultFuchsiaResourceDialect,
12037            >(
12038                self.ramdisk.as_mut().map(
12039                    <fidl::encoding::Endpoint<
12040                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12041                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12042                ),
12043                encoder,
12044                offset + cur_offset,
12045                depth,
12046            )?;
12047
12048            _prev_end_offset = cur_offset + envelope_size;
12049            if 4 > max_ordinal {
12050                return Ok(());
12051            }
12052
12053            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12054            // are envelope_size bytes.
12055            let cur_offset: usize = (4 - 1) * envelope_size;
12056
12057            // Zero reserved fields.
12058            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12059
12060            // Safety:
12061            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12062            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12063            //   envelope_size bytes, there is always sufficient room.
12064            fidl::encoding::encode_in_envelope_optional::<
12065                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
12066                fidl::encoding::DefaultFuchsiaResourceDialect,
12067            >(
12068                self.dtb_overlay.as_mut().map(
12069                    <fidl::encoding::Endpoint<
12070                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12071                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12072                ),
12073                encoder,
12074                offset + cur_offset,
12075                depth,
12076            )?;
12077
12078            _prev_end_offset = cur_offset + envelope_size;
12079            if 5 > max_ordinal {
12080                return Ok(());
12081            }
12082
12083            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12084            // are envelope_size bytes.
12085            let cur_offset: usize = (5 - 1) * envelope_size;
12086
12087            // Zero reserved fields.
12088            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12089
12090            // Safety:
12091            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12092            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12093            //   envelope_size bytes, there is always sufficient room.
12094            fidl::encoding::encode_in_envelope_optional::<
12095                fidl::encoding::UnboundedString,
12096                fidl::encoding::DefaultFuchsiaResourceDialect,
12097            >(
12098                self.cmdline.as_ref().map(
12099                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
12100                ),
12101                encoder,
12102                offset + cur_offset,
12103                depth,
12104            )?;
12105
12106            _prev_end_offset = cur_offset + envelope_size;
12107            if 6 > max_ordinal {
12108                return Ok(());
12109            }
12110
12111            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12112            // are envelope_size bytes.
12113            let cur_offset: usize = (6 - 1) * envelope_size;
12114
12115            // Zero reserved fields.
12116            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12117
12118            // Safety:
12119            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12120            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12121            //   envelope_size bytes, there is always sufficient room.
12122            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12123            self.cmdline_add.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
12124            encoder, offset + cur_offset, depth
12125        )?;
12126
12127            _prev_end_offset = cur_offset + envelope_size;
12128            if 7 > max_ordinal {
12129                return Ok(());
12130            }
12131
12132            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12133            // are envelope_size bytes.
12134            let cur_offset: usize = (7 - 1) * envelope_size;
12135
12136            // Zero reserved fields.
12137            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12138
12139            // Safety:
12140            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12141            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12142            //   envelope_size bytes, there is always sufficient room.
12143            fidl::encoding::encode_in_envelope_optional::<
12144                u8,
12145                fidl::encoding::DefaultFuchsiaResourceDialect,
12146            >(
12147                self.cpus.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
12148                encoder,
12149                offset + cur_offset,
12150                depth,
12151            )?;
12152
12153            _prev_end_offset = cur_offset + envelope_size;
12154            if 8 > 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 = (8 - 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::<
12170                u64,
12171                fidl::encoding::DefaultFuchsiaResourceDialect,
12172            >(
12173                self.guest_memory.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12174                encoder,
12175                offset + cur_offset,
12176                depth,
12177            )?;
12178
12179            _prev_end_offset = cur_offset + envelope_size;
12180            if 9 > max_ordinal {
12181                return Ok(());
12182            }
12183
12184            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12185            // are envelope_size bytes.
12186            let cur_offset: usize = (9 - 1) * envelope_size;
12187
12188            // Zero reserved fields.
12189            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12190
12191            // Safety:
12192            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12193            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12194            //   envelope_size bytes, there is always sufficient room.
12195            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12196            self.block_devices.as_mut().map(<fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12197            encoder, offset + cur_offset, depth
12198        )?;
12199
12200            _prev_end_offset = cur_offset + envelope_size;
12201            if 10 > 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 = (10 - 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::<fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12217            self.net_devices.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
12218            encoder, offset + cur_offset, depth
12219        )?;
12220
12221            _prev_end_offset = cur_offset + envelope_size;
12222            if 13 > max_ordinal {
12223                return Ok(());
12224            }
12225
12226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12227            // are envelope_size bytes.
12228            let cur_offset: usize = (13 - 1) * envelope_size;
12229
12230            // Zero reserved fields.
12231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12232
12233            // Safety:
12234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12236            //   envelope_size bytes, there is always sufficient room.
12237            fidl::encoding::encode_in_envelope_optional::<
12238                bool,
12239                fidl::encoding::DefaultFuchsiaResourceDialect,
12240            >(
12241                self.default_net.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12242                encoder,
12243                offset + cur_offset,
12244                depth,
12245            )?;
12246
12247            _prev_end_offset = cur_offset + envelope_size;
12248            if 14 > 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 = (14 - 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::<
12264                bool,
12265                fidl::encoding::DefaultFuchsiaResourceDialect,
12266            >(
12267                self.virtio_balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12268                encoder,
12269                offset + cur_offset,
12270                depth,
12271            )?;
12272
12273            _prev_end_offset = cur_offset + envelope_size;
12274            if 15 > max_ordinal {
12275                return Ok(());
12276            }
12277
12278            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12279            // are envelope_size bytes.
12280            let cur_offset: usize = (15 - 1) * envelope_size;
12281
12282            // Zero reserved fields.
12283            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12284
12285            // Safety:
12286            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12287            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12288            //   envelope_size bytes, there is always sufficient room.
12289            fidl::encoding::encode_in_envelope_optional::<
12290                bool,
12291                fidl::encoding::DefaultFuchsiaResourceDialect,
12292            >(
12293                self.virtio_console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12294                encoder,
12295                offset + cur_offset,
12296                depth,
12297            )?;
12298
12299            _prev_end_offset = cur_offset + envelope_size;
12300            if 16 > max_ordinal {
12301                return Ok(());
12302            }
12303
12304            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12305            // are envelope_size bytes.
12306            let cur_offset: usize = (16 - 1) * envelope_size;
12307
12308            // Zero reserved fields.
12309            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12310
12311            // Safety:
12312            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12313            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12314            //   envelope_size bytes, there is always sufficient room.
12315            fidl::encoding::encode_in_envelope_optional::<
12316                bool,
12317                fidl::encoding::DefaultFuchsiaResourceDialect,
12318            >(
12319                self.virtio_gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12320                encoder,
12321                offset + cur_offset,
12322                depth,
12323            )?;
12324
12325            _prev_end_offset = cur_offset + envelope_size;
12326            if 17 > max_ordinal {
12327                return Ok(());
12328            }
12329
12330            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12331            // are envelope_size bytes.
12332            let cur_offset: usize = (17 - 1) * envelope_size;
12333
12334            // Zero reserved fields.
12335            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12336
12337            // Safety:
12338            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12339            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12340            //   envelope_size bytes, there is always sufficient room.
12341            fidl::encoding::encode_in_envelope_optional::<
12342                bool,
12343                fidl::encoding::DefaultFuchsiaResourceDialect,
12344            >(
12345                self.virtio_rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12346                encoder,
12347                offset + cur_offset,
12348                depth,
12349            )?;
12350
12351            _prev_end_offset = cur_offset + envelope_size;
12352            if 18 > max_ordinal {
12353                return Ok(());
12354            }
12355
12356            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12357            // are envelope_size bytes.
12358            let cur_offset: usize = (18 - 1) * envelope_size;
12359
12360            // Zero reserved fields.
12361            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12362
12363            // Safety:
12364            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12365            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12366            //   envelope_size bytes, there is always sufficient room.
12367            fidl::encoding::encode_in_envelope_optional::<
12368                bool,
12369                fidl::encoding::DefaultFuchsiaResourceDialect,
12370            >(
12371                self.virtio_vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12372                encoder,
12373                offset + cur_offset,
12374                depth,
12375            )?;
12376
12377            _prev_end_offset = cur_offset + envelope_size;
12378            if 19 > max_ordinal {
12379                return Ok(());
12380            }
12381
12382            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12383            // are envelope_size bytes.
12384            let cur_offset: usize = (19 - 1) * envelope_size;
12385
12386            // Zero reserved fields.
12387            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12388
12389            // Safety:
12390            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12391            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12392            //   envelope_size bytes, there is always sufficient room.
12393            fidl::encoding::encode_in_envelope_optional::<
12394                bool,
12395                fidl::encoding::DefaultFuchsiaResourceDialect,
12396            >(
12397                self.virtio_sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12398                encoder,
12399                offset + cur_offset,
12400                depth,
12401            )?;
12402
12403            _prev_end_offset = cur_offset + envelope_size;
12404            if 20 > max_ordinal {
12405                return Ok(());
12406            }
12407
12408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12409            // are envelope_size bytes.
12410            let cur_offset: usize = (20 - 1) * envelope_size;
12411
12412            // Zero reserved fields.
12413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12414
12415            // Safety:
12416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12418            //   envelope_size bytes, there is always sufficient room.
12419            fidl::encoding::encode_in_envelope_optional::<
12420                bool,
12421                fidl::encoding::DefaultFuchsiaResourceDialect,
12422            >(
12423                self.virtio_sound_input
12424                    .as_ref()
12425                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12426                encoder,
12427                offset + cur_offset,
12428                depth,
12429            )?;
12430
12431            _prev_end_offset = cur_offset + envelope_size;
12432            if 21 > max_ordinal {
12433                return Ok(());
12434            }
12435
12436            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12437            // are envelope_size bytes.
12438            let cur_offset: usize = (21 - 1) * envelope_size;
12439
12440            // Zero reserved fields.
12441            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12442
12443            // Safety:
12444            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12445            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12446            //   envelope_size bytes, there is always sufficient room.
12447            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Listener>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12448            self.vsock_listeners.as_mut().map(<fidl::encoding::UnboundedVector<Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12449            encoder, offset + cur_offset, depth
12450        )?;
12451
12452            _prev_end_offset = cur_offset + envelope_size;
12453            if 22 > max_ordinal {
12454                return Ok(());
12455            }
12456
12457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12458            // are envelope_size bytes.
12459            let cur_offset: usize = (22 - 1) * envelope_size;
12460
12461            // Zero reserved fields.
12462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12463
12464            // Safety:
12465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12467            //   envelope_size bytes, there is always sufficient room.
12468            fidl::encoding::encode_in_envelope_optional::<
12469                bool,
12470                fidl::encoding::DefaultFuchsiaResourceDialect,
12471            >(
12472                self.virtio_mem.as_ref().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 23 > 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 = (23 - 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::<
12495                u64,
12496                fidl::encoding::DefaultFuchsiaResourceDialect,
12497            >(
12498                self.virtio_mem_block_size
12499                    .as_ref()
12500                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12501                encoder,
12502                offset + cur_offset,
12503                depth,
12504            )?;
12505
12506            _prev_end_offset = cur_offset + envelope_size;
12507            if 24 > max_ordinal {
12508                return Ok(());
12509            }
12510
12511            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12512            // are envelope_size bytes.
12513            let cur_offset: usize = (24 - 1) * envelope_size;
12514
12515            // Zero reserved fields.
12516            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12517
12518            // Safety:
12519            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12520            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12521            //   envelope_size bytes, there is always sufficient room.
12522            fidl::encoding::encode_in_envelope_optional::<
12523                u64,
12524                fidl::encoding::DefaultFuchsiaResourceDialect,
12525            >(
12526                self.virtio_mem_region_size
12527                    .as_ref()
12528                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12529                encoder,
12530                offset + cur_offset,
12531                depth,
12532            )?;
12533
12534            _prev_end_offset = cur_offset + envelope_size;
12535            if 25 > max_ordinal {
12536                return Ok(());
12537            }
12538
12539            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12540            // are envelope_size bytes.
12541            let cur_offset: usize = (25 - 1) * envelope_size;
12542
12543            // Zero reserved fields.
12544            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12545
12546            // Safety:
12547            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12548            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12549            //   envelope_size bytes, there is always sufficient room.
12550            fidl::encoding::encode_in_envelope_optional::<
12551                u64,
12552                fidl::encoding::DefaultFuchsiaResourceDialect,
12553            >(
12554                self.virtio_mem_region_alignment
12555                    .as_ref()
12556                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12557                encoder,
12558                offset + cur_offset,
12559                depth,
12560            )?;
12561
12562            _prev_end_offset = cur_offset + envelope_size;
12563
12564            Ok(())
12565        }
12566    }
12567
12568    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {
12569        #[inline(always)]
12570        fn new_empty() -> Self {
12571            Self::default()
12572        }
12573
12574        unsafe fn decode(
12575            &mut self,
12576            decoder: &mut fidl::encoding::Decoder<
12577                '_,
12578                fidl::encoding::DefaultFuchsiaResourceDialect,
12579            >,
12580            offset: usize,
12581            mut depth: fidl::encoding::Depth,
12582        ) -> fidl::Result<()> {
12583            decoder.debug_check_bounds::<Self>(offset);
12584            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12585                None => return Err(fidl::Error::NotNullable),
12586                Some(len) => len,
12587            };
12588            // Calling decoder.out_of_line_offset(0) is not allowed.
12589            if len == 0 {
12590                return Ok(());
12591            };
12592            depth.increment()?;
12593            let envelope_size = 8;
12594            let bytes_len = len * envelope_size;
12595            let offset = decoder.out_of_line_offset(bytes_len)?;
12596            // Decode the envelope for each type.
12597            let mut _next_ordinal_to_read = 0;
12598            let mut next_offset = offset;
12599            let end_offset = offset + bytes_len;
12600            _next_ordinal_to_read += 1;
12601            if next_offset >= end_offset {
12602                return Ok(());
12603            }
12604
12605            // Decode unknown envelopes for gaps in ordinals.
12606            while _next_ordinal_to_read < 1 {
12607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12608                _next_ordinal_to_read += 1;
12609                next_offset += envelope_size;
12610            }
12611
12612            let next_out_of_line = decoder.next_out_of_line();
12613            let handles_before = decoder.remaining_handles();
12614            if let Some((inlined, num_bytes, num_handles)) =
12615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12616            {
12617                let member_inline_size =
12618                    <KernelType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12619                if inlined != (member_inline_size <= 4) {
12620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12621                }
12622                let inner_offset;
12623                let mut inner_depth = depth.clone();
12624                if inlined {
12625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12626                    inner_offset = next_offset;
12627                } else {
12628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12629                    inner_depth.increment()?;
12630                }
12631                let val_ref = self.kernel_type.get_or_insert_with(|| {
12632                    fidl::new_empty!(KernelType, fidl::encoding::DefaultFuchsiaResourceDialect)
12633                });
12634                fidl::decode!(
12635                    KernelType,
12636                    fidl::encoding::DefaultFuchsiaResourceDialect,
12637                    val_ref,
12638                    decoder,
12639                    inner_offset,
12640                    inner_depth
12641                )?;
12642                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12643                {
12644                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12645                }
12646                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12647                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12648                }
12649            }
12650
12651            next_offset += envelope_size;
12652            _next_ordinal_to_read += 1;
12653            if next_offset >= end_offset {
12654                return Ok(());
12655            }
12656
12657            // Decode unknown envelopes for gaps in ordinals.
12658            while _next_ordinal_to_read < 2 {
12659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12660                _next_ordinal_to_read += 1;
12661                next_offset += envelope_size;
12662            }
12663
12664            let next_out_of_line = decoder.next_out_of_line();
12665            let handles_before = decoder.remaining_handles();
12666            if let Some((inlined, num_bytes, num_handles)) =
12667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12668            {
12669                let member_inline_size = <fidl::encoding::Endpoint<
12670                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12671                > as fidl::encoding::TypeMarker>::inline_size(
12672                    decoder.context
12673                );
12674                if inlined != (member_inline_size <= 4) {
12675                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12676                }
12677                let inner_offset;
12678                let mut inner_depth = depth.clone();
12679                if inlined {
12680                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12681                    inner_offset = next_offset;
12682                } else {
12683                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12684                    inner_depth.increment()?;
12685                }
12686                let val_ref = self.kernel.get_or_insert_with(|| {
12687                    fidl::new_empty!(
12688                        fidl::encoding::Endpoint<
12689                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12690                        >,
12691                        fidl::encoding::DefaultFuchsiaResourceDialect
12692                    )
12693                });
12694                fidl::decode!(
12695                    fidl::encoding::Endpoint<
12696                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12697                    >,
12698                    fidl::encoding::DefaultFuchsiaResourceDialect,
12699                    val_ref,
12700                    decoder,
12701                    inner_offset,
12702                    inner_depth
12703                )?;
12704                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12705                {
12706                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12707                }
12708                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12709                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12710                }
12711            }
12712
12713            next_offset += envelope_size;
12714            _next_ordinal_to_read += 1;
12715            if next_offset >= end_offset {
12716                return Ok(());
12717            }
12718
12719            // Decode unknown envelopes for gaps in ordinals.
12720            while _next_ordinal_to_read < 3 {
12721                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12722                _next_ordinal_to_read += 1;
12723                next_offset += envelope_size;
12724            }
12725
12726            let next_out_of_line = decoder.next_out_of_line();
12727            let handles_before = decoder.remaining_handles();
12728            if let Some((inlined, num_bytes, num_handles)) =
12729                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12730            {
12731                let member_inline_size = <fidl::encoding::Endpoint<
12732                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12733                > as fidl::encoding::TypeMarker>::inline_size(
12734                    decoder.context
12735                );
12736                if inlined != (member_inline_size <= 4) {
12737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12738                }
12739                let inner_offset;
12740                let mut inner_depth = depth.clone();
12741                if inlined {
12742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12743                    inner_offset = next_offset;
12744                } else {
12745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12746                    inner_depth.increment()?;
12747                }
12748                let val_ref = self.ramdisk.get_or_insert_with(|| {
12749                    fidl::new_empty!(
12750                        fidl::encoding::Endpoint<
12751                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12752                        >,
12753                        fidl::encoding::DefaultFuchsiaResourceDialect
12754                    )
12755                });
12756                fidl::decode!(
12757                    fidl::encoding::Endpoint<
12758                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12759                    >,
12760                    fidl::encoding::DefaultFuchsiaResourceDialect,
12761                    val_ref,
12762                    decoder,
12763                    inner_offset,
12764                    inner_depth
12765                )?;
12766                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12767                {
12768                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12769                }
12770                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12771                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12772                }
12773            }
12774
12775            next_offset += envelope_size;
12776            _next_ordinal_to_read += 1;
12777            if next_offset >= end_offset {
12778                return Ok(());
12779            }
12780
12781            // Decode unknown envelopes for gaps in ordinals.
12782            while _next_ordinal_to_read < 4 {
12783                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12784                _next_ordinal_to_read += 1;
12785                next_offset += envelope_size;
12786            }
12787
12788            let next_out_of_line = decoder.next_out_of_line();
12789            let handles_before = decoder.remaining_handles();
12790            if let Some((inlined, num_bytes, num_handles)) =
12791                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12792            {
12793                let member_inline_size = <fidl::encoding::Endpoint<
12794                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12795                > as fidl::encoding::TypeMarker>::inline_size(
12796                    decoder.context
12797                );
12798                if inlined != (member_inline_size <= 4) {
12799                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12800                }
12801                let inner_offset;
12802                let mut inner_depth = depth.clone();
12803                if inlined {
12804                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12805                    inner_offset = next_offset;
12806                } else {
12807                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12808                    inner_depth.increment()?;
12809                }
12810                let val_ref = self.dtb_overlay.get_or_insert_with(|| {
12811                    fidl::new_empty!(
12812                        fidl::encoding::Endpoint<
12813                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12814                        >,
12815                        fidl::encoding::DefaultFuchsiaResourceDialect
12816                    )
12817                });
12818                fidl::decode!(
12819                    fidl::encoding::Endpoint<
12820                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12821                    >,
12822                    fidl::encoding::DefaultFuchsiaResourceDialect,
12823                    val_ref,
12824                    decoder,
12825                    inner_offset,
12826                    inner_depth
12827                )?;
12828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12829                {
12830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12831                }
12832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12834                }
12835            }
12836
12837            next_offset += envelope_size;
12838            _next_ordinal_to_read += 1;
12839            if next_offset >= end_offset {
12840                return Ok(());
12841            }
12842
12843            // Decode unknown envelopes for gaps in ordinals.
12844            while _next_ordinal_to_read < 5 {
12845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12846                _next_ordinal_to_read += 1;
12847                next_offset += envelope_size;
12848            }
12849
12850            let next_out_of_line = decoder.next_out_of_line();
12851            let handles_before = decoder.remaining_handles();
12852            if let Some((inlined, num_bytes, num_handles)) =
12853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12854            {
12855                let member_inline_size =
12856                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
12857                        decoder.context,
12858                    );
12859                if inlined != (member_inline_size <= 4) {
12860                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12861                }
12862                let inner_offset;
12863                let mut inner_depth = depth.clone();
12864                if inlined {
12865                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12866                    inner_offset = next_offset;
12867                } else {
12868                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12869                    inner_depth.increment()?;
12870                }
12871                let val_ref = self.cmdline.get_or_insert_with(|| {
12872                    fidl::new_empty!(
12873                        fidl::encoding::UnboundedString,
12874                        fidl::encoding::DefaultFuchsiaResourceDialect
12875                    )
12876                });
12877                fidl::decode!(
12878                    fidl::encoding::UnboundedString,
12879                    fidl::encoding::DefaultFuchsiaResourceDialect,
12880                    val_ref,
12881                    decoder,
12882                    inner_offset,
12883                    inner_depth
12884                )?;
12885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12886                {
12887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12888                }
12889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12891                }
12892            }
12893
12894            next_offset += envelope_size;
12895            _next_ordinal_to_read += 1;
12896            if next_offset >= end_offset {
12897                return Ok(());
12898            }
12899
12900            // Decode unknown envelopes for gaps in ordinals.
12901            while _next_ordinal_to_read < 6 {
12902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12903                _next_ordinal_to_read += 1;
12904                next_offset += envelope_size;
12905            }
12906
12907            let next_out_of_line = decoder.next_out_of_line();
12908            let handles_before = decoder.remaining_handles();
12909            if let Some((inlined, num_bytes, num_handles)) =
12910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12911            {
12912                let member_inline_size = <fidl::encoding::UnboundedVector<
12913                    fidl::encoding::UnboundedString,
12914                > as fidl::encoding::TypeMarker>::inline_size(
12915                    decoder.context
12916                );
12917                if inlined != (member_inline_size <= 4) {
12918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12919                }
12920                let inner_offset;
12921                let mut inner_depth = depth.clone();
12922                if inlined {
12923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12924                    inner_offset = next_offset;
12925                } else {
12926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12927                    inner_depth.increment()?;
12928                }
12929                let val_ref = self.cmdline_add.get_or_insert_with(|| {
12930                    fidl::new_empty!(
12931                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12932                        fidl::encoding::DefaultFuchsiaResourceDialect
12933                    )
12934                });
12935                fidl::decode!(
12936                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12937                    fidl::encoding::DefaultFuchsiaResourceDialect,
12938                    val_ref,
12939                    decoder,
12940                    inner_offset,
12941                    inner_depth
12942                )?;
12943                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12944                {
12945                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12946                }
12947                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12948                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12949                }
12950            }
12951
12952            next_offset += envelope_size;
12953            _next_ordinal_to_read += 1;
12954            if next_offset >= end_offset {
12955                return Ok(());
12956            }
12957
12958            // Decode unknown envelopes for gaps in ordinals.
12959            while _next_ordinal_to_read < 7 {
12960                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12961                _next_ordinal_to_read += 1;
12962                next_offset += envelope_size;
12963            }
12964
12965            let next_out_of_line = decoder.next_out_of_line();
12966            let handles_before = decoder.remaining_handles();
12967            if let Some((inlined, num_bytes, num_handles)) =
12968                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12969            {
12970                let member_inline_size =
12971                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12972                if inlined != (member_inline_size <= 4) {
12973                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12974                }
12975                let inner_offset;
12976                let mut inner_depth = depth.clone();
12977                if inlined {
12978                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12979                    inner_offset = next_offset;
12980                } else {
12981                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12982                    inner_depth.increment()?;
12983                }
12984                let val_ref = self.cpus.get_or_insert_with(|| {
12985                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
12986                });
12987                fidl::decode!(
12988                    u8,
12989                    fidl::encoding::DefaultFuchsiaResourceDialect,
12990                    val_ref,
12991                    decoder,
12992                    inner_offset,
12993                    inner_depth
12994                )?;
12995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12996                {
12997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12998                }
12999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13001                }
13002            }
13003
13004            next_offset += envelope_size;
13005            _next_ordinal_to_read += 1;
13006            if next_offset >= end_offset {
13007                return Ok(());
13008            }
13009
13010            // Decode unknown envelopes for gaps in ordinals.
13011            while _next_ordinal_to_read < 8 {
13012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13013                _next_ordinal_to_read += 1;
13014                next_offset += envelope_size;
13015            }
13016
13017            let next_out_of_line = decoder.next_out_of_line();
13018            let handles_before = decoder.remaining_handles();
13019            if let Some((inlined, num_bytes, num_handles)) =
13020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13021            {
13022                let member_inline_size =
13023                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13024                if inlined != (member_inline_size <= 4) {
13025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13026                }
13027                let inner_offset;
13028                let mut inner_depth = depth.clone();
13029                if inlined {
13030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13031                    inner_offset = next_offset;
13032                } else {
13033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13034                    inner_depth.increment()?;
13035                }
13036                let val_ref = self.guest_memory.get_or_insert_with(|| {
13037                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13038                });
13039                fidl::decode!(
13040                    u64,
13041                    fidl::encoding::DefaultFuchsiaResourceDialect,
13042                    val_ref,
13043                    decoder,
13044                    inner_offset,
13045                    inner_depth
13046                )?;
13047                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13048                {
13049                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13050                }
13051                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13052                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13053                }
13054            }
13055
13056            next_offset += envelope_size;
13057            _next_ordinal_to_read += 1;
13058            if next_offset >= end_offset {
13059                return Ok(());
13060            }
13061
13062            // Decode unknown envelopes for gaps in ordinals.
13063            while _next_ordinal_to_read < 9 {
13064                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13065                _next_ordinal_to_read += 1;
13066                next_offset += envelope_size;
13067            }
13068
13069            let next_out_of_line = decoder.next_out_of_line();
13070            let handles_before = decoder.remaining_handles();
13071            if let Some((inlined, num_bytes, num_handles)) =
13072                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13073            {
13074                let member_inline_size = <fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13075                if inlined != (member_inline_size <= 4) {
13076                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13077                }
13078                let inner_offset;
13079                let mut inner_depth = depth.clone();
13080                if inlined {
13081                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13082                    inner_offset = next_offset;
13083                } else {
13084                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13085                    inner_depth.increment()?;
13086                }
13087                let val_ref =
13088                self.block_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13089                fidl::decode!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13090                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13091                {
13092                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13093                }
13094                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13095                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13096                }
13097            }
13098
13099            next_offset += envelope_size;
13100            _next_ordinal_to_read += 1;
13101            if next_offset >= end_offset {
13102                return Ok(());
13103            }
13104
13105            // Decode unknown envelopes for gaps in ordinals.
13106            while _next_ordinal_to_read < 10 {
13107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13108                _next_ordinal_to_read += 1;
13109                next_offset += envelope_size;
13110            }
13111
13112            let next_out_of_line = decoder.next_out_of_line();
13113            let handles_before = decoder.remaining_handles();
13114            if let Some((inlined, num_bytes, num_handles)) =
13115                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13116            {
13117                let member_inline_size = <fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13118                if inlined != (member_inline_size <= 4) {
13119                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13120                }
13121                let inner_offset;
13122                let mut inner_depth = depth.clone();
13123                if inlined {
13124                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13125                    inner_offset = next_offset;
13126                } else {
13127                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13128                    inner_depth.increment()?;
13129                }
13130                let val_ref =
13131                self.net_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13132                fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13133                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13134                {
13135                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13136                }
13137                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13138                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13139                }
13140            }
13141
13142            next_offset += envelope_size;
13143            _next_ordinal_to_read += 1;
13144            if next_offset >= end_offset {
13145                return Ok(());
13146            }
13147
13148            // Decode unknown envelopes for gaps in ordinals.
13149            while _next_ordinal_to_read < 13 {
13150                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13151                _next_ordinal_to_read += 1;
13152                next_offset += envelope_size;
13153            }
13154
13155            let next_out_of_line = decoder.next_out_of_line();
13156            let handles_before = decoder.remaining_handles();
13157            if let Some((inlined, num_bytes, num_handles)) =
13158                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13159            {
13160                let member_inline_size =
13161                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13162                if inlined != (member_inline_size <= 4) {
13163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13164                }
13165                let inner_offset;
13166                let mut inner_depth = depth.clone();
13167                if inlined {
13168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13169                    inner_offset = next_offset;
13170                } else {
13171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13172                    inner_depth.increment()?;
13173                }
13174                let val_ref = self.default_net.get_or_insert_with(|| {
13175                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13176                });
13177                fidl::decode!(
13178                    bool,
13179                    fidl::encoding::DefaultFuchsiaResourceDialect,
13180                    val_ref,
13181                    decoder,
13182                    inner_offset,
13183                    inner_depth
13184                )?;
13185                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13186                {
13187                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13188                }
13189                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13190                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13191                }
13192            }
13193
13194            next_offset += envelope_size;
13195            _next_ordinal_to_read += 1;
13196            if next_offset >= end_offset {
13197                return Ok(());
13198            }
13199
13200            // Decode unknown envelopes for gaps in ordinals.
13201            while _next_ordinal_to_read < 14 {
13202                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13203                _next_ordinal_to_read += 1;
13204                next_offset += envelope_size;
13205            }
13206
13207            let next_out_of_line = decoder.next_out_of_line();
13208            let handles_before = decoder.remaining_handles();
13209            if let Some((inlined, num_bytes, num_handles)) =
13210                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13211            {
13212                let member_inline_size =
13213                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13214                if inlined != (member_inline_size <= 4) {
13215                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13216                }
13217                let inner_offset;
13218                let mut inner_depth = depth.clone();
13219                if inlined {
13220                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13221                    inner_offset = next_offset;
13222                } else {
13223                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13224                    inner_depth.increment()?;
13225                }
13226                let val_ref = self.virtio_balloon.get_or_insert_with(|| {
13227                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13228                });
13229                fidl::decode!(
13230                    bool,
13231                    fidl::encoding::DefaultFuchsiaResourceDialect,
13232                    val_ref,
13233                    decoder,
13234                    inner_offset,
13235                    inner_depth
13236                )?;
13237                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13238                {
13239                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13240                }
13241                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13242                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13243                }
13244            }
13245
13246            next_offset += envelope_size;
13247            _next_ordinal_to_read += 1;
13248            if next_offset >= end_offset {
13249                return Ok(());
13250            }
13251
13252            // Decode unknown envelopes for gaps in ordinals.
13253            while _next_ordinal_to_read < 15 {
13254                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13255                _next_ordinal_to_read += 1;
13256                next_offset += envelope_size;
13257            }
13258
13259            let next_out_of_line = decoder.next_out_of_line();
13260            let handles_before = decoder.remaining_handles();
13261            if let Some((inlined, num_bytes, num_handles)) =
13262                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13263            {
13264                let member_inline_size =
13265                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13266                if inlined != (member_inline_size <= 4) {
13267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13268                }
13269                let inner_offset;
13270                let mut inner_depth = depth.clone();
13271                if inlined {
13272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13273                    inner_offset = next_offset;
13274                } else {
13275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13276                    inner_depth.increment()?;
13277                }
13278                let val_ref = self.virtio_console.get_or_insert_with(|| {
13279                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13280                });
13281                fidl::decode!(
13282                    bool,
13283                    fidl::encoding::DefaultFuchsiaResourceDialect,
13284                    val_ref,
13285                    decoder,
13286                    inner_offset,
13287                    inner_depth
13288                )?;
13289                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13290                {
13291                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13292                }
13293                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13294                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13295                }
13296            }
13297
13298            next_offset += envelope_size;
13299            _next_ordinal_to_read += 1;
13300            if next_offset >= end_offset {
13301                return Ok(());
13302            }
13303
13304            // Decode unknown envelopes for gaps in ordinals.
13305            while _next_ordinal_to_read < 16 {
13306                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13307                _next_ordinal_to_read += 1;
13308                next_offset += envelope_size;
13309            }
13310
13311            let next_out_of_line = decoder.next_out_of_line();
13312            let handles_before = decoder.remaining_handles();
13313            if let Some((inlined, num_bytes, num_handles)) =
13314                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13315            {
13316                let member_inline_size =
13317                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13318                if inlined != (member_inline_size <= 4) {
13319                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13320                }
13321                let inner_offset;
13322                let mut inner_depth = depth.clone();
13323                if inlined {
13324                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13325                    inner_offset = next_offset;
13326                } else {
13327                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13328                    inner_depth.increment()?;
13329                }
13330                let val_ref = self.virtio_gpu.get_or_insert_with(|| {
13331                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13332                });
13333                fidl::decode!(
13334                    bool,
13335                    fidl::encoding::DefaultFuchsiaResourceDialect,
13336                    val_ref,
13337                    decoder,
13338                    inner_offset,
13339                    inner_depth
13340                )?;
13341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13342                {
13343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13344                }
13345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13347                }
13348            }
13349
13350            next_offset += envelope_size;
13351            _next_ordinal_to_read += 1;
13352            if next_offset >= end_offset {
13353                return Ok(());
13354            }
13355
13356            // Decode unknown envelopes for gaps in ordinals.
13357            while _next_ordinal_to_read < 17 {
13358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13359                _next_ordinal_to_read += 1;
13360                next_offset += envelope_size;
13361            }
13362
13363            let next_out_of_line = decoder.next_out_of_line();
13364            let handles_before = decoder.remaining_handles();
13365            if let Some((inlined, num_bytes, num_handles)) =
13366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13367            {
13368                let member_inline_size =
13369                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13370                if inlined != (member_inline_size <= 4) {
13371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13372                }
13373                let inner_offset;
13374                let mut inner_depth = depth.clone();
13375                if inlined {
13376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13377                    inner_offset = next_offset;
13378                } else {
13379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13380                    inner_depth.increment()?;
13381                }
13382                let val_ref = self.virtio_rng.get_or_insert_with(|| {
13383                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13384                });
13385                fidl::decode!(
13386                    bool,
13387                    fidl::encoding::DefaultFuchsiaResourceDialect,
13388                    val_ref,
13389                    decoder,
13390                    inner_offset,
13391                    inner_depth
13392                )?;
13393                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13394                {
13395                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13396                }
13397                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13398                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13399                }
13400            }
13401
13402            next_offset += envelope_size;
13403            _next_ordinal_to_read += 1;
13404            if next_offset >= end_offset {
13405                return Ok(());
13406            }
13407
13408            // Decode unknown envelopes for gaps in ordinals.
13409            while _next_ordinal_to_read < 18 {
13410                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13411                _next_ordinal_to_read += 1;
13412                next_offset += envelope_size;
13413            }
13414
13415            let next_out_of_line = decoder.next_out_of_line();
13416            let handles_before = decoder.remaining_handles();
13417            if let Some((inlined, num_bytes, num_handles)) =
13418                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13419            {
13420                let member_inline_size =
13421                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13422                if inlined != (member_inline_size <= 4) {
13423                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13424                }
13425                let inner_offset;
13426                let mut inner_depth = depth.clone();
13427                if inlined {
13428                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13429                    inner_offset = next_offset;
13430                } else {
13431                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13432                    inner_depth.increment()?;
13433                }
13434                let val_ref = self.virtio_vsock.get_or_insert_with(|| {
13435                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13436                });
13437                fidl::decode!(
13438                    bool,
13439                    fidl::encoding::DefaultFuchsiaResourceDialect,
13440                    val_ref,
13441                    decoder,
13442                    inner_offset,
13443                    inner_depth
13444                )?;
13445                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13446                {
13447                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13448                }
13449                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13450                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13451                }
13452            }
13453
13454            next_offset += envelope_size;
13455            _next_ordinal_to_read += 1;
13456            if next_offset >= end_offset {
13457                return Ok(());
13458            }
13459
13460            // Decode unknown envelopes for gaps in ordinals.
13461            while _next_ordinal_to_read < 19 {
13462                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13463                _next_ordinal_to_read += 1;
13464                next_offset += envelope_size;
13465            }
13466
13467            let next_out_of_line = decoder.next_out_of_line();
13468            let handles_before = decoder.remaining_handles();
13469            if let Some((inlined, num_bytes, num_handles)) =
13470                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13471            {
13472                let member_inline_size =
13473                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13474                if inlined != (member_inline_size <= 4) {
13475                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13476                }
13477                let inner_offset;
13478                let mut inner_depth = depth.clone();
13479                if inlined {
13480                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13481                    inner_offset = next_offset;
13482                } else {
13483                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13484                    inner_depth.increment()?;
13485                }
13486                let val_ref = self.virtio_sound.get_or_insert_with(|| {
13487                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13488                });
13489                fidl::decode!(
13490                    bool,
13491                    fidl::encoding::DefaultFuchsiaResourceDialect,
13492                    val_ref,
13493                    decoder,
13494                    inner_offset,
13495                    inner_depth
13496                )?;
13497                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13498                {
13499                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13500                }
13501                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13502                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13503                }
13504            }
13505
13506            next_offset += envelope_size;
13507            _next_ordinal_to_read += 1;
13508            if next_offset >= end_offset {
13509                return Ok(());
13510            }
13511
13512            // Decode unknown envelopes for gaps in ordinals.
13513            while _next_ordinal_to_read < 20 {
13514                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13515                _next_ordinal_to_read += 1;
13516                next_offset += envelope_size;
13517            }
13518
13519            let next_out_of_line = decoder.next_out_of_line();
13520            let handles_before = decoder.remaining_handles();
13521            if let Some((inlined, num_bytes, num_handles)) =
13522                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13523            {
13524                let member_inline_size =
13525                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13526                if inlined != (member_inline_size <= 4) {
13527                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13528                }
13529                let inner_offset;
13530                let mut inner_depth = depth.clone();
13531                if inlined {
13532                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13533                    inner_offset = next_offset;
13534                } else {
13535                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13536                    inner_depth.increment()?;
13537                }
13538                let val_ref = self.virtio_sound_input.get_or_insert_with(|| {
13539                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13540                });
13541                fidl::decode!(
13542                    bool,
13543                    fidl::encoding::DefaultFuchsiaResourceDialect,
13544                    val_ref,
13545                    decoder,
13546                    inner_offset,
13547                    inner_depth
13548                )?;
13549                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13550                {
13551                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13552                }
13553                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13554                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13555                }
13556            }
13557
13558            next_offset += envelope_size;
13559            _next_ordinal_to_read += 1;
13560            if next_offset >= end_offset {
13561                return Ok(());
13562            }
13563
13564            // Decode unknown envelopes for gaps in ordinals.
13565            while _next_ordinal_to_read < 21 {
13566                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13567                _next_ordinal_to_read += 1;
13568                next_offset += envelope_size;
13569            }
13570
13571            let next_out_of_line = decoder.next_out_of_line();
13572            let handles_before = decoder.remaining_handles();
13573            if let Some((inlined, num_bytes, num_handles)) =
13574                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13575            {
13576                let member_inline_size = <fidl::encoding::UnboundedVector<Listener> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13577                if inlined != (member_inline_size <= 4) {
13578                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13579                }
13580                let inner_offset;
13581                let mut inner_depth = depth.clone();
13582                if inlined {
13583                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13584                    inner_offset = next_offset;
13585                } else {
13586                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13587                    inner_depth.increment()?;
13588                }
13589                let val_ref = self.vsock_listeners.get_or_insert_with(|| {
13590                    fidl::new_empty!(
13591                        fidl::encoding::UnboundedVector<Listener>,
13592                        fidl::encoding::DefaultFuchsiaResourceDialect
13593                    )
13594                });
13595                fidl::decode!(
13596                    fidl::encoding::UnboundedVector<Listener>,
13597                    fidl::encoding::DefaultFuchsiaResourceDialect,
13598                    val_ref,
13599                    decoder,
13600                    inner_offset,
13601                    inner_depth
13602                )?;
13603                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13604                {
13605                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13606                }
13607                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13608                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13609                }
13610            }
13611
13612            next_offset += envelope_size;
13613            _next_ordinal_to_read += 1;
13614            if next_offset >= end_offset {
13615                return Ok(());
13616            }
13617
13618            // Decode unknown envelopes for gaps in ordinals.
13619            while _next_ordinal_to_read < 22 {
13620                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13621                _next_ordinal_to_read += 1;
13622                next_offset += envelope_size;
13623            }
13624
13625            let next_out_of_line = decoder.next_out_of_line();
13626            let handles_before = decoder.remaining_handles();
13627            if let Some((inlined, num_bytes, num_handles)) =
13628                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13629            {
13630                let member_inline_size =
13631                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13632                if inlined != (member_inline_size <= 4) {
13633                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13634                }
13635                let inner_offset;
13636                let mut inner_depth = depth.clone();
13637                if inlined {
13638                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13639                    inner_offset = next_offset;
13640                } else {
13641                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13642                    inner_depth.increment()?;
13643                }
13644                let val_ref = self.virtio_mem.get_or_insert_with(|| {
13645                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13646                });
13647                fidl::decode!(
13648                    bool,
13649                    fidl::encoding::DefaultFuchsiaResourceDialect,
13650                    val_ref,
13651                    decoder,
13652                    inner_offset,
13653                    inner_depth
13654                )?;
13655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13656                {
13657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13658                }
13659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13661                }
13662            }
13663
13664            next_offset += envelope_size;
13665            _next_ordinal_to_read += 1;
13666            if next_offset >= end_offset {
13667                return Ok(());
13668            }
13669
13670            // Decode unknown envelopes for gaps in ordinals.
13671            while _next_ordinal_to_read < 23 {
13672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13673                _next_ordinal_to_read += 1;
13674                next_offset += envelope_size;
13675            }
13676
13677            let next_out_of_line = decoder.next_out_of_line();
13678            let handles_before = decoder.remaining_handles();
13679            if let Some((inlined, num_bytes, num_handles)) =
13680                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13681            {
13682                let member_inline_size =
13683                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13684                if inlined != (member_inline_size <= 4) {
13685                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13686                }
13687                let inner_offset;
13688                let mut inner_depth = depth.clone();
13689                if inlined {
13690                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13691                    inner_offset = next_offset;
13692                } else {
13693                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13694                    inner_depth.increment()?;
13695                }
13696                let val_ref = self.virtio_mem_block_size.get_or_insert_with(|| {
13697                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13698                });
13699                fidl::decode!(
13700                    u64,
13701                    fidl::encoding::DefaultFuchsiaResourceDialect,
13702                    val_ref,
13703                    decoder,
13704                    inner_offset,
13705                    inner_depth
13706                )?;
13707                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13708                {
13709                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13710                }
13711                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13712                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13713                }
13714            }
13715
13716            next_offset += envelope_size;
13717            _next_ordinal_to_read += 1;
13718            if next_offset >= end_offset {
13719                return Ok(());
13720            }
13721
13722            // Decode unknown envelopes for gaps in ordinals.
13723            while _next_ordinal_to_read < 24 {
13724                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13725                _next_ordinal_to_read += 1;
13726                next_offset += envelope_size;
13727            }
13728
13729            let next_out_of_line = decoder.next_out_of_line();
13730            let handles_before = decoder.remaining_handles();
13731            if let Some((inlined, num_bytes, num_handles)) =
13732                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13733            {
13734                let member_inline_size =
13735                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13736                if inlined != (member_inline_size <= 4) {
13737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13738                }
13739                let inner_offset;
13740                let mut inner_depth = depth.clone();
13741                if inlined {
13742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13743                    inner_offset = next_offset;
13744                } else {
13745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13746                    inner_depth.increment()?;
13747                }
13748                let val_ref = self.virtio_mem_region_size.get_or_insert_with(|| {
13749                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13750                });
13751                fidl::decode!(
13752                    u64,
13753                    fidl::encoding::DefaultFuchsiaResourceDialect,
13754                    val_ref,
13755                    decoder,
13756                    inner_offset,
13757                    inner_depth
13758                )?;
13759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13760                {
13761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13762                }
13763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13765                }
13766            }
13767
13768            next_offset += envelope_size;
13769            _next_ordinal_to_read += 1;
13770            if next_offset >= end_offset {
13771                return Ok(());
13772            }
13773
13774            // Decode unknown envelopes for gaps in ordinals.
13775            while _next_ordinal_to_read < 25 {
13776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13777                _next_ordinal_to_read += 1;
13778                next_offset += envelope_size;
13779            }
13780
13781            let next_out_of_line = decoder.next_out_of_line();
13782            let handles_before = decoder.remaining_handles();
13783            if let Some((inlined, num_bytes, num_handles)) =
13784                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13785            {
13786                let member_inline_size =
13787                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13788                if inlined != (member_inline_size <= 4) {
13789                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13790                }
13791                let inner_offset;
13792                let mut inner_depth = depth.clone();
13793                if inlined {
13794                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13795                    inner_offset = next_offset;
13796                } else {
13797                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13798                    inner_depth.increment()?;
13799                }
13800                let val_ref = self.virtio_mem_region_alignment.get_or_insert_with(|| {
13801                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13802                });
13803                fidl::decode!(
13804                    u64,
13805                    fidl::encoding::DefaultFuchsiaResourceDialect,
13806                    val_ref,
13807                    decoder,
13808                    inner_offset,
13809                    inner_depth
13810                )?;
13811                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13812                {
13813                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13814                }
13815                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13816                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13817                }
13818            }
13819
13820            next_offset += envelope_size;
13821
13822            // Decode the remaining unknown envelopes.
13823            while next_offset < end_offset {
13824                _next_ordinal_to_read += 1;
13825                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13826                next_offset += envelope_size;
13827            }
13828
13829            Ok(())
13830        }
13831    }
13832
13833    impl fidl::encoding::ResourceTypeMarker for BlockFormat {
13834        type Borrowed<'a> = &'a mut Self;
13835        fn take_or_borrow<'a>(
13836            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13837        ) -> Self::Borrowed<'a> {
13838            value
13839        }
13840    }
13841
13842    unsafe impl fidl::encoding::TypeMarker for BlockFormat {
13843        type Owned = Self;
13844
13845        #[inline(always)]
13846        fn inline_align(_context: fidl::encoding::Context) -> usize {
13847            8
13848        }
13849
13850        #[inline(always)]
13851        fn inline_size(_context: fidl::encoding::Context) -> usize {
13852            16
13853        }
13854    }
13855
13856    unsafe impl fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>
13857        for &mut BlockFormat
13858    {
13859        #[inline]
13860        unsafe fn encode(
13861            self,
13862            encoder: &mut fidl::encoding::Encoder<
13863                '_,
13864                fidl::encoding::DefaultFuchsiaResourceDialect,
13865            >,
13866            offset: usize,
13867            _depth: fidl::encoding::Depth,
13868        ) -> fidl::Result<()> {
13869            encoder.debug_check_bounds::<BlockFormat>(offset);
13870            encoder.write_num::<u64>(self.ordinal(), offset);
13871            match self {
13872                BlockFormat::File(ref mut val) => fidl::encoding::encode_in_envelope::<
13873                    fidl::encoding::Endpoint<
13874                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13875                    >,
13876                    fidl::encoding::DefaultFuchsiaResourceDialect,
13877                >(
13878                    <fidl::encoding::Endpoint<
13879                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13880                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13881                        val
13882                    ),
13883                    encoder,
13884                    offset + 8,
13885                    _depth,
13886                ),
13887                BlockFormat::Qcow(ref mut val) => fidl::encoding::encode_in_envelope::<
13888                    fidl::encoding::HandleType<
13889                        fidl::Channel,
13890                        { fidl::ObjectType::CHANNEL.into_raw() },
13891                        2147483648,
13892                    >,
13893                    fidl::encoding::DefaultFuchsiaResourceDialect,
13894                >(
13895                    <fidl::encoding::HandleType<
13896                        fidl::Channel,
13897                        { fidl::ObjectType::CHANNEL.into_raw() },
13898                        2147483648,
13899                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13900                        val
13901                    ),
13902                    encoder,
13903                    offset + 8,
13904                    _depth,
13905                ),
13906                BlockFormat::Block(ref mut val) => fidl::encoding::encode_in_envelope::<
13907                    fidl::encoding::Endpoint<
13908                        fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
13909                    >,
13910                    fidl::encoding::DefaultFuchsiaResourceDialect,
13911                >(
13912                    <fidl::encoding::Endpoint<
13913                        fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
13914                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13915                        val
13916                    ),
13917                    encoder,
13918                    offset + 8,
13919                    _depth,
13920                ),
13921            }
13922        }
13923    }
13924
13925    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {
13926        #[inline(always)]
13927        fn new_empty() -> Self {
13928            Self::File(fidl::new_empty!(
13929                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13930                fidl::encoding::DefaultFuchsiaResourceDialect
13931            ))
13932        }
13933
13934        #[inline]
13935        unsafe fn decode(
13936            &mut self,
13937            decoder: &mut fidl::encoding::Decoder<
13938                '_,
13939                fidl::encoding::DefaultFuchsiaResourceDialect,
13940            >,
13941            offset: usize,
13942            mut depth: fidl::encoding::Depth,
13943        ) -> fidl::Result<()> {
13944            decoder.debug_check_bounds::<Self>(offset);
13945            #[allow(unused_variables)]
13946            let next_out_of_line = decoder.next_out_of_line();
13947            let handles_before = decoder.remaining_handles();
13948            let (ordinal, inlined, num_bytes, num_handles) =
13949                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13950
13951            let member_inline_size = match ordinal {
13952                1 => <fidl::encoding::Endpoint<
13953                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13954                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13955                2 => <fidl::encoding::HandleType<
13956                    fidl::Channel,
13957                    { fidl::ObjectType::CHANNEL.into_raw() },
13958                    2147483648,
13959                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13960                3 => <fidl::encoding::Endpoint<
13961                    fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
13962                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13963                _ => return Err(fidl::Error::UnknownUnionTag),
13964            };
13965
13966            if inlined != (member_inline_size <= 4) {
13967                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13968            }
13969            let _inner_offset;
13970            if inlined {
13971                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13972                _inner_offset = offset + 8;
13973            } else {
13974                depth.increment()?;
13975                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13976            }
13977            match ordinal {
13978                1 => {
13979                    #[allow(irrefutable_let_patterns)]
13980                    if let BlockFormat::File(_) = self {
13981                        // Do nothing, read the value into the object
13982                    } else {
13983                        // Initialize `self` to the right variant
13984                        *self = BlockFormat::File(fidl::new_empty!(
13985                            fidl::encoding::Endpoint<
13986                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13987                            >,
13988                            fidl::encoding::DefaultFuchsiaResourceDialect
13989                        ));
13990                    }
13991                    #[allow(irrefutable_let_patterns)]
13992                    if let BlockFormat::File(ref mut val) = self {
13993                        fidl::decode!(
13994                            fidl::encoding::Endpoint<
13995                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13996                            >,
13997                            fidl::encoding::DefaultFuchsiaResourceDialect,
13998                            val,
13999                            decoder,
14000                            _inner_offset,
14001                            depth
14002                        )?;
14003                    } else {
14004                        unreachable!()
14005                    }
14006                }
14007                2 => {
14008                    #[allow(irrefutable_let_patterns)]
14009                    if let BlockFormat::Qcow(_) = self {
14010                        // Do nothing, read the value into the object
14011                    } else {
14012                        // Initialize `self` to the right variant
14013                        *self = BlockFormat::Qcow(
14014                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14015                        );
14016                    }
14017                    #[allow(irrefutable_let_patterns)]
14018                    if let BlockFormat::Qcow(ref mut val) = self {
14019                        fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
14020                    } else {
14021                        unreachable!()
14022                    }
14023                }
14024                3 => {
14025                    #[allow(irrefutable_let_patterns)]
14026                    if let BlockFormat::Block(_) = self {
14027                        // Do nothing, read the value into the object
14028                    } else {
14029                        // Initialize `self` to the right variant
14030                        *self = BlockFormat::Block(fidl::new_empty!(
14031                            fidl::encoding::Endpoint<
14032                                fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
14033                            >,
14034                            fidl::encoding::DefaultFuchsiaResourceDialect
14035                        ));
14036                    }
14037                    #[allow(irrefutable_let_patterns)]
14038                    if let BlockFormat::Block(ref mut val) = self {
14039                        fidl::decode!(
14040                            fidl::encoding::Endpoint<
14041                                fidl::endpoints::ClientEnd<fidl_fuchsia_storage_block::BlockMarker>,
14042                            >,
14043                            fidl::encoding::DefaultFuchsiaResourceDialect,
14044                            val,
14045                            decoder,
14046                            _inner_offset,
14047                            depth
14048                        )?;
14049                    } else {
14050                        unreachable!()
14051                    }
14052                }
14053                ordinal => panic!("unexpected ordinal {:?}", ordinal),
14054            }
14055            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14056                return Err(fidl::Error::InvalidNumBytesInEnvelope);
14057            }
14058            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14059                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14060            }
14061            Ok(())
14062        }
14063    }
14064}