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/// Properties describing a virtio_wl device.
145#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
146pub struct WaylandDevice {
147    /// The amount of guest-physical address space to allocate for virtio_wl
148    /// buffers.
149    ///
150    /// Default to a 1GiB allocation.
151    pub memory: u64,
152    /// The server for new virtio_wl connections.
153    pub server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
154}
155
156impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WaylandDevice {}
157
158/// The configuration required to start up a guest. When adding a new field, consider updating
159/// fuchsia.virtualization.GuestDescriptor which is an informational snapshot of this table.
160#[derive(Debug, Default, PartialEq)]
161pub struct GuestConfig {
162    /// Type of kernel to load. Cannot be changed from the command-line.
163    pub kernel_type: Option<KernelType>,
164    /// File to load the kernel from. Cannot be changed from the command-line.
165    pub kernel: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
166    /// File to load the initial RAM disk from. Cannot be changed from the
167    /// command-line.
168    pub ramdisk: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
169    /// File to load the dtb overlay for a Linux kernel from. Cannot be changed
170    /// from the command-line.
171    pub dtb_overlay: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
172    /// Kernel command-line to use. Cannot be changed from the command-line.
173    pub cmdline: Option<String>,
174    /// Additional kernel command-lines to append to the main command-line.
175    pub cmdline_add: Option<Vec<String>>,
176    /// The number of CPUs to provide to a guest.
177    pub cpus: Option<u8>,
178    /// Amount of guest memory required, in bytes. This value may be rounded up depending on
179    /// the system configuration.
180    pub guest_memory: Option<u64>,
181    /// A list of block devices to give a guest. Cannot be changed from the
182    /// command-line.
183    pub block_devices: Option<Vec<BlockSpec>>,
184    /// A list of specifications for network devices.
185    pub net_devices: Option<Vec<NetSpec>>,
186    /// Optional virtio-wl device.
187    pub wayland_device: Option<WaylandDevice>,
188    /// Optional virtio-magma device.
189    pub magma_device: Option<MagmaDevice>,
190    /// Whether to add a default network device.
191    pub default_net: Option<bool>,
192    /// Enable virtio-balloon.
193    pub virtio_balloon: Option<bool>,
194    /// Enable virtio-console.
195    pub virtio_console: Option<bool>,
196    /// Enable virtio-gpu.
197    pub virtio_gpu: Option<bool>,
198    /// Enable virtio-rng.
199    pub virtio_rng: Option<bool>,
200    /// Enable virtio-vsock.
201    pub virtio_vsock: Option<bool>,
202    /// Enable virtio-sound.
203    pub virtio_sound: Option<bool>,
204    /// Enable input streams (capture) for virtio-sound.
205    pub virtio_sound_input: Option<bool>,
206    /// Host ports to listen for guest initiated vsock connections on. This can be used for
207    /// simplicity if a Listener is known at config creation time, or if a Listener must be
208    /// available at the moment of guest creation for timing reasons.
209    ///
210    /// To add a Listener after a guest starts, see HostVsockEndpoint::Listen.
211    pub vsock_listeners: Option<Vec<Listener>>,
212    /// Enable virtio-mem
213    pub virtio_mem: Option<bool>,
214    /// Size of the dynamically (un)pluggable memory block.
215    /// Memory can be (un)plugged at this granularity.
216    /// Smaller block size increases changes of successful unplug at the cost of increasing
217    /// the size of tracking bitmap.
218    pub virtio_mem_block_size: Option<u64>,
219    /// Size of the entire dynamically pluggable memory region
220    pub virtio_mem_region_size: Option<u64>,
221    /// Required alignment of the dynamically pluggable memory region
222    pub virtio_mem_region_alignment: Option<u64>,
223    #[doc(hidden)]
224    pub __source_breaking: fidl::marker::SourceBreaking,
225}
226
227impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {}
228
229#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
230pub enum BlockFormat {
231    /// File IO. All reads and writes go directly to disk as a flat file.
232    File(fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>),
233    /// QCOW image. All reads and writes go to a QCOW image.
234    Qcow(fidl::Channel),
235    /// Block IO. All reads and writes go to a block server.
236    Block(fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>),
237}
238
239impl BlockFormat {
240    #[inline]
241    pub fn ordinal(&self) -> u64 {
242        match *self {
243            Self::File(_) => 1,
244            Self::Qcow(_) => 2,
245            Self::Block(_) => 3,
246        }
247    }
248}
249
250impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {}
251
252#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
253pub struct BalloonControllerMarker;
254
255impl fidl::endpoints::ProtocolMarker for BalloonControllerMarker {
256    type Proxy = BalloonControllerProxy;
257    type RequestStream = BalloonControllerRequestStream;
258    #[cfg(target_os = "fuchsia")]
259    type SynchronousProxy = BalloonControllerSynchronousProxy;
260
261    const DEBUG_NAME: &'static str = "fuchsia.virtualization.BalloonController";
262}
263impl fidl::endpoints::DiscoverableProtocolMarker for BalloonControllerMarker {}
264
265pub trait BalloonControllerProxyInterface: Send + Sync {
266    type GetBalloonSizeResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>>
267        + Send;
268    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut;
269    fn r#request_num_pages(&self, requested_num_pages: u32) -> Result<(), fidl::Error>;
270    type GetMemStatsResponseFut: std::future::Future<Output = Result<(i32, Option<Vec<MemStat>>), fidl::Error>>
271        + Send;
272    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
273}
274#[derive(Debug)]
275#[cfg(target_os = "fuchsia")]
276pub struct BalloonControllerSynchronousProxy {
277    client: fidl::client::sync::Client,
278}
279
280#[cfg(target_os = "fuchsia")]
281impl fidl::endpoints::SynchronousProxy for BalloonControllerSynchronousProxy {
282    type Proxy = BalloonControllerProxy;
283    type Protocol = BalloonControllerMarker;
284
285    fn from_channel(inner: fidl::Channel) -> Self {
286        Self::new(inner)
287    }
288
289    fn into_channel(self) -> fidl::Channel {
290        self.client.into_channel()
291    }
292
293    fn as_channel(&self) -> &fidl::Channel {
294        self.client.as_channel()
295    }
296}
297
298#[cfg(target_os = "fuchsia")]
299impl BalloonControllerSynchronousProxy {
300    pub fn new(channel: fidl::Channel) -> Self {
301        let protocol_name =
302            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
303        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
304    }
305
306    pub fn into_channel(self) -> fidl::Channel {
307        self.client.into_channel()
308    }
309
310    /// Waits until an event arrives and returns it. It is safe for other
311    /// threads to make concurrent requests while waiting for an event.
312    pub fn wait_for_event(
313        &self,
314        deadline: zx::MonotonicInstant,
315    ) -> Result<BalloonControllerEvent, fidl::Error> {
316        BalloonControllerEvent::decode(self.client.wait_for_event(deadline)?)
317    }
318
319    /// Get the current and requested number of pages in the memory balloon.
320    ///
321    /// current_num_pages is the number of pages balloon has right now.
322    /// requested_num_pages is the desired number of pages in the balloon.
323    ///
324    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
325    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
326    pub fn r#get_balloon_size(
327        &self,
328        ___deadline: zx::MonotonicInstant,
329    ) -> Result<(u32, u32), fidl::Error> {
330        let _response = self
331            .client
332            .send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetBalloonSizeResponse>(
333                (),
334                0x2bb2ebaa6ff64d0b,
335                fidl::encoding::DynamicFlags::empty(),
336                ___deadline,
337            )?;
338        Ok((_response.current_num_pages, _response.requested_num_pages))
339    }
340
341    /// Request a number of pages to be supplied to the memory balloon.
342    ///
343    /// If `requested_num_pages` is greater than the `current_num_pages` config
344    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
345    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
346    /// the guest driver MAY reclaim pages from the memory balloon.
347    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
348        self.client.send::<BalloonControllerRequestNumPagesRequest>(
349            (requested_num_pages,),
350            0x55c444d65e1df1e8,
351            fidl::encoding::DynamicFlags::empty(),
352        )
353    }
354
355    /// Get memory statistics of the guest instance.
356    pub fn r#get_mem_stats(
357        &self,
358        ___deadline: zx::MonotonicInstant,
359    ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
360        let _response = self
361            .client
362            .send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetMemStatsResponse>(
363                (),
364                0x676199795cc01142,
365                fidl::encoding::DynamicFlags::empty(),
366                ___deadline,
367            )?;
368        Ok((_response.status, _response.mem_stats))
369    }
370}
371
372#[cfg(target_os = "fuchsia")]
373impl From<BalloonControllerSynchronousProxy> for zx::Handle {
374    fn from(value: BalloonControllerSynchronousProxy) -> Self {
375        value.into_channel().into()
376    }
377}
378
379#[cfg(target_os = "fuchsia")]
380impl From<fidl::Channel> for BalloonControllerSynchronousProxy {
381    fn from(value: fidl::Channel) -> Self {
382        Self::new(value)
383    }
384}
385
386#[cfg(target_os = "fuchsia")]
387impl fidl::endpoints::FromClient for BalloonControllerSynchronousProxy {
388    type Protocol = BalloonControllerMarker;
389
390    fn from_client(value: fidl::endpoints::ClientEnd<BalloonControllerMarker>) -> Self {
391        Self::new(value.into_channel())
392    }
393}
394
395#[derive(Debug, Clone)]
396pub struct BalloonControllerProxy {
397    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
398}
399
400impl fidl::endpoints::Proxy for BalloonControllerProxy {
401    type Protocol = BalloonControllerMarker;
402
403    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
404        Self::new(inner)
405    }
406
407    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
408        self.client.into_channel().map_err(|client| Self { client })
409    }
410
411    fn as_channel(&self) -> &::fidl::AsyncChannel {
412        self.client.as_channel()
413    }
414}
415
416impl BalloonControllerProxy {
417    /// Create a new Proxy for fuchsia.virtualization/BalloonController.
418    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
419        let protocol_name =
420            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
421        Self { client: fidl::client::Client::new(channel, protocol_name) }
422    }
423
424    /// Get a Stream of events from the remote end of the protocol.
425    ///
426    /// # Panics
427    ///
428    /// Panics if the event stream was already taken.
429    pub fn take_event_stream(&self) -> BalloonControllerEventStream {
430        BalloonControllerEventStream { event_receiver: self.client.take_event_receiver() }
431    }
432
433    /// Get the current and requested number of pages in the memory balloon.
434    ///
435    /// current_num_pages is the number of pages balloon has right now.
436    /// requested_num_pages is the desired number of pages in the balloon.
437    ///
438    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
439    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
440    pub fn r#get_balloon_size(
441        &self,
442    ) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
443    {
444        BalloonControllerProxyInterface::r#get_balloon_size(self)
445    }
446
447    /// Request a number of pages to be supplied to the memory balloon.
448    ///
449    /// If `requested_num_pages` is greater than the `current_num_pages` config
450    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
451    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
452    /// the guest driver MAY reclaim pages from the memory balloon.
453    pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
454        BalloonControllerProxyInterface::r#request_num_pages(self, requested_num_pages)
455    }
456
457    /// Get memory statistics of the guest instance.
458    pub fn r#get_mem_stats(
459        &self,
460    ) -> fidl::client::QueryResponseFut<
461        (i32, Option<Vec<MemStat>>),
462        fidl::encoding::DefaultFuchsiaResourceDialect,
463    > {
464        BalloonControllerProxyInterface::r#get_mem_stats(self)
465    }
466}
467
468impl BalloonControllerProxyInterface for BalloonControllerProxy {
469    type GetBalloonSizeResponseFut =
470        fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
471    fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut {
472        fn _decode(
473            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
474        ) -> Result<(u32, u32), fidl::Error> {
475            let _response = fidl::client::decode_transaction_body::<
476                BalloonControllerGetBalloonSizeResponse,
477                fidl::encoding::DefaultFuchsiaResourceDialect,
478                0x2bb2ebaa6ff64d0b,
479            >(_buf?)?;
480            Ok((_response.current_num_pages, _response.requested_num_pages))
481        }
482        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, u32)>(
483            (),
484            0x2bb2ebaa6ff64d0b,
485            fidl::encoding::DynamicFlags::empty(),
486            _decode,
487        )
488    }
489
490    fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
491        self.client.send::<BalloonControllerRequestNumPagesRequest>(
492            (requested_num_pages,),
493            0x55c444d65e1df1e8,
494            fidl::encoding::DynamicFlags::empty(),
495        )
496    }
497
498    type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
499        (i32, Option<Vec<MemStat>>),
500        fidl::encoding::DefaultFuchsiaResourceDialect,
501    >;
502    fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
503        fn _decode(
504            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
505        ) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
506            let _response = fidl::client::decode_transaction_body::<
507                BalloonControllerGetMemStatsResponse,
508                fidl::encoding::DefaultFuchsiaResourceDialect,
509                0x676199795cc01142,
510            >(_buf?)?;
511            Ok((_response.status, _response.mem_stats))
512        }
513        self.client
514            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Vec<MemStat>>)>(
515                (),
516                0x676199795cc01142,
517                fidl::encoding::DynamicFlags::empty(),
518                _decode,
519            )
520    }
521}
522
523pub struct BalloonControllerEventStream {
524    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
525}
526
527impl std::marker::Unpin for BalloonControllerEventStream {}
528
529impl futures::stream::FusedStream for BalloonControllerEventStream {
530    fn is_terminated(&self) -> bool {
531        self.event_receiver.is_terminated()
532    }
533}
534
535impl futures::Stream for BalloonControllerEventStream {
536    type Item = Result<BalloonControllerEvent, fidl::Error>;
537
538    fn poll_next(
539        mut self: std::pin::Pin<&mut Self>,
540        cx: &mut std::task::Context<'_>,
541    ) -> std::task::Poll<Option<Self::Item>> {
542        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
543            &mut self.event_receiver,
544            cx
545        )?) {
546            Some(buf) => std::task::Poll::Ready(Some(BalloonControllerEvent::decode(buf))),
547            None => std::task::Poll::Ready(None),
548        }
549    }
550}
551
552#[derive(Debug)]
553pub enum BalloonControllerEvent {}
554
555impl BalloonControllerEvent {
556    /// Decodes a message buffer as a [`BalloonControllerEvent`].
557    fn decode(
558        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
559    ) -> Result<BalloonControllerEvent, fidl::Error> {
560        let (bytes, _handles) = buf.split_mut();
561        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
562        debug_assert_eq!(tx_header.tx_id, 0);
563        match tx_header.ordinal {
564            _ => Err(fidl::Error::UnknownOrdinal {
565                ordinal: tx_header.ordinal,
566                protocol_name:
567                    <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
568            }),
569        }
570    }
571}
572
573/// A Stream of incoming requests for fuchsia.virtualization/BalloonController.
574pub struct BalloonControllerRequestStream {
575    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
576    is_terminated: bool,
577}
578
579impl std::marker::Unpin for BalloonControllerRequestStream {}
580
581impl futures::stream::FusedStream for BalloonControllerRequestStream {
582    fn is_terminated(&self) -> bool {
583        self.is_terminated
584    }
585}
586
587impl fidl::endpoints::RequestStream for BalloonControllerRequestStream {
588    type Protocol = BalloonControllerMarker;
589    type ControlHandle = BalloonControllerControlHandle;
590
591    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
592        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
593    }
594
595    fn control_handle(&self) -> Self::ControlHandle {
596        BalloonControllerControlHandle { inner: self.inner.clone() }
597    }
598
599    fn into_inner(
600        self,
601    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
602    {
603        (self.inner, self.is_terminated)
604    }
605
606    fn from_inner(
607        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
608        is_terminated: bool,
609    ) -> Self {
610        Self { inner, is_terminated }
611    }
612}
613
614impl futures::Stream for BalloonControllerRequestStream {
615    type Item = Result<BalloonControllerRequest, fidl::Error>;
616
617    fn poll_next(
618        mut self: std::pin::Pin<&mut Self>,
619        cx: &mut std::task::Context<'_>,
620    ) -> std::task::Poll<Option<Self::Item>> {
621        let this = &mut *self;
622        if this.inner.check_shutdown(cx) {
623            this.is_terminated = true;
624            return std::task::Poll::Ready(None);
625        }
626        if this.is_terminated {
627            panic!("polled BalloonControllerRequestStream after completion");
628        }
629        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
630            |bytes, handles| {
631                match this.inner.channel().read_etc(cx, bytes, handles) {
632                    std::task::Poll::Ready(Ok(())) => {}
633                    std::task::Poll::Pending => return std::task::Poll::Pending,
634                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
635                        this.is_terminated = true;
636                        return std::task::Poll::Ready(None);
637                    }
638                    std::task::Poll::Ready(Err(e)) => {
639                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
640                            e.into(),
641                        ))))
642                    }
643                }
644
645                // A message has been received from the channel
646                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
647
648                std::task::Poll::Ready(Some(match header.ordinal {
649                    0x2bb2ebaa6ff64d0b => {
650                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
651                        let mut req = fidl::new_empty!(
652                            fidl::encoding::EmptyPayload,
653                            fidl::encoding::DefaultFuchsiaResourceDialect
654                        );
655                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
656                        let control_handle =
657                            BalloonControllerControlHandle { inner: this.inner.clone() };
658                        Ok(BalloonControllerRequest::GetBalloonSize {
659                            responder: BalloonControllerGetBalloonSizeResponder {
660                                control_handle: std::mem::ManuallyDrop::new(control_handle),
661                                tx_id: header.tx_id,
662                            },
663                        })
664                    }
665                    0x55c444d65e1df1e8 => {
666                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
667                        let mut req = fidl::new_empty!(
668                            BalloonControllerRequestNumPagesRequest,
669                            fidl::encoding::DefaultFuchsiaResourceDialect
670                        );
671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BalloonControllerRequestNumPagesRequest>(&header, _body_bytes, handles, &mut req)?;
672                        let control_handle =
673                            BalloonControllerControlHandle { inner: this.inner.clone() };
674                        Ok(BalloonControllerRequest::RequestNumPages {
675                            requested_num_pages: req.requested_num_pages,
676
677                            control_handle,
678                        })
679                    }
680                    0x676199795cc01142 => {
681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
682                        let mut req = fidl::new_empty!(
683                            fidl::encoding::EmptyPayload,
684                            fidl::encoding::DefaultFuchsiaResourceDialect
685                        );
686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
687                        let control_handle =
688                            BalloonControllerControlHandle { inner: this.inner.clone() };
689                        Ok(BalloonControllerRequest::GetMemStats {
690                            responder: BalloonControllerGetMemStatsResponder {
691                                control_handle: std::mem::ManuallyDrop::new(control_handle),
692                                tx_id: header.tx_id,
693                            },
694                        })
695                    }
696                    _ => Err(fidl::Error::UnknownOrdinal {
697                        ordinal: header.ordinal,
698                        protocol_name:
699                            <BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
700                    }),
701                }))
702            },
703        )
704    }
705}
706
707/// A `BalloonController` controls a guest instance's memory balloon.
708#[derive(Debug)]
709pub enum BalloonControllerRequest {
710    /// Get the current and requested number of pages in the memory balloon.
711    ///
712    /// current_num_pages is the number of pages balloon has right now.
713    /// requested_num_pages is the desired number of pages in the balloon.
714    ///
715    /// 'current_num_pages' corresponds to the 'actual' virtio-balloon config field
716    /// 'requested_num_pages' corresponds to the 'num_pages' virtio-balloon config field.
717    GetBalloonSize { responder: BalloonControllerGetBalloonSizeResponder },
718    /// Request a number of pages to be supplied to the memory balloon.
719    ///
720    /// If `requested_num_pages` is greater than the `current_num_pages` config
721    /// value, the guest driver SHOULD provide additional pages to the memory balloon.
722    /// If `requested_num_pages` is less than the 'current_num_pages' config value,
723    /// the guest driver MAY reclaim pages from the memory balloon.
724    RequestNumPages { requested_num_pages: u32, control_handle: BalloonControllerControlHandle },
725    /// Get memory statistics of the guest instance.
726    GetMemStats { responder: BalloonControllerGetMemStatsResponder },
727}
728
729impl BalloonControllerRequest {
730    #[allow(irrefutable_let_patterns)]
731    pub fn into_get_balloon_size(self) -> Option<(BalloonControllerGetBalloonSizeResponder)> {
732        if let BalloonControllerRequest::GetBalloonSize { responder } = self {
733            Some((responder))
734        } else {
735            None
736        }
737    }
738
739    #[allow(irrefutable_let_patterns)]
740    pub fn into_request_num_pages(self) -> Option<(u32, BalloonControllerControlHandle)> {
741        if let BalloonControllerRequest::RequestNumPages { requested_num_pages, control_handle } =
742            self
743        {
744            Some((requested_num_pages, control_handle))
745        } else {
746            None
747        }
748    }
749
750    #[allow(irrefutable_let_patterns)]
751    pub fn into_get_mem_stats(self) -> Option<(BalloonControllerGetMemStatsResponder)> {
752        if let BalloonControllerRequest::GetMemStats { responder } = self {
753            Some((responder))
754        } else {
755            None
756        }
757    }
758
759    /// Name of the method defined in FIDL
760    pub fn method_name(&self) -> &'static str {
761        match *self {
762            BalloonControllerRequest::GetBalloonSize { .. } => "get_balloon_size",
763            BalloonControllerRequest::RequestNumPages { .. } => "request_num_pages",
764            BalloonControllerRequest::GetMemStats { .. } => "get_mem_stats",
765        }
766    }
767}
768
769#[derive(Debug, Clone)]
770pub struct BalloonControllerControlHandle {
771    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
772}
773
774impl fidl::endpoints::ControlHandle for BalloonControllerControlHandle {
775    fn shutdown(&self) {
776        self.inner.shutdown()
777    }
778    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
779        self.inner.shutdown_with_epitaph(status)
780    }
781
782    fn is_closed(&self) -> bool {
783        self.inner.channel().is_closed()
784    }
785    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
786        self.inner.channel().on_closed()
787    }
788
789    #[cfg(target_os = "fuchsia")]
790    fn signal_peer(
791        &self,
792        clear_mask: zx::Signals,
793        set_mask: zx::Signals,
794    ) -> Result<(), zx_status::Status> {
795        use fidl::Peered;
796        self.inner.channel().signal_peer(clear_mask, set_mask)
797    }
798}
799
800impl BalloonControllerControlHandle {}
801
802#[must_use = "FIDL methods require a response to be sent"]
803#[derive(Debug)]
804pub struct BalloonControllerGetBalloonSizeResponder {
805    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
806    tx_id: u32,
807}
808
809/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
810/// if the responder is dropped without sending a response, so that the client
811/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
812impl std::ops::Drop for BalloonControllerGetBalloonSizeResponder {
813    fn drop(&mut self) {
814        self.control_handle.shutdown();
815        // Safety: drops once, never accessed again
816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
817    }
818}
819
820impl fidl::endpoints::Responder for BalloonControllerGetBalloonSizeResponder {
821    type ControlHandle = BalloonControllerControlHandle;
822
823    fn control_handle(&self) -> &BalloonControllerControlHandle {
824        &self.control_handle
825    }
826
827    fn drop_without_shutdown(mut self) {
828        // Safety: drops once, never accessed again due to mem::forget
829        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
830        // Prevent Drop from running (which would shut down the channel)
831        std::mem::forget(self);
832    }
833}
834
835impl BalloonControllerGetBalloonSizeResponder {
836    /// Sends a response to the FIDL transaction.
837    ///
838    /// Sets the channel to shutdown if an error occurs.
839    pub fn send(
840        self,
841        mut current_num_pages: u32,
842        mut requested_num_pages: u32,
843    ) -> Result<(), fidl::Error> {
844        let _result = self.send_raw(current_num_pages, requested_num_pages);
845        if _result.is_err() {
846            self.control_handle.shutdown();
847        }
848        self.drop_without_shutdown();
849        _result
850    }
851
852    /// Similar to "send" but does not shutdown the channel if an error occurs.
853    pub fn send_no_shutdown_on_err(
854        self,
855        mut current_num_pages: u32,
856        mut requested_num_pages: u32,
857    ) -> Result<(), fidl::Error> {
858        let _result = self.send_raw(current_num_pages, requested_num_pages);
859        self.drop_without_shutdown();
860        _result
861    }
862
863    fn send_raw(
864        &self,
865        mut current_num_pages: u32,
866        mut requested_num_pages: u32,
867    ) -> Result<(), fidl::Error> {
868        self.control_handle.inner.send::<BalloonControllerGetBalloonSizeResponse>(
869            (current_num_pages, requested_num_pages),
870            self.tx_id,
871            0x2bb2ebaa6ff64d0b,
872            fidl::encoding::DynamicFlags::empty(),
873        )
874    }
875}
876
877#[must_use = "FIDL methods require a response to be sent"]
878#[derive(Debug)]
879pub struct BalloonControllerGetMemStatsResponder {
880    control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
881    tx_id: u32,
882}
883
884/// Set the the channel to be shutdown (see [`BalloonControllerControlHandle::shutdown`])
885/// if the responder is dropped without sending a response, so that the client
886/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
887impl std::ops::Drop for BalloonControllerGetMemStatsResponder {
888    fn drop(&mut self) {
889        self.control_handle.shutdown();
890        // Safety: drops once, never accessed again
891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892    }
893}
894
895impl fidl::endpoints::Responder for BalloonControllerGetMemStatsResponder {
896    type ControlHandle = BalloonControllerControlHandle;
897
898    fn control_handle(&self) -> &BalloonControllerControlHandle {
899        &self.control_handle
900    }
901
902    fn drop_without_shutdown(mut self) {
903        // Safety: drops once, never accessed again due to mem::forget
904        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
905        // Prevent Drop from running (which would shut down the channel)
906        std::mem::forget(self);
907    }
908}
909
910impl BalloonControllerGetMemStatsResponder {
911    /// Sends a response to the FIDL transaction.
912    ///
913    /// Sets the channel to shutdown if an error occurs.
914    pub fn send(
915        self,
916        mut status: i32,
917        mut mem_stats: Option<&[MemStat]>,
918    ) -> Result<(), fidl::Error> {
919        let _result = self.send_raw(status, mem_stats);
920        if _result.is_err() {
921            self.control_handle.shutdown();
922        }
923        self.drop_without_shutdown();
924        _result
925    }
926
927    /// Similar to "send" but does not shutdown the channel if an error occurs.
928    pub fn send_no_shutdown_on_err(
929        self,
930        mut status: i32,
931        mut mem_stats: Option<&[MemStat]>,
932    ) -> Result<(), fidl::Error> {
933        let _result = self.send_raw(status, mem_stats);
934        self.drop_without_shutdown();
935        _result
936    }
937
938    fn send_raw(
939        &self,
940        mut status: i32,
941        mut mem_stats: Option<&[MemStat]>,
942    ) -> Result<(), fidl::Error> {
943        self.control_handle.inner.send::<BalloonControllerGetMemStatsResponse>(
944            (status, mem_stats),
945            self.tx_id,
946            0x676199795cc01142,
947            fidl::encoding::DynamicFlags::empty(),
948        )
949    }
950}
951
952#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
953pub struct DebianGuestManagerMarker;
954
955impl fidl::endpoints::ProtocolMarker for DebianGuestManagerMarker {
956    type Proxy = DebianGuestManagerProxy;
957    type RequestStream = DebianGuestManagerRequestStream;
958    #[cfg(target_os = "fuchsia")]
959    type SynchronousProxy = DebianGuestManagerSynchronousProxy;
960
961    const DEBUG_NAME: &'static str = "fuchsia.virtualization.DebianGuestManager";
962}
963impl fidl::endpoints::DiscoverableProtocolMarker for DebianGuestManagerMarker {}
964
965pub trait DebianGuestManagerProxyInterface: Send + Sync {
966    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
967        + Send;
968    fn r#launch(
969        &self,
970        guest_config: GuestConfig,
971        controller: fidl::endpoints::ServerEnd<GuestMarker>,
972    ) -> Self::LaunchResponseFut;
973    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
974    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
975    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
976        + Send;
977    fn r#connect(
978        &self,
979        controller: fidl::endpoints::ServerEnd<GuestMarker>,
980    ) -> Self::ConnectResponseFut;
981    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
982    fn r#get_info(&self) -> Self::GetInfoResponseFut;
983}
984#[derive(Debug)]
985#[cfg(target_os = "fuchsia")]
986pub struct DebianGuestManagerSynchronousProxy {
987    client: fidl::client::sync::Client,
988}
989
990#[cfg(target_os = "fuchsia")]
991impl fidl::endpoints::SynchronousProxy for DebianGuestManagerSynchronousProxy {
992    type Proxy = DebianGuestManagerProxy;
993    type Protocol = DebianGuestManagerMarker;
994
995    fn from_channel(inner: fidl::Channel) -> Self {
996        Self::new(inner)
997    }
998
999    fn into_channel(self) -> fidl::Channel {
1000        self.client.into_channel()
1001    }
1002
1003    fn as_channel(&self) -> &fidl::Channel {
1004        self.client.as_channel()
1005    }
1006}
1007
1008#[cfg(target_os = "fuchsia")]
1009impl DebianGuestManagerSynchronousProxy {
1010    pub fn new(channel: fidl::Channel) -> Self {
1011        let protocol_name =
1012            <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1013        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1014    }
1015
1016    pub fn into_channel(self) -> fidl::Channel {
1017        self.client.into_channel()
1018    }
1019
1020    /// Waits until an event arrives and returns it. It is safe for other
1021    /// threads to make concurrent requests while waiting for an event.
1022    pub fn wait_for_event(
1023        &self,
1024        deadline: zx::MonotonicInstant,
1025    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
1026        DebianGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
1027    }
1028
1029    /// Launch a new guest instance.
1030    ///
1031    /// Possible errors:
1032    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
1033    ///         problems detected by the guest manager.
1034    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
1035    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
1036    ///         component logs for a more specific failure.
1037    pub fn r#launch(
1038        &self,
1039        mut guest_config: GuestConfig,
1040        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1041        ___deadline: zx::MonotonicInstant,
1042    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
1043        let _response =
1044            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
1045                fidl::encoding::EmptyStruct,
1046                GuestManagerError,
1047            >>(
1048                (&mut guest_config, controller),
1049                0x394a2e29f750323e,
1050                fidl::encoding::DynamicFlags::empty(),
1051                ___deadline,
1052            )?;
1053        Ok(_response.map(|x| x))
1054    }
1055
1056    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
1057    /// be used to launch another guest.
1058    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1059        let _response =
1060            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1061                (),
1062                0x3ad9a012982f872d,
1063                fidl::encoding::DynamicFlags::empty(),
1064                ___deadline,
1065            )?;
1066        Ok(_response)
1067    }
1068
1069    /// Connect to a currently running guest.
1070    ///
1071    /// Possible errors:
1072    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
1073    ///         has launched before attempting to reconnect.
1074    pub fn r#connect(
1075        &self,
1076        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1077        ___deadline: zx::MonotonicInstant,
1078    ) -> Result<GuestManagerConnectResult, fidl::Error> {
1079        let _response =
1080            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
1081                fidl::encoding::EmptyStruct,
1082                GuestManagerError,
1083            >>(
1084                (controller,),
1085                0x4e489076e3bb15b4,
1086                fidl::encoding::DynamicFlags::empty(),
1087                ___deadline,
1088            )?;
1089        Ok(_response.map(|x| x))
1090    }
1091
1092    /// Query guest info
1093    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
1094        let _response =
1095            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
1096                (),
1097                0x76892614aea695dc,
1098                fidl::encoding::DynamicFlags::empty(),
1099                ___deadline,
1100            )?;
1101        Ok(_response.guest_info)
1102    }
1103}
1104
1105#[cfg(target_os = "fuchsia")]
1106impl From<DebianGuestManagerSynchronousProxy> for zx::Handle {
1107    fn from(value: DebianGuestManagerSynchronousProxy) -> Self {
1108        value.into_channel().into()
1109    }
1110}
1111
1112#[cfg(target_os = "fuchsia")]
1113impl From<fidl::Channel> for DebianGuestManagerSynchronousProxy {
1114    fn from(value: fidl::Channel) -> Self {
1115        Self::new(value)
1116    }
1117}
1118
1119#[cfg(target_os = "fuchsia")]
1120impl fidl::endpoints::FromClient for DebianGuestManagerSynchronousProxy {
1121    type Protocol = DebianGuestManagerMarker;
1122
1123    fn from_client(value: fidl::endpoints::ClientEnd<DebianGuestManagerMarker>) -> Self {
1124        Self::new(value.into_channel())
1125    }
1126}
1127
1128#[derive(Debug, Clone)]
1129pub struct DebianGuestManagerProxy {
1130    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1131}
1132
1133impl fidl::endpoints::Proxy for DebianGuestManagerProxy {
1134    type Protocol = DebianGuestManagerMarker;
1135
1136    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1137        Self::new(inner)
1138    }
1139
1140    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1141        self.client.into_channel().map_err(|client| Self { client })
1142    }
1143
1144    fn as_channel(&self) -> &::fidl::AsyncChannel {
1145        self.client.as_channel()
1146    }
1147}
1148
1149impl DebianGuestManagerProxy {
1150    /// Create a new Proxy for fuchsia.virtualization/DebianGuestManager.
1151    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1152        let protocol_name =
1153            <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1154        Self { client: fidl::client::Client::new(channel, protocol_name) }
1155    }
1156
1157    /// Get a Stream of events from the remote end of the protocol.
1158    ///
1159    /// # Panics
1160    ///
1161    /// Panics if the event stream was already taken.
1162    pub fn take_event_stream(&self) -> DebianGuestManagerEventStream {
1163        DebianGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
1164    }
1165
1166    /// Launch a new guest instance.
1167    ///
1168    /// Possible errors:
1169    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
1170    ///         problems detected by the guest manager.
1171    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
1172    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
1173    ///         component logs for a more specific failure.
1174    pub fn r#launch(
1175        &self,
1176        mut guest_config: GuestConfig,
1177        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1178    ) -> fidl::client::QueryResponseFut<
1179        GuestManagerLaunchResult,
1180        fidl::encoding::DefaultFuchsiaResourceDialect,
1181    > {
1182        DebianGuestManagerProxyInterface::r#launch(self, guest_config, controller)
1183    }
1184
1185    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
1186    /// be used to launch another guest.
1187    pub fn r#force_shutdown(
1188        &self,
1189    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1190        DebianGuestManagerProxyInterface::r#force_shutdown(self)
1191    }
1192
1193    /// Connect to a currently running guest.
1194    ///
1195    /// Possible errors:
1196    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
1197    ///         has launched before attempting to reconnect.
1198    pub fn r#connect(
1199        &self,
1200        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1201    ) -> fidl::client::QueryResponseFut<
1202        GuestManagerConnectResult,
1203        fidl::encoding::DefaultFuchsiaResourceDialect,
1204    > {
1205        DebianGuestManagerProxyInterface::r#connect(self, controller)
1206    }
1207
1208    /// Query guest info
1209    pub fn r#get_info(
1210        &self,
1211    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1212    {
1213        DebianGuestManagerProxyInterface::r#get_info(self)
1214    }
1215}
1216
1217impl DebianGuestManagerProxyInterface for DebianGuestManagerProxy {
1218    type LaunchResponseFut = fidl::client::QueryResponseFut<
1219        GuestManagerLaunchResult,
1220        fidl::encoding::DefaultFuchsiaResourceDialect,
1221    >;
1222    fn r#launch(
1223        &self,
1224        mut guest_config: GuestConfig,
1225        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1226    ) -> Self::LaunchResponseFut {
1227        fn _decode(
1228            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1229        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
1230            let _response = fidl::client::decode_transaction_body::<
1231                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
1232                fidl::encoding::DefaultFuchsiaResourceDialect,
1233                0x394a2e29f750323e,
1234            >(_buf?)?;
1235            Ok(_response.map(|x| x))
1236        }
1237        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
1238            (&mut guest_config, controller),
1239            0x394a2e29f750323e,
1240            fidl::encoding::DynamicFlags::empty(),
1241            _decode,
1242        )
1243    }
1244
1245    type ForceShutdownResponseFut =
1246        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1247    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
1248        fn _decode(
1249            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1250        ) -> Result<(), fidl::Error> {
1251            let _response = fidl::client::decode_transaction_body::<
1252                fidl::encoding::EmptyPayload,
1253                fidl::encoding::DefaultFuchsiaResourceDialect,
1254                0x3ad9a012982f872d,
1255            >(_buf?)?;
1256            Ok(_response)
1257        }
1258        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1259            (),
1260            0x3ad9a012982f872d,
1261            fidl::encoding::DynamicFlags::empty(),
1262            _decode,
1263        )
1264    }
1265
1266    type ConnectResponseFut = fidl::client::QueryResponseFut<
1267        GuestManagerConnectResult,
1268        fidl::encoding::DefaultFuchsiaResourceDialect,
1269    >;
1270    fn r#connect(
1271        &self,
1272        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
1273    ) -> Self::ConnectResponseFut {
1274        fn _decode(
1275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1276        ) -> Result<GuestManagerConnectResult, fidl::Error> {
1277            let _response = fidl::client::decode_transaction_body::<
1278                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
1279                fidl::encoding::DefaultFuchsiaResourceDialect,
1280                0x4e489076e3bb15b4,
1281            >(_buf?)?;
1282            Ok(_response.map(|x| x))
1283        }
1284        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
1285            (controller,),
1286            0x4e489076e3bb15b4,
1287            fidl::encoding::DynamicFlags::empty(),
1288            _decode,
1289        )
1290    }
1291
1292    type GetInfoResponseFut =
1293        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1294    fn r#get_info(&self) -> Self::GetInfoResponseFut {
1295        fn _decode(
1296            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1297        ) -> Result<GuestInfo, fidl::Error> {
1298            let _response = fidl::client::decode_transaction_body::<
1299                GuestManagerGetInfoResponse,
1300                fidl::encoding::DefaultFuchsiaResourceDialect,
1301                0x76892614aea695dc,
1302            >(_buf?)?;
1303            Ok(_response.guest_info)
1304        }
1305        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
1306            (),
1307            0x76892614aea695dc,
1308            fidl::encoding::DynamicFlags::empty(),
1309            _decode,
1310        )
1311    }
1312}
1313
1314pub struct DebianGuestManagerEventStream {
1315    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1316}
1317
1318impl std::marker::Unpin for DebianGuestManagerEventStream {}
1319
1320impl futures::stream::FusedStream for DebianGuestManagerEventStream {
1321    fn is_terminated(&self) -> bool {
1322        self.event_receiver.is_terminated()
1323    }
1324}
1325
1326impl futures::Stream for DebianGuestManagerEventStream {
1327    type Item = Result<DebianGuestManagerEvent, fidl::Error>;
1328
1329    fn poll_next(
1330        mut self: std::pin::Pin<&mut Self>,
1331        cx: &mut std::task::Context<'_>,
1332    ) -> std::task::Poll<Option<Self::Item>> {
1333        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1334            &mut self.event_receiver,
1335            cx
1336        )?) {
1337            Some(buf) => std::task::Poll::Ready(Some(DebianGuestManagerEvent::decode(buf))),
1338            None => std::task::Poll::Ready(None),
1339        }
1340    }
1341}
1342
1343#[derive(Debug)]
1344pub enum DebianGuestManagerEvent {}
1345
1346impl DebianGuestManagerEvent {
1347    /// Decodes a message buffer as a [`DebianGuestManagerEvent`].
1348    fn decode(
1349        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1350    ) -> Result<DebianGuestManagerEvent, fidl::Error> {
1351        let (bytes, _handles) = buf.split_mut();
1352        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1353        debug_assert_eq!(tx_header.tx_id, 0);
1354        match tx_header.ordinal {
1355            _ => Err(fidl::Error::UnknownOrdinal {
1356                ordinal: tx_header.ordinal,
1357                protocol_name:
1358                    <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1359            }),
1360        }
1361    }
1362}
1363
1364/// A Stream of incoming requests for fuchsia.virtualization/DebianGuestManager.
1365pub struct DebianGuestManagerRequestStream {
1366    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1367    is_terminated: bool,
1368}
1369
1370impl std::marker::Unpin for DebianGuestManagerRequestStream {}
1371
1372impl futures::stream::FusedStream for DebianGuestManagerRequestStream {
1373    fn is_terminated(&self) -> bool {
1374        self.is_terminated
1375    }
1376}
1377
1378impl fidl::endpoints::RequestStream for DebianGuestManagerRequestStream {
1379    type Protocol = DebianGuestManagerMarker;
1380    type ControlHandle = DebianGuestManagerControlHandle;
1381
1382    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1383        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1384    }
1385
1386    fn control_handle(&self) -> Self::ControlHandle {
1387        DebianGuestManagerControlHandle { inner: self.inner.clone() }
1388    }
1389
1390    fn into_inner(
1391        self,
1392    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1393    {
1394        (self.inner, self.is_terminated)
1395    }
1396
1397    fn from_inner(
1398        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1399        is_terminated: bool,
1400    ) -> Self {
1401        Self { inner, is_terminated }
1402    }
1403}
1404
1405impl futures::Stream for DebianGuestManagerRequestStream {
1406    type Item = Result<DebianGuestManagerRequest, fidl::Error>;
1407
1408    fn poll_next(
1409        mut self: std::pin::Pin<&mut Self>,
1410        cx: &mut std::task::Context<'_>,
1411    ) -> std::task::Poll<Option<Self::Item>> {
1412        let this = &mut *self;
1413        if this.inner.check_shutdown(cx) {
1414            this.is_terminated = true;
1415            return std::task::Poll::Ready(None);
1416        }
1417        if this.is_terminated {
1418            panic!("polled DebianGuestManagerRequestStream after completion");
1419        }
1420        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1421            |bytes, handles| {
1422                match this.inner.channel().read_etc(cx, bytes, handles) {
1423                    std::task::Poll::Ready(Ok(())) => {}
1424                    std::task::Poll::Pending => return std::task::Poll::Pending,
1425                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1426                        this.is_terminated = true;
1427                        return std::task::Poll::Ready(None);
1428                    }
1429                    std::task::Poll::Ready(Err(e)) => {
1430                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1431                            e.into(),
1432                        ))))
1433                    }
1434                }
1435
1436                // A message has been received from the channel
1437                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1438
1439                std::task::Poll::Ready(Some(match header.ordinal {
1440                0x394a2e29f750323e => {
1441                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1442                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1443                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
1444                    let control_handle = DebianGuestManagerControlHandle {
1445                        inner: this.inner.clone(),
1446                    };
1447                    Ok(DebianGuestManagerRequest::Launch {guest_config: req.guest_config,
1448controller: req.controller,
1449
1450                        responder: DebianGuestManagerLaunchResponder {
1451                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1452                            tx_id: header.tx_id,
1453                        },
1454                    })
1455                }
1456                0x3ad9a012982f872d => {
1457                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1458                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1459                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1460                    let control_handle = DebianGuestManagerControlHandle {
1461                        inner: this.inner.clone(),
1462                    };
1463                    Ok(DebianGuestManagerRequest::ForceShutdown {
1464                        responder: DebianGuestManagerForceShutdownResponder {
1465                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1466                            tx_id: header.tx_id,
1467                        },
1468                    })
1469                }
1470                0x4e489076e3bb15b4 => {
1471                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1472                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1473                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1474                    let control_handle = DebianGuestManagerControlHandle {
1475                        inner: this.inner.clone(),
1476                    };
1477                    Ok(DebianGuestManagerRequest::Connect {controller: req.controller,
1478
1479                        responder: DebianGuestManagerConnectResponder {
1480                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1481                            tx_id: header.tx_id,
1482                        },
1483                    })
1484                }
1485                0x76892614aea695dc => {
1486                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1487                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1488                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1489                    let control_handle = DebianGuestManagerControlHandle {
1490                        inner: this.inner.clone(),
1491                    };
1492                    Ok(DebianGuestManagerRequest::GetInfo {
1493                        responder: DebianGuestManagerGetInfoResponder {
1494                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1495                            tx_id: header.tx_id,
1496                        },
1497                    })
1498                }
1499                _ => Err(fidl::Error::UnknownOrdinal {
1500                    ordinal: header.ordinal,
1501                    protocol_name: <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1502                }),
1503            }))
1504            },
1505        )
1506    }
1507}
1508
1509#[derive(Debug)]
1510pub enum DebianGuestManagerRequest {
1511    /// Launch a new guest instance.
1512    ///
1513    /// Possible errors:
1514    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
1515    ///         problems detected by the guest manager.
1516    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
1517    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
1518    ///         component logs for a more specific failure.
1519    Launch {
1520        guest_config: GuestConfig,
1521        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1522        responder: DebianGuestManagerLaunchResponder,
1523    },
1524    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
1525    /// be used to launch another guest.
1526    ForceShutdown { responder: DebianGuestManagerForceShutdownResponder },
1527    /// Connect to a currently running guest.
1528    ///
1529    /// Possible errors:
1530    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
1531    ///         has launched before attempting to reconnect.
1532    Connect {
1533        controller: fidl::endpoints::ServerEnd<GuestMarker>,
1534        responder: DebianGuestManagerConnectResponder,
1535    },
1536    /// Query guest info
1537    GetInfo { responder: DebianGuestManagerGetInfoResponder },
1538}
1539
1540impl DebianGuestManagerRequest {
1541    #[allow(irrefutable_let_patterns)]
1542    pub fn into_launch(
1543        self,
1544    ) -> Option<(
1545        GuestConfig,
1546        fidl::endpoints::ServerEnd<GuestMarker>,
1547        DebianGuestManagerLaunchResponder,
1548    )> {
1549        if let DebianGuestManagerRequest::Launch { guest_config, controller, responder } = self {
1550            Some((guest_config, controller, responder))
1551        } else {
1552            None
1553        }
1554    }
1555
1556    #[allow(irrefutable_let_patterns)]
1557    pub fn into_force_shutdown(self) -> Option<(DebianGuestManagerForceShutdownResponder)> {
1558        if let DebianGuestManagerRequest::ForceShutdown { responder } = self {
1559            Some((responder))
1560        } else {
1561            None
1562        }
1563    }
1564
1565    #[allow(irrefutable_let_patterns)]
1566    pub fn into_connect(
1567        self,
1568    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, DebianGuestManagerConnectResponder)> {
1569        if let DebianGuestManagerRequest::Connect { controller, responder } = self {
1570            Some((controller, responder))
1571        } else {
1572            None
1573        }
1574    }
1575
1576    #[allow(irrefutable_let_patterns)]
1577    pub fn into_get_info(self) -> Option<(DebianGuestManagerGetInfoResponder)> {
1578        if let DebianGuestManagerRequest::GetInfo { responder } = self {
1579            Some((responder))
1580        } else {
1581            None
1582        }
1583    }
1584
1585    /// Name of the method defined in FIDL
1586    pub fn method_name(&self) -> &'static str {
1587        match *self {
1588            DebianGuestManagerRequest::Launch { .. } => "launch",
1589            DebianGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
1590            DebianGuestManagerRequest::Connect { .. } => "connect",
1591            DebianGuestManagerRequest::GetInfo { .. } => "get_info",
1592        }
1593    }
1594}
1595
1596#[derive(Debug, Clone)]
1597pub struct DebianGuestManagerControlHandle {
1598    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1599}
1600
1601impl fidl::endpoints::ControlHandle for DebianGuestManagerControlHandle {
1602    fn shutdown(&self) {
1603        self.inner.shutdown()
1604    }
1605    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1606        self.inner.shutdown_with_epitaph(status)
1607    }
1608
1609    fn is_closed(&self) -> bool {
1610        self.inner.channel().is_closed()
1611    }
1612    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1613        self.inner.channel().on_closed()
1614    }
1615
1616    #[cfg(target_os = "fuchsia")]
1617    fn signal_peer(
1618        &self,
1619        clear_mask: zx::Signals,
1620        set_mask: zx::Signals,
1621    ) -> Result<(), zx_status::Status> {
1622        use fidl::Peered;
1623        self.inner.channel().signal_peer(clear_mask, set_mask)
1624    }
1625}
1626
1627impl DebianGuestManagerControlHandle {}
1628
1629#[must_use = "FIDL methods require a response to be sent"]
1630#[derive(Debug)]
1631pub struct DebianGuestManagerLaunchResponder {
1632    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
1633    tx_id: u32,
1634}
1635
1636/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
1637/// if the responder is dropped without sending a response, so that the client
1638/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1639impl std::ops::Drop for DebianGuestManagerLaunchResponder {
1640    fn drop(&mut self) {
1641        self.control_handle.shutdown();
1642        // Safety: drops once, never accessed again
1643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1644    }
1645}
1646
1647impl fidl::endpoints::Responder for DebianGuestManagerLaunchResponder {
1648    type ControlHandle = DebianGuestManagerControlHandle;
1649
1650    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
1651        &self.control_handle
1652    }
1653
1654    fn drop_without_shutdown(mut self) {
1655        // Safety: drops once, never accessed again due to mem::forget
1656        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1657        // Prevent Drop from running (which would shut down the channel)
1658        std::mem::forget(self);
1659    }
1660}
1661
1662impl DebianGuestManagerLaunchResponder {
1663    /// Sends a response to the FIDL transaction.
1664    ///
1665    /// Sets the channel to shutdown if an error occurs.
1666    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1667        let _result = self.send_raw(result);
1668        if _result.is_err() {
1669            self.control_handle.shutdown();
1670        }
1671        self.drop_without_shutdown();
1672        _result
1673    }
1674
1675    /// Similar to "send" but does not shutdown the channel if an error occurs.
1676    pub fn send_no_shutdown_on_err(
1677        self,
1678        mut result: Result<(), GuestManagerError>,
1679    ) -> Result<(), fidl::Error> {
1680        let _result = self.send_raw(result);
1681        self.drop_without_shutdown();
1682        _result
1683    }
1684
1685    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1686        self.control_handle.inner.send::<fidl::encoding::ResultType<
1687            fidl::encoding::EmptyStruct,
1688            GuestManagerError,
1689        >>(
1690            result,
1691            self.tx_id,
1692            0x394a2e29f750323e,
1693            fidl::encoding::DynamicFlags::empty(),
1694        )
1695    }
1696}
1697
1698#[must_use = "FIDL methods require a response to be sent"]
1699#[derive(Debug)]
1700pub struct DebianGuestManagerForceShutdownResponder {
1701    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
1702    tx_id: u32,
1703}
1704
1705/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
1706/// if the responder is dropped without sending a response, so that the client
1707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1708impl std::ops::Drop for DebianGuestManagerForceShutdownResponder {
1709    fn drop(&mut self) {
1710        self.control_handle.shutdown();
1711        // Safety: drops once, never accessed again
1712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1713    }
1714}
1715
1716impl fidl::endpoints::Responder for DebianGuestManagerForceShutdownResponder {
1717    type ControlHandle = DebianGuestManagerControlHandle;
1718
1719    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
1720        &self.control_handle
1721    }
1722
1723    fn drop_without_shutdown(mut self) {
1724        // Safety: drops once, never accessed again due to mem::forget
1725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1726        // Prevent Drop from running (which would shut down the channel)
1727        std::mem::forget(self);
1728    }
1729}
1730
1731impl DebianGuestManagerForceShutdownResponder {
1732    /// Sends a response to the FIDL transaction.
1733    ///
1734    /// Sets the channel to shutdown if an error occurs.
1735    pub fn send(self) -> Result<(), fidl::Error> {
1736        let _result = self.send_raw();
1737        if _result.is_err() {
1738            self.control_handle.shutdown();
1739        }
1740        self.drop_without_shutdown();
1741        _result
1742    }
1743
1744    /// Similar to "send" but does not shutdown the channel if an error occurs.
1745    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1746        let _result = self.send_raw();
1747        self.drop_without_shutdown();
1748        _result
1749    }
1750
1751    fn send_raw(&self) -> Result<(), fidl::Error> {
1752        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1753            (),
1754            self.tx_id,
1755            0x3ad9a012982f872d,
1756            fidl::encoding::DynamicFlags::empty(),
1757        )
1758    }
1759}
1760
1761#[must_use = "FIDL methods require a response to be sent"]
1762#[derive(Debug)]
1763pub struct DebianGuestManagerConnectResponder {
1764    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
1765    tx_id: u32,
1766}
1767
1768/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
1769/// if the responder is dropped without sending a response, so that the client
1770/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1771impl std::ops::Drop for DebianGuestManagerConnectResponder {
1772    fn drop(&mut self) {
1773        self.control_handle.shutdown();
1774        // Safety: drops once, never accessed again
1775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776    }
1777}
1778
1779impl fidl::endpoints::Responder for DebianGuestManagerConnectResponder {
1780    type ControlHandle = DebianGuestManagerControlHandle;
1781
1782    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
1783        &self.control_handle
1784    }
1785
1786    fn drop_without_shutdown(mut self) {
1787        // Safety: drops once, never accessed again due to mem::forget
1788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1789        // Prevent Drop from running (which would shut down the channel)
1790        std::mem::forget(self);
1791    }
1792}
1793
1794impl DebianGuestManagerConnectResponder {
1795    /// Sends a response to the FIDL transaction.
1796    ///
1797    /// Sets the channel to shutdown if an error occurs.
1798    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1799        let _result = self.send_raw(result);
1800        if _result.is_err() {
1801            self.control_handle.shutdown();
1802        }
1803        self.drop_without_shutdown();
1804        _result
1805    }
1806
1807    /// Similar to "send" but does not shutdown the channel if an error occurs.
1808    pub fn send_no_shutdown_on_err(
1809        self,
1810        mut result: Result<(), GuestManagerError>,
1811    ) -> Result<(), fidl::Error> {
1812        let _result = self.send_raw(result);
1813        self.drop_without_shutdown();
1814        _result
1815    }
1816
1817    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
1818        self.control_handle.inner.send::<fidl::encoding::ResultType<
1819            fidl::encoding::EmptyStruct,
1820            GuestManagerError,
1821        >>(
1822            result,
1823            self.tx_id,
1824            0x4e489076e3bb15b4,
1825            fidl::encoding::DynamicFlags::empty(),
1826        )
1827    }
1828}
1829
1830#[must_use = "FIDL methods require a response to be sent"]
1831#[derive(Debug)]
1832pub struct DebianGuestManagerGetInfoResponder {
1833    control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
1834    tx_id: u32,
1835}
1836
1837/// Set the the channel to be shutdown (see [`DebianGuestManagerControlHandle::shutdown`])
1838/// if the responder is dropped without sending a response, so that the client
1839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1840impl std::ops::Drop for DebianGuestManagerGetInfoResponder {
1841    fn drop(&mut self) {
1842        self.control_handle.shutdown();
1843        // Safety: drops once, never accessed again
1844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1845    }
1846}
1847
1848impl fidl::endpoints::Responder for DebianGuestManagerGetInfoResponder {
1849    type ControlHandle = DebianGuestManagerControlHandle;
1850
1851    fn control_handle(&self) -> &DebianGuestManagerControlHandle {
1852        &self.control_handle
1853    }
1854
1855    fn drop_without_shutdown(mut self) {
1856        // Safety: drops once, never accessed again due to mem::forget
1857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1858        // Prevent Drop from running (which would shut down the channel)
1859        std::mem::forget(self);
1860    }
1861}
1862
1863impl DebianGuestManagerGetInfoResponder {
1864    /// Sends a response to the FIDL transaction.
1865    ///
1866    /// Sets the channel to shutdown if an error occurs.
1867    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1868        let _result = self.send_raw(guest_info);
1869        if _result.is_err() {
1870            self.control_handle.shutdown();
1871        }
1872        self.drop_without_shutdown();
1873        _result
1874    }
1875
1876    /// Similar to "send" but does not shutdown the channel if an error occurs.
1877    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1878        let _result = self.send_raw(guest_info);
1879        self.drop_without_shutdown();
1880        _result
1881    }
1882
1883    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
1884        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
1885            (guest_info,),
1886            self.tx_id,
1887            0x76892614aea695dc,
1888            fidl::encoding::DynamicFlags::empty(),
1889        )
1890    }
1891}
1892
1893#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1894pub struct GuestMarker;
1895
1896impl fidl::endpoints::ProtocolMarker for GuestMarker {
1897    type Proxy = GuestProxy;
1898    type RequestStream = GuestRequestStream;
1899    #[cfg(target_os = "fuchsia")]
1900    type SynchronousProxy = GuestSynchronousProxy;
1901
1902    const DEBUG_NAME: &'static str = "fuchsia.virtualization.Guest";
1903}
1904impl fidl::endpoints::DiscoverableProtocolMarker for GuestMarker {}
1905pub type GuestGetConsoleResult = Result<fidl::Socket, GuestError>;
1906pub type GuestGetHostVsockEndpointResult = Result<(), GuestError>;
1907pub type GuestGetBalloonControllerResult = Result<(), GuestError>;
1908pub type GuestGetMemControllerResult = Result<(), GuestError>;
1909
1910pub trait GuestProxyInterface: Send + Sync {
1911    type GetConsoleResponseFut: std::future::Future<Output = Result<GuestGetConsoleResult, fidl::Error>>
1912        + Send;
1913    fn r#get_console(&self) -> Self::GetConsoleResponseFut;
1914    type GetSerialResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
1915        + Send;
1916    fn r#get_serial(&self) -> Self::GetSerialResponseFut;
1917    type GetHostVsockEndpointResponseFut: std::future::Future<Output = Result<GuestGetHostVsockEndpointResult, fidl::Error>>
1918        + Send;
1919    fn r#get_host_vsock_endpoint(
1920        &self,
1921        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
1922    ) -> Self::GetHostVsockEndpointResponseFut;
1923    type GetBalloonControllerResponseFut: std::future::Future<Output = Result<GuestGetBalloonControllerResult, fidl::Error>>
1924        + Send;
1925    fn r#get_balloon_controller(
1926        &self,
1927        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
1928    ) -> Self::GetBalloonControllerResponseFut;
1929    type GetMemControllerResponseFut: std::future::Future<Output = Result<GuestGetMemControllerResult, fidl::Error>>
1930        + Send;
1931    fn r#get_mem_controller(
1932        &self,
1933        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
1934    ) -> Self::GetMemControllerResponseFut;
1935}
1936#[derive(Debug)]
1937#[cfg(target_os = "fuchsia")]
1938pub struct GuestSynchronousProxy {
1939    client: fidl::client::sync::Client,
1940}
1941
1942#[cfg(target_os = "fuchsia")]
1943impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
1944    type Proxy = GuestProxy;
1945    type Protocol = GuestMarker;
1946
1947    fn from_channel(inner: fidl::Channel) -> Self {
1948        Self::new(inner)
1949    }
1950
1951    fn into_channel(self) -> fidl::Channel {
1952        self.client.into_channel()
1953    }
1954
1955    fn as_channel(&self) -> &fidl::Channel {
1956        self.client.as_channel()
1957    }
1958}
1959
1960#[cfg(target_os = "fuchsia")]
1961impl GuestSynchronousProxy {
1962    pub fn new(channel: fidl::Channel) -> Self {
1963        let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1964        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1965    }
1966
1967    pub fn into_channel(self) -> fidl::Channel {
1968        self.client.into_channel()
1969    }
1970
1971    /// Waits until an event arrives and returns it. It is safe for other
1972    /// threads to make concurrent requests while waiting for an event.
1973    pub fn wait_for_event(
1974        &self,
1975        deadline: zx::MonotonicInstant,
1976    ) -> Result<GuestEvent, fidl::Error> {
1977        GuestEvent::decode(self.client.wait_for_event(deadline)?)
1978    }
1979
1980    /// Get a guest console.
1981    ///
1982    /// The details regarding what output is produced and what input is accepted
1983    /// are determined by each guest, but will typically be a read/write socket
1984    /// with a shell.
1985    ///
1986    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
1987    pub fn r#get_console(
1988        &self,
1989        ___deadline: zx::MonotonicInstant,
1990    ) -> Result<GuestGetConsoleResult, fidl::Error> {
1991        let _response = self.client.send_query::<
1992            fidl::encoding::EmptyPayload,
1993            fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
1994        >(
1995            (),
1996            0x48cbcecb7793806e,
1997            fidl::encoding::DynamicFlags::empty(),
1998            ___deadline,
1999        )?;
2000        Ok(_response.map(|x| x.socket))
2001    }
2002
2003    /// Get the socket for low-level guest debug logs.
2004    ///
2005    /// The details regarding what output is produced and what input is accepted
2006    /// are determined by each guest, but will typically be a read-only socket
2007    /// with the guest kernel's serial logs.
2008    pub fn r#get_serial(
2009        &self,
2010        ___deadline: zx::MonotonicInstant,
2011    ) -> Result<fidl::Socket, fidl::Error> {
2012        let _response =
2013            self.client.send_query::<fidl::encoding::EmptyPayload, GuestGetSerialResponse>(
2014                (),
2015                0xcdd541a160d7044,
2016                fidl::encoding::DynamicFlags::empty(),
2017                ___deadline,
2018            )?;
2019        Ok(_response.socket)
2020    }
2021
2022    /// Get the vsock endpoint for the guest.
2023    ///
2024    /// This endpoint can be used to register listeners for guest initiated connections, and
2025    /// to initiate connections from a client. If listeners need to be registered before the guest
2026    /// starts so that they are immediately available, set them via the guest config instead of
2027    /// using this endpoint.
2028    ///
2029    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
2030    pub fn r#get_host_vsock_endpoint(
2031        &self,
2032        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2033        ___deadline: zx::MonotonicInstant,
2034    ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
2035        let _response = self.client.send_query::<
2036            GuestGetHostVsockEndpointRequest,
2037            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2038        >(
2039            (endpoint,),
2040            0x766e96aeb9c28ed1,
2041            fidl::encoding::DynamicFlags::empty(),
2042            ___deadline,
2043        )?;
2044        Ok(_response.map(|x| x))
2045    }
2046
2047    /// Get the balloon controller endpoint for the guest.
2048    ///
2049    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
2050    pub fn r#get_balloon_controller(
2051        &self,
2052        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2053        ___deadline: zx::MonotonicInstant,
2054    ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
2055        let _response = self.client.send_query::<
2056            GuestGetBalloonControllerRequest,
2057            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2058        >(
2059            (controller,),
2060            0x7b210bff219ac84e,
2061            fidl::encoding::DynamicFlags::empty(),
2062            ___deadline,
2063        )?;
2064        Ok(_response.map(|x| x))
2065    }
2066
2067    /// Get the mem controller endpoint for the guest.
2068    ///
2069    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
2070    pub fn r#get_mem_controller(
2071        &self,
2072        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2073        ___deadline: zx::MonotonicInstant,
2074    ) -> Result<GuestGetMemControllerResult, fidl::Error> {
2075        let _response = self.client.send_query::<
2076            GuestGetMemControllerRequest,
2077            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2078        >(
2079            (controller,),
2080            0x170b19f4b867a01c,
2081            fidl::encoding::DynamicFlags::empty(),
2082            ___deadline,
2083        )?;
2084        Ok(_response.map(|x| x))
2085    }
2086}
2087
2088#[cfg(target_os = "fuchsia")]
2089impl From<GuestSynchronousProxy> for zx::Handle {
2090    fn from(value: GuestSynchronousProxy) -> Self {
2091        value.into_channel().into()
2092    }
2093}
2094
2095#[cfg(target_os = "fuchsia")]
2096impl From<fidl::Channel> for GuestSynchronousProxy {
2097    fn from(value: fidl::Channel) -> Self {
2098        Self::new(value)
2099    }
2100}
2101
2102#[cfg(target_os = "fuchsia")]
2103impl fidl::endpoints::FromClient for GuestSynchronousProxy {
2104    type Protocol = GuestMarker;
2105
2106    fn from_client(value: fidl::endpoints::ClientEnd<GuestMarker>) -> Self {
2107        Self::new(value.into_channel())
2108    }
2109}
2110
2111#[derive(Debug, Clone)]
2112pub struct GuestProxy {
2113    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2114}
2115
2116impl fidl::endpoints::Proxy for GuestProxy {
2117    type Protocol = GuestMarker;
2118
2119    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2120        Self::new(inner)
2121    }
2122
2123    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2124        self.client.into_channel().map_err(|client| Self { client })
2125    }
2126
2127    fn as_channel(&self) -> &::fidl::AsyncChannel {
2128        self.client.as_channel()
2129    }
2130}
2131
2132impl GuestProxy {
2133    /// Create a new Proxy for fuchsia.virtualization/Guest.
2134    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2135        let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2136        Self { client: fidl::client::Client::new(channel, protocol_name) }
2137    }
2138
2139    /// Get a Stream of events from the remote end of the protocol.
2140    ///
2141    /// # Panics
2142    ///
2143    /// Panics if the event stream was already taken.
2144    pub fn take_event_stream(&self) -> GuestEventStream {
2145        GuestEventStream { event_receiver: self.client.take_event_receiver() }
2146    }
2147
2148    /// Get a guest console.
2149    ///
2150    /// The details regarding what output is produced and what input is accepted
2151    /// are determined by each guest, but will typically be a read/write socket
2152    /// with a shell.
2153    ///
2154    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
2155    pub fn r#get_console(
2156        &self,
2157    ) -> fidl::client::QueryResponseFut<
2158        GuestGetConsoleResult,
2159        fidl::encoding::DefaultFuchsiaResourceDialect,
2160    > {
2161        GuestProxyInterface::r#get_console(self)
2162    }
2163
2164    /// Get the socket for low-level guest debug logs.
2165    ///
2166    /// The details regarding what output is produced and what input is accepted
2167    /// are determined by each guest, but will typically be a read-only socket
2168    /// with the guest kernel's serial logs.
2169    pub fn r#get_serial(
2170        &self,
2171    ) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
2172    {
2173        GuestProxyInterface::r#get_serial(self)
2174    }
2175
2176    /// Get the vsock endpoint for the guest.
2177    ///
2178    /// This endpoint can be used to register listeners for guest initiated connections, and
2179    /// to initiate connections from a client. If listeners need to be registered before the guest
2180    /// starts so that they are immediately available, set them via the guest config instead of
2181    /// using this endpoint.
2182    ///
2183    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
2184    pub fn r#get_host_vsock_endpoint(
2185        &self,
2186        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2187    ) -> fidl::client::QueryResponseFut<
2188        GuestGetHostVsockEndpointResult,
2189        fidl::encoding::DefaultFuchsiaResourceDialect,
2190    > {
2191        GuestProxyInterface::r#get_host_vsock_endpoint(self, endpoint)
2192    }
2193
2194    /// Get the balloon controller endpoint for the guest.
2195    ///
2196    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
2197    pub fn r#get_balloon_controller(
2198        &self,
2199        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2200    ) -> fidl::client::QueryResponseFut<
2201        GuestGetBalloonControllerResult,
2202        fidl::encoding::DefaultFuchsiaResourceDialect,
2203    > {
2204        GuestProxyInterface::r#get_balloon_controller(self, controller)
2205    }
2206
2207    /// Get the mem controller endpoint for the guest.
2208    ///
2209    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
2210    pub fn r#get_mem_controller(
2211        &self,
2212        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2213    ) -> fidl::client::QueryResponseFut<
2214        GuestGetMemControllerResult,
2215        fidl::encoding::DefaultFuchsiaResourceDialect,
2216    > {
2217        GuestProxyInterface::r#get_mem_controller(self, controller)
2218    }
2219}
2220
2221impl GuestProxyInterface for GuestProxy {
2222    type GetConsoleResponseFut = fidl::client::QueryResponseFut<
2223        GuestGetConsoleResult,
2224        fidl::encoding::DefaultFuchsiaResourceDialect,
2225    >;
2226    fn r#get_console(&self) -> Self::GetConsoleResponseFut {
2227        fn _decode(
2228            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2229        ) -> Result<GuestGetConsoleResult, fidl::Error> {
2230            let _response = fidl::client::decode_transaction_body::<
2231                fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
2232                fidl::encoding::DefaultFuchsiaResourceDialect,
2233                0x48cbcecb7793806e,
2234            >(_buf?)?;
2235            Ok(_response.map(|x| x.socket))
2236        }
2237        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestGetConsoleResult>(
2238            (),
2239            0x48cbcecb7793806e,
2240            fidl::encoding::DynamicFlags::empty(),
2241            _decode,
2242        )
2243    }
2244
2245    type GetSerialResponseFut =
2246        fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
2247    fn r#get_serial(&self) -> Self::GetSerialResponseFut {
2248        fn _decode(
2249            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2250        ) -> Result<fidl::Socket, fidl::Error> {
2251            let _response = fidl::client::decode_transaction_body::<
2252                GuestGetSerialResponse,
2253                fidl::encoding::DefaultFuchsiaResourceDialect,
2254                0xcdd541a160d7044,
2255            >(_buf?)?;
2256            Ok(_response.socket)
2257        }
2258        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Socket>(
2259            (),
2260            0xcdd541a160d7044,
2261            fidl::encoding::DynamicFlags::empty(),
2262            _decode,
2263        )
2264    }
2265
2266    type GetHostVsockEndpointResponseFut = fidl::client::QueryResponseFut<
2267        GuestGetHostVsockEndpointResult,
2268        fidl::encoding::DefaultFuchsiaResourceDialect,
2269    >;
2270    fn r#get_host_vsock_endpoint(
2271        &self,
2272        mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2273    ) -> Self::GetHostVsockEndpointResponseFut {
2274        fn _decode(
2275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2276        ) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
2277            let _response = fidl::client::decode_transaction_body::<
2278                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2279                fidl::encoding::DefaultFuchsiaResourceDialect,
2280                0x766e96aeb9c28ed1,
2281            >(_buf?)?;
2282            Ok(_response.map(|x| x))
2283        }
2284        self.client.send_query_and_decode::<
2285            GuestGetHostVsockEndpointRequest,
2286            GuestGetHostVsockEndpointResult,
2287        >(
2288            (endpoint,),
2289            0x766e96aeb9c28ed1,
2290            fidl::encoding::DynamicFlags::empty(),
2291            _decode,
2292        )
2293    }
2294
2295    type GetBalloonControllerResponseFut = fidl::client::QueryResponseFut<
2296        GuestGetBalloonControllerResult,
2297        fidl::encoding::DefaultFuchsiaResourceDialect,
2298    >;
2299    fn r#get_balloon_controller(
2300        &self,
2301        mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2302    ) -> Self::GetBalloonControllerResponseFut {
2303        fn _decode(
2304            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2305        ) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
2306            let _response = fidl::client::decode_transaction_body::<
2307                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2308                fidl::encoding::DefaultFuchsiaResourceDialect,
2309                0x7b210bff219ac84e,
2310            >(_buf?)?;
2311            Ok(_response.map(|x| x))
2312        }
2313        self.client.send_query_and_decode::<
2314            GuestGetBalloonControllerRequest,
2315            GuestGetBalloonControllerResult,
2316        >(
2317            (controller,),
2318            0x7b210bff219ac84e,
2319            fidl::encoding::DynamicFlags::empty(),
2320            _decode,
2321        )
2322    }
2323
2324    type GetMemControllerResponseFut = fidl::client::QueryResponseFut<
2325        GuestGetMemControllerResult,
2326        fidl::encoding::DefaultFuchsiaResourceDialect,
2327    >;
2328    fn r#get_mem_controller(
2329        &self,
2330        mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2331    ) -> Self::GetMemControllerResponseFut {
2332        fn _decode(
2333            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2334        ) -> Result<GuestGetMemControllerResult, fidl::Error> {
2335            let _response = fidl::client::decode_transaction_body::<
2336                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
2337                fidl::encoding::DefaultFuchsiaResourceDialect,
2338                0x170b19f4b867a01c,
2339            >(_buf?)?;
2340            Ok(_response.map(|x| x))
2341        }
2342        self.client
2343            .send_query_and_decode::<GuestGetMemControllerRequest, GuestGetMemControllerResult>(
2344                (controller,),
2345                0x170b19f4b867a01c,
2346                fidl::encoding::DynamicFlags::empty(),
2347                _decode,
2348            )
2349    }
2350}
2351
2352pub struct GuestEventStream {
2353    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2354}
2355
2356impl std::marker::Unpin for GuestEventStream {}
2357
2358impl futures::stream::FusedStream for GuestEventStream {
2359    fn is_terminated(&self) -> bool {
2360        self.event_receiver.is_terminated()
2361    }
2362}
2363
2364impl futures::Stream for GuestEventStream {
2365    type Item = Result<GuestEvent, fidl::Error>;
2366
2367    fn poll_next(
2368        mut self: std::pin::Pin<&mut Self>,
2369        cx: &mut std::task::Context<'_>,
2370    ) -> std::task::Poll<Option<Self::Item>> {
2371        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2372            &mut self.event_receiver,
2373            cx
2374        )?) {
2375            Some(buf) => std::task::Poll::Ready(Some(GuestEvent::decode(buf))),
2376            None => std::task::Poll::Ready(None),
2377        }
2378    }
2379}
2380
2381#[derive(Debug)]
2382pub enum GuestEvent {}
2383
2384impl GuestEvent {
2385    /// Decodes a message buffer as a [`GuestEvent`].
2386    fn decode(
2387        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2388    ) -> Result<GuestEvent, fidl::Error> {
2389        let (bytes, _handles) = buf.split_mut();
2390        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2391        debug_assert_eq!(tx_header.tx_id, 0);
2392        match tx_header.ordinal {
2393            _ => Err(fidl::Error::UnknownOrdinal {
2394                ordinal: tx_header.ordinal,
2395                protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2396            }),
2397        }
2398    }
2399}
2400
2401/// A Stream of incoming requests for fuchsia.virtualization/Guest.
2402pub struct GuestRequestStream {
2403    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2404    is_terminated: bool,
2405}
2406
2407impl std::marker::Unpin for GuestRequestStream {}
2408
2409impl futures::stream::FusedStream for GuestRequestStream {
2410    fn is_terminated(&self) -> bool {
2411        self.is_terminated
2412    }
2413}
2414
2415impl fidl::endpoints::RequestStream for GuestRequestStream {
2416    type Protocol = GuestMarker;
2417    type ControlHandle = GuestControlHandle;
2418
2419    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2420        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2421    }
2422
2423    fn control_handle(&self) -> Self::ControlHandle {
2424        GuestControlHandle { inner: self.inner.clone() }
2425    }
2426
2427    fn into_inner(
2428        self,
2429    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2430    {
2431        (self.inner, self.is_terminated)
2432    }
2433
2434    fn from_inner(
2435        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2436        is_terminated: bool,
2437    ) -> Self {
2438        Self { inner, is_terminated }
2439    }
2440}
2441
2442impl futures::Stream for GuestRequestStream {
2443    type Item = Result<GuestRequest, fidl::Error>;
2444
2445    fn poll_next(
2446        mut self: std::pin::Pin<&mut Self>,
2447        cx: &mut std::task::Context<'_>,
2448    ) -> std::task::Poll<Option<Self::Item>> {
2449        let this = &mut *self;
2450        if this.inner.check_shutdown(cx) {
2451            this.is_terminated = true;
2452            return std::task::Poll::Ready(None);
2453        }
2454        if this.is_terminated {
2455            panic!("polled GuestRequestStream after completion");
2456        }
2457        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2458            |bytes, handles| {
2459                match this.inner.channel().read_etc(cx, bytes, handles) {
2460                    std::task::Poll::Ready(Ok(())) => {}
2461                    std::task::Poll::Pending => return std::task::Poll::Pending,
2462                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2463                        this.is_terminated = true;
2464                        return std::task::Poll::Ready(None);
2465                    }
2466                    std::task::Poll::Ready(Err(e)) => {
2467                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2468                            e.into(),
2469                        ))))
2470                    }
2471                }
2472
2473                // A message has been received from the channel
2474                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2475
2476                std::task::Poll::Ready(Some(match header.ordinal {
2477                    0x48cbcecb7793806e => {
2478                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2479                        let mut req = fidl::new_empty!(
2480                            fidl::encoding::EmptyPayload,
2481                            fidl::encoding::DefaultFuchsiaResourceDialect
2482                        );
2483                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2484                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
2485                        Ok(GuestRequest::GetConsole {
2486                            responder: GuestGetConsoleResponder {
2487                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2488                                tx_id: header.tx_id,
2489                            },
2490                        })
2491                    }
2492                    0xcdd541a160d7044 => {
2493                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2494                        let mut req = fidl::new_empty!(
2495                            fidl::encoding::EmptyPayload,
2496                            fidl::encoding::DefaultFuchsiaResourceDialect
2497                        );
2498                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2499                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
2500                        Ok(GuestRequest::GetSerial {
2501                            responder: GuestGetSerialResponder {
2502                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2503                                tx_id: header.tx_id,
2504                            },
2505                        })
2506                    }
2507                    0x766e96aeb9c28ed1 => {
2508                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2509                        let mut req = fidl::new_empty!(
2510                            GuestGetHostVsockEndpointRequest,
2511                            fidl::encoding::DefaultFuchsiaResourceDialect
2512                        );
2513                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetHostVsockEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
2514                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
2515                        Ok(GuestRequest::GetHostVsockEndpoint {
2516                            endpoint: req.endpoint,
2517
2518                            responder: GuestGetHostVsockEndpointResponder {
2519                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2520                                tx_id: header.tx_id,
2521                            },
2522                        })
2523                    }
2524                    0x7b210bff219ac84e => {
2525                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2526                        let mut req = fidl::new_empty!(
2527                            GuestGetBalloonControllerRequest,
2528                            fidl::encoding::DefaultFuchsiaResourceDialect
2529                        );
2530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetBalloonControllerRequest>(&header, _body_bytes, handles, &mut req)?;
2531                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
2532                        Ok(GuestRequest::GetBalloonController {
2533                            controller: req.controller,
2534
2535                            responder: GuestGetBalloonControllerResponder {
2536                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2537                                tx_id: header.tx_id,
2538                            },
2539                        })
2540                    }
2541                    0x170b19f4b867a01c => {
2542                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2543                        let mut req = fidl::new_empty!(
2544                            GuestGetMemControllerRequest,
2545                            fidl::encoding::DefaultFuchsiaResourceDialect
2546                        );
2547                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetMemControllerRequest>(&header, _body_bytes, handles, &mut req)?;
2548                        let control_handle = GuestControlHandle { inner: this.inner.clone() };
2549                        Ok(GuestRequest::GetMemController {
2550                            controller: req.controller,
2551
2552                            responder: GuestGetMemControllerResponder {
2553                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2554                                tx_id: header.tx_id,
2555                            },
2556                        })
2557                    }
2558                    _ => Err(fidl::Error::UnknownOrdinal {
2559                        ordinal: header.ordinal,
2560                        protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2561                    }),
2562                }))
2563            },
2564        )
2565    }
2566}
2567
2568/// The guest client API providing high level access to guest features. When the guest terminates,
2569/// this channel will contain a ZX_OK epitaph on a clean shutdown, a ZX_ERR_INTERNAL epitaph on
2570/// an unexpected shutdown, and no epitaph if the component crashed.
2571#[derive(Debug)]
2572pub enum GuestRequest {
2573    /// Get a guest console.
2574    ///
2575    /// The details regarding what output is produced and what input is accepted
2576    /// are determined by each guest, but will typically be a read/write socket
2577    /// with a shell.
2578    ///
2579    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a console device.
2580    GetConsole { responder: GuestGetConsoleResponder },
2581    /// Get the socket for low-level guest debug logs.
2582    ///
2583    /// The details regarding what output is produced and what input is accepted
2584    /// are determined by each guest, but will typically be a read-only socket
2585    /// with the guest kernel's serial logs.
2586    GetSerial { responder: GuestGetSerialResponder },
2587    /// Get the vsock endpoint for the guest.
2588    ///
2589    /// This endpoint can be used to register listeners for guest initiated connections, and
2590    /// to initiate connections from a client. If listeners need to be registered before the guest
2591    /// starts so that they are immediately available, set them via the guest config instead of
2592    /// using this endpoint.
2593    ///
2594    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a vsock device.
2595    GetHostVsockEndpoint {
2596        endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2597        responder: GuestGetHostVsockEndpointResponder,
2598    },
2599    /// Get the balloon controller endpoint for the guest.
2600    ///
2601    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a balloon device.
2602    GetBalloonController {
2603        controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2604        responder: GuestGetBalloonControllerResponder,
2605    },
2606    /// Get the mem controller endpoint for the guest.
2607    ///
2608    /// Returns error DEVICE_NOT_PRESENT if the guest was started without a mem device.
2609    GetMemController {
2610        controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
2611        responder: GuestGetMemControllerResponder,
2612    },
2613}
2614
2615impl GuestRequest {
2616    #[allow(irrefutable_let_patterns)]
2617    pub fn into_get_console(self) -> Option<(GuestGetConsoleResponder)> {
2618        if let GuestRequest::GetConsole { responder } = self {
2619            Some((responder))
2620        } else {
2621            None
2622        }
2623    }
2624
2625    #[allow(irrefutable_let_patterns)]
2626    pub fn into_get_serial(self) -> Option<(GuestGetSerialResponder)> {
2627        if let GuestRequest::GetSerial { responder } = self {
2628            Some((responder))
2629        } else {
2630            None
2631        }
2632    }
2633
2634    #[allow(irrefutable_let_patterns)]
2635    pub fn into_get_host_vsock_endpoint(
2636        self,
2637    ) -> Option<(
2638        fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
2639        GuestGetHostVsockEndpointResponder,
2640    )> {
2641        if let GuestRequest::GetHostVsockEndpoint { endpoint, responder } = self {
2642            Some((endpoint, responder))
2643        } else {
2644            None
2645        }
2646    }
2647
2648    #[allow(irrefutable_let_patterns)]
2649    pub fn into_get_balloon_controller(
2650        self,
2651    ) -> Option<(
2652        fidl::endpoints::ServerEnd<BalloonControllerMarker>,
2653        GuestGetBalloonControllerResponder,
2654    )> {
2655        if let GuestRequest::GetBalloonController { controller, responder } = self {
2656            Some((controller, responder))
2657        } else {
2658            None
2659        }
2660    }
2661
2662    #[allow(irrefutable_let_patterns)]
2663    pub fn into_get_mem_controller(
2664        self,
2665    ) -> Option<(fidl::endpoints::ServerEnd<MemControllerMarker>, GuestGetMemControllerResponder)>
2666    {
2667        if let GuestRequest::GetMemController { controller, responder } = self {
2668            Some((controller, responder))
2669        } else {
2670            None
2671        }
2672    }
2673
2674    /// Name of the method defined in FIDL
2675    pub fn method_name(&self) -> &'static str {
2676        match *self {
2677            GuestRequest::GetConsole { .. } => "get_console",
2678            GuestRequest::GetSerial { .. } => "get_serial",
2679            GuestRequest::GetHostVsockEndpoint { .. } => "get_host_vsock_endpoint",
2680            GuestRequest::GetBalloonController { .. } => "get_balloon_controller",
2681            GuestRequest::GetMemController { .. } => "get_mem_controller",
2682        }
2683    }
2684}
2685
2686#[derive(Debug, Clone)]
2687pub struct GuestControlHandle {
2688    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2689}
2690
2691impl fidl::endpoints::ControlHandle for GuestControlHandle {
2692    fn shutdown(&self) {
2693        self.inner.shutdown()
2694    }
2695    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2696        self.inner.shutdown_with_epitaph(status)
2697    }
2698
2699    fn is_closed(&self) -> bool {
2700        self.inner.channel().is_closed()
2701    }
2702    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2703        self.inner.channel().on_closed()
2704    }
2705
2706    #[cfg(target_os = "fuchsia")]
2707    fn signal_peer(
2708        &self,
2709        clear_mask: zx::Signals,
2710        set_mask: zx::Signals,
2711    ) -> Result<(), zx_status::Status> {
2712        use fidl::Peered;
2713        self.inner.channel().signal_peer(clear_mask, set_mask)
2714    }
2715}
2716
2717impl GuestControlHandle {}
2718
2719#[must_use = "FIDL methods require a response to be sent"]
2720#[derive(Debug)]
2721pub struct GuestGetConsoleResponder {
2722    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
2723    tx_id: u32,
2724}
2725
2726/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
2727/// if the responder is dropped without sending a response, so that the client
2728/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2729impl std::ops::Drop for GuestGetConsoleResponder {
2730    fn drop(&mut self) {
2731        self.control_handle.shutdown();
2732        // Safety: drops once, never accessed again
2733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2734    }
2735}
2736
2737impl fidl::endpoints::Responder for GuestGetConsoleResponder {
2738    type ControlHandle = GuestControlHandle;
2739
2740    fn control_handle(&self) -> &GuestControlHandle {
2741        &self.control_handle
2742    }
2743
2744    fn drop_without_shutdown(mut self) {
2745        // Safety: drops once, never accessed again due to mem::forget
2746        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2747        // Prevent Drop from running (which would shut down the channel)
2748        std::mem::forget(self);
2749    }
2750}
2751
2752impl GuestGetConsoleResponder {
2753    /// Sends a response to the FIDL transaction.
2754    ///
2755    /// Sets the channel to shutdown if an error occurs.
2756    pub fn send(self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
2757        let _result = self.send_raw(result);
2758        if _result.is_err() {
2759            self.control_handle.shutdown();
2760        }
2761        self.drop_without_shutdown();
2762        _result
2763    }
2764
2765    /// Similar to "send" but does not shutdown the channel if an error occurs.
2766    pub fn send_no_shutdown_on_err(
2767        self,
2768        mut result: Result<fidl::Socket, GuestError>,
2769    ) -> Result<(), fidl::Error> {
2770        let _result = self.send_raw(result);
2771        self.drop_without_shutdown();
2772        _result
2773    }
2774
2775    fn send_raw(&self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
2776        self.control_handle
2777            .inner
2778            .send::<fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>>(
2779                result.map(|socket| (socket,)),
2780                self.tx_id,
2781                0x48cbcecb7793806e,
2782                fidl::encoding::DynamicFlags::empty(),
2783            )
2784    }
2785}
2786
2787#[must_use = "FIDL methods require a response to be sent"]
2788#[derive(Debug)]
2789pub struct GuestGetSerialResponder {
2790    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
2791    tx_id: u32,
2792}
2793
2794/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
2795/// if the responder is dropped without sending a response, so that the client
2796/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2797impl std::ops::Drop for GuestGetSerialResponder {
2798    fn drop(&mut self) {
2799        self.control_handle.shutdown();
2800        // Safety: drops once, never accessed again
2801        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2802    }
2803}
2804
2805impl fidl::endpoints::Responder for GuestGetSerialResponder {
2806    type ControlHandle = GuestControlHandle;
2807
2808    fn control_handle(&self) -> &GuestControlHandle {
2809        &self.control_handle
2810    }
2811
2812    fn drop_without_shutdown(mut self) {
2813        // Safety: drops once, never accessed again due to mem::forget
2814        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2815        // Prevent Drop from running (which would shut down the channel)
2816        std::mem::forget(self);
2817    }
2818}
2819
2820impl GuestGetSerialResponder {
2821    /// Sends a response to the FIDL transaction.
2822    ///
2823    /// Sets the channel to shutdown if an error occurs.
2824    pub fn send(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
2825        let _result = self.send_raw(socket);
2826        if _result.is_err() {
2827            self.control_handle.shutdown();
2828        }
2829        self.drop_without_shutdown();
2830        _result
2831    }
2832
2833    /// Similar to "send" but does not shutdown the channel if an error occurs.
2834    pub fn send_no_shutdown_on_err(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
2835        let _result = self.send_raw(socket);
2836        self.drop_without_shutdown();
2837        _result
2838    }
2839
2840    fn send_raw(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
2841        self.control_handle.inner.send::<GuestGetSerialResponse>(
2842            (socket,),
2843            self.tx_id,
2844            0xcdd541a160d7044,
2845            fidl::encoding::DynamicFlags::empty(),
2846        )
2847    }
2848}
2849
2850#[must_use = "FIDL methods require a response to be sent"]
2851#[derive(Debug)]
2852pub struct GuestGetHostVsockEndpointResponder {
2853    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
2854    tx_id: u32,
2855}
2856
2857/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
2858/// if the responder is dropped without sending a response, so that the client
2859/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2860impl std::ops::Drop for GuestGetHostVsockEndpointResponder {
2861    fn drop(&mut self) {
2862        self.control_handle.shutdown();
2863        // Safety: drops once, never accessed again
2864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2865    }
2866}
2867
2868impl fidl::endpoints::Responder for GuestGetHostVsockEndpointResponder {
2869    type ControlHandle = GuestControlHandle;
2870
2871    fn control_handle(&self) -> &GuestControlHandle {
2872        &self.control_handle
2873    }
2874
2875    fn drop_without_shutdown(mut self) {
2876        // Safety: drops once, never accessed again due to mem::forget
2877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2878        // Prevent Drop from running (which would shut down the channel)
2879        std::mem::forget(self);
2880    }
2881}
2882
2883impl GuestGetHostVsockEndpointResponder {
2884    /// Sends a response to the FIDL transaction.
2885    ///
2886    /// Sets the channel to shutdown if an error occurs.
2887    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
2888        let _result = self.send_raw(result);
2889        if _result.is_err() {
2890            self.control_handle.shutdown();
2891        }
2892        self.drop_without_shutdown();
2893        _result
2894    }
2895
2896    /// Similar to "send" but does not shutdown the channel if an error occurs.
2897    pub fn send_no_shutdown_on_err(
2898        self,
2899        mut result: Result<(), GuestError>,
2900    ) -> Result<(), fidl::Error> {
2901        let _result = self.send_raw(result);
2902        self.drop_without_shutdown();
2903        _result
2904    }
2905
2906    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
2907        self.control_handle
2908            .inner
2909            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
2910                result,
2911                self.tx_id,
2912                0x766e96aeb9c28ed1,
2913                fidl::encoding::DynamicFlags::empty(),
2914            )
2915    }
2916}
2917
2918#[must_use = "FIDL methods require a response to be sent"]
2919#[derive(Debug)]
2920pub struct GuestGetBalloonControllerResponder {
2921    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
2922    tx_id: u32,
2923}
2924
2925/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
2926/// if the responder is dropped without sending a response, so that the client
2927/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2928impl std::ops::Drop for GuestGetBalloonControllerResponder {
2929    fn drop(&mut self) {
2930        self.control_handle.shutdown();
2931        // Safety: drops once, never accessed again
2932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2933    }
2934}
2935
2936impl fidl::endpoints::Responder for GuestGetBalloonControllerResponder {
2937    type ControlHandle = GuestControlHandle;
2938
2939    fn control_handle(&self) -> &GuestControlHandle {
2940        &self.control_handle
2941    }
2942
2943    fn drop_without_shutdown(mut self) {
2944        // Safety: drops once, never accessed again due to mem::forget
2945        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2946        // Prevent Drop from running (which would shut down the channel)
2947        std::mem::forget(self);
2948    }
2949}
2950
2951impl GuestGetBalloonControllerResponder {
2952    /// Sends a response to the FIDL transaction.
2953    ///
2954    /// Sets the channel to shutdown if an error occurs.
2955    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
2956        let _result = self.send_raw(result);
2957        if _result.is_err() {
2958            self.control_handle.shutdown();
2959        }
2960        self.drop_without_shutdown();
2961        _result
2962    }
2963
2964    /// Similar to "send" but does not shutdown the channel if an error occurs.
2965    pub fn send_no_shutdown_on_err(
2966        self,
2967        mut result: Result<(), GuestError>,
2968    ) -> Result<(), fidl::Error> {
2969        let _result = self.send_raw(result);
2970        self.drop_without_shutdown();
2971        _result
2972    }
2973
2974    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
2975        self.control_handle
2976            .inner
2977            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
2978                result,
2979                self.tx_id,
2980                0x7b210bff219ac84e,
2981                fidl::encoding::DynamicFlags::empty(),
2982            )
2983    }
2984}
2985
2986#[must_use = "FIDL methods require a response to be sent"]
2987#[derive(Debug)]
2988pub struct GuestGetMemControllerResponder {
2989    control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
2990    tx_id: u32,
2991}
2992
2993/// Set the the channel to be shutdown (see [`GuestControlHandle::shutdown`])
2994/// if the responder is dropped without sending a response, so that the client
2995/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2996impl std::ops::Drop for GuestGetMemControllerResponder {
2997    fn drop(&mut self) {
2998        self.control_handle.shutdown();
2999        // Safety: drops once, never accessed again
3000        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3001    }
3002}
3003
3004impl fidl::endpoints::Responder for GuestGetMemControllerResponder {
3005    type ControlHandle = GuestControlHandle;
3006
3007    fn control_handle(&self) -> &GuestControlHandle {
3008        &self.control_handle
3009    }
3010
3011    fn drop_without_shutdown(mut self) {
3012        // Safety: drops once, never accessed again due to mem::forget
3013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3014        // Prevent Drop from running (which would shut down the channel)
3015        std::mem::forget(self);
3016    }
3017}
3018
3019impl GuestGetMemControllerResponder {
3020    /// Sends a response to the FIDL transaction.
3021    ///
3022    /// Sets the channel to shutdown if an error occurs.
3023    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3024        let _result = self.send_raw(result);
3025        if _result.is_err() {
3026            self.control_handle.shutdown();
3027        }
3028        self.drop_without_shutdown();
3029        _result
3030    }
3031
3032    /// Similar to "send" but does not shutdown the channel if an error occurs.
3033    pub fn send_no_shutdown_on_err(
3034        self,
3035        mut result: Result<(), GuestError>,
3036    ) -> Result<(), fidl::Error> {
3037        let _result = self.send_raw(result);
3038        self.drop_without_shutdown();
3039        _result
3040    }
3041
3042    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3043        self.control_handle
3044            .inner
3045            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3046                result,
3047                self.tx_id,
3048                0x170b19f4b867a01c,
3049                fidl::encoding::DynamicFlags::empty(),
3050            )
3051    }
3052}
3053
3054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3055pub struct GuestLifecycleMarker;
3056
3057impl fidl::endpoints::ProtocolMarker for GuestLifecycleMarker {
3058    type Proxy = GuestLifecycleProxy;
3059    type RequestStream = GuestLifecycleRequestStream;
3060    #[cfg(target_os = "fuchsia")]
3061    type SynchronousProxy = GuestLifecycleSynchronousProxy;
3062
3063    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestLifecycle";
3064}
3065impl fidl::endpoints::DiscoverableProtocolMarker for GuestLifecycleMarker {}
3066pub type GuestLifecycleCreateResult = Result<(), GuestError>;
3067pub type GuestLifecycleRunResult = Result<(), GuestError>;
3068
3069pub trait GuestLifecycleProxyInterface: Send + Sync {
3070    type CreateResponseFut: std::future::Future<Output = Result<GuestLifecycleCreateResult, fidl::Error>>
3071        + Send;
3072    fn r#create(&self, guest_config: GuestConfig) -> Self::CreateResponseFut;
3073    fn r#bind(&self, guest: fidl::endpoints::ServerEnd<GuestMarker>) -> Result<(), fidl::Error>;
3074    type RunResponseFut: std::future::Future<Output = Result<GuestLifecycleRunResult, fidl::Error>>
3075        + Send;
3076    fn r#run(&self) -> Self::RunResponseFut;
3077    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3078    fn r#stop(&self) -> Self::StopResponseFut;
3079}
3080#[derive(Debug)]
3081#[cfg(target_os = "fuchsia")]
3082pub struct GuestLifecycleSynchronousProxy {
3083    client: fidl::client::sync::Client,
3084}
3085
3086#[cfg(target_os = "fuchsia")]
3087impl fidl::endpoints::SynchronousProxy for GuestLifecycleSynchronousProxy {
3088    type Proxy = GuestLifecycleProxy;
3089    type Protocol = GuestLifecycleMarker;
3090
3091    fn from_channel(inner: fidl::Channel) -> Self {
3092        Self::new(inner)
3093    }
3094
3095    fn into_channel(self) -> fidl::Channel {
3096        self.client.into_channel()
3097    }
3098
3099    fn as_channel(&self) -> &fidl::Channel {
3100        self.client.as_channel()
3101    }
3102}
3103
3104#[cfg(target_os = "fuchsia")]
3105impl GuestLifecycleSynchronousProxy {
3106    pub fn new(channel: fidl::Channel) -> Self {
3107        let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3108        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3109    }
3110
3111    pub fn into_channel(self) -> fidl::Channel {
3112        self.client.into_channel()
3113    }
3114
3115    /// Waits until an event arrives and returns it. It is safe for other
3116    /// threads to make concurrent requests while waiting for an event.
3117    pub fn wait_for_event(
3118        &self,
3119        deadline: zx::MonotonicInstant,
3120    ) -> Result<GuestLifecycleEvent, fidl::Error> {
3121        GuestLifecycleEvent::decode(self.client.wait_for_event(deadline)?)
3122    }
3123
3124    /// Create a VMM configured with the provided config. This instantiates all devices and loads
3125    /// the kernel without starting the VCPU or device dispatch loops.
3126    ///
3127    /// Possible errors:
3128    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
3129    ///         recreated.
3130    ///
3131    /// All other errors are related to VMM initialization.
3132    pub fn r#create(
3133        &self,
3134        mut guest_config: GuestConfig,
3135        ___deadline: zx::MonotonicInstant,
3136    ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
3137        let _response = self.client.send_query::<
3138            GuestLifecycleCreateRequest,
3139            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3140        >(
3141            (&mut guest_config,),
3142            0x152719eed416ed41,
3143            fidl::encoding::DynamicFlags::empty(),
3144            ___deadline,
3145        )?;
3146        Ok(_response.map(|x| x))
3147    }
3148
3149    /// Binds to the Guest protocol for an initialized guest.
3150    ///
3151    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
3152    /// will be immediately closed.
3153    pub fn r#bind(
3154        &self,
3155        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
3156    ) -> Result<(), fidl::Error> {
3157        self.client.send::<GuestLifecycleBindRequest>(
3158            (guest,),
3159            0x57dd3e245f9598ed,
3160            fidl::encoding::DynamicFlags::empty(),
3161        )
3162    }
3163
3164    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
3165    /// running. On a clean shutdown (either guest or client initiated) this will return success.
3166    ///
3167    /// Possible errors:
3168    ///     - ALREADY_RUNING: The VMM has already been started.
3169    ///     - NOT_CREATED: Run was called before the VMM was created.
3170    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
3171    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
3172    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
3173    pub fn r#run(
3174        &self,
3175        ___deadline: zx::MonotonicInstant,
3176    ) -> Result<GuestLifecycleRunResult, fidl::Error> {
3177        let _response = self.client.send_query::<
3178            fidl::encoding::EmptyPayload,
3179            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3180        >(
3181            (),
3182            0x2907fef2ac775657,
3183            fidl::encoding::DynamicFlags::empty(),
3184            ___deadline,
3185        )?;
3186        Ok(_response.map(|x| x))
3187    }
3188
3189    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
3190    /// Create and then Run can be called again.
3191    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3192        let _response =
3193            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
3194                (),
3195                0x27eef9c535ac8eb4,
3196                fidl::encoding::DynamicFlags::empty(),
3197                ___deadline,
3198            )?;
3199        Ok(_response)
3200    }
3201}
3202
3203#[cfg(target_os = "fuchsia")]
3204impl From<GuestLifecycleSynchronousProxy> for zx::Handle {
3205    fn from(value: GuestLifecycleSynchronousProxy) -> Self {
3206        value.into_channel().into()
3207    }
3208}
3209
3210#[cfg(target_os = "fuchsia")]
3211impl From<fidl::Channel> for GuestLifecycleSynchronousProxy {
3212    fn from(value: fidl::Channel) -> Self {
3213        Self::new(value)
3214    }
3215}
3216
3217#[cfg(target_os = "fuchsia")]
3218impl fidl::endpoints::FromClient for GuestLifecycleSynchronousProxy {
3219    type Protocol = GuestLifecycleMarker;
3220
3221    fn from_client(value: fidl::endpoints::ClientEnd<GuestLifecycleMarker>) -> Self {
3222        Self::new(value.into_channel())
3223    }
3224}
3225
3226#[derive(Debug, Clone)]
3227pub struct GuestLifecycleProxy {
3228    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3229}
3230
3231impl fidl::endpoints::Proxy for GuestLifecycleProxy {
3232    type Protocol = GuestLifecycleMarker;
3233
3234    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3235        Self::new(inner)
3236    }
3237
3238    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3239        self.client.into_channel().map_err(|client| Self { client })
3240    }
3241
3242    fn as_channel(&self) -> &::fidl::AsyncChannel {
3243        self.client.as_channel()
3244    }
3245}
3246
3247impl GuestLifecycleProxy {
3248    /// Create a new Proxy for fuchsia.virtualization/GuestLifecycle.
3249    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3250        let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3251        Self { client: fidl::client::Client::new(channel, protocol_name) }
3252    }
3253
3254    /// Get a Stream of events from the remote end of the protocol.
3255    ///
3256    /// # Panics
3257    ///
3258    /// Panics if the event stream was already taken.
3259    pub fn take_event_stream(&self) -> GuestLifecycleEventStream {
3260        GuestLifecycleEventStream { event_receiver: self.client.take_event_receiver() }
3261    }
3262
3263    /// Create a VMM configured with the provided config. This instantiates all devices and loads
3264    /// the kernel without starting the VCPU or device dispatch loops.
3265    ///
3266    /// Possible errors:
3267    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
3268    ///         recreated.
3269    ///
3270    /// All other errors are related to VMM initialization.
3271    pub fn r#create(
3272        &self,
3273        mut guest_config: GuestConfig,
3274    ) -> fidl::client::QueryResponseFut<
3275        GuestLifecycleCreateResult,
3276        fidl::encoding::DefaultFuchsiaResourceDialect,
3277    > {
3278        GuestLifecycleProxyInterface::r#create(self, guest_config)
3279    }
3280
3281    /// Binds to the Guest protocol for an initialized guest.
3282    ///
3283    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
3284    /// will be immediately closed.
3285    pub fn r#bind(
3286        &self,
3287        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
3288    ) -> Result<(), fidl::Error> {
3289        GuestLifecycleProxyInterface::r#bind(self, guest)
3290    }
3291
3292    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
3293    /// running. On a clean shutdown (either guest or client initiated) this will return success.
3294    ///
3295    /// Possible errors:
3296    ///     - ALREADY_RUNING: The VMM has already been started.
3297    ///     - NOT_CREATED: Run was called before the VMM was created.
3298    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
3299    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
3300    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
3301    pub fn r#run(
3302        &self,
3303    ) -> fidl::client::QueryResponseFut<
3304        GuestLifecycleRunResult,
3305        fidl::encoding::DefaultFuchsiaResourceDialect,
3306    > {
3307        GuestLifecycleProxyInterface::r#run(self)
3308    }
3309
3310    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
3311    /// Create and then Run can be called again.
3312    pub fn r#stop(
3313        &self,
3314    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3315        GuestLifecycleProxyInterface::r#stop(self)
3316    }
3317}
3318
3319impl GuestLifecycleProxyInterface for GuestLifecycleProxy {
3320    type CreateResponseFut = fidl::client::QueryResponseFut<
3321        GuestLifecycleCreateResult,
3322        fidl::encoding::DefaultFuchsiaResourceDialect,
3323    >;
3324    fn r#create(&self, mut guest_config: GuestConfig) -> Self::CreateResponseFut {
3325        fn _decode(
3326            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3327        ) -> Result<GuestLifecycleCreateResult, fidl::Error> {
3328            let _response = fidl::client::decode_transaction_body::<
3329                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3330                fidl::encoding::DefaultFuchsiaResourceDialect,
3331                0x152719eed416ed41,
3332            >(_buf?)?;
3333            Ok(_response.map(|x| x))
3334        }
3335        self.client
3336            .send_query_and_decode::<GuestLifecycleCreateRequest, GuestLifecycleCreateResult>(
3337                (&mut guest_config,),
3338                0x152719eed416ed41,
3339                fidl::encoding::DynamicFlags::empty(),
3340                _decode,
3341            )
3342    }
3343
3344    fn r#bind(
3345        &self,
3346        mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
3347    ) -> Result<(), fidl::Error> {
3348        self.client.send::<GuestLifecycleBindRequest>(
3349            (guest,),
3350            0x57dd3e245f9598ed,
3351            fidl::encoding::DynamicFlags::empty(),
3352        )
3353    }
3354
3355    type RunResponseFut = fidl::client::QueryResponseFut<
3356        GuestLifecycleRunResult,
3357        fidl::encoding::DefaultFuchsiaResourceDialect,
3358    >;
3359    fn r#run(&self) -> Self::RunResponseFut {
3360        fn _decode(
3361            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3362        ) -> Result<GuestLifecycleRunResult, fidl::Error> {
3363            let _response = fidl::client::decode_transaction_body::<
3364                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
3365                fidl::encoding::DefaultFuchsiaResourceDialect,
3366                0x2907fef2ac775657,
3367            >(_buf?)?;
3368            Ok(_response.map(|x| x))
3369        }
3370        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestLifecycleRunResult>(
3371            (),
3372            0x2907fef2ac775657,
3373            fidl::encoding::DynamicFlags::empty(),
3374            _decode,
3375        )
3376    }
3377
3378    type StopResponseFut =
3379        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3380    fn r#stop(&self) -> Self::StopResponseFut {
3381        fn _decode(
3382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3383        ) -> Result<(), fidl::Error> {
3384            let _response = fidl::client::decode_transaction_body::<
3385                fidl::encoding::EmptyPayload,
3386                fidl::encoding::DefaultFuchsiaResourceDialect,
3387                0x27eef9c535ac8eb4,
3388            >(_buf?)?;
3389            Ok(_response)
3390        }
3391        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3392            (),
3393            0x27eef9c535ac8eb4,
3394            fidl::encoding::DynamicFlags::empty(),
3395            _decode,
3396        )
3397    }
3398}
3399
3400pub struct GuestLifecycleEventStream {
3401    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3402}
3403
3404impl std::marker::Unpin for GuestLifecycleEventStream {}
3405
3406impl futures::stream::FusedStream for GuestLifecycleEventStream {
3407    fn is_terminated(&self) -> bool {
3408        self.event_receiver.is_terminated()
3409    }
3410}
3411
3412impl futures::Stream for GuestLifecycleEventStream {
3413    type Item = Result<GuestLifecycleEvent, fidl::Error>;
3414
3415    fn poll_next(
3416        mut self: std::pin::Pin<&mut Self>,
3417        cx: &mut std::task::Context<'_>,
3418    ) -> std::task::Poll<Option<Self::Item>> {
3419        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3420            &mut self.event_receiver,
3421            cx
3422        )?) {
3423            Some(buf) => std::task::Poll::Ready(Some(GuestLifecycleEvent::decode(buf))),
3424            None => std::task::Poll::Ready(None),
3425        }
3426    }
3427}
3428
3429#[derive(Debug)]
3430pub enum GuestLifecycleEvent {}
3431
3432impl GuestLifecycleEvent {
3433    /// Decodes a message buffer as a [`GuestLifecycleEvent`].
3434    fn decode(
3435        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3436    ) -> Result<GuestLifecycleEvent, fidl::Error> {
3437        let (bytes, _handles) = buf.split_mut();
3438        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3439        debug_assert_eq!(tx_header.tx_id, 0);
3440        match tx_header.ordinal {
3441            _ => Err(fidl::Error::UnknownOrdinal {
3442                ordinal: tx_header.ordinal,
3443                protocol_name:
3444                    <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3445            }),
3446        }
3447    }
3448}
3449
3450/// A Stream of incoming requests for fuchsia.virtualization/GuestLifecycle.
3451pub struct GuestLifecycleRequestStream {
3452    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3453    is_terminated: bool,
3454}
3455
3456impl std::marker::Unpin for GuestLifecycleRequestStream {}
3457
3458impl futures::stream::FusedStream for GuestLifecycleRequestStream {
3459    fn is_terminated(&self) -> bool {
3460        self.is_terminated
3461    }
3462}
3463
3464impl fidl::endpoints::RequestStream for GuestLifecycleRequestStream {
3465    type Protocol = GuestLifecycleMarker;
3466    type ControlHandle = GuestLifecycleControlHandle;
3467
3468    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3469        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3470    }
3471
3472    fn control_handle(&self) -> Self::ControlHandle {
3473        GuestLifecycleControlHandle { inner: self.inner.clone() }
3474    }
3475
3476    fn into_inner(
3477        self,
3478    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3479    {
3480        (self.inner, self.is_terminated)
3481    }
3482
3483    fn from_inner(
3484        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3485        is_terminated: bool,
3486    ) -> Self {
3487        Self { inner, is_terminated }
3488    }
3489}
3490
3491impl futures::Stream for GuestLifecycleRequestStream {
3492    type Item = Result<GuestLifecycleRequest, fidl::Error>;
3493
3494    fn poll_next(
3495        mut self: std::pin::Pin<&mut Self>,
3496        cx: &mut std::task::Context<'_>,
3497    ) -> std::task::Poll<Option<Self::Item>> {
3498        let this = &mut *self;
3499        if this.inner.check_shutdown(cx) {
3500            this.is_terminated = true;
3501            return std::task::Poll::Ready(None);
3502        }
3503        if this.is_terminated {
3504            panic!("polled GuestLifecycleRequestStream after completion");
3505        }
3506        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3507            |bytes, handles| {
3508                match this.inner.channel().read_etc(cx, bytes, handles) {
3509                    std::task::Poll::Ready(Ok(())) => {}
3510                    std::task::Poll::Pending => return std::task::Poll::Pending,
3511                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3512                        this.is_terminated = true;
3513                        return std::task::Poll::Ready(None);
3514                    }
3515                    std::task::Poll::Ready(Err(e)) => {
3516                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3517                            e.into(),
3518                        ))))
3519                    }
3520                }
3521
3522                // A message has been received from the channel
3523                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3524
3525                std::task::Poll::Ready(Some(match header.ordinal {
3526                    0x152719eed416ed41 => {
3527                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3528                        let mut req = fidl::new_empty!(
3529                            GuestLifecycleCreateRequest,
3530                            fidl::encoding::DefaultFuchsiaResourceDialect
3531                        );
3532                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleCreateRequest>(&header, _body_bytes, handles, &mut req)?;
3533                        let control_handle =
3534                            GuestLifecycleControlHandle { inner: this.inner.clone() };
3535                        Ok(GuestLifecycleRequest::Create {
3536                            guest_config: req.guest_config,
3537
3538                            responder: GuestLifecycleCreateResponder {
3539                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3540                                tx_id: header.tx_id,
3541                            },
3542                        })
3543                    }
3544                    0x57dd3e245f9598ed => {
3545                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3546                        let mut req = fidl::new_empty!(
3547                            GuestLifecycleBindRequest,
3548                            fidl::encoding::DefaultFuchsiaResourceDialect
3549                        );
3550                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleBindRequest>(&header, _body_bytes, handles, &mut req)?;
3551                        let control_handle =
3552                            GuestLifecycleControlHandle { inner: this.inner.clone() };
3553                        Ok(GuestLifecycleRequest::Bind { guest: req.guest, control_handle })
3554                    }
3555                    0x2907fef2ac775657 => {
3556                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3557                        let mut req = fidl::new_empty!(
3558                            fidl::encoding::EmptyPayload,
3559                            fidl::encoding::DefaultFuchsiaResourceDialect
3560                        );
3561                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3562                        let control_handle =
3563                            GuestLifecycleControlHandle { inner: this.inner.clone() };
3564                        Ok(GuestLifecycleRequest::Run {
3565                            responder: GuestLifecycleRunResponder {
3566                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3567                                tx_id: header.tx_id,
3568                            },
3569                        })
3570                    }
3571                    0x27eef9c535ac8eb4 => {
3572                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3573                        let mut req = fidl::new_empty!(
3574                            fidl::encoding::EmptyPayload,
3575                            fidl::encoding::DefaultFuchsiaResourceDialect
3576                        );
3577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3578                        let control_handle =
3579                            GuestLifecycleControlHandle { inner: this.inner.clone() };
3580                        Ok(GuestLifecycleRequest::Stop {
3581                            responder: GuestLifecycleStopResponder {
3582                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3583                                tx_id: header.tx_id,
3584                            },
3585                        })
3586                    }
3587                    _ => Err(fidl::Error::UnknownOrdinal {
3588                        ordinal: header.ordinal,
3589                        protocol_name:
3590                            <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3591                    }),
3592                }))
3593            },
3594        )
3595    }
3596}
3597
3598/// The guest control plane allowing for creating, starting, and stopping the guest.
3599#[derive(Debug)]
3600pub enum GuestLifecycleRequest {
3601    /// Create a VMM configured with the provided config. This instantiates all devices and loads
3602    /// the kernel without starting the VCPU or device dispatch loops.
3603    ///
3604    /// Possible errors:
3605    ///     - ALREADY_RUNNING: A VMM instance is already running, and must be stopped before being
3606    ///         recreated.
3607    ///
3608    /// All other errors are related to VMM initialization.
3609    Create { guest_config: GuestConfig, responder: GuestLifecycleCreateResponder },
3610    /// Binds to the Guest protocol for an initialized guest.
3611    ///
3612    /// This operation must be called between `Create` and `Stop`, otherwise the provided channel
3613    /// will be immediately closed.
3614    Bind {
3615        guest: fidl::endpoints::ServerEnd<GuestMarker>,
3616        control_handle: GuestLifecycleControlHandle,
3617    },
3618    /// Start the primary VCPU and any dispatch loop. This will not return until the VMM stops
3619    /// running. On a clean shutdown (either guest or client initiated) this will return success.
3620    ///
3621    /// Possible errors:
3622    ///     - ALREADY_RUNING: The VMM has already been started.
3623    ///     - NOT_CREATED: Run was called before the VMM was created.
3624    ///     - CONTROLLER_FORCED_HALT: Stop was called on a running VMM.
3625    ///     - VCPU_START_FAILURE: Failed to start the primary VCPU.
3626    ///     - VCPU_RUNTIME_FAILURE: A VCPU encountered a fatal error while running the guest.
3627    Run { responder: GuestLifecycleRunResponder },
3628    /// Stop a running VMM. Returns once the dispatch loops have stopped. After Stop returns,
3629    /// Create and then Run can be called again.
3630    Stop { responder: GuestLifecycleStopResponder },
3631}
3632
3633impl GuestLifecycleRequest {
3634    #[allow(irrefutable_let_patterns)]
3635    pub fn into_create(self) -> Option<(GuestConfig, GuestLifecycleCreateResponder)> {
3636        if let GuestLifecycleRequest::Create { guest_config, responder } = self {
3637            Some((guest_config, responder))
3638        } else {
3639            None
3640        }
3641    }
3642
3643    #[allow(irrefutable_let_patterns)]
3644    pub fn into_bind(
3645        self,
3646    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestLifecycleControlHandle)> {
3647        if let GuestLifecycleRequest::Bind { guest, control_handle } = self {
3648            Some((guest, control_handle))
3649        } else {
3650            None
3651        }
3652    }
3653
3654    #[allow(irrefutable_let_patterns)]
3655    pub fn into_run(self) -> Option<(GuestLifecycleRunResponder)> {
3656        if let GuestLifecycleRequest::Run { responder } = self {
3657            Some((responder))
3658        } else {
3659            None
3660        }
3661    }
3662
3663    #[allow(irrefutable_let_patterns)]
3664    pub fn into_stop(self) -> Option<(GuestLifecycleStopResponder)> {
3665        if let GuestLifecycleRequest::Stop { responder } = self {
3666            Some((responder))
3667        } else {
3668            None
3669        }
3670    }
3671
3672    /// Name of the method defined in FIDL
3673    pub fn method_name(&self) -> &'static str {
3674        match *self {
3675            GuestLifecycleRequest::Create { .. } => "create",
3676            GuestLifecycleRequest::Bind { .. } => "bind",
3677            GuestLifecycleRequest::Run { .. } => "run",
3678            GuestLifecycleRequest::Stop { .. } => "stop",
3679        }
3680    }
3681}
3682
3683#[derive(Debug, Clone)]
3684pub struct GuestLifecycleControlHandle {
3685    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3686}
3687
3688impl fidl::endpoints::ControlHandle for GuestLifecycleControlHandle {
3689    fn shutdown(&self) {
3690        self.inner.shutdown()
3691    }
3692    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3693        self.inner.shutdown_with_epitaph(status)
3694    }
3695
3696    fn is_closed(&self) -> bool {
3697        self.inner.channel().is_closed()
3698    }
3699    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3700        self.inner.channel().on_closed()
3701    }
3702
3703    #[cfg(target_os = "fuchsia")]
3704    fn signal_peer(
3705        &self,
3706        clear_mask: zx::Signals,
3707        set_mask: zx::Signals,
3708    ) -> Result<(), zx_status::Status> {
3709        use fidl::Peered;
3710        self.inner.channel().signal_peer(clear_mask, set_mask)
3711    }
3712}
3713
3714impl GuestLifecycleControlHandle {}
3715
3716#[must_use = "FIDL methods require a response to be sent"]
3717#[derive(Debug)]
3718pub struct GuestLifecycleCreateResponder {
3719    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
3720    tx_id: u32,
3721}
3722
3723/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
3724/// if the responder is dropped without sending a response, so that the client
3725/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3726impl std::ops::Drop for GuestLifecycleCreateResponder {
3727    fn drop(&mut self) {
3728        self.control_handle.shutdown();
3729        // Safety: drops once, never accessed again
3730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3731    }
3732}
3733
3734impl fidl::endpoints::Responder for GuestLifecycleCreateResponder {
3735    type ControlHandle = GuestLifecycleControlHandle;
3736
3737    fn control_handle(&self) -> &GuestLifecycleControlHandle {
3738        &self.control_handle
3739    }
3740
3741    fn drop_without_shutdown(mut self) {
3742        // Safety: drops once, never accessed again due to mem::forget
3743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3744        // Prevent Drop from running (which would shut down the channel)
3745        std::mem::forget(self);
3746    }
3747}
3748
3749impl GuestLifecycleCreateResponder {
3750    /// Sends a response to the FIDL transaction.
3751    ///
3752    /// Sets the channel to shutdown if an error occurs.
3753    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3754        let _result = self.send_raw(result);
3755        if _result.is_err() {
3756            self.control_handle.shutdown();
3757        }
3758        self.drop_without_shutdown();
3759        _result
3760    }
3761
3762    /// Similar to "send" but does not shutdown the channel if an error occurs.
3763    pub fn send_no_shutdown_on_err(
3764        self,
3765        mut result: Result<(), GuestError>,
3766    ) -> Result<(), fidl::Error> {
3767        let _result = self.send_raw(result);
3768        self.drop_without_shutdown();
3769        _result
3770    }
3771
3772    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3773        self.control_handle
3774            .inner
3775            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3776                result,
3777                self.tx_id,
3778                0x152719eed416ed41,
3779                fidl::encoding::DynamicFlags::empty(),
3780            )
3781    }
3782}
3783
3784#[must_use = "FIDL methods require a response to be sent"]
3785#[derive(Debug)]
3786pub struct GuestLifecycleRunResponder {
3787    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
3788    tx_id: u32,
3789}
3790
3791/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
3792/// if the responder is dropped without sending a response, so that the client
3793/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3794impl std::ops::Drop for GuestLifecycleRunResponder {
3795    fn drop(&mut self) {
3796        self.control_handle.shutdown();
3797        // Safety: drops once, never accessed again
3798        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3799    }
3800}
3801
3802impl fidl::endpoints::Responder for GuestLifecycleRunResponder {
3803    type ControlHandle = GuestLifecycleControlHandle;
3804
3805    fn control_handle(&self) -> &GuestLifecycleControlHandle {
3806        &self.control_handle
3807    }
3808
3809    fn drop_without_shutdown(mut self) {
3810        // Safety: drops once, never accessed again due to mem::forget
3811        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3812        // Prevent Drop from running (which would shut down the channel)
3813        std::mem::forget(self);
3814    }
3815}
3816
3817impl GuestLifecycleRunResponder {
3818    /// Sends a response to the FIDL transaction.
3819    ///
3820    /// Sets the channel to shutdown if an error occurs.
3821    pub fn send(self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3822        let _result = self.send_raw(result);
3823        if _result.is_err() {
3824            self.control_handle.shutdown();
3825        }
3826        self.drop_without_shutdown();
3827        _result
3828    }
3829
3830    /// Similar to "send" but does not shutdown the channel if an error occurs.
3831    pub fn send_no_shutdown_on_err(
3832        self,
3833        mut result: Result<(), GuestError>,
3834    ) -> Result<(), fidl::Error> {
3835        let _result = self.send_raw(result);
3836        self.drop_without_shutdown();
3837        _result
3838    }
3839
3840    fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
3841        self.control_handle
3842            .inner
3843            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
3844                result,
3845                self.tx_id,
3846                0x2907fef2ac775657,
3847                fidl::encoding::DynamicFlags::empty(),
3848            )
3849    }
3850}
3851
3852#[must_use = "FIDL methods require a response to be sent"]
3853#[derive(Debug)]
3854pub struct GuestLifecycleStopResponder {
3855    control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
3856    tx_id: u32,
3857}
3858
3859/// Set the the channel to be shutdown (see [`GuestLifecycleControlHandle::shutdown`])
3860/// if the responder is dropped without sending a response, so that the client
3861/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3862impl std::ops::Drop for GuestLifecycleStopResponder {
3863    fn drop(&mut self) {
3864        self.control_handle.shutdown();
3865        // Safety: drops once, never accessed again
3866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3867    }
3868}
3869
3870impl fidl::endpoints::Responder for GuestLifecycleStopResponder {
3871    type ControlHandle = GuestLifecycleControlHandle;
3872
3873    fn control_handle(&self) -> &GuestLifecycleControlHandle {
3874        &self.control_handle
3875    }
3876
3877    fn drop_without_shutdown(mut self) {
3878        // Safety: drops once, never accessed again due to mem::forget
3879        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3880        // Prevent Drop from running (which would shut down the channel)
3881        std::mem::forget(self);
3882    }
3883}
3884
3885impl GuestLifecycleStopResponder {
3886    /// Sends a response to the FIDL transaction.
3887    ///
3888    /// Sets the channel to shutdown if an error occurs.
3889    pub fn send(self) -> Result<(), fidl::Error> {
3890        let _result = self.send_raw();
3891        if _result.is_err() {
3892            self.control_handle.shutdown();
3893        }
3894        self.drop_without_shutdown();
3895        _result
3896    }
3897
3898    /// Similar to "send" but does not shutdown the channel if an error occurs.
3899    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3900        let _result = self.send_raw();
3901        self.drop_without_shutdown();
3902        _result
3903    }
3904
3905    fn send_raw(&self) -> Result<(), fidl::Error> {
3906        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3907            (),
3908            self.tx_id,
3909            0x27eef9c535ac8eb4,
3910            fidl::encoding::DynamicFlags::empty(),
3911        )
3912    }
3913}
3914
3915#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3916pub struct GuestManagerMarker;
3917
3918impl fidl::endpoints::ProtocolMarker for GuestManagerMarker {
3919    type Proxy = GuestManagerProxy;
3920    type RequestStream = GuestManagerRequestStream;
3921    #[cfg(target_os = "fuchsia")]
3922    type SynchronousProxy = GuestManagerSynchronousProxy;
3923
3924    const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestManager";
3925}
3926impl fidl::endpoints::DiscoverableProtocolMarker for GuestManagerMarker {}
3927pub type GuestManagerLaunchResult = Result<(), GuestManagerError>;
3928pub type GuestManagerConnectResult = Result<(), GuestManagerError>;
3929
3930pub trait GuestManagerProxyInterface: Send + Sync {
3931    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
3932        + Send;
3933    fn r#launch(
3934        &self,
3935        guest_config: GuestConfig,
3936        controller: fidl::endpoints::ServerEnd<GuestMarker>,
3937    ) -> Self::LaunchResponseFut;
3938    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3939    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
3940    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
3941        + Send;
3942    fn r#connect(
3943        &self,
3944        controller: fidl::endpoints::ServerEnd<GuestMarker>,
3945    ) -> Self::ConnectResponseFut;
3946    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
3947    fn r#get_info(&self) -> Self::GetInfoResponseFut;
3948}
3949#[derive(Debug)]
3950#[cfg(target_os = "fuchsia")]
3951pub struct GuestManagerSynchronousProxy {
3952    client: fidl::client::sync::Client,
3953}
3954
3955#[cfg(target_os = "fuchsia")]
3956impl fidl::endpoints::SynchronousProxy for GuestManagerSynchronousProxy {
3957    type Proxy = GuestManagerProxy;
3958    type Protocol = GuestManagerMarker;
3959
3960    fn from_channel(inner: fidl::Channel) -> Self {
3961        Self::new(inner)
3962    }
3963
3964    fn into_channel(self) -> fidl::Channel {
3965        self.client.into_channel()
3966    }
3967
3968    fn as_channel(&self) -> &fidl::Channel {
3969        self.client.as_channel()
3970    }
3971}
3972
3973#[cfg(target_os = "fuchsia")]
3974impl GuestManagerSynchronousProxy {
3975    pub fn new(channel: fidl::Channel) -> Self {
3976        let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3977        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3978    }
3979
3980    pub fn into_channel(self) -> fidl::Channel {
3981        self.client.into_channel()
3982    }
3983
3984    /// Waits until an event arrives and returns it. It is safe for other
3985    /// threads to make concurrent requests while waiting for an event.
3986    pub fn wait_for_event(
3987        &self,
3988        deadline: zx::MonotonicInstant,
3989    ) -> Result<GuestManagerEvent, fidl::Error> {
3990        GuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
3991    }
3992
3993    /// Launch a new guest instance.
3994    ///
3995    /// Possible errors:
3996    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
3997    ///         problems detected by the guest manager.
3998    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
3999    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
4000    ///         component logs for a more specific failure.
4001    pub fn r#launch(
4002        &self,
4003        mut guest_config: GuestConfig,
4004        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4005        ___deadline: zx::MonotonicInstant,
4006    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
4007        let _response =
4008            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
4009                fidl::encoding::EmptyStruct,
4010                GuestManagerError,
4011            >>(
4012                (&mut guest_config, controller),
4013                0x394a2e29f750323e,
4014                fidl::encoding::DynamicFlags::empty(),
4015                ___deadline,
4016            )?;
4017        Ok(_response.map(|x| x))
4018    }
4019
4020    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
4021    /// be used to launch another guest.
4022    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4023        let _response =
4024            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4025                (),
4026                0x3ad9a012982f872d,
4027                fidl::encoding::DynamicFlags::empty(),
4028                ___deadline,
4029            )?;
4030        Ok(_response)
4031    }
4032
4033    /// Connect to a currently running guest.
4034    ///
4035    /// Possible errors:
4036    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
4037    ///         has launched before attempting to reconnect.
4038    pub fn r#connect(
4039        &self,
4040        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4041        ___deadline: zx::MonotonicInstant,
4042    ) -> Result<GuestManagerConnectResult, fidl::Error> {
4043        let _response =
4044            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
4045                fidl::encoding::EmptyStruct,
4046                GuestManagerError,
4047            >>(
4048                (controller,),
4049                0x4e489076e3bb15b4,
4050                fidl::encoding::DynamicFlags::empty(),
4051                ___deadline,
4052            )?;
4053        Ok(_response.map(|x| x))
4054    }
4055
4056    /// Query guest info
4057    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
4058        let _response =
4059            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
4060                (),
4061                0x76892614aea695dc,
4062                fidl::encoding::DynamicFlags::empty(),
4063                ___deadline,
4064            )?;
4065        Ok(_response.guest_info)
4066    }
4067}
4068
4069#[cfg(target_os = "fuchsia")]
4070impl From<GuestManagerSynchronousProxy> for zx::Handle {
4071    fn from(value: GuestManagerSynchronousProxy) -> Self {
4072        value.into_channel().into()
4073    }
4074}
4075
4076#[cfg(target_os = "fuchsia")]
4077impl From<fidl::Channel> for GuestManagerSynchronousProxy {
4078    fn from(value: fidl::Channel) -> Self {
4079        Self::new(value)
4080    }
4081}
4082
4083#[cfg(target_os = "fuchsia")]
4084impl fidl::endpoints::FromClient for GuestManagerSynchronousProxy {
4085    type Protocol = GuestManagerMarker;
4086
4087    fn from_client(value: fidl::endpoints::ClientEnd<GuestManagerMarker>) -> Self {
4088        Self::new(value.into_channel())
4089    }
4090}
4091
4092#[derive(Debug, Clone)]
4093pub struct GuestManagerProxy {
4094    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4095}
4096
4097impl fidl::endpoints::Proxy for GuestManagerProxy {
4098    type Protocol = GuestManagerMarker;
4099
4100    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4101        Self::new(inner)
4102    }
4103
4104    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4105        self.client.into_channel().map_err(|client| Self { client })
4106    }
4107
4108    fn as_channel(&self) -> &::fidl::AsyncChannel {
4109        self.client.as_channel()
4110    }
4111}
4112
4113impl GuestManagerProxy {
4114    /// Create a new Proxy for fuchsia.virtualization/GuestManager.
4115    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4116        let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4117        Self { client: fidl::client::Client::new(channel, protocol_name) }
4118    }
4119
4120    /// Get a Stream of events from the remote end of the protocol.
4121    ///
4122    /// # Panics
4123    ///
4124    /// Panics if the event stream was already taken.
4125    pub fn take_event_stream(&self) -> GuestManagerEventStream {
4126        GuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
4127    }
4128
4129    /// Launch a new guest instance.
4130    ///
4131    /// Possible errors:
4132    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
4133    ///         problems detected by the guest manager.
4134    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
4135    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
4136    ///         component logs for a more specific failure.
4137    pub fn r#launch(
4138        &self,
4139        mut guest_config: GuestConfig,
4140        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4141    ) -> fidl::client::QueryResponseFut<
4142        GuestManagerLaunchResult,
4143        fidl::encoding::DefaultFuchsiaResourceDialect,
4144    > {
4145        GuestManagerProxyInterface::r#launch(self, guest_config, controller)
4146    }
4147
4148    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
4149    /// be used to launch another guest.
4150    pub fn r#force_shutdown(
4151        &self,
4152    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4153        GuestManagerProxyInterface::r#force_shutdown(self)
4154    }
4155
4156    /// Connect to a currently running guest.
4157    ///
4158    /// Possible errors:
4159    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
4160    ///         has launched before attempting to reconnect.
4161    pub fn r#connect(
4162        &self,
4163        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4164    ) -> fidl::client::QueryResponseFut<
4165        GuestManagerConnectResult,
4166        fidl::encoding::DefaultFuchsiaResourceDialect,
4167    > {
4168        GuestManagerProxyInterface::r#connect(self, controller)
4169    }
4170
4171    /// Query guest info
4172    pub fn r#get_info(
4173        &self,
4174    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
4175    {
4176        GuestManagerProxyInterface::r#get_info(self)
4177    }
4178}
4179
4180impl GuestManagerProxyInterface for GuestManagerProxy {
4181    type LaunchResponseFut = fidl::client::QueryResponseFut<
4182        GuestManagerLaunchResult,
4183        fidl::encoding::DefaultFuchsiaResourceDialect,
4184    >;
4185    fn r#launch(
4186        &self,
4187        mut guest_config: GuestConfig,
4188        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4189    ) -> Self::LaunchResponseFut {
4190        fn _decode(
4191            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4192        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
4193            let _response = fidl::client::decode_transaction_body::<
4194                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
4195                fidl::encoding::DefaultFuchsiaResourceDialect,
4196                0x394a2e29f750323e,
4197            >(_buf?)?;
4198            Ok(_response.map(|x| x))
4199        }
4200        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
4201            (&mut guest_config, controller),
4202            0x394a2e29f750323e,
4203            fidl::encoding::DynamicFlags::empty(),
4204            _decode,
4205        )
4206    }
4207
4208    type ForceShutdownResponseFut =
4209        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4210    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
4211        fn _decode(
4212            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4213        ) -> Result<(), fidl::Error> {
4214            let _response = fidl::client::decode_transaction_body::<
4215                fidl::encoding::EmptyPayload,
4216                fidl::encoding::DefaultFuchsiaResourceDialect,
4217                0x3ad9a012982f872d,
4218            >(_buf?)?;
4219            Ok(_response)
4220        }
4221        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4222            (),
4223            0x3ad9a012982f872d,
4224            fidl::encoding::DynamicFlags::empty(),
4225            _decode,
4226        )
4227    }
4228
4229    type ConnectResponseFut = fidl::client::QueryResponseFut<
4230        GuestManagerConnectResult,
4231        fidl::encoding::DefaultFuchsiaResourceDialect,
4232    >;
4233    fn r#connect(
4234        &self,
4235        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
4236    ) -> Self::ConnectResponseFut {
4237        fn _decode(
4238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4239        ) -> Result<GuestManagerConnectResult, fidl::Error> {
4240            let _response = fidl::client::decode_transaction_body::<
4241                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
4242                fidl::encoding::DefaultFuchsiaResourceDialect,
4243                0x4e489076e3bb15b4,
4244            >(_buf?)?;
4245            Ok(_response.map(|x| x))
4246        }
4247        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
4248            (controller,),
4249            0x4e489076e3bb15b4,
4250            fidl::encoding::DynamicFlags::empty(),
4251            _decode,
4252        )
4253    }
4254
4255    type GetInfoResponseFut =
4256        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
4257    fn r#get_info(&self) -> Self::GetInfoResponseFut {
4258        fn _decode(
4259            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4260        ) -> Result<GuestInfo, fidl::Error> {
4261            let _response = fidl::client::decode_transaction_body::<
4262                GuestManagerGetInfoResponse,
4263                fidl::encoding::DefaultFuchsiaResourceDialect,
4264                0x76892614aea695dc,
4265            >(_buf?)?;
4266            Ok(_response.guest_info)
4267        }
4268        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
4269            (),
4270            0x76892614aea695dc,
4271            fidl::encoding::DynamicFlags::empty(),
4272            _decode,
4273        )
4274    }
4275}
4276
4277pub struct GuestManagerEventStream {
4278    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4279}
4280
4281impl std::marker::Unpin for GuestManagerEventStream {}
4282
4283impl futures::stream::FusedStream for GuestManagerEventStream {
4284    fn is_terminated(&self) -> bool {
4285        self.event_receiver.is_terminated()
4286    }
4287}
4288
4289impl futures::Stream for GuestManagerEventStream {
4290    type Item = Result<GuestManagerEvent, fidl::Error>;
4291
4292    fn poll_next(
4293        mut self: std::pin::Pin<&mut Self>,
4294        cx: &mut std::task::Context<'_>,
4295    ) -> std::task::Poll<Option<Self::Item>> {
4296        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4297            &mut self.event_receiver,
4298            cx
4299        )?) {
4300            Some(buf) => std::task::Poll::Ready(Some(GuestManagerEvent::decode(buf))),
4301            None => std::task::Poll::Ready(None),
4302        }
4303    }
4304}
4305
4306#[derive(Debug)]
4307pub enum GuestManagerEvent {}
4308
4309impl GuestManagerEvent {
4310    /// Decodes a message buffer as a [`GuestManagerEvent`].
4311    fn decode(
4312        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4313    ) -> Result<GuestManagerEvent, fidl::Error> {
4314        let (bytes, _handles) = buf.split_mut();
4315        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4316        debug_assert_eq!(tx_header.tx_id, 0);
4317        match tx_header.ordinal {
4318            _ => Err(fidl::Error::UnknownOrdinal {
4319                ordinal: tx_header.ordinal,
4320                protocol_name: <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4321            }),
4322        }
4323    }
4324}
4325
4326/// A Stream of incoming requests for fuchsia.virtualization/GuestManager.
4327pub struct GuestManagerRequestStream {
4328    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4329    is_terminated: bool,
4330}
4331
4332impl std::marker::Unpin for GuestManagerRequestStream {}
4333
4334impl futures::stream::FusedStream for GuestManagerRequestStream {
4335    fn is_terminated(&self) -> bool {
4336        self.is_terminated
4337    }
4338}
4339
4340impl fidl::endpoints::RequestStream for GuestManagerRequestStream {
4341    type Protocol = GuestManagerMarker;
4342    type ControlHandle = GuestManagerControlHandle;
4343
4344    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4345        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4346    }
4347
4348    fn control_handle(&self) -> Self::ControlHandle {
4349        GuestManagerControlHandle { inner: self.inner.clone() }
4350    }
4351
4352    fn into_inner(
4353        self,
4354    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4355    {
4356        (self.inner, self.is_terminated)
4357    }
4358
4359    fn from_inner(
4360        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4361        is_terminated: bool,
4362    ) -> Self {
4363        Self { inner, is_terminated }
4364    }
4365}
4366
4367impl futures::Stream for GuestManagerRequestStream {
4368    type Item = Result<GuestManagerRequest, fidl::Error>;
4369
4370    fn poll_next(
4371        mut self: std::pin::Pin<&mut Self>,
4372        cx: &mut std::task::Context<'_>,
4373    ) -> std::task::Poll<Option<Self::Item>> {
4374        let this = &mut *self;
4375        if this.inner.check_shutdown(cx) {
4376            this.is_terminated = true;
4377            return std::task::Poll::Ready(None);
4378        }
4379        if this.is_terminated {
4380            panic!("polled GuestManagerRequestStream after completion");
4381        }
4382        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4383            |bytes, handles| {
4384                match this.inner.channel().read_etc(cx, bytes, handles) {
4385                    std::task::Poll::Ready(Ok(())) => {}
4386                    std::task::Poll::Pending => return std::task::Poll::Pending,
4387                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4388                        this.is_terminated = true;
4389                        return std::task::Poll::Ready(None);
4390                    }
4391                    std::task::Poll::Ready(Err(e)) => {
4392                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4393                            e.into(),
4394                        ))))
4395                    }
4396                }
4397
4398                // A message has been received from the channel
4399                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4400
4401                std::task::Poll::Ready(Some(match header.ordinal {
4402                    0x394a2e29f750323e => {
4403                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4404                        let mut req = fidl::new_empty!(
4405                            GuestManagerLaunchRequest,
4406                            fidl::encoding::DefaultFuchsiaResourceDialect
4407                        );
4408                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
4409                        let control_handle =
4410                            GuestManagerControlHandle { inner: this.inner.clone() };
4411                        Ok(GuestManagerRequest::Launch {
4412                            guest_config: req.guest_config,
4413                            controller: req.controller,
4414
4415                            responder: GuestManagerLaunchResponder {
4416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4417                                tx_id: header.tx_id,
4418                            },
4419                        })
4420                    }
4421                    0x3ad9a012982f872d => {
4422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4423                        let mut req = fidl::new_empty!(
4424                            fidl::encoding::EmptyPayload,
4425                            fidl::encoding::DefaultFuchsiaResourceDialect
4426                        );
4427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4428                        let control_handle =
4429                            GuestManagerControlHandle { inner: this.inner.clone() };
4430                        Ok(GuestManagerRequest::ForceShutdown {
4431                            responder: GuestManagerForceShutdownResponder {
4432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4433                                tx_id: header.tx_id,
4434                            },
4435                        })
4436                    }
4437                    0x4e489076e3bb15b4 => {
4438                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4439                        let mut req = fidl::new_empty!(
4440                            GuestManagerConnectRequest,
4441                            fidl::encoding::DefaultFuchsiaResourceDialect
4442                        );
4443                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4444                        let control_handle =
4445                            GuestManagerControlHandle { inner: this.inner.clone() };
4446                        Ok(GuestManagerRequest::Connect {
4447                            controller: req.controller,
4448
4449                            responder: GuestManagerConnectResponder {
4450                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4451                                tx_id: header.tx_id,
4452                            },
4453                        })
4454                    }
4455                    0x76892614aea695dc => {
4456                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4457                        let mut req = fidl::new_empty!(
4458                            fidl::encoding::EmptyPayload,
4459                            fidl::encoding::DefaultFuchsiaResourceDialect
4460                        );
4461                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4462                        let control_handle =
4463                            GuestManagerControlHandle { inner: this.inner.clone() };
4464                        Ok(GuestManagerRequest::GetInfo {
4465                            responder: GuestManagerGetInfoResponder {
4466                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4467                                tx_id: header.tx_id,
4468                            },
4469                        })
4470                    }
4471                    _ => Err(fidl::Error::UnknownOrdinal {
4472                        ordinal: header.ordinal,
4473                        protocol_name:
4474                            <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4475                    }),
4476                }))
4477            },
4478        )
4479    }
4480}
4481
4482#[derive(Debug)]
4483pub enum GuestManagerRequest {
4484    /// Launch a new guest instance.
4485    ///
4486    /// Possible errors:
4487    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
4488    ///         problems detected by the guest manager.
4489    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
4490    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
4491    ///         component logs for a more specific failure.
4492    Launch {
4493        guest_config: GuestConfig,
4494        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4495        responder: GuestManagerLaunchResponder,
4496    },
4497    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
4498    /// be used to launch another guest.
4499    ForceShutdown { responder: GuestManagerForceShutdownResponder },
4500    /// Connect to a currently running guest.
4501    ///
4502    /// Possible errors:
4503    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
4504    ///         has launched before attempting to reconnect.
4505    Connect {
4506        controller: fidl::endpoints::ServerEnd<GuestMarker>,
4507        responder: GuestManagerConnectResponder,
4508    },
4509    /// Query guest info
4510    GetInfo { responder: GuestManagerGetInfoResponder },
4511}
4512
4513impl GuestManagerRequest {
4514    #[allow(irrefutable_let_patterns)]
4515    pub fn into_launch(
4516        self,
4517    ) -> Option<(GuestConfig, fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerLaunchResponder)>
4518    {
4519        if let GuestManagerRequest::Launch { guest_config, controller, responder } = self {
4520            Some((guest_config, controller, responder))
4521        } else {
4522            None
4523        }
4524    }
4525
4526    #[allow(irrefutable_let_patterns)]
4527    pub fn into_force_shutdown(self) -> Option<(GuestManagerForceShutdownResponder)> {
4528        if let GuestManagerRequest::ForceShutdown { responder } = self {
4529            Some((responder))
4530        } else {
4531            None
4532        }
4533    }
4534
4535    #[allow(irrefutable_let_patterns)]
4536    pub fn into_connect(
4537        self,
4538    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerConnectResponder)> {
4539        if let GuestManagerRequest::Connect { controller, responder } = self {
4540            Some((controller, responder))
4541        } else {
4542            None
4543        }
4544    }
4545
4546    #[allow(irrefutable_let_patterns)]
4547    pub fn into_get_info(self) -> Option<(GuestManagerGetInfoResponder)> {
4548        if let GuestManagerRequest::GetInfo { responder } = self {
4549            Some((responder))
4550        } else {
4551            None
4552        }
4553    }
4554
4555    /// Name of the method defined in FIDL
4556    pub fn method_name(&self) -> &'static str {
4557        match *self {
4558            GuestManagerRequest::Launch { .. } => "launch",
4559            GuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
4560            GuestManagerRequest::Connect { .. } => "connect",
4561            GuestManagerRequest::GetInfo { .. } => "get_info",
4562        }
4563    }
4564}
4565
4566#[derive(Debug, Clone)]
4567pub struct GuestManagerControlHandle {
4568    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4569}
4570
4571impl fidl::endpoints::ControlHandle for GuestManagerControlHandle {
4572    fn shutdown(&self) {
4573        self.inner.shutdown()
4574    }
4575    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4576        self.inner.shutdown_with_epitaph(status)
4577    }
4578
4579    fn is_closed(&self) -> bool {
4580        self.inner.channel().is_closed()
4581    }
4582    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4583        self.inner.channel().on_closed()
4584    }
4585
4586    #[cfg(target_os = "fuchsia")]
4587    fn signal_peer(
4588        &self,
4589        clear_mask: zx::Signals,
4590        set_mask: zx::Signals,
4591    ) -> Result<(), zx_status::Status> {
4592        use fidl::Peered;
4593        self.inner.channel().signal_peer(clear_mask, set_mask)
4594    }
4595}
4596
4597impl GuestManagerControlHandle {}
4598
4599#[must_use = "FIDL methods require a response to be sent"]
4600#[derive(Debug)]
4601pub struct GuestManagerLaunchResponder {
4602    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
4603    tx_id: u32,
4604}
4605
4606/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
4607/// if the responder is dropped without sending a response, so that the client
4608/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4609impl std::ops::Drop for GuestManagerLaunchResponder {
4610    fn drop(&mut self) {
4611        self.control_handle.shutdown();
4612        // Safety: drops once, never accessed again
4613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4614    }
4615}
4616
4617impl fidl::endpoints::Responder for GuestManagerLaunchResponder {
4618    type ControlHandle = GuestManagerControlHandle;
4619
4620    fn control_handle(&self) -> &GuestManagerControlHandle {
4621        &self.control_handle
4622    }
4623
4624    fn drop_without_shutdown(mut self) {
4625        // Safety: drops once, never accessed again due to mem::forget
4626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4627        // Prevent Drop from running (which would shut down the channel)
4628        std::mem::forget(self);
4629    }
4630}
4631
4632impl GuestManagerLaunchResponder {
4633    /// Sends a response to the FIDL transaction.
4634    ///
4635    /// Sets the channel to shutdown if an error occurs.
4636    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
4637        let _result = self.send_raw(result);
4638        if _result.is_err() {
4639            self.control_handle.shutdown();
4640        }
4641        self.drop_without_shutdown();
4642        _result
4643    }
4644
4645    /// Similar to "send" but does not shutdown the channel if an error occurs.
4646    pub fn send_no_shutdown_on_err(
4647        self,
4648        mut result: Result<(), GuestManagerError>,
4649    ) -> Result<(), fidl::Error> {
4650        let _result = self.send_raw(result);
4651        self.drop_without_shutdown();
4652        _result
4653    }
4654
4655    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
4656        self.control_handle.inner.send::<fidl::encoding::ResultType<
4657            fidl::encoding::EmptyStruct,
4658            GuestManagerError,
4659        >>(
4660            result,
4661            self.tx_id,
4662            0x394a2e29f750323e,
4663            fidl::encoding::DynamicFlags::empty(),
4664        )
4665    }
4666}
4667
4668#[must_use = "FIDL methods require a response to be sent"]
4669#[derive(Debug)]
4670pub struct GuestManagerForceShutdownResponder {
4671    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
4672    tx_id: u32,
4673}
4674
4675/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
4676/// if the responder is dropped without sending a response, so that the client
4677/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4678impl std::ops::Drop for GuestManagerForceShutdownResponder {
4679    fn drop(&mut self) {
4680        self.control_handle.shutdown();
4681        // Safety: drops once, never accessed again
4682        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4683    }
4684}
4685
4686impl fidl::endpoints::Responder for GuestManagerForceShutdownResponder {
4687    type ControlHandle = GuestManagerControlHandle;
4688
4689    fn control_handle(&self) -> &GuestManagerControlHandle {
4690        &self.control_handle
4691    }
4692
4693    fn drop_without_shutdown(mut self) {
4694        // Safety: drops once, never accessed again due to mem::forget
4695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4696        // Prevent Drop from running (which would shut down the channel)
4697        std::mem::forget(self);
4698    }
4699}
4700
4701impl GuestManagerForceShutdownResponder {
4702    /// Sends a response to the FIDL transaction.
4703    ///
4704    /// Sets the channel to shutdown if an error occurs.
4705    pub fn send(self) -> Result<(), fidl::Error> {
4706        let _result = self.send_raw();
4707        if _result.is_err() {
4708            self.control_handle.shutdown();
4709        }
4710        self.drop_without_shutdown();
4711        _result
4712    }
4713
4714    /// Similar to "send" but does not shutdown the channel if an error occurs.
4715    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4716        let _result = self.send_raw();
4717        self.drop_without_shutdown();
4718        _result
4719    }
4720
4721    fn send_raw(&self) -> Result<(), fidl::Error> {
4722        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4723            (),
4724            self.tx_id,
4725            0x3ad9a012982f872d,
4726            fidl::encoding::DynamicFlags::empty(),
4727        )
4728    }
4729}
4730
4731#[must_use = "FIDL methods require a response to be sent"]
4732#[derive(Debug)]
4733pub struct GuestManagerConnectResponder {
4734    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
4735    tx_id: u32,
4736}
4737
4738/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
4739/// if the responder is dropped without sending a response, so that the client
4740/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4741impl std::ops::Drop for GuestManagerConnectResponder {
4742    fn drop(&mut self) {
4743        self.control_handle.shutdown();
4744        // Safety: drops once, never accessed again
4745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4746    }
4747}
4748
4749impl fidl::endpoints::Responder for GuestManagerConnectResponder {
4750    type ControlHandle = GuestManagerControlHandle;
4751
4752    fn control_handle(&self) -> &GuestManagerControlHandle {
4753        &self.control_handle
4754    }
4755
4756    fn drop_without_shutdown(mut self) {
4757        // Safety: drops once, never accessed again due to mem::forget
4758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4759        // Prevent Drop from running (which would shut down the channel)
4760        std::mem::forget(self);
4761    }
4762}
4763
4764impl GuestManagerConnectResponder {
4765    /// Sends a response to the FIDL transaction.
4766    ///
4767    /// Sets the channel to shutdown if an error occurs.
4768    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
4769        let _result = self.send_raw(result);
4770        if _result.is_err() {
4771            self.control_handle.shutdown();
4772        }
4773        self.drop_without_shutdown();
4774        _result
4775    }
4776
4777    /// Similar to "send" but does not shutdown the channel if an error occurs.
4778    pub fn send_no_shutdown_on_err(
4779        self,
4780        mut result: Result<(), GuestManagerError>,
4781    ) -> Result<(), fidl::Error> {
4782        let _result = self.send_raw(result);
4783        self.drop_without_shutdown();
4784        _result
4785    }
4786
4787    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
4788        self.control_handle.inner.send::<fidl::encoding::ResultType<
4789            fidl::encoding::EmptyStruct,
4790            GuestManagerError,
4791        >>(
4792            result,
4793            self.tx_id,
4794            0x4e489076e3bb15b4,
4795            fidl::encoding::DynamicFlags::empty(),
4796        )
4797    }
4798}
4799
4800#[must_use = "FIDL methods require a response to be sent"]
4801#[derive(Debug)]
4802pub struct GuestManagerGetInfoResponder {
4803    control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
4804    tx_id: u32,
4805}
4806
4807/// Set the the channel to be shutdown (see [`GuestManagerControlHandle::shutdown`])
4808/// if the responder is dropped without sending a response, so that the client
4809/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4810impl std::ops::Drop for GuestManagerGetInfoResponder {
4811    fn drop(&mut self) {
4812        self.control_handle.shutdown();
4813        // Safety: drops once, never accessed again
4814        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4815    }
4816}
4817
4818impl fidl::endpoints::Responder for GuestManagerGetInfoResponder {
4819    type ControlHandle = GuestManagerControlHandle;
4820
4821    fn control_handle(&self) -> &GuestManagerControlHandle {
4822        &self.control_handle
4823    }
4824
4825    fn drop_without_shutdown(mut self) {
4826        // Safety: drops once, never accessed again due to mem::forget
4827        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4828        // Prevent Drop from running (which would shut down the channel)
4829        std::mem::forget(self);
4830    }
4831}
4832
4833impl GuestManagerGetInfoResponder {
4834    /// Sends a response to the FIDL transaction.
4835    ///
4836    /// Sets the channel to shutdown if an error occurs.
4837    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
4838        let _result = self.send_raw(guest_info);
4839        if _result.is_err() {
4840            self.control_handle.shutdown();
4841        }
4842        self.drop_without_shutdown();
4843        _result
4844    }
4845
4846    /// Similar to "send" but does not shutdown the channel if an error occurs.
4847    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
4848        let _result = self.send_raw(guest_info);
4849        self.drop_without_shutdown();
4850        _result
4851    }
4852
4853    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
4854        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
4855            (guest_info,),
4856            self.tx_id,
4857            0x76892614aea695dc,
4858            fidl::encoding::DynamicFlags::empty(),
4859        )
4860    }
4861}
4862
4863#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4864pub struct HostVsockAcceptorMarker;
4865
4866impl fidl::endpoints::ProtocolMarker for HostVsockAcceptorMarker {
4867    type Proxy = HostVsockAcceptorProxy;
4868    type RequestStream = HostVsockAcceptorRequestStream;
4869    #[cfg(target_os = "fuchsia")]
4870    type SynchronousProxy = HostVsockAcceptorSynchronousProxy;
4871
4872    const DEBUG_NAME: &'static str = "(anonymous) HostVsockAcceptor";
4873}
4874pub type HostVsockAcceptorAcceptResult = Result<fidl::Socket, i32>;
4875
4876pub trait HostVsockAcceptorProxyInterface: Send + Sync {
4877    type AcceptResponseFut: std::future::Future<Output = Result<HostVsockAcceptorAcceptResult, fidl::Error>>
4878        + Send;
4879    fn r#accept(&self, src_cid: u32, src_port: u32, port: u32) -> Self::AcceptResponseFut;
4880}
4881#[derive(Debug)]
4882#[cfg(target_os = "fuchsia")]
4883pub struct HostVsockAcceptorSynchronousProxy {
4884    client: fidl::client::sync::Client,
4885}
4886
4887#[cfg(target_os = "fuchsia")]
4888impl fidl::endpoints::SynchronousProxy for HostVsockAcceptorSynchronousProxy {
4889    type Proxy = HostVsockAcceptorProxy;
4890    type Protocol = HostVsockAcceptorMarker;
4891
4892    fn from_channel(inner: fidl::Channel) -> Self {
4893        Self::new(inner)
4894    }
4895
4896    fn into_channel(self) -> fidl::Channel {
4897        self.client.into_channel()
4898    }
4899
4900    fn as_channel(&self) -> &fidl::Channel {
4901        self.client.as_channel()
4902    }
4903}
4904
4905#[cfg(target_os = "fuchsia")]
4906impl HostVsockAcceptorSynchronousProxy {
4907    pub fn new(channel: fidl::Channel) -> Self {
4908        let protocol_name =
4909            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4910        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4911    }
4912
4913    pub fn into_channel(self) -> fidl::Channel {
4914        self.client.into_channel()
4915    }
4916
4917    /// Waits until an event arrives and returns it. It is safe for other
4918    /// threads to make concurrent requests while waiting for an event.
4919    pub fn wait_for_event(
4920        &self,
4921        deadline: zx::MonotonicInstant,
4922    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
4923        HostVsockAcceptorEvent::decode(self.client.wait_for_event(deadline)?)
4924    }
4925
4926    pub fn r#accept(
4927        &self,
4928        mut src_cid: u32,
4929        mut src_port: u32,
4930        mut port: u32,
4931        ___deadline: zx::MonotonicInstant,
4932    ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
4933        let _response = self.client.send_query::<
4934            HostVsockAcceptorAcceptRequest,
4935            fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
4936        >(
4937            (src_cid, src_port, port,),
4938            0x6996ed935beaa2d7,
4939            fidl::encoding::DynamicFlags::empty(),
4940            ___deadline,
4941        )?;
4942        Ok(_response.map(|x| x.socket))
4943    }
4944}
4945
4946#[cfg(target_os = "fuchsia")]
4947impl From<HostVsockAcceptorSynchronousProxy> for zx::Handle {
4948    fn from(value: HostVsockAcceptorSynchronousProxy) -> Self {
4949        value.into_channel().into()
4950    }
4951}
4952
4953#[cfg(target_os = "fuchsia")]
4954impl From<fidl::Channel> for HostVsockAcceptorSynchronousProxy {
4955    fn from(value: fidl::Channel) -> Self {
4956        Self::new(value)
4957    }
4958}
4959
4960#[cfg(target_os = "fuchsia")]
4961impl fidl::endpoints::FromClient for HostVsockAcceptorSynchronousProxy {
4962    type Protocol = HostVsockAcceptorMarker;
4963
4964    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>) -> Self {
4965        Self::new(value.into_channel())
4966    }
4967}
4968
4969#[derive(Debug, Clone)]
4970pub struct HostVsockAcceptorProxy {
4971    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4972}
4973
4974impl fidl::endpoints::Proxy for HostVsockAcceptorProxy {
4975    type Protocol = HostVsockAcceptorMarker;
4976
4977    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4978        Self::new(inner)
4979    }
4980
4981    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4982        self.client.into_channel().map_err(|client| Self { client })
4983    }
4984
4985    fn as_channel(&self) -> &::fidl::AsyncChannel {
4986        self.client.as_channel()
4987    }
4988}
4989
4990impl HostVsockAcceptorProxy {
4991    /// Create a new Proxy for fuchsia.virtualization/HostVsockAcceptor.
4992    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4993        let protocol_name =
4994            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4995        Self { client: fidl::client::Client::new(channel, protocol_name) }
4996    }
4997
4998    /// Get a Stream of events from the remote end of the protocol.
4999    ///
5000    /// # Panics
5001    ///
5002    /// Panics if the event stream was already taken.
5003    pub fn take_event_stream(&self) -> HostVsockAcceptorEventStream {
5004        HostVsockAcceptorEventStream { event_receiver: self.client.take_event_receiver() }
5005    }
5006
5007    pub fn r#accept(
5008        &self,
5009        mut src_cid: u32,
5010        mut src_port: u32,
5011        mut port: u32,
5012    ) -> fidl::client::QueryResponseFut<
5013        HostVsockAcceptorAcceptResult,
5014        fidl::encoding::DefaultFuchsiaResourceDialect,
5015    > {
5016        HostVsockAcceptorProxyInterface::r#accept(self, src_cid, src_port, port)
5017    }
5018}
5019
5020impl HostVsockAcceptorProxyInterface for HostVsockAcceptorProxy {
5021    type AcceptResponseFut = fidl::client::QueryResponseFut<
5022        HostVsockAcceptorAcceptResult,
5023        fidl::encoding::DefaultFuchsiaResourceDialect,
5024    >;
5025    fn r#accept(
5026        &self,
5027        mut src_cid: u32,
5028        mut src_port: u32,
5029        mut port: u32,
5030    ) -> Self::AcceptResponseFut {
5031        fn _decode(
5032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5033        ) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
5034            let _response = fidl::client::decode_transaction_body::<
5035                fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
5036                fidl::encoding::DefaultFuchsiaResourceDialect,
5037                0x6996ed935beaa2d7,
5038            >(_buf?)?;
5039            Ok(_response.map(|x| x.socket))
5040        }
5041        self.client
5042            .send_query_and_decode::<HostVsockAcceptorAcceptRequest, HostVsockAcceptorAcceptResult>(
5043                (src_cid, src_port, port),
5044                0x6996ed935beaa2d7,
5045                fidl::encoding::DynamicFlags::empty(),
5046                _decode,
5047            )
5048    }
5049}
5050
5051pub struct HostVsockAcceptorEventStream {
5052    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5053}
5054
5055impl std::marker::Unpin for HostVsockAcceptorEventStream {}
5056
5057impl futures::stream::FusedStream for HostVsockAcceptorEventStream {
5058    fn is_terminated(&self) -> bool {
5059        self.event_receiver.is_terminated()
5060    }
5061}
5062
5063impl futures::Stream for HostVsockAcceptorEventStream {
5064    type Item = Result<HostVsockAcceptorEvent, fidl::Error>;
5065
5066    fn poll_next(
5067        mut self: std::pin::Pin<&mut Self>,
5068        cx: &mut std::task::Context<'_>,
5069    ) -> std::task::Poll<Option<Self::Item>> {
5070        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5071            &mut self.event_receiver,
5072            cx
5073        )?) {
5074            Some(buf) => std::task::Poll::Ready(Some(HostVsockAcceptorEvent::decode(buf))),
5075            None => std::task::Poll::Ready(None),
5076        }
5077    }
5078}
5079
5080#[derive(Debug)]
5081pub enum HostVsockAcceptorEvent {}
5082
5083impl HostVsockAcceptorEvent {
5084    /// Decodes a message buffer as a [`HostVsockAcceptorEvent`].
5085    fn decode(
5086        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5087    ) -> Result<HostVsockAcceptorEvent, fidl::Error> {
5088        let (bytes, _handles) = buf.split_mut();
5089        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5090        debug_assert_eq!(tx_header.tx_id, 0);
5091        match tx_header.ordinal {
5092            _ => Err(fidl::Error::UnknownOrdinal {
5093                ordinal: tx_header.ordinal,
5094                protocol_name:
5095                    <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5096            }),
5097        }
5098    }
5099}
5100
5101/// A Stream of incoming requests for fuchsia.virtualization/HostVsockAcceptor.
5102pub struct HostVsockAcceptorRequestStream {
5103    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5104    is_terminated: bool,
5105}
5106
5107impl std::marker::Unpin for HostVsockAcceptorRequestStream {}
5108
5109impl futures::stream::FusedStream for HostVsockAcceptorRequestStream {
5110    fn is_terminated(&self) -> bool {
5111        self.is_terminated
5112    }
5113}
5114
5115impl fidl::endpoints::RequestStream for HostVsockAcceptorRequestStream {
5116    type Protocol = HostVsockAcceptorMarker;
5117    type ControlHandle = HostVsockAcceptorControlHandle;
5118
5119    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5120        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5121    }
5122
5123    fn control_handle(&self) -> Self::ControlHandle {
5124        HostVsockAcceptorControlHandle { inner: self.inner.clone() }
5125    }
5126
5127    fn into_inner(
5128        self,
5129    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5130    {
5131        (self.inner, self.is_terminated)
5132    }
5133
5134    fn from_inner(
5135        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5136        is_terminated: bool,
5137    ) -> Self {
5138        Self { inner, is_terminated }
5139    }
5140}
5141
5142impl futures::Stream for HostVsockAcceptorRequestStream {
5143    type Item = Result<HostVsockAcceptorRequest, fidl::Error>;
5144
5145    fn poll_next(
5146        mut self: std::pin::Pin<&mut Self>,
5147        cx: &mut std::task::Context<'_>,
5148    ) -> std::task::Poll<Option<Self::Item>> {
5149        let this = &mut *self;
5150        if this.inner.check_shutdown(cx) {
5151            this.is_terminated = true;
5152            return std::task::Poll::Ready(None);
5153        }
5154        if this.is_terminated {
5155            panic!("polled HostVsockAcceptorRequestStream after completion");
5156        }
5157        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5158            |bytes, handles| {
5159                match this.inner.channel().read_etc(cx, bytes, handles) {
5160                    std::task::Poll::Ready(Ok(())) => {}
5161                    std::task::Poll::Pending => return std::task::Poll::Pending,
5162                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5163                        this.is_terminated = true;
5164                        return std::task::Poll::Ready(None);
5165                    }
5166                    std::task::Poll::Ready(Err(e)) => {
5167                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5168                            e.into(),
5169                        ))))
5170                    }
5171                }
5172
5173                // A message has been received from the channel
5174                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5175
5176                std::task::Poll::Ready(Some(match header.ordinal {
5177                    0x6996ed935beaa2d7 => {
5178                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5179                        let mut req = fidl::new_empty!(
5180                            HostVsockAcceptorAcceptRequest,
5181                            fidl::encoding::DefaultFuchsiaResourceDialect
5182                        );
5183                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockAcceptorAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
5184                        let control_handle =
5185                            HostVsockAcceptorControlHandle { inner: this.inner.clone() };
5186                        Ok(HostVsockAcceptorRequest::Accept {
5187                            src_cid: req.src_cid,
5188                            src_port: req.src_port,
5189                            port: req.port,
5190
5191                            responder: HostVsockAcceptorAcceptResponder {
5192                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5193                                tx_id: header.tx_id,
5194                            },
5195                        })
5196                    }
5197                    _ => Err(fidl::Error::UnknownOrdinal {
5198                        ordinal: header.ordinal,
5199                        protocol_name:
5200                            <HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5201                    }),
5202                }))
5203            },
5204        )
5205    }
5206}
5207
5208/// Exposed by a host capable of listening via vsocks. A variant of a
5209/// `GuestVsockAcceptor` that is responsible for creating the `socket` with which
5210/// to communicate.
5211#[derive(Debug)]
5212pub enum HostVsockAcceptorRequest {
5213    Accept { src_cid: u32, src_port: u32, port: u32, responder: HostVsockAcceptorAcceptResponder },
5214}
5215
5216impl HostVsockAcceptorRequest {
5217    #[allow(irrefutable_let_patterns)]
5218    pub fn into_accept(self) -> Option<(u32, u32, u32, HostVsockAcceptorAcceptResponder)> {
5219        if let HostVsockAcceptorRequest::Accept { src_cid, src_port, port, responder } = self {
5220            Some((src_cid, src_port, port, responder))
5221        } else {
5222            None
5223        }
5224    }
5225
5226    /// Name of the method defined in FIDL
5227    pub fn method_name(&self) -> &'static str {
5228        match *self {
5229            HostVsockAcceptorRequest::Accept { .. } => "accept",
5230        }
5231    }
5232}
5233
5234#[derive(Debug, Clone)]
5235pub struct HostVsockAcceptorControlHandle {
5236    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5237}
5238
5239impl fidl::endpoints::ControlHandle for HostVsockAcceptorControlHandle {
5240    fn shutdown(&self) {
5241        self.inner.shutdown()
5242    }
5243    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5244        self.inner.shutdown_with_epitaph(status)
5245    }
5246
5247    fn is_closed(&self) -> bool {
5248        self.inner.channel().is_closed()
5249    }
5250    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5251        self.inner.channel().on_closed()
5252    }
5253
5254    #[cfg(target_os = "fuchsia")]
5255    fn signal_peer(
5256        &self,
5257        clear_mask: zx::Signals,
5258        set_mask: zx::Signals,
5259    ) -> Result<(), zx_status::Status> {
5260        use fidl::Peered;
5261        self.inner.channel().signal_peer(clear_mask, set_mask)
5262    }
5263}
5264
5265impl HostVsockAcceptorControlHandle {}
5266
5267#[must_use = "FIDL methods require a response to be sent"]
5268#[derive(Debug)]
5269pub struct HostVsockAcceptorAcceptResponder {
5270    control_handle: std::mem::ManuallyDrop<HostVsockAcceptorControlHandle>,
5271    tx_id: u32,
5272}
5273
5274/// Set the the channel to be shutdown (see [`HostVsockAcceptorControlHandle::shutdown`])
5275/// if the responder is dropped without sending a response, so that the client
5276/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5277impl std::ops::Drop for HostVsockAcceptorAcceptResponder {
5278    fn drop(&mut self) {
5279        self.control_handle.shutdown();
5280        // Safety: drops once, never accessed again
5281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5282    }
5283}
5284
5285impl fidl::endpoints::Responder for HostVsockAcceptorAcceptResponder {
5286    type ControlHandle = HostVsockAcceptorControlHandle;
5287
5288    fn control_handle(&self) -> &HostVsockAcceptorControlHandle {
5289        &self.control_handle
5290    }
5291
5292    fn drop_without_shutdown(mut self) {
5293        // Safety: drops once, never accessed again due to mem::forget
5294        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5295        // Prevent Drop from running (which would shut down the channel)
5296        std::mem::forget(self);
5297    }
5298}
5299
5300impl HostVsockAcceptorAcceptResponder {
5301    /// Sends a response to the FIDL transaction.
5302    ///
5303    /// Sets the channel to shutdown if an error occurs.
5304    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
5305        let _result = self.send_raw(result);
5306        if _result.is_err() {
5307            self.control_handle.shutdown();
5308        }
5309        self.drop_without_shutdown();
5310        _result
5311    }
5312
5313    /// Similar to "send" but does not shutdown the channel if an error occurs.
5314    pub fn send_no_shutdown_on_err(
5315        self,
5316        mut result: Result<fidl::Socket, i32>,
5317    ) -> Result<(), fidl::Error> {
5318        let _result = self.send_raw(result);
5319        self.drop_without_shutdown();
5320        _result
5321    }
5322
5323    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
5324        self.control_handle
5325            .inner
5326            .send::<fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>>(
5327                result.map(|socket| (socket,)),
5328                self.tx_id,
5329                0x6996ed935beaa2d7,
5330                fidl::encoding::DynamicFlags::empty(),
5331            )
5332    }
5333}
5334
5335#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5336pub struct HostVsockEndpointMarker;
5337
5338impl fidl::endpoints::ProtocolMarker for HostVsockEndpointMarker {
5339    type Proxy = HostVsockEndpointProxy;
5340    type RequestStream = HostVsockEndpointRequestStream;
5341    #[cfg(target_os = "fuchsia")]
5342    type SynchronousProxy = HostVsockEndpointSynchronousProxy;
5343
5344    const DEBUG_NAME: &'static str = "fuchsia.virtualization.HostVsockEndpoint";
5345}
5346impl fidl::endpoints::DiscoverableProtocolMarker for HostVsockEndpointMarker {}
5347pub type HostVsockEndpointListenResult = Result<(), i32>;
5348pub type HostVsockEndpointConnectResult = Result<fidl::Socket, i32>;
5349
5350pub trait HostVsockEndpointProxyInterface: Send + Sync {
5351    type ListenResponseFut: std::future::Future<Output = Result<HostVsockEndpointListenResult, fidl::Error>>
5352        + Send;
5353    fn r#listen(
5354        &self,
5355        port: u32,
5356        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5357    ) -> Self::ListenResponseFut;
5358    type ConnectResponseFut: std::future::Future<Output = Result<HostVsockEndpointConnectResult, fidl::Error>>
5359        + Send;
5360    fn r#connect(&self, guest_port: u32) -> Self::ConnectResponseFut;
5361}
5362#[derive(Debug)]
5363#[cfg(target_os = "fuchsia")]
5364pub struct HostVsockEndpointSynchronousProxy {
5365    client: fidl::client::sync::Client,
5366}
5367
5368#[cfg(target_os = "fuchsia")]
5369impl fidl::endpoints::SynchronousProxy for HostVsockEndpointSynchronousProxy {
5370    type Proxy = HostVsockEndpointProxy;
5371    type Protocol = HostVsockEndpointMarker;
5372
5373    fn from_channel(inner: fidl::Channel) -> Self {
5374        Self::new(inner)
5375    }
5376
5377    fn into_channel(self) -> fidl::Channel {
5378        self.client.into_channel()
5379    }
5380
5381    fn as_channel(&self) -> &fidl::Channel {
5382        self.client.as_channel()
5383    }
5384}
5385
5386#[cfg(target_os = "fuchsia")]
5387impl HostVsockEndpointSynchronousProxy {
5388    pub fn new(channel: fidl::Channel) -> Self {
5389        let protocol_name =
5390            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5391        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5392    }
5393
5394    pub fn into_channel(self) -> fidl::Channel {
5395        self.client.into_channel()
5396    }
5397
5398    /// Waits until an event arrives and returns it. It is safe for other
5399    /// threads to make concurrent requests while waiting for an event.
5400    pub fn wait_for_event(
5401        &self,
5402        deadline: zx::MonotonicInstant,
5403    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
5404        HostVsockEndpointEvent::decode(self.client.wait_for_event(deadline)?)
5405    }
5406
5407    /// Instructs the device to listen for guest initiated connections to a given port by
5408    /// using `acceptor` when the guest creates a connection.
5409    ///
5410    /// Possible errors:
5411    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
5412    pub fn r#listen(
5413        &self,
5414        mut port: u32,
5415        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5416        ___deadline: zx::MonotonicInstant,
5417    ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
5418        let _response = self
5419            .client
5420            .send_query::<Listener, fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5421                (port, acceptor),
5422                0xfd88f3b4767f2c7,
5423                fidl::encoding::DynamicFlags::empty(),
5424                ___deadline,
5425            )?;
5426        Ok(_response.map(|x| x))
5427    }
5428
5429    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
5430    /// ephemeral host port.
5431    ///
5432    /// Possible errors:
5433    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
5434    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
5435    ///
5436    /// Other errors are related to socket creation, see
5437    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
5438    pub fn r#connect(
5439        &self,
5440        mut guest_port: u32,
5441        ___deadline: zx::MonotonicInstant,
5442    ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
5443        let _response = self.client.send_query::<
5444            HostVsockEndpointConnectRequest,
5445            fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
5446        >(
5447            (guest_port,),
5448            0x4d12e10e946b43e4,
5449            fidl::encoding::DynamicFlags::empty(),
5450            ___deadline,
5451        )?;
5452        Ok(_response.map(|x| x.socket))
5453    }
5454}
5455
5456#[cfg(target_os = "fuchsia")]
5457impl From<HostVsockEndpointSynchronousProxy> for zx::Handle {
5458    fn from(value: HostVsockEndpointSynchronousProxy) -> Self {
5459        value.into_channel().into()
5460    }
5461}
5462
5463#[cfg(target_os = "fuchsia")]
5464impl From<fidl::Channel> for HostVsockEndpointSynchronousProxy {
5465    fn from(value: fidl::Channel) -> Self {
5466        Self::new(value)
5467    }
5468}
5469
5470#[cfg(target_os = "fuchsia")]
5471impl fidl::endpoints::FromClient for HostVsockEndpointSynchronousProxy {
5472    type Protocol = HostVsockEndpointMarker;
5473
5474    fn from_client(value: fidl::endpoints::ClientEnd<HostVsockEndpointMarker>) -> Self {
5475        Self::new(value.into_channel())
5476    }
5477}
5478
5479#[derive(Debug, Clone)]
5480pub struct HostVsockEndpointProxy {
5481    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5482}
5483
5484impl fidl::endpoints::Proxy for HostVsockEndpointProxy {
5485    type Protocol = HostVsockEndpointMarker;
5486
5487    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5488        Self::new(inner)
5489    }
5490
5491    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5492        self.client.into_channel().map_err(|client| Self { client })
5493    }
5494
5495    fn as_channel(&self) -> &::fidl::AsyncChannel {
5496        self.client.as_channel()
5497    }
5498}
5499
5500impl HostVsockEndpointProxy {
5501    /// Create a new Proxy for fuchsia.virtualization/HostVsockEndpoint.
5502    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5503        let protocol_name =
5504            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5505        Self { client: fidl::client::Client::new(channel, protocol_name) }
5506    }
5507
5508    /// Get a Stream of events from the remote end of the protocol.
5509    ///
5510    /// # Panics
5511    ///
5512    /// Panics if the event stream was already taken.
5513    pub fn take_event_stream(&self) -> HostVsockEndpointEventStream {
5514        HostVsockEndpointEventStream { event_receiver: self.client.take_event_receiver() }
5515    }
5516
5517    /// Instructs the device to listen for guest initiated connections to a given port by
5518    /// using `acceptor` when the guest creates a connection.
5519    ///
5520    /// Possible errors:
5521    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
5522    pub fn r#listen(
5523        &self,
5524        mut port: u32,
5525        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5526    ) -> fidl::client::QueryResponseFut<
5527        HostVsockEndpointListenResult,
5528        fidl::encoding::DefaultFuchsiaResourceDialect,
5529    > {
5530        HostVsockEndpointProxyInterface::r#listen(self, port, acceptor)
5531    }
5532
5533    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
5534    /// ephemeral host port.
5535    ///
5536    /// Possible errors:
5537    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
5538    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
5539    ///
5540    /// Other errors are related to socket creation, see
5541    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
5542    pub fn r#connect(
5543        &self,
5544        mut guest_port: u32,
5545    ) -> fidl::client::QueryResponseFut<
5546        HostVsockEndpointConnectResult,
5547        fidl::encoding::DefaultFuchsiaResourceDialect,
5548    > {
5549        HostVsockEndpointProxyInterface::r#connect(self, guest_port)
5550    }
5551}
5552
5553impl HostVsockEndpointProxyInterface for HostVsockEndpointProxy {
5554    type ListenResponseFut = fidl::client::QueryResponseFut<
5555        HostVsockEndpointListenResult,
5556        fidl::encoding::DefaultFuchsiaResourceDialect,
5557    >;
5558    fn r#listen(
5559        &self,
5560        mut port: u32,
5561        mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5562    ) -> Self::ListenResponseFut {
5563        fn _decode(
5564            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5565        ) -> Result<HostVsockEndpointListenResult, fidl::Error> {
5566            let _response = fidl::client::decode_transaction_body::<
5567                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5568                fidl::encoding::DefaultFuchsiaResourceDialect,
5569                0xfd88f3b4767f2c7,
5570            >(_buf?)?;
5571            Ok(_response.map(|x| x))
5572        }
5573        self.client.send_query_and_decode::<Listener, HostVsockEndpointListenResult>(
5574            (port, acceptor),
5575            0xfd88f3b4767f2c7,
5576            fidl::encoding::DynamicFlags::empty(),
5577            _decode,
5578        )
5579    }
5580
5581    type ConnectResponseFut = fidl::client::QueryResponseFut<
5582        HostVsockEndpointConnectResult,
5583        fidl::encoding::DefaultFuchsiaResourceDialect,
5584    >;
5585    fn r#connect(&self, mut guest_port: u32) -> Self::ConnectResponseFut {
5586        fn _decode(
5587            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5588        ) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
5589            let _response = fidl::client::decode_transaction_body::<
5590                fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
5591                fidl::encoding::DefaultFuchsiaResourceDialect,
5592                0x4d12e10e946b43e4,
5593            >(_buf?)?;
5594            Ok(_response.map(|x| x.socket))
5595        }
5596        self.client.send_query_and_decode::<
5597            HostVsockEndpointConnectRequest,
5598            HostVsockEndpointConnectResult,
5599        >(
5600            (guest_port,),
5601            0x4d12e10e946b43e4,
5602            fidl::encoding::DynamicFlags::empty(),
5603            _decode,
5604        )
5605    }
5606}
5607
5608pub struct HostVsockEndpointEventStream {
5609    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5610}
5611
5612impl std::marker::Unpin for HostVsockEndpointEventStream {}
5613
5614impl futures::stream::FusedStream for HostVsockEndpointEventStream {
5615    fn is_terminated(&self) -> bool {
5616        self.event_receiver.is_terminated()
5617    }
5618}
5619
5620impl futures::Stream for HostVsockEndpointEventStream {
5621    type Item = Result<HostVsockEndpointEvent, fidl::Error>;
5622
5623    fn poll_next(
5624        mut self: std::pin::Pin<&mut Self>,
5625        cx: &mut std::task::Context<'_>,
5626    ) -> std::task::Poll<Option<Self::Item>> {
5627        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5628            &mut self.event_receiver,
5629            cx
5630        )?) {
5631            Some(buf) => std::task::Poll::Ready(Some(HostVsockEndpointEvent::decode(buf))),
5632            None => std::task::Poll::Ready(None),
5633        }
5634    }
5635}
5636
5637#[derive(Debug)]
5638pub enum HostVsockEndpointEvent {}
5639
5640impl HostVsockEndpointEvent {
5641    /// Decodes a message buffer as a [`HostVsockEndpointEvent`].
5642    fn decode(
5643        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5644    ) -> Result<HostVsockEndpointEvent, fidl::Error> {
5645        let (bytes, _handles) = buf.split_mut();
5646        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5647        debug_assert_eq!(tx_header.tx_id, 0);
5648        match tx_header.ordinal {
5649            _ => Err(fidl::Error::UnknownOrdinal {
5650                ordinal: tx_header.ordinal,
5651                protocol_name:
5652                    <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5653            }),
5654        }
5655    }
5656}
5657
5658/// A Stream of incoming requests for fuchsia.virtualization/HostVsockEndpoint.
5659pub struct HostVsockEndpointRequestStream {
5660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5661    is_terminated: bool,
5662}
5663
5664impl std::marker::Unpin for HostVsockEndpointRequestStream {}
5665
5666impl futures::stream::FusedStream for HostVsockEndpointRequestStream {
5667    fn is_terminated(&self) -> bool {
5668        self.is_terminated
5669    }
5670}
5671
5672impl fidl::endpoints::RequestStream for HostVsockEndpointRequestStream {
5673    type Protocol = HostVsockEndpointMarker;
5674    type ControlHandle = HostVsockEndpointControlHandle;
5675
5676    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5677        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5678    }
5679
5680    fn control_handle(&self) -> Self::ControlHandle {
5681        HostVsockEndpointControlHandle { inner: self.inner.clone() }
5682    }
5683
5684    fn into_inner(
5685        self,
5686    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5687    {
5688        (self.inner, self.is_terminated)
5689    }
5690
5691    fn from_inner(
5692        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5693        is_terminated: bool,
5694    ) -> Self {
5695        Self { inner, is_terminated }
5696    }
5697}
5698
5699impl futures::Stream for HostVsockEndpointRequestStream {
5700    type Item = Result<HostVsockEndpointRequest, fidl::Error>;
5701
5702    fn poll_next(
5703        mut self: std::pin::Pin<&mut Self>,
5704        cx: &mut std::task::Context<'_>,
5705    ) -> std::task::Poll<Option<Self::Item>> {
5706        let this = &mut *self;
5707        if this.inner.check_shutdown(cx) {
5708            this.is_terminated = true;
5709            return std::task::Poll::Ready(None);
5710        }
5711        if this.is_terminated {
5712            panic!("polled HostVsockEndpointRequestStream after completion");
5713        }
5714        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5715            |bytes, handles| {
5716                match this.inner.channel().read_etc(cx, bytes, handles) {
5717                    std::task::Poll::Ready(Ok(())) => {}
5718                    std::task::Poll::Pending => return std::task::Poll::Pending,
5719                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5720                        this.is_terminated = true;
5721                        return std::task::Poll::Ready(None);
5722                    }
5723                    std::task::Poll::Ready(Err(e)) => {
5724                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5725                            e.into(),
5726                        ))))
5727                    }
5728                }
5729
5730                // A message has been received from the channel
5731                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5732
5733                std::task::Poll::Ready(Some(match header.ordinal {
5734                    0xfd88f3b4767f2c7 => {
5735                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5736                        let mut req = fidl::new_empty!(
5737                            Listener,
5738                            fidl::encoding::DefaultFuchsiaResourceDialect
5739                        );
5740                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Listener>(&header, _body_bytes, handles, &mut req)?;
5741                        let control_handle =
5742                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
5743                        Ok(HostVsockEndpointRequest::Listen {
5744                            port: req.port,
5745                            acceptor: req.acceptor,
5746
5747                            responder: HostVsockEndpointListenResponder {
5748                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5749                                tx_id: header.tx_id,
5750                            },
5751                        })
5752                    }
5753                    0x4d12e10e946b43e4 => {
5754                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5755                        let mut req = fidl::new_empty!(
5756                            HostVsockEndpointConnectRequest,
5757                            fidl::encoding::DefaultFuchsiaResourceDialect
5758                        );
5759                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockEndpointConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5760                        let control_handle =
5761                            HostVsockEndpointControlHandle { inner: this.inner.clone() };
5762                        Ok(HostVsockEndpointRequest::Connect {
5763                            guest_port: req.guest_port,
5764
5765                            responder: HostVsockEndpointConnectResponder {
5766                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5767                                tx_id: header.tx_id,
5768                            },
5769                        })
5770                    }
5771                    _ => Err(fidl::Error::UnknownOrdinal {
5772                        ordinal: header.ordinal,
5773                        protocol_name:
5774                            <HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5775                    }),
5776                }))
5777            },
5778        )
5779    }
5780}
5781
5782/// Exposed by a host to provide the ability for listeners to be multiplexed by
5783/// port and to manage dynamic port allocation for outbound connections.
5784#[derive(Debug)]
5785pub enum HostVsockEndpointRequest {
5786    /// Instructs the device to listen for guest initiated connections to a given port by
5787    /// using `acceptor` when the guest creates a connection.
5788    ///
5789    /// Possible errors:
5790    ///     - ZX_ERR_ALREADY_BOUND: A client is already listening on this port.
5791    Listen {
5792        port: u32,
5793        acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5794        responder: HostVsockEndpointListenResponder,
5795    },
5796    /// Attempts to create a vsock connection to a guest on 'guest_port'. Uses a dynamically chosen
5797    /// ephemeral host port.
5798    ///
5799    /// Possible errors:
5800    ///     - ZX_ERR_NO_RESOURCES: The device couldn't allocate an unused host port.
5801    ///     - ZX_ERR_CONNECTION_REFUSED: The guest refused this connection.
5802    ///
5803    /// Other errors are related to socket creation, see
5804    /// [zx_socket_create](https://fuchsia.dev/fuchsia-src/reference/syscalls/socket_create.md)
5805    Connect { guest_port: u32, responder: HostVsockEndpointConnectResponder },
5806}
5807
5808impl HostVsockEndpointRequest {
5809    #[allow(irrefutable_let_patterns)]
5810    pub fn into_listen(
5811        self,
5812    ) -> Option<(
5813        u32,
5814        fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
5815        HostVsockEndpointListenResponder,
5816    )> {
5817        if let HostVsockEndpointRequest::Listen { port, acceptor, responder } = self {
5818            Some((port, acceptor, responder))
5819        } else {
5820            None
5821        }
5822    }
5823
5824    #[allow(irrefutable_let_patterns)]
5825    pub fn into_connect(self) -> Option<(u32, HostVsockEndpointConnectResponder)> {
5826        if let HostVsockEndpointRequest::Connect { guest_port, responder } = self {
5827            Some((guest_port, responder))
5828        } else {
5829            None
5830        }
5831    }
5832
5833    /// Name of the method defined in FIDL
5834    pub fn method_name(&self) -> &'static str {
5835        match *self {
5836            HostVsockEndpointRequest::Listen { .. } => "listen",
5837            HostVsockEndpointRequest::Connect { .. } => "connect",
5838        }
5839    }
5840}
5841
5842#[derive(Debug, Clone)]
5843pub struct HostVsockEndpointControlHandle {
5844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5845}
5846
5847impl fidl::endpoints::ControlHandle for HostVsockEndpointControlHandle {
5848    fn shutdown(&self) {
5849        self.inner.shutdown()
5850    }
5851    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5852        self.inner.shutdown_with_epitaph(status)
5853    }
5854
5855    fn is_closed(&self) -> bool {
5856        self.inner.channel().is_closed()
5857    }
5858    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5859        self.inner.channel().on_closed()
5860    }
5861
5862    #[cfg(target_os = "fuchsia")]
5863    fn signal_peer(
5864        &self,
5865        clear_mask: zx::Signals,
5866        set_mask: zx::Signals,
5867    ) -> Result<(), zx_status::Status> {
5868        use fidl::Peered;
5869        self.inner.channel().signal_peer(clear_mask, set_mask)
5870    }
5871}
5872
5873impl HostVsockEndpointControlHandle {}
5874
5875#[must_use = "FIDL methods require a response to be sent"]
5876#[derive(Debug)]
5877pub struct HostVsockEndpointListenResponder {
5878    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
5879    tx_id: u32,
5880}
5881
5882/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
5883/// if the responder is dropped without sending a response, so that the client
5884/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5885impl std::ops::Drop for HostVsockEndpointListenResponder {
5886    fn drop(&mut self) {
5887        self.control_handle.shutdown();
5888        // Safety: drops once, never accessed again
5889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5890    }
5891}
5892
5893impl fidl::endpoints::Responder for HostVsockEndpointListenResponder {
5894    type ControlHandle = HostVsockEndpointControlHandle;
5895
5896    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
5897        &self.control_handle
5898    }
5899
5900    fn drop_without_shutdown(mut self) {
5901        // Safety: drops once, never accessed again due to mem::forget
5902        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5903        // Prevent Drop from running (which would shut down the channel)
5904        std::mem::forget(self);
5905    }
5906}
5907
5908impl HostVsockEndpointListenResponder {
5909    /// Sends a response to the FIDL transaction.
5910    ///
5911    /// Sets the channel to shutdown if an error occurs.
5912    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5913        let _result = self.send_raw(result);
5914        if _result.is_err() {
5915            self.control_handle.shutdown();
5916        }
5917        self.drop_without_shutdown();
5918        _result
5919    }
5920
5921    /// Similar to "send" but does not shutdown the channel if an error occurs.
5922    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5923        let _result = self.send_raw(result);
5924        self.drop_without_shutdown();
5925        _result
5926    }
5927
5928    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5929        self.control_handle
5930            .inner
5931            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5932                result,
5933                self.tx_id,
5934                0xfd88f3b4767f2c7,
5935                fidl::encoding::DynamicFlags::empty(),
5936            )
5937    }
5938}
5939
5940#[must_use = "FIDL methods require a response to be sent"]
5941#[derive(Debug)]
5942pub struct HostVsockEndpointConnectResponder {
5943    control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
5944    tx_id: u32,
5945}
5946
5947/// Set the the channel to be shutdown (see [`HostVsockEndpointControlHandle::shutdown`])
5948/// if the responder is dropped without sending a response, so that the client
5949/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5950impl std::ops::Drop for HostVsockEndpointConnectResponder {
5951    fn drop(&mut self) {
5952        self.control_handle.shutdown();
5953        // Safety: drops once, never accessed again
5954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5955    }
5956}
5957
5958impl fidl::endpoints::Responder for HostVsockEndpointConnectResponder {
5959    type ControlHandle = HostVsockEndpointControlHandle;
5960
5961    fn control_handle(&self) -> &HostVsockEndpointControlHandle {
5962        &self.control_handle
5963    }
5964
5965    fn drop_without_shutdown(mut self) {
5966        // Safety: drops once, never accessed again due to mem::forget
5967        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5968        // Prevent Drop from running (which would shut down the channel)
5969        std::mem::forget(self);
5970    }
5971}
5972
5973impl HostVsockEndpointConnectResponder {
5974    /// Sends a response to the FIDL transaction.
5975    ///
5976    /// Sets the channel to shutdown if an error occurs.
5977    pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
5978        let _result = self.send_raw(result);
5979        if _result.is_err() {
5980            self.control_handle.shutdown();
5981        }
5982        self.drop_without_shutdown();
5983        _result
5984    }
5985
5986    /// Similar to "send" but does not shutdown the channel if an error occurs.
5987    pub fn send_no_shutdown_on_err(
5988        self,
5989        mut result: Result<fidl::Socket, i32>,
5990    ) -> Result<(), fidl::Error> {
5991        let _result = self.send_raw(result);
5992        self.drop_without_shutdown();
5993        _result
5994    }
5995
5996    fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
5997        self.control_handle
5998            .inner
5999            .send::<fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>>(
6000                result.map(|socket| (socket,)),
6001                self.tx_id,
6002                0x4d12e10e946b43e4,
6003                fidl::encoding::DynamicFlags::empty(),
6004            )
6005    }
6006}
6007
6008#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6009pub struct LinuxManagerMarker;
6010
6011impl fidl::endpoints::ProtocolMarker for LinuxManagerMarker {
6012    type Proxy = LinuxManagerProxy;
6013    type RequestStream = LinuxManagerRequestStream;
6014    #[cfg(target_os = "fuchsia")]
6015    type SynchronousProxy = LinuxManagerSynchronousProxy;
6016
6017    const DEBUG_NAME: &'static str = "fuchsia.virtualization.LinuxManager";
6018}
6019impl fidl::endpoints::DiscoverableProtocolMarker for LinuxManagerMarker {}
6020pub type LinuxManagerStartAndGetLinuxGuestInfoResult = Result<LinuxGuestInfo, i32>;
6021pub type LinuxManagerWipeDataResult = Result<(), i32>;
6022
6023pub trait LinuxManagerProxyInterface: Send + Sync {
6024    type StartAndGetLinuxGuestInfoResponseFut: std::future::Future<
6025            Output = Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error>,
6026        > + Send;
6027    fn r#start_and_get_linux_guest_info(
6028        &self,
6029        label: &str,
6030    ) -> Self::StartAndGetLinuxGuestInfoResponseFut;
6031    type WipeDataResponseFut: std::future::Future<Output = Result<LinuxManagerWipeDataResult, fidl::Error>>
6032        + Send;
6033    fn r#wipe_data(&self) -> Self::WipeDataResponseFut;
6034    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error>;
6035}
6036#[derive(Debug)]
6037#[cfg(target_os = "fuchsia")]
6038pub struct LinuxManagerSynchronousProxy {
6039    client: fidl::client::sync::Client,
6040}
6041
6042#[cfg(target_os = "fuchsia")]
6043impl fidl::endpoints::SynchronousProxy for LinuxManagerSynchronousProxy {
6044    type Proxy = LinuxManagerProxy;
6045    type Protocol = LinuxManagerMarker;
6046
6047    fn from_channel(inner: fidl::Channel) -> Self {
6048        Self::new(inner)
6049    }
6050
6051    fn into_channel(self) -> fidl::Channel {
6052        self.client.into_channel()
6053    }
6054
6055    fn as_channel(&self) -> &fidl::Channel {
6056        self.client.as_channel()
6057    }
6058}
6059
6060#[cfg(target_os = "fuchsia")]
6061impl LinuxManagerSynchronousProxy {
6062    pub fn new(channel: fidl::Channel) -> Self {
6063        let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6064        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6065    }
6066
6067    pub fn into_channel(self) -> fidl::Channel {
6068        self.client.into_channel()
6069    }
6070
6071    /// Waits until an event arrives and returns it. It is safe for other
6072    /// threads to make concurrent requests while waiting for an event.
6073    pub fn wait_for_event(
6074        &self,
6075        deadline: zx::MonotonicInstant,
6076    ) -> Result<LinuxManagerEvent, fidl::Error> {
6077        LinuxManagerEvent::decode(self.client.wait_for_event(deadline)?)
6078    }
6079
6080    /// Get Linux guest environment info.
6081    ///
6082    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
6083    pub fn r#start_and_get_linux_guest_info(
6084        &self,
6085        mut label: &str,
6086        ___deadline: zx::MonotonicInstant,
6087    ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
6088        let _response = self.client.send_query::<
6089            LinuxManagerStartAndGetLinuxGuestInfoRequest,
6090            fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
6091        >(
6092            (label,),
6093            0x11809ced100a2bea,
6094            fidl::encoding::DynamicFlags::empty(),
6095            ___deadline,
6096        )?;
6097        Ok(_response.map(|x| x.info))
6098    }
6099
6100    /// Clears the stateful data. This includes any installed containers and any user data
6101    /// they may contain.
6102    ///
6103    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
6104    /// Returns ZX_ERR_IO if there was an IO failure while performing the
6105    /// operation.
6106    pub fn r#wipe_data(
6107        &self,
6108        ___deadline: zx::MonotonicInstant,
6109    ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
6110        let _response = self.client.send_query::<
6111            fidl::encoding::EmptyPayload,
6112            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6113        >(
6114            (),
6115            0x732c69394548a76a,
6116            fidl::encoding::DynamicFlags::empty(),
6117            ___deadline,
6118        )?;
6119        Ok(_response.map(|x| x))
6120    }
6121
6122    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
6123    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
6124    /// the epitaph) before attempting to launch another guest.
6125    ///
6126    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
6127    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
6128    /// a component crash).
6129    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
6130        self.client.send::<fidl::encoding::EmptyPayload>(
6131            (),
6132            0x5dab12b50bc9909d,
6133            fidl::encoding::DynamicFlags::empty(),
6134        )
6135    }
6136}
6137
6138#[cfg(target_os = "fuchsia")]
6139impl From<LinuxManagerSynchronousProxy> for zx::Handle {
6140    fn from(value: LinuxManagerSynchronousProxy) -> Self {
6141        value.into_channel().into()
6142    }
6143}
6144
6145#[cfg(target_os = "fuchsia")]
6146impl From<fidl::Channel> for LinuxManagerSynchronousProxy {
6147    fn from(value: fidl::Channel) -> Self {
6148        Self::new(value)
6149    }
6150}
6151
6152#[cfg(target_os = "fuchsia")]
6153impl fidl::endpoints::FromClient for LinuxManagerSynchronousProxy {
6154    type Protocol = LinuxManagerMarker;
6155
6156    fn from_client(value: fidl::endpoints::ClientEnd<LinuxManagerMarker>) -> Self {
6157        Self::new(value.into_channel())
6158    }
6159}
6160
6161#[derive(Debug, Clone)]
6162pub struct LinuxManagerProxy {
6163    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6164}
6165
6166impl fidl::endpoints::Proxy for LinuxManagerProxy {
6167    type Protocol = LinuxManagerMarker;
6168
6169    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6170        Self::new(inner)
6171    }
6172
6173    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6174        self.client.into_channel().map_err(|client| Self { client })
6175    }
6176
6177    fn as_channel(&self) -> &::fidl::AsyncChannel {
6178        self.client.as_channel()
6179    }
6180}
6181
6182impl LinuxManagerProxy {
6183    /// Create a new Proxy for fuchsia.virtualization/LinuxManager.
6184    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6185        let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6186        Self { client: fidl::client::Client::new(channel, protocol_name) }
6187    }
6188
6189    /// Get a Stream of events from the remote end of the protocol.
6190    ///
6191    /// # Panics
6192    ///
6193    /// Panics if the event stream was already taken.
6194    pub fn take_event_stream(&self) -> LinuxManagerEventStream {
6195        LinuxManagerEventStream { event_receiver: self.client.take_event_receiver() }
6196    }
6197
6198    /// Get Linux guest environment info.
6199    ///
6200    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
6201    pub fn r#start_and_get_linux_guest_info(
6202        &self,
6203        mut label: &str,
6204    ) -> fidl::client::QueryResponseFut<
6205        LinuxManagerStartAndGetLinuxGuestInfoResult,
6206        fidl::encoding::DefaultFuchsiaResourceDialect,
6207    > {
6208        LinuxManagerProxyInterface::r#start_and_get_linux_guest_info(self, label)
6209    }
6210
6211    /// Clears the stateful data. This includes any installed containers and any user data
6212    /// they may contain.
6213    ///
6214    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
6215    /// Returns ZX_ERR_IO if there was an IO failure while performing the
6216    /// operation.
6217    pub fn r#wipe_data(
6218        &self,
6219    ) -> fidl::client::QueryResponseFut<
6220        LinuxManagerWipeDataResult,
6221        fidl::encoding::DefaultFuchsiaResourceDialect,
6222    > {
6223        LinuxManagerProxyInterface::r#wipe_data(self)
6224    }
6225
6226    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
6227    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
6228    /// the epitaph) before attempting to launch another guest.
6229    ///
6230    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
6231    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
6232    /// a component crash).
6233    pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
6234        LinuxManagerProxyInterface::r#graceful_shutdown(self)
6235    }
6236}
6237
6238impl LinuxManagerProxyInterface for LinuxManagerProxy {
6239    type StartAndGetLinuxGuestInfoResponseFut = fidl::client::QueryResponseFut<
6240        LinuxManagerStartAndGetLinuxGuestInfoResult,
6241        fidl::encoding::DefaultFuchsiaResourceDialect,
6242    >;
6243    fn r#start_and_get_linux_guest_info(
6244        &self,
6245        mut label: &str,
6246    ) -> Self::StartAndGetLinuxGuestInfoResponseFut {
6247        fn _decode(
6248            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6249        ) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
6250            let _response = fidl::client::decode_transaction_body::<
6251                fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
6252                fidl::encoding::DefaultFuchsiaResourceDialect,
6253                0x11809ced100a2bea,
6254            >(_buf?)?;
6255            Ok(_response.map(|x| x.info))
6256        }
6257        self.client.send_query_and_decode::<
6258            LinuxManagerStartAndGetLinuxGuestInfoRequest,
6259            LinuxManagerStartAndGetLinuxGuestInfoResult,
6260        >(
6261            (label,),
6262            0x11809ced100a2bea,
6263            fidl::encoding::DynamicFlags::empty(),
6264            _decode,
6265        )
6266    }
6267
6268    type WipeDataResponseFut = fidl::client::QueryResponseFut<
6269        LinuxManagerWipeDataResult,
6270        fidl::encoding::DefaultFuchsiaResourceDialect,
6271    >;
6272    fn r#wipe_data(&self) -> Self::WipeDataResponseFut {
6273        fn _decode(
6274            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6275        ) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
6276            let _response = fidl::client::decode_transaction_body::<
6277                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6278                fidl::encoding::DefaultFuchsiaResourceDialect,
6279                0x732c69394548a76a,
6280            >(_buf?)?;
6281            Ok(_response.map(|x| x))
6282        }
6283        self.client
6284            .send_query_and_decode::<fidl::encoding::EmptyPayload, LinuxManagerWipeDataResult>(
6285                (),
6286                0x732c69394548a76a,
6287                fidl::encoding::DynamicFlags::empty(),
6288                _decode,
6289            )
6290    }
6291
6292    fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
6293        self.client.send::<fidl::encoding::EmptyPayload>(
6294            (),
6295            0x5dab12b50bc9909d,
6296            fidl::encoding::DynamicFlags::empty(),
6297        )
6298    }
6299}
6300
6301pub struct LinuxManagerEventStream {
6302    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6303}
6304
6305impl std::marker::Unpin for LinuxManagerEventStream {}
6306
6307impl futures::stream::FusedStream for LinuxManagerEventStream {
6308    fn is_terminated(&self) -> bool {
6309        self.event_receiver.is_terminated()
6310    }
6311}
6312
6313impl futures::Stream for LinuxManagerEventStream {
6314    type Item = Result<LinuxManagerEvent, fidl::Error>;
6315
6316    fn poll_next(
6317        mut self: std::pin::Pin<&mut Self>,
6318        cx: &mut std::task::Context<'_>,
6319    ) -> std::task::Poll<Option<Self::Item>> {
6320        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6321            &mut self.event_receiver,
6322            cx
6323        )?) {
6324            Some(buf) => std::task::Poll::Ready(Some(LinuxManagerEvent::decode(buf))),
6325            None => std::task::Poll::Ready(None),
6326        }
6327    }
6328}
6329
6330#[derive(Debug)]
6331pub enum LinuxManagerEvent {
6332    OnGuestInfoChanged { label: String, info: LinuxGuestInfo },
6333}
6334
6335impl LinuxManagerEvent {
6336    #[allow(irrefutable_let_patterns)]
6337    pub fn into_on_guest_info_changed(self) -> Option<(String, LinuxGuestInfo)> {
6338        if let LinuxManagerEvent::OnGuestInfoChanged { label, info } = self {
6339            Some((label, info))
6340        } else {
6341            None
6342        }
6343    }
6344
6345    /// Decodes a message buffer as a [`LinuxManagerEvent`].
6346    fn decode(
6347        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6348    ) -> Result<LinuxManagerEvent, fidl::Error> {
6349        let (bytes, _handles) = buf.split_mut();
6350        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6351        debug_assert_eq!(tx_header.tx_id, 0);
6352        match tx_header.ordinal {
6353            0x30a9be4c43d6a2d6 => {
6354                let mut out = fidl::new_empty!(
6355                    LinuxManagerOnGuestInfoChangedRequest,
6356                    fidl::encoding::DefaultFuchsiaResourceDialect
6357                );
6358                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerOnGuestInfoChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6359                Ok((LinuxManagerEvent::OnGuestInfoChanged { label: out.label, info: out.info }))
6360            }
6361            _ => Err(fidl::Error::UnknownOrdinal {
6362                ordinal: tx_header.ordinal,
6363                protocol_name: <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6364            }),
6365        }
6366    }
6367}
6368
6369/// A Stream of incoming requests for fuchsia.virtualization/LinuxManager.
6370pub struct LinuxManagerRequestStream {
6371    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6372    is_terminated: bool,
6373}
6374
6375impl std::marker::Unpin for LinuxManagerRequestStream {}
6376
6377impl futures::stream::FusedStream for LinuxManagerRequestStream {
6378    fn is_terminated(&self) -> bool {
6379        self.is_terminated
6380    }
6381}
6382
6383impl fidl::endpoints::RequestStream for LinuxManagerRequestStream {
6384    type Protocol = LinuxManagerMarker;
6385    type ControlHandle = LinuxManagerControlHandle;
6386
6387    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6388        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6389    }
6390
6391    fn control_handle(&self) -> Self::ControlHandle {
6392        LinuxManagerControlHandle { inner: self.inner.clone() }
6393    }
6394
6395    fn into_inner(
6396        self,
6397    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6398    {
6399        (self.inner, self.is_terminated)
6400    }
6401
6402    fn from_inner(
6403        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6404        is_terminated: bool,
6405    ) -> Self {
6406        Self { inner, is_terminated }
6407    }
6408}
6409
6410impl futures::Stream for LinuxManagerRequestStream {
6411    type Item = Result<LinuxManagerRequest, fidl::Error>;
6412
6413    fn poll_next(
6414        mut self: std::pin::Pin<&mut Self>,
6415        cx: &mut std::task::Context<'_>,
6416    ) -> std::task::Poll<Option<Self::Item>> {
6417        let this = &mut *self;
6418        if this.inner.check_shutdown(cx) {
6419            this.is_terminated = true;
6420            return std::task::Poll::Ready(None);
6421        }
6422        if this.is_terminated {
6423            panic!("polled LinuxManagerRequestStream after completion");
6424        }
6425        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6426            |bytes, handles| {
6427                match this.inner.channel().read_etc(cx, bytes, handles) {
6428                    std::task::Poll::Ready(Ok(())) => {}
6429                    std::task::Poll::Pending => return std::task::Poll::Pending,
6430                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6431                        this.is_terminated = true;
6432                        return std::task::Poll::Ready(None);
6433                    }
6434                    std::task::Poll::Ready(Err(e)) => {
6435                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6436                            e.into(),
6437                        ))))
6438                    }
6439                }
6440
6441                // A message has been received from the channel
6442                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6443
6444                std::task::Poll::Ready(Some(match header.ordinal {
6445                    0x11809ced100a2bea => {
6446                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6447                        let mut req = fidl::new_empty!(
6448                            LinuxManagerStartAndGetLinuxGuestInfoRequest,
6449                            fidl::encoding::DefaultFuchsiaResourceDialect
6450                        );
6451                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(&header, _body_bytes, handles, &mut req)?;
6452                        let control_handle =
6453                            LinuxManagerControlHandle { inner: this.inner.clone() };
6454                        Ok(LinuxManagerRequest::StartAndGetLinuxGuestInfo {
6455                            label: req.label,
6456
6457                            responder: LinuxManagerStartAndGetLinuxGuestInfoResponder {
6458                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6459                                tx_id: header.tx_id,
6460                            },
6461                        })
6462                    }
6463                    0x732c69394548a76a => {
6464                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6465                        let mut req = fidl::new_empty!(
6466                            fidl::encoding::EmptyPayload,
6467                            fidl::encoding::DefaultFuchsiaResourceDialect
6468                        );
6469                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6470                        let control_handle =
6471                            LinuxManagerControlHandle { inner: this.inner.clone() };
6472                        Ok(LinuxManagerRequest::WipeData {
6473                            responder: LinuxManagerWipeDataResponder {
6474                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6475                                tx_id: header.tx_id,
6476                            },
6477                        })
6478                    }
6479                    0x5dab12b50bc9909d => {
6480                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6481                        let mut req = fidl::new_empty!(
6482                            fidl::encoding::EmptyPayload,
6483                            fidl::encoding::DefaultFuchsiaResourceDialect
6484                        );
6485                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6486                        let control_handle =
6487                            LinuxManagerControlHandle { inner: this.inner.clone() };
6488                        Ok(LinuxManagerRequest::GracefulShutdown { control_handle })
6489                    }
6490                    _ => Err(fidl::Error::UnknownOrdinal {
6491                        ordinal: header.ordinal,
6492                        protocol_name:
6493                            <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6494                    }),
6495                }))
6496            },
6497        )
6498    }
6499}
6500
6501/// A `LinuxManager` provides access to the status of Linux guest instances.
6502#[derive(Debug)]
6503pub enum LinuxManagerRequest {
6504    /// Get Linux guest environment info.
6505    ///
6506    /// Returns ZX_ERR_UNAVAILABLE if the Linux guest is not available.
6507    StartAndGetLinuxGuestInfo {
6508        label: String,
6509        responder: LinuxManagerStartAndGetLinuxGuestInfoResponder,
6510    },
6511    /// Clears the stateful data. This includes any installed containers and any user data
6512    /// they may contain.
6513    ///
6514    /// Returns ZX_ERR_BAD_STATE if this is called while the VM is running.
6515    /// Returns ZX_ERR_IO if there was an IO failure while performing the
6516    /// operation.
6517    WipeData { responder: LinuxManagerWipeDataResponder },
6518    /// Attempts to gracefully shut down a running guest. The caller must ensure that the guest
6519    /// has actually stopped (such as by waiting on a Guest client PEER_CLOSED signal and checking
6520    /// the epitaph) before attempting to launch another guest.
6521    ///
6522    /// On a clean shutdown the Guest client will contain a ZX_OK epitaph, and on an unexpected
6523    /// shutdown the client will contain a ZX_ERR_INTERNAL epitaph (or no epitaph if there was
6524    /// a component crash).
6525    GracefulShutdown { control_handle: LinuxManagerControlHandle },
6526}
6527
6528impl LinuxManagerRequest {
6529    #[allow(irrefutable_let_patterns)]
6530    pub fn into_start_and_get_linux_guest_info(
6531        self,
6532    ) -> Option<(String, LinuxManagerStartAndGetLinuxGuestInfoResponder)> {
6533        if let LinuxManagerRequest::StartAndGetLinuxGuestInfo { label, responder } = self {
6534            Some((label, responder))
6535        } else {
6536            None
6537        }
6538    }
6539
6540    #[allow(irrefutable_let_patterns)]
6541    pub fn into_wipe_data(self) -> Option<(LinuxManagerWipeDataResponder)> {
6542        if let LinuxManagerRequest::WipeData { responder } = self {
6543            Some((responder))
6544        } else {
6545            None
6546        }
6547    }
6548
6549    #[allow(irrefutable_let_patterns)]
6550    pub fn into_graceful_shutdown(self) -> Option<(LinuxManagerControlHandle)> {
6551        if let LinuxManagerRequest::GracefulShutdown { control_handle } = self {
6552            Some((control_handle))
6553        } else {
6554            None
6555        }
6556    }
6557
6558    /// Name of the method defined in FIDL
6559    pub fn method_name(&self) -> &'static str {
6560        match *self {
6561            LinuxManagerRequest::StartAndGetLinuxGuestInfo { .. } => {
6562                "start_and_get_linux_guest_info"
6563            }
6564            LinuxManagerRequest::WipeData { .. } => "wipe_data",
6565            LinuxManagerRequest::GracefulShutdown { .. } => "graceful_shutdown",
6566        }
6567    }
6568}
6569
6570#[derive(Debug, Clone)]
6571pub struct LinuxManagerControlHandle {
6572    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6573}
6574
6575impl fidl::endpoints::ControlHandle for LinuxManagerControlHandle {
6576    fn shutdown(&self) {
6577        self.inner.shutdown()
6578    }
6579    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6580        self.inner.shutdown_with_epitaph(status)
6581    }
6582
6583    fn is_closed(&self) -> bool {
6584        self.inner.channel().is_closed()
6585    }
6586    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6587        self.inner.channel().on_closed()
6588    }
6589
6590    #[cfg(target_os = "fuchsia")]
6591    fn signal_peer(
6592        &self,
6593        clear_mask: zx::Signals,
6594        set_mask: zx::Signals,
6595    ) -> Result<(), zx_status::Status> {
6596        use fidl::Peered;
6597        self.inner.channel().signal_peer(clear_mask, set_mask)
6598    }
6599}
6600
6601impl LinuxManagerControlHandle {
6602    pub fn send_on_guest_info_changed(
6603        &self,
6604        mut label: &str,
6605        mut info: &LinuxGuestInfo,
6606    ) -> Result<(), fidl::Error> {
6607        self.inner.send::<LinuxManagerOnGuestInfoChangedRequest>(
6608            (label, info),
6609            0,
6610            0x30a9be4c43d6a2d6,
6611            fidl::encoding::DynamicFlags::empty(),
6612        )
6613    }
6614}
6615
6616#[must_use = "FIDL methods require a response to be sent"]
6617#[derive(Debug)]
6618pub struct LinuxManagerStartAndGetLinuxGuestInfoResponder {
6619    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
6620    tx_id: u32,
6621}
6622
6623/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
6624/// if the responder is dropped without sending a response, so that the client
6625/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6626impl std::ops::Drop for LinuxManagerStartAndGetLinuxGuestInfoResponder {
6627    fn drop(&mut self) {
6628        self.control_handle.shutdown();
6629        // Safety: drops once, never accessed again
6630        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6631    }
6632}
6633
6634impl fidl::endpoints::Responder for LinuxManagerStartAndGetLinuxGuestInfoResponder {
6635    type ControlHandle = LinuxManagerControlHandle;
6636
6637    fn control_handle(&self) -> &LinuxManagerControlHandle {
6638        &self.control_handle
6639    }
6640
6641    fn drop_without_shutdown(mut self) {
6642        // Safety: drops once, never accessed again due to mem::forget
6643        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6644        // Prevent Drop from running (which would shut down the channel)
6645        std::mem::forget(self);
6646    }
6647}
6648
6649impl LinuxManagerStartAndGetLinuxGuestInfoResponder {
6650    /// Sends a response to the FIDL transaction.
6651    ///
6652    /// Sets the channel to shutdown if an error occurs.
6653    pub fn send(self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
6654        let _result = self.send_raw(result);
6655        if _result.is_err() {
6656            self.control_handle.shutdown();
6657        }
6658        self.drop_without_shutdown();
6659        _result
6660    }
6661
6662    /// Similar to "send" but does not shutdown the channel if an error occurs.
6663    pub fn send_no_shutdown_on_err(
6664        self,
6665        mut result: Result<&LinuxGuestInfo, i32>,
6666    ) -> Result<(), fidl::Error> {
6667        let _result = self.send_raw(result);
6668        self.drop_without_shutdown();
6669        _result
6670    }
6671
6672    fn send_raw(&self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
6673        self.control_handle.inner.send::<fidl::encoding::ResultType<
6674            LinuxManagerStartAndGetLinuxGuestInfoResponse,
6675            i32,
6676        >>(
6677            result.map(|info| (info,)),
6678            self.tx_id,
6679            0x11809ced100a2bea,
6680            fidl::encoding::DynamicFlags::empty(),
6681        )
6682    }
6683}
6684
6685#[must_use = "FIDL methods require a response to be sent"]
6686#[derive(Debug)]
6687pub struct LinuxManagerWipeDataResponder {
6688    control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
6689    tx_id: u32,
6690}
6691
6692/// Set the the channel to be shutdown (see [`LinuxManagerControlHandle::shutdown`])
6693/// if the responder is dropped without sending a response, so that the client
6694/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6695impl std::ops::Drop for LinuxManagerWipeDataResponder {
6696    fn drop(&mut self) {
6697        self.control_handle.shutdown();
6698        // Safety: drops once, never accessed again
6699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6700    }
6701}
6702
6703impl fidl::endpoints::Responder for LinuxManagerWipeDataResponder {
6704    type ControlHandle = LinuxManagerControlHandle;
6705
6706    fn control_handle(&self) -> &LinuxManagerControlHandle {
6707        &self.control_handle
6708    }
6709
6710    fn drop_without_shutdown(mut self) {
6711        // Safety: drops once, never accessed again due to mem::forget
6712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6713        // Prevent Drop from running (which would shut down the channel)
6714        std::mem::forget(self);
6715    }
6716}
6717
6718impl LinuxManagerWipeDataResponder {
6719    /// Sends a response to the FIDL transaction.
6720    ///
6721    /// Sets the channel to shutdown if an error occurs.
6722    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6723        let _result = self.send_raw(result);
6724        if _result.is_err() {
6725            self.control_handle.shutdown();
6726        }
6727        self.drop_without_shutdown();
6728        _result
6729    }
6730
6731    /// Similar to "send" but does not shutdown the channel if an error occurs.
6732    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6733        let _result = self.send_raw(result);
6734        self.drop_without_shutdown();
6735        _result
6736    }
6737
6738    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6739        self.control_handle
6740            .inner
6741            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6742                result,
6743                self.tx_id,
6744                0x732c69394548a76a,
6745                fidl::encoding::DynamicFlags::empty(),
6746            )
6747    }
6748}
6749
6750#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6751pub struct MemControllerMarker;
6752
6753impl fidl::endpoints::ProtocolMarker for MemControllerMarker {
6754    type Proxy = MemControllerProxy;
6755    type RequestStream = MemControllerRequestStream;
6756    #[cfg(target_os = "fuchsia")]
6757    type SynchronousProxy = MemControllerSynchronousProxy;
6758
6759    const DEBUG_NAME: &'static str = "fuchsia.virtualization.MemController";
6760}
6761impl fidl::endpoints::DiscoverableProtocolMarker for MemControllerMarker {}
6762
6763pub trait MemControllerProxyInterface: Send + Sync {
6764    type GetMemSizeResponseFut: std::future::Future<Output = Result<(u64, u64, u64, u64, u64), fidl::Error>>
6765        + Send;
6766    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut;
6767    fn r#request_size(&self, requested_size: u64) -> Result<(), fidl::Error>;
6768}
6769#[derive(Debug)]
6770#[cfg(target_os = "fuchsia")]
6771pub struct MemControllerSynchronousProxy {
6772    client: fidl::client::sync::Client,
6773}
6774
6775#[cfg(target_os = "fuchsia")]
6776impl fidl::endpoints::SynchronousProxy for MemControllerSynchronousProxy {
6777    type Proxy = MemControllerProxy;
6778    type Protocol = MemControllerMarker;
6779
6780    fn from_channel(inner: fidl::Channel) -> Self {
6781        Self::new(inner)
6782    }
6783
6784    fn into_channel(self) -> fidl::Channel {
6785        self.client.into_channel()
6786    }
6787
6788    fn as_channel(&self) -> &fidl::Channel {
6789        self.client.as_channel()
6790    }
6791}
6792
6793#[cfg(target_os = "fuchsia")]
6794impl MemControllerSynchronousProxy {
6795    pub fn new(channel: fidl::Channel) -> Self {
6796        let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6797        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6798    }
6799
6800    pub fn into_channel(self) -> fidl::Channel {
6801        self.client.into_channel()
6802    }
6803
6804    /// Waits until an event arrives and returns it. It is safe for other
6805    /// threads to make concurrent requests while waiting for an event.
6806    pub fn wait_for_event(
6807        &self,
6808        deadline: zx::MonotonicInstant,
6809    ) -> Result<MemControllerEvent, fidl::Error> {
6810        MemControllerEvent::decode(self.client.wait_for_event(deadline)?)
6811    }
6812
6813    /// Get the configured region size, usable region size, plugged size and requestd size
6814    ///
6815    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
6816    /// region_size is the size of device-managed memory region in bytes. Cannot change.
6817    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
6818    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
6819    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
6820    /// memory region.
6821    /// requested_size is the requested amount of plugged memory within the usable device-managed
6822    /// memory region.
6823    pub fn r#get_mem_size(
6824        &self,
6825        ___deadline: zx::MonotonicInstant,
6826    ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
6827        let _response = self
6828            .client
6829            .send_query::<fidl::encoding::EmptyPayload, MemControllerGetMemSizeResponse>(
6830                (),
6831                0x6e9d496f9b66ea56,
6832                fidl::encoding::DynamicFlags::empty(),
6833                ___deadline,
6834            )?;
6835        Ok((
6836            _response.block_size,
6837            _response.region_size,
6838            _response.usable_region_size,
6839            _response.plugged_size,
6840            _response.requested_size,
6841        ))
6842    }
6843
6844    /// Update the requested size to plug or unplug memory
6845    ///
6846    /// The driver SHOULD react to resize requests from the device (requested_size in the device
6847    /// configuration changed) by (un)plugging memory blocks.
6848    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
6849        self.client.send::<MemControllerRequestSizeRequest>(
6850            (requested_size,),
6851            0x12f8e2cc21ee8102,
6852            fidl::encoding::DynamicFlags::empty(),
6853        )
6854    }
6855}
6856
6857#[cfg(target_os = "fuchsia")]
6858impl From<MemControllerSynchronousProxy> for zx::Handle {
6859    fn from(value: MemControllerSynchronousProxy) -> Self {
6860        value.into_channel().into()
6861    }
6862}
6863
6864#[cfg(target_os = "fuchsia")]
6865impl From<fidl::Channel> for MemControllerSynchronousProxy {
6866    fn from(value: fidl::Channel) -> Self {
6867        Self::new(value)
6868    }
6869}
6870
6871#[cfg(target_os = "fuchsia")]
6872impl fidl::endpoints::FromClient for MemControllerSynchronousProxy {
6873    type Protocol = MemControllerMarker;
6874
6875    fn from_client(value: fidl::endpoints::ClientEnd<MemControllerMarker>) -> Self {
6876        Self::new(value.into_channel())
6877    }
6878}
6879
6880#[derive(Debug, Clone)]
6881pub struct MemControllerProxy {
6882    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6883}
6884
6885impl fidl::endpoints::Proxy for MemControllerProxy {
6886    type Protocol = MemControllerMarker;
6887
6888    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6889        Self::new(inner)
6890    }
6891
6892    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6893        self.client.into_channel().map_err(|client| Self { client })
6894    }
6895
6896    fn as_channel(&self) -> &::fidl::AsyncChannel {
6897        self.client.as_channel()
6898    }
6899}
6900
6901impl MemControllerProxy {
6902    /// Create a new Proxy for fuchsia.virtualization/MemController.
6903    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6904        let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6905        Self { client: fidl::client::Client::new(channel, protocol_name) }
6906    }
6907
6908    /// Get a Stream of events from the remote end of the protocol.
6909    ///
6910    /// # Panics
6911    ///
6912    /// Panics if the event stream was already taken.
6913    pub fn take_event_stream(&self) -> MemControllerEventStream {
6914        MemControllerEventStream { event_receiver: self.client.take_event_receiver() }
6915    }
6916
6917    /// Get the configured region size, usable region size, plugged size and requestd size
6918    ///
6919    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
6920    /// region_size is the size of device-managed memory region in bytes. Cannot change.
6921    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
6922    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
6923    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
6924    /// memory region.
6925    /// requested_size is the requested amount of plugged memory within the usable device-managed
6926    /// memory region.
6927    pub fn r#get_mem_size(
6928        &self,
6929    ) -> fidl::client::QueryResponseFut<
6930        (u64, u64, u64, u64, u64),
6931        fidl::encoding::DefaultFuchsiaResourceDialect,
6932    > {
6933        MemControllerProxyInterface::r#get_mem_size(self)
6934    }
6935
6936    /// Update the requested size to plug or unplug memory
6937    ///
6938    /// The driver SHOULD react to resize requests from the device (requested_size in the device
6939    /// configuration changed) by (un)plugging memory blocks.
6940    pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
6941        MemControllerProxyInterface::r#request_size(self, requested_size)
6942    }
6943}
6944
6945impl MemControllerProxyInterface for MemControllerProxy {
6946    type GetMemSizeResponseFut = fidl::client::QueryResponseFut<
6947        (u64, u64, u64, u64, u64),
6948        fidl::encoding::DefaultFuchsiaResourceDialect,
6949    >;
6950    fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut {
6951        fn _decode(
6952            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6953        ) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
6954            let _response = fidl::client::decode_transaction_body::<
6955                MemControllerGetMemSizeResponse,
6956                fidl::encoding::DefaultFuchsiaResourceDialect,
6957                0x6e9d496f9b66ea56,
6958            >(_buf?)?;
6959            Ok((
6960                _response.block_size,
6961                _response.region_size,
6962                _response.usable_region_size,
6963                _response.plugged_size,
6964                _response.requested_size,
6965            ))
6966        }
6967        self.client
6968            .send_query_and_decode::<fidl::encoding::EmptyPayload, (u64, u64, u64, u64, u64)>(
6969                (),
6970                0x6e9d496f9b66ea56,
6971                fidl::encoding::DynamicFlags::empty(),
6972                _decode,
6973            )
6974    }
6975
6976    fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
6977        self.client.send::<MemControllerRequestSizeRequest>(
6978            (requested_size,),
6979            0x12f8e2cc21ee8102,
6980            fidl::encoding::DynamicFlags::empty(),
6981        )
6982    }
6983}
6984
6985pub struct MemControllerEventStream {
6986    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6987}
6988
6989impl std::marker::Unpin for MemControllerEventStream {}
6990
6991impl futures::stream::FusedStream for MemControllerEventStream {
6992    fn is_terminated(&self) -> bool {
6993        self.event_receiver.is_terminated()
6994    }
6995}
6996
6997impl futures::Stream for MemControllerEventStream {
6998    type Item = Result<MemControllerEvent, fidl::Error>;
6999
7000    fn poll_next(
7001        mut self: std::pin::Pin<&mut Self>,
7002        cx: &mut std::task::Context<'_>,
7003    ) -> std::task::Poll<Option<Self::Item>> {
7004        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7005            &mut self.event_receiver,
7006            cx
7007        )?) {
7008            Some(buf) => std::task::Poll::Ready(Some(MemControllerEvent::decode(buf))),
7009            None => std::task::Poll::Ready(None),
7010        }
7011    }
7012}
7013
7014#[derive(Debug)]
7015pub enum MemControllerEvent {}
7016
7017impl MemControllerEvent {
7018    /// Decodes a message buffer as a [`MemControllerEvent`].
7019    fn decode(
7020        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7021    ) -> Result<MemControllerEvent, fidl::Error> {
7022        let (bytes, _handles) = buf.split_mut();
7023        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7024        debug_assert_eq!(tx_header.tx_id, 0);
7025        match tx_header.ordinal {
7026            _ => Err(fidl::Error::UnknownOrdinal {
7027                ordinal: tx_header.ordinal,
7028                protocol_name: <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7029            }),
7030        }
7031    }
7032}
7033
7034/// A Stream of incoming requests for fuchsia.virtualization/MemController.
7035pub struct MemControllerRequestStream {
7036    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7037    is_terminated: bool,
7038}
7039
7040impl std::marker::Unpin for MemControllerRequestStream {}
7041
7042impl futures::stream::FusedStream for MemControllerRequestStream {
7043    fn is_terminated(&self) -> bool {
7044        self.is_terminated
7045    }
7046}
7047
7048impl fidl::endpoints::RequestStream for MemControllerRequestStream {
7049    type Protocol = MemControllerMarker;
7050    type ControlHandle = MemControllerControlHandle;
7051
7052    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7053        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7054    }
7055
7056    fn control_handle(&self) -> Self::ControlHandle {
7057        MemControllerControlHandle { inner: self.inner.clone() }
7058    }
7059
7060    fn into_inner(
7061        self,
7062    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7063    {
7064        (self.inner, self.is_terminated)
7065    }
7066
7067    fn from_inner(
7068        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7069        is_terminated: bool,
7070    ) -> Self {
7071        Self { inner, is_terminated }
7072    }
7073}
7074
7075impl futures::Stream for MemControllerRequestStream {
7076    type Item = Result<MemControllerRequest, fidl::Error>;
7077
7078    fn poll_next(
7079        mut self: std::pin::Pin<&mut Self>,
7080        cx: &mut std::task::Context<'_>,
7081    ) -> std::task::Poll<Option<Self::Item>> {
7082        let this = &mut *self;
7083        if this.inner.check_shutdown(cx) {
7084            this.is_terminated = true;
7085            return std::task::Poll::Ready(None);
7086        }
7087        if this.is_terminated {
7088            panic!("polled MemControllerRequestStream after completion");
7089        }
7090        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7091            |bytes, handles| {
7092                match this.inner.channel().read_etc(cx, bytes, handles) {
7093                    std::task::Poll::Ready(Ok(())) => {}
7094                    std::task::Poll::Pending => return std::task::Poll::Pending,
7095                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7096                        this.is_terminated = true;
7097                        return std::task::Poll::Ready(None);
7098                    }
7099                    std::task::Poll::Ready(Err(e)) => {
7100                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7101                            e.into(),
7102                        ))))
7103                    }
7104                }
7105
7106                // A message has been received from the channel
7107                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7108
7109                std::task::Poll::Ready(Some(match header.ordinal {
7110                    0x6e9d496f9b66ea56 => {
7111                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7112                        let mut req = fidl::new_empty!(
7113                            fidl::encoding::EmptyPayload,
7114                            fidl::encoding::DefaultFuchsiaResourceDialect
7115                        );
7116                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7117                        let control_handle =
7118                            MemControllerControlHandle { inner: this.inner.clone() };
7119                        Ok(MemControllerRequest::GetMemSize {
7120                            responder: MemControllerGetMemSizeResponder {
7121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7122                                tx_id: header.tx_id,
7123                            },
7124                        })
7125                    }
7126                    0x12f8e2cc21ee8102 => {
7127                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7128                        let mut req = fidl::new_empty!(
7129                            MemControllerRequestSizeRequest,
7130                            fidl::encoding::DefaultFuchsiaResourceDialect
7131                        );
7132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemControllerRequestSizeRequest>(&header, _body_bytes, handles, &mut req)?;
7133                        let control_handle =
7134                            MemControllerControlHandle { inner: this.inner.clone() };
7135                        Ok(MemControllerRequest::RequestSize {
7136                            requested_size: req.requested_size,
7137
7138                            control_handle,
7139                        })
7140                    }
7141                    _ => Err(fidl::Error::UnknownOrdinal {
7142                        ordinal: header.ordinal,
7143                        protocol_name:
7144                            <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7145                    }),
7146                }))
7147            },
7148        )
7149    }
7150}
7151
7152/// A `MemController` controls a guest's virtio-mem
7153#[derive(Debug)]
7154pub enum MemControllerRequest {
7155    /// Get the configured region size, usable region size, plugged size and requestd size
7156    ///
7157    /// block_size is the size and the alignment in bytes of a memory block. Cannot change.
7158    /// region_size is the size of device-managed memory region in bytes. Cannot change.
7159    /// usable_region_size is the size of the usable device-managed memory region. Can grow up to
7160    /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests.
7161    /// plugged_size is the amount of plugged memory in bytes within the usable device-managed
7162    /// memory region.
7163    /// requested_size is the requested amount of plugged memory within the usable device-managed
7164    /// memory region.
7165    GetMemSize { responder: MemControllerGetMemSizeResponder },
7166    /// Update the requested size to plug or unplug memory
7167    ///
7168    /// The driver SHOULD react to resize requests from the device (requested_size in the device
7169    /// configuration changed) by (un)plugging memory blocks.
7170    RequestSize { requested_size: u64, control_handle: MemControllerControlHandle },
7171}
7172
7173impl MemControllerRequest {
7174    #[allow(irrefutable_let_patterns)]
7175    pub fn into_get_mem_size(self) -> Option<(MemControllerGetMemSizeResponder)> {
7176        if let MemControllerRequest::GetMemSize { responder } = self {
7177            Some((responder))
7178        } else {
7179            None
7180        }
7181    }
7182
7183    #[allow(irrefutable_let_patterns)]
7184    pub fn into_request_size(self) -> Option<(u64, MemControllerControlHandle)> {
7185        if let MemControllerRequest::RequestSize { requested_size, control_handle } = self {
7186            Some((requested_size, control_handle))
7187        } else {
7188            None
7189        }
7190    }
7191
7192    /// Name of the method defined in FIDL
7193    pub fn method_name(&self) -> &'static str {
7194        match *self {
7195            MemControllerRequest::GetMemSize { .. } => "get_mem_size",
7196            MemControllerRequest::RequestSize { .. } => "request_size",
7197        }
7198    }
7199}
7200
7201#[derive(Debug, Clone)]
7202pub struct MemControllerControlHandle {
7203    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7204}
7205
7206impl fidl::endpoints::ControlHandle for MemControllerControlHandle {
7207    fn shutdown(&self) {
7208        self.inner.shutdown()
7209    }
7210    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7211        self.inner.shutdown_with_epitaph(status)
7212    }
7213
7214    fn is_closed(&self) -> bool {
7215        self.inner.channel().is_closed()
7216    }
7217    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7218        self.inner.channel().on_closed()
7219    }
7220
7221    #[cfg(target_os = "fuchsia")]
7222    fn signal_peer(
7223        &self,
7224        clear_mask: zx::Signals,
7225        set_mask: zx::Signals,
7226    ) -> Result<(), zx_status::Status> {
7227        use fidl::Peered;
7228        self.inner.channel().signal_peer(clear_mask, set_mask)
7229    }
7230}
7231
7232impl MemControllerControlHandle {}
7233
7234#[must_use = "FIDL methods require a response to be sent"]
7235#[derive(Debug)]
7236pub struct MemControllerGetMemSizeResponder {
7237    control_handle: std::mem::ManuallyDrop<MemControllerControlHandle>,
7238    tx_id: u32,
7239}
7240
7241/// Set the the channel to be shutdown (see [`MemControllerControlHandle::shutdown`])
7242/// if the responder is dropped without sending a response, so that the client
7243/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7244impl std::ops::Drop for MemControllerGetMemSizeResponder {
7245    fn drop(&mut self) {
7246        self.control_handle.shutdown();
7247        // Safety: drops once, never accessed again
7248        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7249    }
7250}
7251
7252impl fidl::endpoints::Responder for MemControllerGetMemSizeResponder {
7253    type ControlHandle = MemControllerControlHandle;
7254
7255    fn control_handle(&self) -> &MemControllerControlHandle {
7256        &self.control_handle
7257    }
7258
7259    fn drop_without_shutdown(mut self) {
7260        // Safety: drops once, never accessed again due to mem::forget
7261        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7262        // Prevent Drop from running (which would shut down the channel)
7263        std::mem::forget(self);
7264    }
7265}
7266
7267impl MemControllerGetMemSizeResponder {
7268    /// Sends a response to the FIDL transaction.
7269    ///
7270    /// Sets the channel to shutdown if an error occurs.
7271    pub fn send(
7272        self,
7273        mut block_size: u64,
7274        mut region_size: u64,
7275        mut usable_region_size: u64,
7276        mut plugged_size: u64,
7277        mut requested_size: u64,
7278    ) -> Result<(), fidl::Error> {
7279        let _result = self.send_raw(
7280            block_size,
7281            region_size,
7282            usable_region_size,
7283            plugged_size,
7284            requested_size,
7285        );
7286        if _result.is_err() {
7287            self.control_handle.shutdown();
7288        }
7289        self.drop_without_shutdown();
7290        _result
7291    }
7292
7293    /// Similar to "send" but does not shutdown the channel if an error occurs.
7294    pub fn send_no_shutdown_on_err(
7295        self,
7296        mut block_size: u64,
7297        mut region_size: u64,
7298        mut usable_region_size: u64,
7299        mut plugged_size: u64,
7300        mut requested_size: u64,
7301    ) -> Result<(), fidl::Error> {
7302        let _result = self.send_raw(
7303            block_size,
7304            region_size,
7305            usable_region_size,
7306            plugged_size,
7307            requested_size,
7308        );
7309        self.drop_without_shutdown();
7310        _result
7311    }
7312
7313    fn send_raw(
7314        &self,
7315        mut block_size: u64,
7316        mut region_size: u64,
7317        mut usable_region_size: u64,
7318        mut plugged_size: u64,
7319        mut requested_size: u64,
7320    ) -> Result<(), fidl::Error> {
7321        self.control_handle.inner.send::<MemControllerGetMemSizeResponse>(
7322            (block_size, region_size, usable_region_size, plugged_size, requested_size),
7323            self.tx_id,
7324            0x6e9d496f9b66ea56,
7325            fidl::encoding::DynamicFlags::empty(),
7326        )
7327    }
7328}
7329
7330#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7331pub struct TerminaGuestManagerMarker;
7332
7333impl fidl::endpoints::ProtocolMarker for TerminaGuestManagerMarker {
7334    type Proxy = TerminaGuestManagerProxy;
7335    type RequestStream = TerminaGuestManagerRequestStream;
7336    #[cfg(target_os = "fuchsia")]
7337    type SynchronousProxy = TerminaGuestManagerSynchronousProxy;
7338
7339    const DEBUG_NAME: &'static str = "fuchsia.virtualization.TerminaGuestManager";
7340}
7341impl fidl::endpoints::DiscoverableProtocolMarker for TerminaGuestManagerMarker {}
7342
7343pub trait TerminaGuestManagerProxyInterface: Send + Sync {
7344    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
7345        + Send;
7346    fn r#launch(
7347        &self,
7348        guest_config: GuestConfig,
7349        controller: fidl::endpoints::ServerEnd<GuestMarker>,
7350    ) -> Self::LaunchResponseFut;
7351    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7352    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
7353    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
7354        + Send;
7355    fn r#connect(
7356        &self,
7357        controller: fidl::endpoints::ServerEnd<GuestMarker>,
7358    ) -> Self::ConnectResponseFut;
7359    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
7360    fn r#get_info(&self) -> Self::GetInfoResponseFut;
7361}
7362#[derive(Debug)]
7363#[cfg(target_os = "fuchsia")]
7364pub struct TerminaGuestManagerSynchronousProxy {
7365    client: fidl::client::sync::Client,
7366}
7367
7368#[cfg(target_os = "fuchsia")]
7369impl fidl::endpoints::SynchronousProxy for TerminaGuestManagerSynchronousProxy {
7370    type Proxy = TerminaGuestManagerProxy;
7371    type Protocol = TerminaGuestManagerMarker;
7372
7373    fn from_channel(inner: fidl::Channel) -> Self {
7374        Self::new(inner)
7375    }
7376
7377    fn into_channel(self) -> fidl::Channel {
7378        self.client.into_channel()
7379    }
7380
7381    fn as_channel(&self) -> &fidl::Channel {
7382        self.client.as_channel()
7383    }
7384}
7385
7386#[cfg(target_os = "fuchsia")]
7387impl TerminaGuestManagerSynchronousProxy {
7388    pub fn new(channel: fidl::Channel) -> Self {
7389        let protocol_name =
7390            <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7391        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7392    }
7393
7394    pub fn into_channel(self) -> fidl::Channel {
7395        self.client.into_channel()
7396    }
7397
7398    /// Waits until an event arrives and returns it. It is safe for other
7399    /// threads to make concurrent requests while waiting for an event.
7400    pub fn wait_for_event(
7401        &self,
7402        deadline: zx::MonotonicInstant,
7403    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
7404        TerminaGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
7405    }
7406
7407    /// Launch a new guest instance.
7408    ///
7409    /// Possible errors:
7410    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
7411    ///         problems detected by the guest manager.
7412    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
7413    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
7414    ///         component logs for a more specific failure.
7415    pub fn r#launch(
7416        &self,
7417        mut guest_config: GuestConfig,
7418        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7419        ___deadline: zx::MonotonicInstant,
7420    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
7421        let _response =
7422            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
7423                fidl::encoding::EmptyStruct,
7424                GuestManagerError,
7425            >>(
7426                (&mut guest_config, controller),
7427                0x394a2e29f750323e,
7428                fidl::encoding::DynamicFlags::empty(),
7429                ___deadline,
7430            )?;
7431        Ok(_response.map(|x| x))
7432    }
7433
7434    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
7435    /// be used to launch another guest.
7436    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
7437        let _response =
7438            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
7439                (),
7440                0x3ad9a012982f872d,
7441                fidl::encoding::DynamicFlags::empty(),
7442                ___deadline,
7443            )?;
7444        Ok(_response)
7445    }
7446
7447    /// Connect to a currently running guest.
7448    ///
7449    /// Possible errors:
7450    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
7451    ///         has launched before attempting to reconnect.
7452    pub fn r#connect(
7453        &self,
7454        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7455        ___deadline: zx::MonotonicInstant,
7456    ) -> Result<GuestManagerConnectResult, fidl::Error> {
7457        let _response =
7458            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
7459                fidl::encoding::EmptyStruct,
7460                GuestManagerError,
7461            >>(
7462                (controller,),
7463                0x4e489076e3bb15b4,
7464                fidl::encoding::DynamicFlags::empty(),
7465                ___deadline,
7466            )?;
7467        Ok(_response.map(|x| x))
7468    }
7469
7470    /// Query guest info
7471    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
7472        let _response =
7473            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
7474                (),
7475                0x76892614aea695dc,
7476                fidl::encoding::DynamicFlags::empty(),
7477                ___deadline,
7478            )?;
7479        Ok(_response.guest_info)
7480    }
7481}
7482
7483#[cfg(target_os = "fuchsia")]
7484impl From<TerminaGuestManagerSynchronousProxy> for zx::Handle {
7485    fn from(value: TerminaGuestManagerSynchronousProxy) -> Self {
7486        value.into_channel().into()
7487    }
7488}
7489
7490#[cfg(target_os = "fuchsia")]
7491impl From<fidl::Channel> for TerminaGuestManagerSynchronousProxy {
7492    fn from(value: fidl::Channel) -> Self {
7493        Self::new(value)
7494    }
7495}
7496
7497#[cfg(target_os = "fuchsia")]
7498impl fidl::endpoints::FromClient for TerminaGuestManagerSynchronousProxy {
7499    type Protocol = TerminaGuestManagerMarker;
7500
7501    fn from_client(value: fidl::endpoints::ClientEnd<TerminaGuestManagerMarker>) -> Self {
7502        Self::new(value.into_channel())
7503    }
7504}
7505
7506#[derive(Debug, Clone)]
7507pub struct TerminaGuestManagerProxy {
7508    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7509}
7510
7511impl fidl::endpoints::Proxy for TerminaGuestManagerProxy {
7512    type Protocol = TerminaGuestManagerMarker;
7513
7514    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7515        Self::new(inner)
7516    }
7517
7518    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7519        self.client.into_channel().map_err(|client| Self { client })
7520    }
7521
7522    fn as_channel(&self) -> &::fidl::AsyncChannel {
7523        self.client.as_channel()
7524    }
7525}
7526
7527impl TerminaGuestManagerProxy {
7528    /// Create a new Proxy for fuchsia.virtualization/TerminaGuestManager.
7529    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7530        let protocol_name =
7531            <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7532        Self { client: fidl::client::Client::new(channel, protocol_name) }
7533    }
7534
7535    /// Get a Stream of events from the remote end of the protocol.
7536    ///
7537    /// # Panics
7538    ///
7539    /// Panics if the event stream was already taken.
7540    pub fn take_event_stream(&self) -> TerminaGuestManagerEventStream {
7541        TerminaGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
7542    }
7543
7544    /// Launch a new guest instance.
7545    ///
7546    /// Possible errors:
7547    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
7548    ///         problems detected by the guest manager.
7549    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
7550    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
7551    ///         component logs for a more specific failure.
7552    pub fn r#launch(
7553        &self,
7554        mut guest_config: GuestConfig,
7555        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7556    ) -> fidl::client::QueryResponseFut<
7557        GuestManagerLaunchResult,
7558        fidl::encoding::DefaultFuchsiaResourceDialect,
7559    > {
7560        TerminaGuestManagerProxyInterface::r#launch(self, guest_config, controller)
7561    }
7562
7563    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
7564    /// be used to launch another guest.
7565    pub fn r#force_shutdown(
7566        &self,
7567    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7568        TerminaGuestManagerProxyInterface::r#force_shutdown(self)
7569    }
7570
7571    /// Connect to a currently running guest.
7572    ///
7573    /// Possible errors:
7574    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
7575    ///         has launched before attempting to reconnect.
7576    pub fn r#connect(
7577        &self,
7578        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7579    ) -> fidl::client::QueryResponseFut<
7580        GuestManagerConnectResult,
7581        fidl::encoding::DefaultFuchsiaResourceDialect,
7582    > {
7583        TerminaGuestManagerProxyInterface::r#connect(self, controller)
7584    }
7585
7586    /// Query guest info
7587    pub fn r#get_info(
7588        &self,
7589    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
7590    {
7591        TerminaGuestManagerProxyInterface::r#get_info(self)
7592    }
7593}
7594
7595impl TerminaGuestManagerProxyInterface for TerminaGuestManagerProxy {
7596    type LaunchResponseFut = fidl::client::QueryResponseFut<
7597        GuestManagerLaunchResult,
7598        fidl::encoding::DefaultFuchsiaResourceDialect,
7599    >;
7600    fn r#launch(
7601        &self,
7602        mut guest_config: GuestConfig,
7603        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7604    ) -> Self::LaunchResponseFut {
7605        fn _decode(
7606            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7607        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
7608            let _response = fidl::client::decode_transaction_body::<
7609                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
7610                fidl::encoding::DefaultFuchsiaResourceDialect,
7611                0x394a2e29f750323e,
7612            >(_buf?)?;
7613            Ok(_response.map(|x| x))
7614        }
7615        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
7616            (&mut guest_config, controller),
7617            0x394a2e29f750323e,
7618            fidl::encoding::DynamicFlags::empty(),
7619            _decode,
7620        )
7621    }
7622
7623    type ForceShutdownResponseFut =
7624        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7625    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
7626        fn _decode(
7627            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7628        ) -> Result<(), fidl::Error> {
7629            let _response = fidl::client::decode_transaction_body::<
7630                fidl::encoding::EmptyPayload,
7631                fidl::encoding::DefaultFuchsiaResourceDialect,
7632                0x3ad9a012982f872d,
7633            >(_buf?)?;
7634            Ok(_response)
7635        }
7636        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
7637            (),
7638            0x3ad9a012982f872d,
7639            fidl::encoding::DynamicFlags::empty(),
7640            _decode,
7641        )
7642    }
7643
7644    type ConnectResponseFut = fidl::client::QueryResponseFut<
7645        GuestManagerConnectResult,
7646        fidl::encoding::DefaultFuchsiaResourceDialect,
7647    >;
7648    fn r#connect(
7649        &self,
7650        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
7651    ) -> Self::ConnectResponseFut {
7652        fn _decode(
7653            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7654        ) -> Result<GuestManagerConnectResult, fidl::Error> {
7655            let _response = fidl::client::decode_transaction_body::<
7656                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
7657                fidl::encoding::DefaultFuchsiaResourceDialect,
7658                0x4e489076e3bb15b4,
7659            >(_buf?)?;
7660            Ok(_response.map(|x| x))
7661        }
7662        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
7663            (controller,),
7664            0x4e489076e3bb15b4,
7665            fidl::encoding::DynamicFlags::empty(),
7666            _decode,
7667        )
7668    }
7669
7670    type GetInfoResponseFut =
7671        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
7672    fn r#get_info(&self) -> Self::GetInfoResponseFut {
7673        fn _decode(
7674            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7675        ) -> Result<GuestInfo, fidl::Error> {
7676            let _response = fidl::client::decode_transaction_body::<
7677                GuestManagerGetInfoResponse,
7678                fidl::encoding::DefaultFuchsiaResourceDialect,
7679                0x76892614aea695dc,
7680            >(_buf?)?;
7681            Ok(_response.guest_info)
7682        }
7683        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
7684            (),
7685            0x76892614aea695dc,
7686            fidl::encoding::DynamicFlags::empty(),
7687            _decode,
7688        )
7689    }
7690}
7691
7692pub struct TerminaGuestManagerEventStream {
7693    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7694}
7695
7696impl std::marker::Unpin for TerminaGuestManagerEventStream {}
7697
7698impl futures::stream::FusedStream for TerminaGuestManagerEventStream {
7699    fn is_terminated(&self) -> bool {
7700        self.event_receiver.is_terminated()
7701    }
7702}
7703
7704impl futures::Stream for TerminaGuestManagerEventStream {
7705    type Item = Result<TerminaGuestManagerEvent, fidl::Error>;
7706
7707    fn poll_next(
7708        mut self: std::pin::Pin<&mut Self>,
7709        cx: &mut std::task::Context<'_>,
7710    ) -> std::task::Poll<Option<Self::Item>> {
7711        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7712            &mut self.event_receiver,
7713            cx
7714        )?) {
7715            Some(buf) => std::task::Poll::Ready(Some(TerminaGuestManagerEvent::decode(buf))),
7716            None => std::task::Poll::Ready(None),
7717        }
7718    }
7719}
7720
7721#[derive(Debug)]
7722pub enum TerminaGuestManagerEvent {}
7723
7724impl TerminaGuestManagerEvent {
7725    /// Decodes a message buffer as a [`TerminaGuestManagerEvent`].
7726    fn decode(
7727        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7728    ) -> Result<TerminaGuestManagerEvent, fidl::Error> {
7729        let (bytes, _handles) = buf.split_mut();
7730        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7731        debug_assert_eq!(tx_header.tx_id, 0);
7732        match tx_header.ordinal {
7733            _ => Err(fidl::Error::UnknownOrdinal {
7734                ordinal: tx_header.ordinal,
7735                protocol_name:
7736                    <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7737            }),
7738        }
7739    }
7740}
7741
7742/// A Stream of incoming requests for fuchsia.virtualization/TerminaGuestManager.
7743pub struct TerminaGuestManagerRequestStream {
7744    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7745    is_terminated: bool,
7746}
7747
7748impl std::marker::Unpin for TerminaGuestManagerRequestStream {}
7749
7750impl futures::stream::FusedStream for TerminaGuestManagerRequestStream {
7751    fn is_terminated(&self) -> bool {
7752        self.is_terminated
7753    }
7754}
7755
7756impl fidl::endpoints::RequestStream for TerminaGuestManagerRequestStream {
7757    type Protocol = TerminaGuestManagerMarker;
7758    type ControlHandle = TerminaGuestManagerControlHandle;
7759
7760    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7761        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7762    }
7763
7764    fn control_handle(&self) -> Self::ControlHandle {
7765        TerminaGuestManagerControlHandle { inner: self.inner.clone() }
7766    }
7767
7768    fn into_inner(
7769        self,
7770    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7771    {
7772        (self.inner, self.is_terminated)
7773    }
7774
7775    fn from_inner(
7776        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7777        is_terminated: bool,
7778    ) -> Self {
7779        Self { inner, is_terminated }
7780    }
7781}
7782
7783impl futures::Stream for TerminaGuestManagerRequestStream {
7784    type Item = Result<TerminaGuestManagerRequest, fidl::Error>;
7785
7786    fn poll_next(
7787        mut self: std::pin::Pin<&mut Self>,
7788        cx: &mut std::task::Context<'_>,
7789    ) -> std::task::Poll<Option<Self::Item>> {
7790        let this = &mut *self;
7791        if this.inner.check_shutdown(cx) {
7792            this.is_terminated = true;
7793            return std::task::Poll::Ready(None);
7794        }
7795        if this.is_terminated {
7796            panic!("polled TerminaGuestManagerRequestStream after completion");
7797        }
7798        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7799            |bytes, handles| {
7800                match this.inner.channel().read_etc(cx, bytes, handles) {
7801                    std::task::Poll::Ready(Ok(())) => {}
7802                    std::task::Poll::Pending => return std::task::Poll::Pending,
7803                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7804                        this.is_terminated = true;
7805                        return std::task::Poll::Ready(None);
7806                    }
7807                    std::task::Poll::Ready(Err(e)) => {
7808                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7809                            e.into(),
7810                        ))))
7811                    }
7812                }
7813
7814                // A message has been received from the channel
7815                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7816
7817                std::task::Poll::Ready(Some(match header.ordinal {
7818                0x394a2e29f750323e => {
7819                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7820                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7821                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
7822                    let control_handle = TerminaGuestManagerControlHandle {
7823                        inner: this.inner.clone(),
7824                    };
7825                    Ok(TerminaGuestManagerRequest::Launch {guest_config: req.guest_config,
7826controller: req.controller,
7827
7828                        responder: TerminaGuestManagerLaunchResponder {
7829                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7830                            tx_id: header.tx_id,
7831                        },
7832                    })
7833                }
7834                0x3ad9a012982f872d => {
7835                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7836                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7837                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7838                    let control_handle = TerminaGuestManagerControlHandle {
7839                        inner: this.inner.clone(),
7840                    };
7841                    Ok(TerminaGuestManagerRequest::ForceShutdown {
7842                        responder: TerminaGuestManagerForceShutdownResponder {
7843                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7844                            tx_id: header.tx_id,
7845                        },
7846                    })
7847                }
7848                0x4e489076e3bb15b4 => {
7849                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7850                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7851                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
7852                    let control_handle = TerminaGuestManagerControlHandle {
7853                        inner: this.inner.clone(),
7854                    };
7855                    Ok(TerminaGuestManagerRequest::Connect {controller: req.controller,
7856
7857                        responder: TerminaGuestManagerConnectResponder {
7858                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7859                            tx_id: header.tx_id,
7860                        },
7861                    })
7862                }
7863                0x76892614aea695dc => {
7864                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7865                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7866                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7867                    let control_handle = TerminaGuestManagerControlHandle {
7868                        inner: this.inner.clone(),
7869                    };
7870                    Ok(TerminaGuestManagerRequest::GetInfo {
7871                        responder: TerminaGuestManagerGetInfoResponder {
7872                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7873                            tx_id: header.tx_id,
7874                        },
7875                    })
7876                }
7877                _ => Err(fidl::Error::UnknownOrdinal {
7878                    ordinal: header.ordinal,
7879                    protocol_name: <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7880                }),
7881            }))
7882            },
7883        )
7884    }
7885}
7886
7887#[derive(Debug)]
7888pub enum TerminaGuestManagerRequest {
7889    /// Launch a new guest instance.
7890    ///
7891    /// Possible errors:
7892    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
7893    ///         problems detected by the guest manager.
7894    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
7895    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
7896    ///         component logs for a more specific failure.
7897    Launch {
7898        guest_config: GuestConfig,
7899        controller: fidl::endpoints::ServerEnd<GuestMarker>,
7900        responder: TerminaGuestManagerLaunchResponder,
7901    },
7902    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
7903    /// be used to launch another guest.
7904    ForceShutdown { responder: TerminaGuestManagerForceShutdownResponder },
7905    /// Connect to a currently running guest.
7906    ///
7907    /// Possible errors:
7908    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
7909    ///         has launched before attempting to reconnect.
7910    Connect {
7911        controller: fidl::endpoints::ServerEnd<GuestMarker>,
7912        responder: TerminaGuestManagerConnectResponder,
7913    },
7914    /// Query guest info
7915    GetInfo { responder: TerminaGuestManagerGetInfoResponder },
7916}
7917
7918impl TerminaGuestManagerRequest {
7919    #[allow(irrefutable_let_patterns)]
7920    pub fn into_launch(
7921        self,
7922    ) -> Option<(
7923        GuestConfig,
7924        fidl::endpoints::ServerEnd<GuestMarker>,
7925        TerminaGuestManagerLaunchResponder,
7926    )> {
7927        if let TerminaGuestManagerRequest::Launch { guest_config, controller, responder } = self {
7928            Some((guest_config, controller, responder))
7929        } else {
7930            None
7931        }
7932    }
7933
7934    #[allow(irrefutable_let_patterns)]
7935    pub fn into_force_shutdown(self) -> Option<(TerminaGuestManagerForceShutdownResponder)> {
7936        if let TerminaGuestManagerRequest::ForceShutdown { responder } = self {
7937            Some((responder))
7938        } else {
7939            None
7940        }
7941    }
7942
7943    #[allow(irrefutable_let_patterns)]
7944    pub fn into_connect(
7945        self,
7946    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, TerminaGuestManagerConnectResponder)>
7947    {
7948        if let TerminaGuestManagerRequest::Connect { controller, responder } = self {
7949            Some((controller, responder))
7950        } else {
7951            None
7952        }
7953    }
7954
7955    #[allow(irrefutable_let_patterns)]
7956    pub fn into_get_info(self) -> Option<(TerminaGuestManagerGetInfoResponder)> {
7957        if let TerminaGuestManagerRequest::GetInfo { responder } = self {
7958            Some((responder))
7959        } else {
7960            None
7961        }
7962    }
7963
7964    /// Name of the method defined in FIDL
7965    pub fn method_name(&self) -> &'static str {
7966        match *self {
7967            TerminaGuestManagerRequest::Launch { .. } => "launch",
7968            TerminaGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
7969            TerminaGuestManagerRequest::Connect { .. } => "connect",
7970            TerminaGuestManagerRequest::GetInfo { .. } => "get_info",
7971        }
7972    }
7973}
7974
7975#[derive(Debug, Clone)]
7976pub struct TerminaGuestManagerControlHandle {
7977    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7978}
7979
7980impl fidl::endpoints::ControlHandle for TerminaGuestManagerControlHandle {
7981    fn shutdown(&self) {
7982        self.inner.shutdown()
7983    }
7984    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7985        self.inner.shutdown_with_epitaph(status)
7986    }
7987
7988    fn is_closed(&self) -> bool {
7989        self.inner.channel().is_closed()
7990    }
7991    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7992        self.inner.channel().on_closed()
7993    }
7994
7995    #[cfg(target_os = "fuchsia")]
7996    fn signal_peer(
7997        &self,
7998        clear_mask: zx::Signals,
7999        set_mask: zx::Signals,
8000    ) -> Result<(), zx_status::Status> {
8001        use fidl::Peered;
8002        self.inner.channel().signal_peer(clear_mask, set_mask)
8003    }
8004}
8005
8006impl TerminaGuestManagerControlHandle {}
8007
8008#[must_use = "FIDL methods require a response to be sent"]
8009#[derive(Debug)]
8010pub struct TerminaGuestManagerLaunchResponder {
8011    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8012    tx_id: u32,
8013}
8014
8015/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8016/// if the responder is dropped without sending a response, so that the client
8017/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8018impl std::ops::Drop for TerminaGuestManagerLaunchResponder {
8019    fn drop(&mut self) {
8020        self.control_handle.shutdown();
8021        // Safety: drops once, never accessed again
8022        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8023    }
8024}
8025
8026impl fidl::endpoints::Responder for TerminaGuestManagerLaunchResponder {
8027    type ControlHandle = TerminaGuestManagerControlHandle;
8028
8029    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8030        &self.control_handle
8031    }
8032
8033    fn drop_without_shutdown(mut self) {
8034        // Safety: drops once, never accessed again due to mem::forget
8035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8036        // Prevent Drop from running (which would shut down the channel)
8037        std::mem::forget(self);
8038    }
8039}
8040
8041impl TerminaGuestManagerLaunchResponder {
8042    /// Sends a response to the FIDL transaction.
8043    ///
8044    /// Sets the channel to shutdown if an error occurs.
8045    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8046        let _result = self.send_raw(result);
8047        if _result.is_err() {
8048            self.control_handle.shutdown();
8049        }
8050        self.drop_without_shutdown();
8051        _result
8052    }
8053
8054    /// Similar to "send" but does not shutdown the channel if an error occurs.
8055    pub fn send_no_shutdown_on_err(
8056        self,
8057        mut result: Result<(), GuestManagerError>,
8058    ) -> Result<(), fidl::Error> {
8059        let _result = self.send_raw(result);
8060        self.drop_without_shutdown();
8061        _result
8062    }
8063
8064    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8065        self.control_handle.inner.send::<fidl::encoding::ResultType<
8066            fidl::encoding::EmptyStruct,
8067            GuestManagerError,
8068        >>(
8069            result,
8070            self.tx_id,
8071            0x394a2e29f750323e,
8072            fidl::encoding::DynamicFlags::empty(),
8073        )
8074    }
8075}
8076
8077#[must_use = "FIDL methods require a response to be sent"]
8078#[derive(Debug)]
8079pub struct TerminaGuestManagerForceShutdownResponder {
8080    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8081    tx_id: u32,
8082}
8083
8084/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8085/// if the responder is dropped without sending a response, so that the client
8086/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8087impl std::ops::Drop for TerminaGuestManagerForceShutdownResponder {
8088    fn drop(&mut self) {
8089        self.control_handle.shutdown();
8090        // Safety: drops once, never accessed again
8091        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8092    }
8093}
8094
8095impl fidl::endpoints::Responder for TerminaGuestManagerForceShutdownResponder {
8096    type ControlHandle = TerminaGuestManagerControlHandle;
8097
8098    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8099        &self.control_handle
8100    }
8101
8102    fn drop_without_shutdown(mut self) {
8103        // Safety: drops once, never accessed again due to mem::forget
8104        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8105        // Prevent Drop from running (which would shut down the channel)
8106        std::mem::forget(self);
8107    }
8108}
8109
8110impl TerminaGuestManagerForceShutdownResponder {
8111    /// Sends a response to the FIDL transaction.
8112    ///
8113    /// Sets the channel to shutdown if an error occurs.
8114    pub fn send(self) -> Result<(), fidl::Error> {
8115        let _result = self.send_raw();
8116        if _result.is_err() {
8117            self.control_handle.shutdown();
8118        }
8119        self.drop_without_shutdown();
8120        _result
8121    }
8122
8123    /// Similar to "send" but does not shutdown the channel if an error occurs.
8124    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8125        let _result = self.send_raw();
8126        self.drop_without_shutdown();
8127        _result
8128    }
8129
8130    fn send_raw(&self) -> Result<(), fidl::Error> {
8131        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8132            (),
8133            self.tx_id,
8134            0x3ad9a012982f872d,
8135            fidl::encoding::DynamicFlags::empty(),
8136        )
8137    }
8138}
8139
8140#[must_use = "FIDL methods require a response to be sent"]
8141#[derive(Debug)]
8142pub struct TerminaGuestManagerConnectResponder {
8143    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8144    tx_id: u32,
8145}
8146
8147/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8148/// if the responder is dropped without sending a response, so that the client
8149/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8150impl std::ops::Drop for TerminaGuestManagerConnectResponder {
8151    fn drop(&mut self) {
8152        self.control_handle.shutdown();
8153        // Safety: drops once, never accessed again
8154        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8155    }
8156}
8157
8158impl fidl::endpoints::Responder for TerminaGuestManagerConnectResponder {
8159    type ControlHandle = TerminaGuestManagerControlHandle;
8160
8161    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8162        &self.control_handle
8163    }
8164
8165    fn drop_without_shutdown(mut self) {
8166        // Safety: drops once, never accessed again due to mem::forget
8167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8168        // Prevent Drop from running (which would shut down the channel)
8169        std::mem::forget(self);
8170    }
8171}
8172
8173impl TerminaGuestManagerConnectResponder {
8174    /// Sends a response to the FIDL transaction.
8175    ///
8176    /// Sets the channel to shutdown if an error occurs.
8177    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8178        let _result = self.send_raw(result);
8179        if _result.is_err() {
8180            self.control_handle.shutdown();
8181        }
8182        self.drop_without_shutdown();
8183        _result
8184    }
8185
8186    /// Similar to "send" but does not shutdown the channel if an error occurs.
8187    pub fn send_no_shutdown_on_err(
8188        self,
8189        mut result: Result<(), GuestManagerError>,
8190    ) -> Result<(), fidl::Error> {
8191        let _result = self.send_raw(result);
8192        self.drop_without_shutdown();
8193        _result
8194    }
8195
8196    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8197        self.control_handle.inner.send::<fidl::encoding::ResultType<
8198            fidl::encoding::EmptyStruct,
8199            GuestManagerError,
8200        >>(
8201            result,
8202            self.tx_id,
8203            0x4e489076e3bb15b4,
8204            fidl::encoding::DynamicFlags::empty(),
8205        )
8206    }
8207}
8208
8209#[must_use = "FIDL methods require a response to be sent"]
8210#[derive(Debug)]
8211pub struct TerminaGuestManagerGetInfoResponder {
8212    control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
8213    tx_id: u32,
8214}
8215
8216/// Set the the channel to be shutdown (see [`TerminaGuestManagerControlHandle::shutdown`])
8217/// if the responder is dropped without sending a response, so that the client
8218/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8219impl std::ops::Drop for TerminaGuestManagerGetInfoResponder {
8220    fn drop(&mut self) {
8221        self.control_handle.shutdown();
8222        // Safety: drops once, never accessed again
8223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8224    }
8225}
8226
8227impl fidl::endpoints::Responder for TerminaGuestManagerGetInfoResponder {
8228    type ControlHandle = TerminaGuestManagerControlHandle;
8229
8230    fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
8231        &self.control_handle
8232    }
8233
8234    fn drop_without_shutdown(mut self) {
8235        // Safety: drops once, never accessed again due to mem::forget
8236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8237        // Prevent Drop from running (which would shut down the channel)
8238        std::mem::forget(self);
8239    }
8240}
8241
8242impl TerminaGuestManagerGetInfoResponder {
8243    /// Sends a response to the FIDL transaction.
8244    ///
8245    /// Sets the channel to shutdown if an error occurs.
8246    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
8247        let _result = self.send_raw(guest_info);
8248        if _result.is_err() {
8249            self.control_handle.shutdown();
8250        }
8251        self.drop_without_shutdown();
8252        _result
8253    }
8254
8255    /// Similar to "send" but does not shutdown the channel if an error occurs.
8256    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
8257        let _result = self.send_raw(guest_info);
8258        self.drop_without_shutdown();
8259        _result
8260    }
8261
8262    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
8263        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
8264            (guest_info,),
8265            self.tx_id,
8266            0x76892614aea695dc,
8267            fidl::encoding::DynamicFlags::empty(),
8268        )
8269    }
8270}
8271
8272#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8273pub struct ZirconGuestManagerMarker;
8274
8275impl fidl::endpoints::ProtocolMarker for ZirconGuestManagerMarker {
8276    type Proxy = ZirconGuestManagerProxy;
8277    type RequestStream = ZirconGuestManagerRequestStream;
8278    #[cfg(target_os = "fuchsia")]
8279    type SynchronousProxy = ZirconGuestManagerSynchronousProxy;
8280
8281    const DEBUG_NAME: &'static str = "fuchsia.virtualization.ZirconGuestManager";
8282}
8283impl fidl::endpoints::DiscoverableProtocolMarker for ZirconGuestManagerMarker {}
8284
8285pub trait ZirconGuestManagerProxyInterface: Send + Sync {
8286    type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
8287        + Send;
8288    fn r#launch(
8289        &self,
8290        guest_config: GuestConfig,
8291        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8292    ) -> Self::LaunchResponseFut;
8293    type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8294    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
8295    type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
8296        + Send;
8297    fn r#connect(
8298        &self,
8299        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8300    ) -> Self::ConnectResponseFut;
8301    type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
8302    fn r#get_info(&self) -> Self::GetInfoResponseFut;
8303}
8304#[derive(Debug)]
8305#[cfg(target_os = "fuchsia")]
8306pub struct ZirconGuestManagerSynchronousProxy {
8307    client: fidl::client::sync::Client,
8308}
8309
8310#[cfg(target_os = "fuchsia")]
8311impl fidl::endpoints::SynchronousProxy for ZirconGuestManagerSynchronousProxy {
8312    type Proxy = ZirconGuestManagerProxy;
8313    type Protocol = ZirconGuestManagerMarker;
8314
8315    fn from_channel(inner: fidl::Channel) -> Self {
8316        Self::new(inner)
8317    }
8318
8319    fn into_channel(self) -> fidl::Channel {
8320        self.client.into_channel()
8321    }
8322
8323    fn as_channel(&self) -> &fidl::Channel {
8324        self.client.as_channel()
8325    }
8326}
8327
8328#[cfg(target_os = "fuchsia")]
8329impl ZirconGuestManagerSynchronousProxy {
8330    pub fn new(channel: fidl::Channel) -> Self {
8331        let protocol_name =
8332            <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8333        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8334    }
8335
8336    pub fn into_channel(self) -> fidl::Channel {
8337        self.client.into_channel()
8338    }
8339
8340    /// Waits until an event arrives and returns it. It is safe for other
8341    /// threads to make concurrent requests while waiting for an event.
8342    pub fn wait_for_event(
8343        &self,
8344        deadline: zx::MonotonicInstant,
8345    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
8346        ZirconGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
8347    }
8348
8349    /// Launch a new guest instance.
8350    ///
8351    /// Possible errors:
8352    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8353    ///         problems detected by the guest manager.
8354    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8355    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8356    ///         component logs for a more specific failure.
8357    pub fn r#launch(
8358        &self,
8359        mut guest_config: GuestConfig,
8360        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8361        ___deadline: zx::MonotonicInstant,
8362    ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8363        let _response =
8364            self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
8365                fidl::encoding::EmptyStruct,
8366                GuestManagerError,
8367            >>(
8368                (&mut guest_config, controller),
8369                0x394a2e29f750323e,
8370                fidl::encoding::DynamicFlags::empty(),
8371                ___deadline,
8372            )?;
8373        Ok(_response.map(|x| x))
8374    }
8375
8376    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8377    /// be used to launch another guest.
8378    pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
8379        let _response =
8380            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
8381                (),
8382                0x3ad9a012982f872d,
8383                fidl::encoding::DynamicFlags::empty(),
8384                ___deadline,
8385            )?;
8386        Ok(_response)
8387    }
8388
8389    /// Connect to a currently running guest.
8390    ///
8391    /// Possible errors:
8392    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8393    ///         has launched before attempting to reconnect.
8394    pub fn r#connect(
8395        &self,
8396        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8397        ___deadline: zx::MonotonicInstant,
8398    ) -> Result<GuestManagerConnectResult, fidl::Error> {
8399        let _response =
8400            self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
8401                fidl::encoding::EmptyStruct,
8402                GuestManagerError,
8403            >>(
8404                (controller,),
8405                0x4e489076e3bb15b4,
8406                fidl::encoding::DynamicFlags::empty(),
8407                ___deadline,
8408            )?;
8409        Ok(_response.map(|x| x))
8410    }
8411
8412    /// Query guest info
8413    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
8414        let _response =
8415            self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
8416                (),
8417                0x76892614aea695dc,
8418                fidl::encoding::DynamicFlags::empty(),
8419                ___deadline,
8420            )?;
8421        Ok(_response.guest_info)
8422    }
8423}
8424
8425#[cfg(target_os = "fuchsia")]
8426impl From<ZirconGuestManagerSynchronousProxy> for zx::Handle {
8427    fn from(value: ZirconGuestManagerSynchronousProxy) -> Self {
8428        value.into_channel().into()
8429    }
8430}
8431
8432#[cfg(target_os = "fuchsia")]
8433impl From<fidl::Channel> for ZirconGuestManagerSynchronousProxy {
8434    fn from(value: fidl::Channel) -> Self {
8435        Self::new(value)
8436    }
8437}
8438
8439#[cfg(target_os = "fuchsia")]
8440impl fidl::endpoints::FromClient for ZirconGuestManagerSynchronousProxy {
8441    type Protocol = ZirconGuestManagerMarker;
8442
8443    fn from_client(value: fidl::endpoints::ClientEnd<ZirconGuestManagerMarker>) -> Self {
8444        Self::new(value.into_channel())
8445    }
8446}
8447
8448#[derive(Debug, Clone)]
8449pub struct ZirconGuestManagerProxy {
8450    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8451}
8452
8453impl fidl::endpoints::Proxy for ZirconGuestManagerProxy {
8454    type Protocol = ZirconGuestManagerMarker;
8455
8456    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8457        Self::new(inner)
8458    }
8459
8460    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8461        self.client.into_channel().map_err(|client| Self { client })
8462    }
8463
8464    fn as_channel(&self) -> &::fidl::AsyncChannel {
8465        self.client.as_channel()
8466    }
8467}
8468
8469impl ZirconGuestManagerProxy {
8470    /// Create a new Proxy for fuchsia.virtualization/ZirconGuestManager.
8471    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8472        let protocol_name =
8473            <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8474        Self { client: fidl::client::Client::new(channel, protocol_name) }
8475    }
8476
8477    /// Get a Stream of events from the remote end of the protocol.
8478    ///
8479    /// # Panics
8480    ///
8481    /// Panics if the event stream was already taken.
8482    pub fn take_event_stream(&self) -> ZirconGuestManagerEventStream {
8483        ZirconGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
8484    }
8485
8486    /// Launch a new guest instance.
8487    ///
8488    /// Possible errors:
8489    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8490    ///         problems detected by the guest manager.
8491    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8492    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8493    ///         component logs for a more specific failure.
8494    pub fn r#launch(
8495        &self,
8496        mut guest_config: GuestConfig,
8497        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8498    ) -> fidl::client::QueryResponseFut<
8499        GuestManagerLaunchResult,
8500        fidl::encoding::DefaultFuchsiaResourceDialect,
8501    > {
8502        ZirconGuestManagerProxyInterface::r#launch(self, guest_config, controller)
8503    }
8504
8505    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8506    /// be used to launch another guest.
8507    pub fn r#force_shutdown(
8508        &self,
8509    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8510        ZirconGuestManagerProxyInterface::r#force_shutdown(self)
8511    }
8512
8513    /// Connect to a currently running guest.
8514    ///
8515    /// Possible errors:
8516    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8517    ///         has launched before attempting to reconnect.
8518    pub fn r#connect(
8519        &self,
8520        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8521    ) -> fidl::client::QueryResponseFut<
8522        GuestManagerConnectResult,
8523        fidl::encoding::DefaultFuchsiaResourceDialect,
8524    > {
8525        ZirconGuestManagerProxyInterface::r#connect(self, controller)
8526    }
8527
8528    /// Query guest info
8529    pub fn r#get_info(
8530        &self,
8531    ) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
8532    {
8533        ZirconGuestManagerProxyInterface::r#get_info(self)
8534    }
8535}
8536
8537impl ZirconGuestManagerProxyInterface for ZirconGuestManagerProxy {
8538    type LaunchResponseFut = fidl::client::QueryResponseFut<
8539        GuestManagerLaunchResult,
8540        fidl::encoding::DefaultFuchsiaResourceDialect,
8541    >;
8542    fn r#launch(
8543        &self,
8544        mut guest_config: GuestConfig,
8545        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8546    ) -> Self::LaunchResponseFut {
8547        fn _decode(
8548            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8549        ) -> Result<GuestManagerLaunchResult, fidl::Error> {
8550            let _response = fidl::client::decode_transaction_body::<
8551                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8552                fidl::encoding::DefaultFuchsiaResourceDialect,
8553                0x394a2e29f750323e,
8554            >(_buf?)?;
8555            Ok(_response.map(|x| x))
8556        }
8557        self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
8558            (&mut guest_config, controller),
8559            0x394a2e29f750323e,
8560            fidl::encoding::DynamicFlags::empty(),
8561            _decode,
8562        )
8563    }
8564
8565    type ForceShutdownResponseFut =
8566        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8567    fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
8568        fn _decode(
8569            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8570        ) -> Result<(), fidl::Error> {
8571            let _response = fidl::client::decode_transaction_body::<
8572                fidl::encoding::EmptyPayload,
8573                fidl::encoding::DefaultFuchsiaResourceDialect,
8574                0x3ad9a012982f872d,
8575            >(_buf?)?;
8576            Ok(_response)
8577        }
8578        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8579            (),
8580            0x3ad9a012982f872d,
8581            fidl::encoding::DynamicFlags::empty(),
8582            _decode,
8583        )
8584    }
8585
8586    type ConnectResponseFut = fidl::client::QueryResponseFut<
8587        GuestManagerConnectResult,
8588        fidl::encoding::DefaultFuchsiaResourceDialect,
8589    >;
8590    fn r#connect(
8591        &self,
8592        mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
8593    ) -> Self::ConnectResponseFut {
8594        fn _decode(
8595            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8596        ) -> Result<GuestManagerConnectResult, fidl::Error> {
8597            let _response = fidl::client::decode_transaction_body::<
8598                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
8599                fidl::encoding::DefaultFuchsiaResourceDialect,
8600                0x4e489076e3bb15b4,
8601            >(_buf?)?;
8602            Ok(_response.map(|x| x))
8603        }
8604        self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
8605            (controller,),
8606            0x4e489076e3bb15b4,
8607            fidl::encoding::DynamicFlags::empty(),
8608            _decode,
8609        )
8610    }
8611
8612    type GetInfoResponseFut =
8613        fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
8614    fn r#get_info(&self) -> Self::GetInfoResponseFut {
8615        fn _decode(
8616            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8617        ) -> Result<GuestInfo, fidl::Error> {
8618            let _response = fidl::client::decode_transaction_body::<
8619                GuestManagerGetInfoResponse,
8620                fidl::encoding::DefaultFuchsiaResourceDialect,
8621                0x76892614aea695dc,
8622            >(_buf?)?;
8623            Ok(_response.guest_info)
8624        }
8625        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
8626            (),
8627            0x76892614aea695dc,
8628            fidl::encoding::DynamicFlags::empty(),
8629            _decode,
8630        )
8631    }
8632}
8633
8634pub struct ZirconGuestManagerEventStream {
8635    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8636}
8637
8638impl std::marker::Unpin for ZirconGuestManagerEventStream {}
8639
8640impl futures::stream::FusedStream for ZirconGuestManagerEventStream {
8641    fn is_terminated(&self) -> bool {
8642        self.event_receiver.is_terminated()
8643    }
8644}
8645
8646impl futures::Stream for ZirconGuestManagerEventStream {
8647    type Item = Result<ZirconGuestManagerEvent, fidl::Error>;
8648
8649    fn poll_next(
8650        mut self: std::pin::Pin<&mut Self>,
8651        cx: &mut std::task::Context<'_>,
8652    ) -> std::task::Poll<Option<Self::Item>> {
8653        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8654            &mut self.event_receiver,
8655            cx
8656        )?) {
8657            Some(buf) => std::task::Poll::Ready(Some(ZirconGuestManagerEvent::decode(buf))),
8658            None => std::task::Poll::Ready(None),
8659        }
8660    }
8661}
8662
8663#[derive(Debug)]
8664pub enum ZirconGuestManagerEvent {}
8665
8666impl ZirconGuestManagerEvent {
8667    /// Decodes a message buffer as a [`ZirconGuestManagerEvent`].
8668    fn decode(
8669        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8670    ) -> Result<ZirconGuestManagerEvent, fidl::Error> {
8671        let (bytes, _handles) = buf.split_mut();
8672        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8673        debug_assert_eq!(tx_header.tx_id, 0);
8674        match tx_header.ordinal {
8675            _ => Err(fidl::Error::UnknownOrdinal {
8676                ordinal: tx_header.ordinal,
8677                protocol_name:
8678                    <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8679            }),
8680        }
8681    }
8682}
8683
8684/// A Stream of incoming requests for fuchsia.virtualization/ZirconGuestManager.
8685pub struct ZirconGuestManagerRequestStream {
8686    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8687    is_terminated: bool,
8688}
8689
8690impl std::marker::Unpin for ZirconGuestManagerRequestStream {}
8691
8692impl futures::stream::FusedStream for ZirconGuestManagerRequestStream {
8693    fn is_terminated(&self) -> bool {
8694        self.is_terminated
8695    }
8696}
8697
8698impl fidl::endpoints::RequestStream for ZirconGuestManagerRequestStream {
8699    type Protocol = ZirconGuestManagerMarker;
8700    type ControlHandle = ZirconGuestManagerControlHandle;
8701
8702    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8703        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8704    }
8705
8706    fn control_handle(&self) -> Self::ControlHandle {
8707        ZirconGuestManagerControlHandle { inner: self.inner.clone() }
8708    }
8709
8710    fn into_inner(
8711        self,
8712    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8713    {
8714        (self.inner, self.is_terminated)
8715    }
8716
8717    fn from_inner(
8718        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8719        is_terminated: bool,
8720    ) -> Self {
8721        Self { inner, is_terminated }
8722    }
8723}
8724
8725impl futures::Stream for ZirconGuestManagerRequestStream {
8726    type Item = Result<ZirconGuestManagerRequest, fidl::Error>;
8727
8728    fn poll_next(
8729        mut self: std::pin::Pin<&mut Self>,
8730        cx: &mut std::task::Context<'_>,
8731    ) -> std::task::Poll<Option<Self::Item>> {
8732        let this = &mut *self;
8733        if this.inner.check_shutdown(cx) {
8734            this.is_terminated = true;
8735            return std::task::Poll::Ready(None);
8736        }
8737        if this.is_terminated {
8738            panic!("polled ZirconGuestManagerRequestStream after completion");
8739        }
8740        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8741            |bytes, handles| {
8742                match this.inner.channel().read_etc(cx, bytes, handles) {
8743                    std::task::Poll::Ready(Ok(())) => {}
8744                    std::task::Poll::Pending => return std::task::Poll::Pending,
8745                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8746                        this.is_terminated = true;
8747                        return std::task::Poll::Ready(None);
8748                    }
8749                    std::task::Poll::Ready(Err(e)) => {
8750                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8751                            e.into(),
8752                        ))))
8753                    }
8754                }
8755
8756                // A message has been received from the channel
8757                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8758
8759                std::task::Poll::Ready(Some(match header.ordinal {
8760                0x394a2e29f750323e => {
8761                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8762                    let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8763                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
8764                    let control_handle = ZirconGuestManagerControlHandle {
8765                        inner: this.inner.clone(),
8766                    };
8767                    Ok(ZirconGuestManagerRequest::Launch {guest_config: req.guest_config,
8768controller: req.controller,
8769
8770                        responder: ZirconGuestManagerLaunchResponder {
8771                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8772                            tx_id: header.tx_id,
8773                        },
8774                    })
8775                }
8776                0x3ad9a012982f872d => {
8777                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8778                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8779                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8780                    let control_handle = ZirconGuestManagerControlHandle {
8781                        inner: this.inner.clone(),
8782                    };
8783                    Ok(ZirconGuestManagerRequest::ForceShutdown {
8784                        responder: ZirconGuestManagerForceShutdownResponder {
8785                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8786                            tx_id: header.tx_id,
8787                        },
8788                    })
8789                }
8790                0x4e489076e3bb15b4 => {
8791                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8792                    let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8793                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8794                    let control_handle = ZirconGuestManagerControlHandle {
8795                        inner: this.inner.clone(),
8796                    };
8797                    Ok(ZirconGuestManagerRequest::Connect {controller: req.controller,
8798
8799                        responder: ZirconGuestManagerConnectResponder {
8800                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8801                            tx_id: header.tx_id,
8802                        },
8803                    })
8804                }
8805                0x76892614aea695dc => {
8806                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8807                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8808                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8809                    let control_handle = ZirconGuestManagerControlHandle {
8810                        inner: this.inner.clone(),
8811                    };
8812                    Ok(ZirconGuestManagerRequest::GetInfo {
8813                        responder: ZirconGuestManagerGetInfoResponder {
8814                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8815                            tx_id: header.tx_id,
8816                        },
8817                    })
8818                }
8819                _ => Err(fidl::Error::UnknownOrdinal {
8820                    ordinal: header.ordinal,
8821                    protocol_name: <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8822                }),
8823            }))
8824            },
8825        )
8826    }
8827}
8828
8829#[derive(Debug)]
8830pub enum ZirconGuestManagerRequest {
8831    /// Launch a new guest instance.
8832    ///
8833    /// Possible errors:
8834    ///     - BAD_CONFIG: Failed to parse the config from the guest package, or other config
8835    ///         problems detected by the guest manager.
8836    ///     - ALREADY_RUNNING: The guest is already running. Stop the guest before launching again.
8837    ///     - START_FAILURE: Failed to initialize the VMM and devices, and start the guest. See
8838    ///         component logs for a more specific failure.
8839    Launch {
8840        guest_config: GuestConfig,
8841        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8842        responder: ZirconGuestManagerLaunchResponder,
8843    },
8844    /// Forcibly shuts down a running guest. Immediately after ForceShutdown returns, Launch can
8845    /// be used to launch another guest.
8846    ForceShutdown { responder: ZirconGuestManagerForceShutdownResponder },
8847    /// Connect to a currently running guest.
8848    ///
8849    /// Possible errors:
8850    ///     - NOT_RUNNING: Attempted to connect to a guest in a non-running state. Ensure the guest
8851    ///         has launched before attempting to reconnect.
8852    Connect {
8853        controller: fidl::endpoints::ServerEnd<GuestMarker>,
8854        responder: ZirconGuestManagerConnectResponder,
8855    },
8856    /// Query guest info
8857    GetInfo { responder: ZirconGuestManagerGetInfoResponder },
8858}
8859
8860impl ZirconGuestManagerRequest {
8861    #[allow(irrefutable_let_patterns)]
8862    pub fn into_launch(
8863        self,
8864    ) -> Option<(
8865        GuestConfig,
8866        fidl::endpoints::ServerEnd<GuestMarker>,
8867        ZirconGuestManagerLaunchResponder,
8868    )> {
8869        if let ZirconGuestManagerRequest::Launch { guest_config, controller, responder } = self {
8870            Some((guest_config, controller, responder))
8871        } else {
8872            None
8873        }
8874    }
8875
8876    #[allow(irrefutable_let_patterns)]
8877    pub fn into_force_shutdown(self) -> Option<(ZirconGuestManagerForceShutdownResponder)> {
8878        if let ZirconGuestManagerRequest::ForceShutdown { responder } = self {
8879            Some((responder))
8880        } else {
8881            None
8882        }
8883    }
8884
8885    #[allow(irrefutable_let_patterns)]
8886    pub fn into_connect(
8887        self,
8888    ) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, ZirconGuestManagerConnectResponder)> {
8889        if let ZirconGuestManagerRequest::Connect { controller, responder } = self {
8890            Some((controller, responder))
8891        } else {
8892            None
8893        }
8894    }
8895
8896    #[allow(irrefutable_let_patterns)]
8897    pub fn into_get_info(self) -> Option<(ZirconGuestManagerGetInfoResponder)> {
8898        if let ZirconGuestManagerRequest::GetInfo { responder } = self {
8899            Some((responder))
8900        } else {
8901            None
8902        }
8903    }
8904
8905    /// Name of the method defined in FIDL
8906    pub fn method_name(&self) -> &'static str {
8907        match *self {
8908            ZirconGuestManagerRequest::Launch { .. } => "launch",
8909            ZirconGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
8910            ZirconGuestManagerRequest::Connect { .. } => "connect",
8911            ZirconGuestManagerRequest::GetInfo { .. } => "get_info",
8912        }
8913    }
8914}
8915
8916#[derive(Debug, Clone)]
8917pub struct ZirconGuestManagerControlHandle {
8918    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8919}
8920
8921impl fidl::endpoints::ControlHandle for ZirconGuestManagerControlHandle {
8922    fn shutdown(&self) {
8923        self.inner.shutdown()
8924    }
8925    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8926        self.inner.shutdown_with_epitaph(status)
8927    }
8928
8929    fn is_closed(&self) -> bool {
8930        self.inner.channel().is_closed()
8931    }
8932    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8933        self.inner.channel().on_closed()
8934    }
8935
8936    #[cfg(target_os = "fuchsia")]
8937    fn signal_peer(
8938        &self,
8939        clear_mask: zx::Signals,
8940        set_mask: zx::Signals,
8941    ) -> Result<(), zx_status::Status> {
8942        use fidl::Peered;
8943        self.inner.channel().signal_peer(clear_mask, set_mask)
8944    }
8945}
8946
8947impl ZirconGuestManagerControlHandle {}
8948
8949#[must_use = "FIDL methods require a response to be sent"]
8950#[derive(Debug)]
8951pub struct ZirconGuestManagerLaunchResponder {
8952    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
8953    tx_id: u32,
8954}
8955
8956/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
8957/// if the responder is dropped without sending a response, so that the client
8958/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8959impl std::ops::Drop for ZirconGuestManagerLaunchResponder {
8960    fn drop(&mut self) {
8961        self.control_handle.shutdown();
8962        // Safety: drops once, never accessed again
8963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8964    }
8965}
8966
8967impl fidl::endpoints::Responder for ZirconGuestManagerLaunchResponder {
8968    type ControlHandle = ZirconGuestManagerControlHandle;
8969
8970    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
8971        &self.control_handle
8972    }
8973
8974    fn drop_without_shutdown(mut self) {
8975        // Safety: drops once, never accessed again due to mem::forget
8976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8977        // Prevent Drop from running (which would shut down the channel)
8978        std::mem::forget(self);
8979    }
8980}
8981
8982impl ZirconGuestManagerLaunchResponder {
8983    /// Sends a response to the FIDL transaction.
8984    ///
8985    /// Sets the channel to shutdown if an error occurs.
8986    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
8987        let _result = self.send_raw(result);
8988        if _result.is_err() {
8989            self.control_handle.shutdown();
8990        }
8991        self.drop_without_shutdown();
8992        _result
8993    }
8994
8995    /// Similar to "send" but does not shutdown the channel if an error occurs.
8996    pub fn send_no_shutdown_on_err(
8997        self,
8998        mut result: Result<(), GuestManagerError>,
8999    ) -> Result<(), fidl::Error> {
9000        let _result = self.send_raw(result);
9001        self.drop_without_shutdown();
9002        _result
9003    }
9004
9005    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9006        self.control_handle.inner.send::<fidl::encoding::ResultType<
9007            fidl::encoding::EmptyStruct,
9008            GuestManagerError,
9009        >>(
9010            result,
9011            self.tx_id,
9012            0x394a2e29f750323e,
9013            fidl::encoding::DynamicFlags::empty(),
9014        )
9015    }
9016}
9017
9018#[must_use = "FIDL methods require a response to be sent"]
9019#[derive(Debug)]
9020pub struct ZirconGuestManagerForceShutdownResponder {
9021    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9022    tx_id: u32,
9023}
9024
9025/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9026/// if the responder is dropped without sending a response, so that the client
9027/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9028impl std::ops::Drop for ZirconGuestManagerForceShutdownResponder {
9029    fn drop(&mut self) {
9030        self.control_handle.shutdown();
9031        // Safety: drops once, never accessed again
9032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9033    }
9034}
9035
9036impl fidl::endpoints::Responder for ZirconGuestManagerForceShutdownResponder {
9037    type ControlHandle = ZirconGuestManagerControlHandle;
9038
9039    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9040        &self.control_handle
9041    }
9042
9043    fn drop_without_shutdown(mut self) {
9044        // Safety: drops once, never accessed again due to mem::forget
9045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9046        // Prevent Drop from running (which would shut down the channel)
9047        std::mem::forget(self);
9048    }
9049}
9050
9051impl ZirconGuestManagerForceShutdownResponder {
9052    /// Sends a response to the FIDL transaction.
9053    ///
9054    /// Sets the channel to shutdown if an error occurs.
9055    pub fn send(self) -> Result<(), fidl::Error> {
9056        let _result = self.send_raw();
9057        if _result.is_err() {
9058            self.control_handle.shutdown();
9059        }
9060        self.drop_without_shutdown();
9061        _result
9062    }
9063
9064    /// Similar to "send" but does not shutdown the channel if an error occurs.
9065    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9066        let _result = self.send_raw();
9067        self.drop_without_shutdown();
9068        _result
9069    }
9070
9071    fn send_raw(&self) -> Result<(), fidl::Error> {
9072        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9073            (),
9074            self.tx_id,
9075            0x3ad9a012982f872d,
9076            fidl::encoding::DynamicFlags::empty(),
9077        )
9078    }
9079}
9080
9081#[must_use = "FIDL methods require a response to be sent"]
9082#[derive(Debug)]
9083pub struct ZirconGuestManagerConnectResponder {
9084    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9085    tx_id: u32,
9086}
9087
9088/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9089/// if the responder is dropped without sending a response, so that the client
9090/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9091impl std::ops::Drop for ZirconGuestManagerConnectResponder {
9092    fn drop(&mut self) {
9093        self.control_handle.shutdown();
9094        // Safety: drops once, never accessed again
9095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9096    }
9097}
9098
9099impl fidl::endpoints::Responder for ZirconGuestManagerConnectResponder {
9100    type ControlHandle = ZirconGuestManagerControlHandle;
9101
9102    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9103        &self.control_handle
9104    }
9105
9106    fn drop_without_shutdown(mut self) {
9107        // Safety: drops once, never accessed again due to mem::forget
9108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9109        // Prevent Drop from running (which would shut down the channel)
9110        std::mem::forget(self);
9111    }
9112}
9113
9114impl ZirconGuestManagerConnectResponder {
9115    /// Sends a response to the FIDL transaction.
9116    ///
9117    /// Sets the channel to shutdown if an error occurs.
9118    pub fn send(self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9119        let _result = self.send_raw(result);
9120        if _result.is_err() {
9121            self.control_handle.shutdown();
9122        }
9123        self.drop_without_shutdown();
9124        _result
9125    }
9126
9127    /// Similar to "send" but does not shutdown the channel if an error occurs.
9128    pub fn send_no_shutdown_on_err(
9129        self,
9130        mut result: Result<(), GuestManagerError>,
9131    ) -> Result<(), fidl::Error> {
9132        let _result = self.send_raw(result);
9133        self.drop_without_shutdown();
9134        _result
9135    }
9136
9137    fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
9138        self.control_handle.inner.send::<fidl::encoding::ResultType<
9139            fidl::encoding::EmptyStruct,
9140            GuestManagerError,
9141        >>(
9142            result,
9143            self.tx_id,
9144            0x4e489076e3bb15b4,
9145            fidl::encoding::DynamicFlags::empty(),
9146        )
9147    }
9148}
9149
9150#[must_use = "FIDL methods require a response to be sent"]
9151#[derive(Debug)]
9152pub struct ZirconGuestManagerGetInfoResponder {
9153    control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
9154    tx_id: u32,
9155}
9156
9157/// Set the the channel to be shutdown (see [`ZirconGuestManagerControlHandle::shutdown`])
9158/// if the responder is dropped without sending a response, so that the client
9159/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9160impl std::ops::Drop for ZirconGuestManagerGetInfoResponder {
9161    fn drop(&mut self) {
9162        self.control_handle.shutdown();
9163        // Safety: drops once, never accessed again
9164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9165    }
9166}
9167
9168impl fidl::endpoints::Responder for ZirconGuestManagerGetInfoResponder {
9169    type ControlHandle = ZirconGuestManagerControlHandle;
9170
9171    fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
9172        &self.control_handle
9173    }
9174
9175    fn drop_without_shutdown(mut self) {
9176        // Safety: drops once, never accessed again due to mem::forget
9177        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9178        // Prevent Drop from running (which would shut down the channel)
9179        std::mem::forget(self);
9180    }
9181}
9182
9183impl ZirconGuestManagerGetInfoResponder {
9184    /// Sends a response to the FIDL transaction.
9185    ///
9186    /// Sets the channel to shutdown if an error occurs.
9187    pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9188        let _result = self.send_raw(guest_info);
9189        if _result.is_err() {
9190            self.control_handle.shutdown();
9191        }
9192        self.drop_without_shutdown();
9193        _result
9194    }
9195
9196    /// Similar to "send" but does not shutdown the channel if an error occurs.
9197    pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9198        let _result = self.send_raw(guest_info);
9199        self.drop_without_shutdown();
9200        _result
9201    }
9202
9203    fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
9204        self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
9205            (guest_info,),
9206            self.tx_id,
9207            0x76892614aea695dc,
9208            fidl::encoding::DynamicFlags::empty(),
9209        )
9210    }
9211}
9212
9213mod internal {
9214    use super::*;
9215
9216    impl fidl::encoding::ResourceTypeMarker for BlockSpec {
9217        type Borrowed<'a> = &'a mut Self;
9218        fn take_or_borrow<'a>(
9219            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9220        ) -> Self::Borrowed<'a> {
9221            value
9222        }
9223    }
9224
9225    unsafe impl fidl::encoding::TypeMarker for BlockSpec {
9226        type Owned = Self;
9227
9228        #[inline(always)]
9229        fn inline_align(_context: fidl::encoding::Context) -> usize {
9230            8
9231        }
9232
9233        #[inline(always)]
9234        fn inline_size(_context: fidl::encoding::Context) -> usize {
9235            40
9236        }
9237    }
9238
9239    unsafe impl fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
9240        for &mut BlockSpec
9241    {
9242        #[inline]
9243        unsafe fn encode(
9244            self,
9245            encoder: &mut fidl::encoding::Encoder<
9246                '_,
9247                fidl::encoding::DefaultFuchsiaResourceDialect,
9248            >,
9249            offset: usize,
9250            _depth: fidl::encoding::Depth,
9251        ) -> fidl::Result<()> {
9252            encoder.debug_check_bounds::<BlockSpec>(offset);
9253            // Delegate to tuple encoding.
9254            fidl::encoding::Encode::<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9255                (
9256                    <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
9257                    <BlockMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
9258                    <BlockFormat as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.format),
9259                ),
9260                encoder, offset, _depth
9261            )
9262        }
9263    }
9264    unsafe impl<
9265            T0: fidl::encoding::Encode<
9266                fidl::encoding::BoundedString<20>,
9267                fidl::encoding::DefaultFuchsiaResourceDialect,
9268            >,
9269            T1: fidl::encoding::Encode<BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
9270            T2: fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
9271        > fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
9272        for (T0, T1, T2)
9273    {
9274        #[inline]
9275        unsafe fn encode(
9276            self,
9277            encoder: &mut fidl::encoding::Encoder<
9278                '_,
9279                fidl::encoding::DefaultFuchsiaResourceDialect,
9280            >,
9281            offset: usize,
9282            depth: fidl::encoding::Depth,
9283        ) -> fidl::Result<()> {
9284            encoder.debug_check_bounds::<BlockSpec>(offset);
9285            // Zero out padding regions. There's no need to apply masks
9286            // because the unmasked parts will be overwritten by fields.
9287            unsafe {
9288                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9289                (ptr as *mut u64).write_unaligned(0);
9290            }
9291            // Write the fields.
9292            self.0.encode(encoder, offset + 0, depth)?;
9293            self.1.encode(encoder, offset + 16, depth)?;
9294            self.2.encode(encoder, offset + 24, depth)?;
9295            Ok(())
9296        }
9297    }
9298
9299    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {
9300        #[inline(always)]
9301        fn new_empty() -> Self {
9302            Self {
9303                id: fidl::new_empty!(
9304                    fidl::encoding::BoundedString<20>,
9305                    fidl::encoding::DefaultFuchsiaResourceDialect
9306                ),
9307                mode: fidl::new_empty!(BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect),
9308                format: fidl::new_empty!(
9309                    BlockFormat,
9310                    fidl::encoding::DefaultFuchsiaResourceDialect
9311                ),
9312            }
9313        }
9314
9315        #[inline]
9316        unsafe fn decode(
9317            &mut self,
9318            decoder: &mut fidl::encoding::Decoder<
9319                '_,
9320                fidl::encoding::DefaultFuchsiaResourceDialect,
9321            >,
9322            offset: usize,
9323            _depth: fidl::encoding::Depth,
9324        ) -> fidl::Result<()> {
9325            decoder.debug_check_bounds::<Self>(offset);
9326            // Verify that padding bytes are zero.
9327            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9328            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9329            let mask = 0xffffffff00000000u64;
9330            let maskedval = padval & mask;
9331            if maskedval != 0 {
9332                return Err(fidl::Error::NonZeroPadding {
9333                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9334                });
9335            }
9336            fidl::decode!(
9337                fidl::encoding::BoundedString<20>,
9338                fidl::encoding::DefaultFuchsiaResourceDialect,
9339                &mut self.id,
9340                decoder,
9341                offset + 0,
9342                _depth
9343            )?;
9344            fidl::decode!(
9345                BlockMode,
9346                fidl::encoding::DefaultFuchsiaResourceDialect,
9347                &mut self.mode,
9348                decoder,
9349                offset + 16,
9350                _depth
9351            )?;
9352            fidl::decode!(
9353                BlockFormat,
9354                fidl::encoding::DefaultFuchsiaResourceDialect,
9355                &mut self.format,
9356                decoder,
9357                offset + 24,
9358                _depth
9359            )?;
9360            Ok(())
9361        }
9362    }
9363
9364    impl fidl::encoding::ResourceTypeMarker for GuestGetBalloonControllerRequest {
9365        type Borrowed<'a> = &'a mut Self;
9366        fn take_or_borrow<'a>(
9367            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9368        ) -> Self::Borrowed<'a> {
9369            value
9370        }
9371    }
9372
9373    unsafe impl fidl::encoding::TypeMarker for GuestGetBalloonControllerRequest {
9374        type Owned = Self;
9375
9376        #[inline(always)]
9377        fn inline_align(_context: fidl::encoding::Context) -> usize {
9378            4
9379        }
9380
9381        #[inline(always)]
9382        fn inline_size(_context: fidl::encoding::Context) -> usize {
9383            4
9384        }
9385    }
9386
9387    unsafe impl
9388        fidl::encoding::Encode<
9389            GuestGetBalloonControllerRequest,
9390            fidl::encoding::DefaultFuchsiaResourceDialect,
9391        > for &mut GuestGetBalloonControllerRequest
9392    {
9393        #[inline]
9394        unsafe fn encode(
9395            self,
9396            encoder: &mut fidl::encoding::Encoder<
9397                '_,
9398                fidl::encoding::DefaultFuchsiaResourceDialect,
9399            >,
9400            offset: usize,
9401            _depth: fidl::encoding::Depth,
9402        ) -> fidl::Result<()> {
9403            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
9404            // Delegate to tuple encoding.
9405            fidl::encoding::Encode::<GuestGetBalloonControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9406                (
9407                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
9408                ),
9409                encoder, offset, _depth
9410            )
9411        }
9412    }
9413    unsafe impl<
9414            T0: fidl::encoding::Encode<
9415                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
9416                fidl::encoding::DefaultFuchsiaResourceDialect,
9417            >,
9418        >
9419        fidl::encoding::Encode<
9420            GuestGetBalloonControllerRequest,
9421            fidl::encoding::DefaultFuchsiaResourceDialect,
9422        > for (T0,)
9423    {
9424        #[inline]
9425        unsafe fn encode(
9426            self,
9427            encoder: &mut fidl::encoding::Encoder<
9428                '_,
9429                fidl::encoding::DefaultFuchsiaResourceDialect,
9430            >,
9431            offset: usize,
9432            depth: fidl::encoding::Depth,
9433        ) -> fidl::Result<()> {
9434            encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
9435            // Zero out padding regions. There's no need to apply masks
9436            // because the unmasked parts will be overwritten by fields.
9437            // Write the fields.
9438            self.0.encode(encoder, offset + 0, depth)?;
9439            Ok(())
9440        }
9441    }
9442
9443    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9444        for GuestGetBalloonControllerRequest
9445    {
9446        #[inline(always)]
9447        fn new_empty() -> Self {
9448            Self {
9449                controller: fidl::new_empty!(
9450                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
9451                    fidl::encoding::DefaultFuchsiaResourceDialect
9452                ),
9453            }
9454        }
9455
9456        #[inline]
9457        unsafe fn decode(
9458            &mut self,
9459            decoder: &mut fidl::encoding::Decoder<
9460                '_,
9461                fidl::encoding::DefaultFuchsiaResourceDialect,
9462            >,
9463            offset: usize,
9464            _depth: fidl::encoding::Depth,
9465        ) -> fidl::Result<()> {
9466            decoder.debug_check_bounds::<Self>(offset);
9467            // Verify that padding bytes are zero.
9468            fidl::decode!(
9469                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
9470                fidl::encoding::DefaultFuchsiaResourceDialect,
9471                &mut self.controller,
9472                decoder,
9473                offset + 0,
9474                _depth
9475            )?;
9476            Ok(())
9477        }
9478    }
9479
9480    impl fidl::encoding::ResourceTypeMarker for GuestGetHostVsockEndpointRequest {
9481        type Borrowed<'a> = &'a mut Self;
9482        fn take_or_borrow<'a>(
9483            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9484        ) -> Self::Borrowed<'a> {
9485            value
9486        }
9487    }
9488
9489    unsafe impl fidl::encoding::TypeMarker for GuestGetHostVsockEndpointRequest {
9490        type Owned = Self;
9491
9492        #[inline(always)]
9493        fn inline_align(_context: fidl::encoding::Context) -> usize {
9494            4
9495        }
9496
9497        #[inline(always)]
9498        fn inline_size(_context: fidl::encoding::Context) -> usize {
9499            4
9500        }
9501    }
9502
9503    unsafe impl
9504        fidl::encoding::Encode<
9505            GuestGetHostVsockEndpointRequest,
9506            fidl::encoding::DefaultFuchsiaResourceDialect,
9507        > for &mut GuestGetHostVsockEndpointRequest
9508    {
9509        #[inline]
9510        unsafe fn encode(
9511            self,
9512            encoder: &mut fidl::encoding::Encoder<
9513                '_,
9514                fidl::encoding::DefaultFuchsiaResourceDialect,
9515            >,
9516            offset: usize,
9517            _depth: fidl::encoding::Depth,
9518        ) -> fidl::Result<()> {
9519            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
9520            // Delegate to tuple encoding.
9521            fidl::encoding::Encode::<GuestGetHostVsockEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9522                (
9523                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
9524                ),
9525                encoder, offset, _depth
9526            )
9527        }
9528    }
9529    unsafe impl<
9530            T0: fidl::encoding::Encode<
9531                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
9532                fidl::encoding::DefaultFuchsiaResourceDialect,
9533            >,
9534        >
9535        fidl::encoding::Encode<
9536            GuestGetHostVsockEndpointRequest,
9537            fidl::encoding::DefaultFuchsiaResourceDialect,
9538        > for (T0,)
9539    {
9540        #[inline]
9541        unsafe fn encode(
9542            self,
9543            encoder: &mut fidl::encoding::Encoder<
9544                '_,
9545                fidl::encoding::DefaultFuchsiaResourceDialect,
9546            >,
9547            offset: usize,
9548            depth: fidl::encoding::Depth,
9549        ) -> fidl::Result<()> {
9550            encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
9551            // Zero out padding regions. There's no need to apply masks
9552            // because the unmasked parts will be overwritten by fields.
9553            // Write the fields.
9554            self.0.encode(encoder, offset + 0, depth)?;
9555            Ok(())
9556        }
9557    }
9558
9559    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9560        for GuestGetHostVsockEndpointRequest
9561    {
9562        #[inline(always)]
9563        fn new_empty() -> Self {
9564            Self {
9565                endpoint: fidl::new_empty!(
9566                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
9567                    fidl::encoding::DefaultFuchsiaResourceDialect
9568                ),
9569            }
9570        }
9571
9572        #[inline]
9573        unsafe fn decode(
9574            &mut self,
9575            decoder: &mut fidl::encoding::Decoder<
9576                '_,
9577                fidl::encoding::DefaultFuchsiaResourceDialect,
9578            >,
9579            offset: usize,
9580            _depth: fidl::encoding::Depth,
9581        ) -> fidl::Result<()> {
9582            decoder.debug_check_bounds::<Self>(offset);
9583            // Verify that padding bytes are zero.
9584            fidl::decode!(
9585                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
9586                fidl::encoding::DefaultFuchsiaResourceDialect,
9587                &mut self.endpoint,
9588                decoder,
9589                offset + 0,
9590                _depth
9591            )?;
9592            Ok(())
9593        }
9594    }
9595
9596    impl fidl::encoding::ResourceTypeMarker for GuestGetMemControllerRequest {
9597        type Borrowed<'a> = &'a mut Self;
9598        fn take_or_borrow<'a>(
9599            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9600        ) -> Self::Borrowed<'a> {
9601            value
9602        }
9603    }
9604
9605    unsafe impl fidl::encoding::TypeMarker for GuestGetMemControllerRequest {
9606        type Owned = Self;
9607
9608        #[inline(always)]
9609        fn inline_align(_context: fidl::encoding::Context) -> usize {
9610            4
9611        }
9612
9613        #[inline(always)]
9614        fn inline_size(_context: fidl::encoding::Context) -> usize {
9615            4
9616        }
9617    }
9618
9619    unsafe impl
9620        fidl::encoding::Encode<
9621            GuestGetMemControllerRequest,
9622            fidl::encoding::DefaultFuchsiaResourceDialect,
9623        > for &mut GuestGetMemControllerRequest
9624    {
9625        #[inline]
9626        unsafe fn encode(
9627            self,
9628            encoder: &mut fidl::encoding::Encoder<
9629                '_,
9630                fidl::encoding::DefaultFuchsiaResourceDialect,
9631            >,
9632            offset: usize,
9633            _depth: fidl::encoding::Depth,
9634        ) -> fidl::Result<()> {
9635            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
9636            // Delegate to tuple encoding.
9637            fidl::encoding::Encode::<GuestGetMemControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9638                (
9639                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
9640                ),
9641                encoder, offset, _depth
9642            )
9643        }
9644    }
9645    unsafe impl<
9646            T0: fidl::encoding::Encode<
9647                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
9648                fidl::encoding::DefaultFuchsiaResourceDialect,
9649            >,
9650        >
9651        fidl::encoding::Encode<
9652            GuestGetMemControllerRequest,
9653            fidl::encoding::DefaultFuchsiaResourceDialect,
9654        > for (T0,)
9655    {
9656        #[inline]
9657        unsafe fn encode(
9658            self,
9659            encoder: &mut fidl::encoding::Encoder<
9660                '_,
9661                fidl::encoding::DefaultFuchsiaResourceDialect,
9662            >,
9663            offset: usize,
9664            depth: fidl::encoding::Depth,
9665        ) -> fidl::Result<()> {
9666            encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
9667            // Zero out padding regions. There's no need to apply masks
9668            // because the unmasked parts will be overwritten by fields.
9669            // Write the fields.
9670            self.0.encode(encoder, offset + 0, depth)?;
9671            Ok(())
9672        }
9673    }
9674
9675    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9676        for GuestGetMemControllerRequest
9677    {
9678        #[inline(always)]
9679        fn new_empty() -> Self {
9680            Self {
9681                controller: fidl::new_empty!(
9682                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
9683                    fidl::encoding::DefaultFuchsiaResourceDialect
9684                ),
9685            }
9686        }
9687
9688        #[inline]
9689        unsafe fn decode(
9690            &mut self,
9691            decoder: &mut fidl::encoding::Decoder<
9692                '_,
9693                fidl::encoding::DefaultFuchsiaResourceDialect,
9694            >,
9695            offset: usize,
9696            _depth: fidl::encoding::Depth,
9697        ) -> fidl::Result<()> {
9698            decoder.debug_check_bounds::<Self>(offset);
9699            // Verify that padding bytes are zero.
9700            fidl::decode!(
9701                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
9702                fidl::encoding::DefaultFuchsiaResourceDialect,
9703                &mut self.controller,
9704                decoder,
9705                offset + 0,
9706                _depth
9707            )?;
9708            Ok(())
9709        }
9710    }
9711
9712    impl fidl::encoding::ResourceTypeMarker for GuestGetSerialResponse {
9713        type Borrowed<'a> = &'a mut Self;
9714        fn take_or_borrow<'a>(
9715            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9716        ) -> Self::Borrowed<'a> {
9717            value
9718        }
9719    }
9720
9721    unsafe impl fidl::encoding::TypeMarker for GuestGetSerialResponse {
9722        type Owned = Self;
9723
9724        #[inline(always)]
9725        fn inline_align(_context: fidl::encoding::Context) -> usize {
9726            4
9727        }
9728
9729        #[inline(always)]
9730        fn inline_size(_context: fidl::encoding::Context) -> usize {
9731            4
9732        }
9733    }
9734
9735    unsafe impl
9736        fidl::encoding::Encode<
9737            GuestGetSerialResponse,
9738            fidl::encoding::DefaultFuchsiaResourceDialect,
9739        > for &mut GuestGetSerialResponse
9740    {
9741        #[inline]
9742        unsafe fn encode(
9743            self,
9744            encoder: &mut fidl::encoding::Encoder<
9745                '_,
9746                fidl::encoding::DefaultFuchsiaResourceDialect,
9747            >,
9748            offset: usize,
9749            _depth: fidl::encoding::Depth,
9750        ) -> fidl::Result<()> {
9751            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
9752            // Delegate to tuple encoding.
9753            fidl::encoding::Encode::<
9754                GuestGetSerialResponse,
9755                fidl::encoding::DefaultFuchsiaResourceDialect,
9756            >::encode(
9757                (<fidl::encoding::HandleType<
9758                    fidl::Socket,
9759                    { fidl::ObjectType::SOCKET.into_raw() },
9760                    2147483648,
9761                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9762                    &mut self.socket
9763                ),),
9764                encoder,
9765                offset,
9766                _depth,
9767            )
9768        }
9769    }
9770    unsafe impl<
9771            T0: fidl::encoding::Encode<
9772                fidl::encoding::HandleType<
9773                    fidl::Socket,
9774                    { fidl::ObjectType::SOCKET.into_raw() },
9775                    2147483648,
9776                >,
9777                fidl::encoding::DefaultFuchsiaResourceDialect,
9778            >,
9779        >
9780        fidl::encoding::Encode<
9781            GuestGetSerialResponse,
9782            fidl::encoding::DefaultFuchsiaResourceDialect,
9783        > for (T0,)
9784    {
9785        #[inline]
9786        unsafe fn encode(
9787            self,
9788            encoder: &mut fidl::encoding::Encoder<
9789                '_,
9790                fidl::encoding::DefaultFuchsiaResourceDialect,
9791            >,
9792            offset: usize,
9793            depth: fidl::encoding::Depth,
9794        ) -> fidl::Result<()> {
9795            encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
9796            // Zero out padding regions. There's no need to apply masks
9797            // because the unmasked parts will be overwritten by fields.
9798            // Write the fields.
9799            self.0.encode(encoder, offset + 0, depth)?;
9800            Ok(())
9801        }
9802    }
9803
9804    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9805        for GuestGetSerialResponse
9806    {
9807        #[inline(always)]
9808        fn new_empty() -> Self {
9809            Self {
9810                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9811            }
9812        }
9813
9814        #[inline]
9815        unsafe fn decode(
9816            &mut self,
9817            decoder: &mut fidl::encoding::Decoder<
9818                '_,
9819                fidl::encoding::DefaultFuchsiaResourceDialect,
9820            >,
9821            offset: usize,
9822            _depth: fidl::encoding::Depth,
9823        ) -> fidl::Result<()> {
9824            decoder.debug_check_bounds::<Self>(offset);
9825            // Verify that padding bytes are zero.
9826            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
9827            Ok(())
9828        }
9829    }
9830
9831    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleBindRequest {
9832        type Borrowed<'a> = &'a mut Self;
9833        fn take_or_borrow<'a>(
9834            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9835        ) -> Self::Borrowed<'a> {
9836            value
9837        }
9838    }
9839
9840    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleBindRequest {
9841        type Owned = Self;
9842
9843        #[inline(always)]
9844        fn inline_align(_context: fidl::encoding::Context) -> usize {
9845            4
9846        }
9847
9848        #[inline(always)]
9849        fn inline_size(_context: fidl::encoding::Context) -> usize {
9850            4
9851        }
9852    }
9853
9854    unsafe impl
9855        fidl::encoding::Encode<
9856            GuestLifecycleBindRequest,
9857            fidl::encoding::DefaultFuchsiaResourceDialect,
9858        > for &mut GuestLifecycleBindRequest
9859    {
9860        #[inline]
9861        unsafe fn encode(
9862            self,
9863            encoder: &mut fidl::encoding::Encoder<
9864                '_,
9865                fidl::encoding::DefaultFuchsiaResourceDialect,
9866            >,
9867            offset: usize,
9868            _depth: fidl::encoding::Depth,
9869        ) -> fidl::Result<()> {
9870            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
9871            // Delegate to tuple encoding.
9872            fidl::encoding::Encode::<GuestLifecycleBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9873                (
9874                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
9875                ),
9876                encoder, offset, _depth
9877            )
9878        }
9879    }
9880    unsafe impl<
9881            T0: fidl::encoding::Encode<
9882                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
9883                fidl::encoding::DefaultFuchsiaResourceDialect,
9884            >,
9885        >
9886        fidl::encoding::Encode<
9887            GuestLifecycleBindRequest,
9888            fidl::encoding::DefaultFuchsiaResourceDialect,
9889        > for (T0,)
9890    {
9891        #[inline]
9892        unsafe fn encode(
9893            self,
9894            encoder: &mut fidl::encoding::Encoder<
9895                '_,
9896                fidl::encoding::DefaultFuchsiaResourceDialect,
9897            >,
9898            offset: usize,
9899            depth: fidl::encoding::Depth,
9900        ) -> fidl::Result<()> {
9901            encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
9902            // Zero out padding regions. There's no need to apply masks
9903            // because the unmasked parts will be overwritten by fields.
9904            // Write the fields.
9905            self.0.encode(encoder, offset + 0, depth)?;
9906            Ok(())
9907        }
9908    }
9909
9910    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9911        for GuestLifecycleBindRequest
9912    {
9913        #[inline(always)]
9914        fn new_empty() -> Self {
9915            Self {
9916                guest: fidl::new_empty!(
9917                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
9918                    fidl::encoding::DefaultFuchsiaResourceDialect
9919                ),
9920            }
9921        }
9922
9923        #[inline]
9924        unsafe fn decode(
9925            &mut self,
9926            decoder: &mut fidl::encoding::Decoder<
9927                '_,
9928                fidl::encoding::DefaultFuchsiaResourceDialect,
9929            >,
9930            offset: usize,
9931            _depth: fidl::encoding::Depth,
9932        ) -> fidl::Result<()> {
9933            decoder.debug_check_bounds::<Self>(offset);
9934            // Verify that padding bytes are zero.
9935            fidl::decode!(
9936                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
9937                fidl::encoding::DefaultFuchsiaResourceDialect,
9938                &mut self.guest,
9939                decoder,
9940                offset + 0,
9941                _depth
9942            )?;
9943            Ok(())
9944        }
9945    }
9946
9947    impl fidl::encoding::ResourceTypeMarker for GuestLifecycleCreateRequest {
9948        type Borrowed<'a> = &'a mut Self;
9949        fn take_or_borrow<'a>(
9950            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9951        ) -> Self::Borrowed<'a> {
9952            value
9953        }
9954    }
9955
9956    unsafe impl fidl::encoding::TypeMarker for GuestLifecycleCreateRequest {
9957        type Owned = Self;
9958
9959        #[inline(always)]
9960        fn inline_align(_context: fidl::encoding::Context) -> usize {
9961            8
9962        }
9963
9964        #[inline(always)]
9965        fn inline_size(_context: fidl::encoding::Context) -> usize {
9966            16
9967        }
9968    }
9969
9970    unsafe impl
9971        fidl::encoding::Encode<
9972            GuestLifecycleCreateRequest,
9973            fidl::encoding::DefaultFuchsiaResourceDialect,
9974        > for &mut GuestLifecycleCreateRequest
9975    {
9976        #[inline]
9977        unsafe fn encode(
9978            self,
9979            encoder: &mut fidl::encoding::Encoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            _depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
9987            // Delegate to tuple encoding.
9988            fidl::encoding::Encode::<
9989                GuestLifecycleCreateRequest,
9990                fidl::encoding::DefaultFuchsiaResourceDialect,
9991            >::encode(
9992                (<GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9993                    &mut self.guest_config,
9994                ),),
9995                encoder,
9996                offset,
9997                _depth,
9998            )
9999        }
10000    }
10001    unsafe impl<
10002            T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
10003        >
10004        fidl::encoding::Encode<
10005            GuestLifecycleCreateRequest,
10006            fidl::encoding::DefaultFuchsiaResourceDialect,
10007        > for (T0,)
10008    {
10009        #[inline]
10010        unsafe fn encode(
10011            self,
10012            encoder: &mut fidl::encoding::Encoder<
10013                '_,
10014                fidl::encoding::DefaultFuchsiaResourceDialect,
10015            >,
10016            offset: usize,
10017            depth: fidl::encoding::Depth,
10018        ) -> fidl::Result<()> {
10019            encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
10020            // Zero out padding regions. There's no need to apply masks
10021            // because the unmasked parts will be overwritten by fields.
10022            // Write the fields.
10023            self.0.encode(encoder, offset + 0, depth)?;
10024            Ok(())
10025        }
10026    }
10027
10028    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10029        for GuestLifecycleCreateRequest
10030    {
10031        #[inline(always)]
10032        fn new_empty() -> Self {
10033            Self {
10034                guest_config: fidl::new_empty!(
10035                    GuestConfig,
10036                    fidl::encoding::DefaultFuchsiaResourceDialect
10037                ),
10038            }
10039        }
10040
10041        #[inline]
10042        unsafe fn decode(
10043            &mut self,
10044            decoder: &mut fidl::encoding::Decoder<
10045                '_,
10046                fidl::encoding::DefaultFuchsiaResourceDialect,
10047            >,
10048            offset: usize,
10049            _depth: fidl::encoding::Depth,
10050        ) -> fidl::Result<()> {
10051            decoder.debug_check_bounds::<Self>(offset);
10052            // Verify that padding bytes are zero.
10053            fidl::decode!(
10054                GuestConfig,
10055                fidl::encoding::DefaultFuchsiaResourceDialect,
10056                &mut self.guest_config,
10057                decoder,
10058                offset + 0,
10059                _depth
10060            )?;
10061            Ok(())
10062        }
10063    }
10064
10065    impl fidl::encoding::ResourceTypeMarker for GuestManagerConnectRequest {
10066        type Borrowed<'a> = &'a mut Self;
10067        fn take_or_borrow<'a>(
10068            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10069        ) -> Self::Borrowed<'a> {
10070            value
10071        }
10072    }
10073
10074    unsafe impl fidl::encoding::TypeMarker for GuestManagerConnectRequest {
10075        type Owned = Self;
10076
10077        #[inline(always)]
10078        fn inline_align(_context: fidl::encoding::Context) -> usize {
10079            4
10080        }
10081
10082        #[inline(always)]
10083        fn inline_size(_context: fidl::encoding::Context) -> usize {
10084            4
10085        }
10086    }
10087
10088    unsafe impl
10089        fidl::encoding::Encode<
10090            GuestManagerConnectRequest,
10091            fidl::encoding::DefaultFuchsiaResourceDialect,
10092        > for &mut GuestManagerConnectRequest
10093    {
10094        #[inline]
10095        unsafe fn encode(
10096            self,
10097            encoder: &mut fidl::encoding::Encoder<
10098                '_,
10099                fidl::encoding::DefaultFuchsiaResourceDialect,
10100            >,
10101            offset: usize,
10102            _depth: fidl::encoding::Depth,
10103        ) -> fidl::Result<()> {
10104            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
10105            // Delegate to tuple encoding.
10106            fidl::encoding::Encode::<GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10107                (
10108                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10109                ),
10110                encoder, offset, _depth
10111            )
10112        }
10113    }
10114    unsafe impl<
10115            T0: fidl::encoding::Encode<
10116                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10117                fidl::encoding::DefaultFuchsiaResourceDialect,
10118            >,
10119        >
10120        fidl::encoding::Encode<
10121            GuestManagerConnectRequest,
10122            fidl::encoding::DefaultFuchsiaResourceDialect,
10123        > for (T0,)
10124    {
10125        #[inline]
10126        unsafe fn encode(
10127            self,
10128            encoder: &mut fidl::encoding::Encoder<
10129                '_,
10130                fidl::encoding::DefaultFuchsiaResourceDialect,
10131            >,
10132            offset: usize,
10133            depth: fidl::encoding::Depth,
10134        ) -> fidl::Result<()> {
10135            encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
10136            // Zero out padding regions. There's no need to apply masks
10137            // because the unmasked parts will be overwritten by fields.
10138            // Write the fields.
10139            self.0.encode(encoder, offset + 0, depth)?;
10140            Ok(())
10141        }
10142    }
10143
10144    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10145        for GuestManagerConnectRequest
10146    {
10147        #[inline(always)]
10148        fn new_empty() -> Self {
10149            Self {
10150                controller: fidl::new_empty!(
10151                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10152                    fidl::encoding::DefaultFuchsiaResourceDialect
10153                ),
10154            }
10155        }
10156
10157        #[inline]
10158        unsafe fn decode(
10159            &mut self,
10160            decoder: &mut fidl::encoding::Decoder<
10161                '_,
10162                fidl::encoding::DefaultFuchsiaResourceDialect,
10163            >,
10164            offset: usize,
10165            _depth: fidl::encoding::Depth,
10166        ) -> fidl::Result<()> {
10167            decoder.debug_check_bounds::<Self>(offset);
10168            // Verify that padding bytes are zero.
10169            fidl::decode!(
10170                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10171                fidl::encoding::DefaultFuchsiaResourceDialect,
10172                &mut self.controller,
10173                decoder,
10174                offset + 0,
10175                _depth
10176            )?;
10177            Ok(())
10178        }
10179    }
10180
10181    impl fidl::encoding::ResourceTypeMarker for GuestManagerGetInfoResponse {
10182        type Borrowed<'a> = &'a mut Self;
10183        fn take_or_borrow<'a>(
10184            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10185        ) -> Self::Borrowed<'a> {
10186            value
10187        }
10188    }
10189
10190    unsafe impl fidl::encoding::TypeMarker for GuestManagerGetInfoResponse {
10191        type Owned = Self;
10192
10193        #[inline(always)]
10194        fn inline_align(_context: fidl::encoding::Context) -> usize {
10195            8
10196        }
10197
10198        #[inline(always)]
10199        fn inline_size(_context: fidl::encoding::Context) -> usize {
10200            16
10201        }
10202    }
10203
10204    unsafe impl
10205        fidl::encoding::Encode<
10206            GuestManagerGetInfoResponse,
10207            fidl::encoding::DefaultFuchsiaResourceDialect,
10208        > for &mut GuestManagerGetInfoResponse
10209    {
10210        #[inline]
10211        unsafe fn encode(
10212            self,
10213            encoder: &mut fidl::encoding::Encoder<
10214                '_,
10215                fidl::encoding::DefaultFuchsiaResourceDialect,
10216            >,
10217            offset: usize,
10218            _depth: fidl::encoding::Depth,
10219        ) -> fidl::Result<()> {
10220            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
10221            // Delegate to tuple encoding.
10222            fidl::encoding::Encode::<
10223                GuestManagerGetInfoResponse,
10224                fidl::encoding::DefaultFuchsiaResourceDialect,
10225            >::encode(
10226                (<GuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_info),),
10227                encoder,
10228                offset,
10229                _depth,
10230            )
10231        }
10232    }
10233    unsafe impl<T0: fidl::encoding::Encode<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
10234        fidl::encoding::Encode<
10235            GuestManagerGetInfoResponse,
10236            fidl::encoding::DefaultFuchsiaResourceDialect,
10237        > for (T0,)
10238    {
10239        #[inline]
10240        unsafe fn encode(
10241            self,
10242            encoder: &mut fidl::encoding::Encoder<
10243                '_,
10244                fidl::encoding::DefaultFuchsiaResourceDialect,
10245            >,
10246            offset: usize,
10247            depth: fidl::encoding::Depth,
10248        ) -> fidl::Result<()> {
10249            encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
10250            // Zero out padding regions. There's no need to apply masks
10251            // because the unmasked parts will be overwritten by fields.
10252            // Write the fields.
10253            self.0.encode(encoder, offset + 0, depth)?;
10254            Ok(())
10255        }
10256    }
10257
10258    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10259        for GuestManagerGetInfoResponse
10260    {
10261        #[inline(always)]
10262        fn new_empty() -> Self {
10263            Self {
10264                guest_info: fidl::new_empty!(
10265                    GuestInfo,
10266                    fidl::encoding::DefaultFuchsiaResourceDialect
10267                ),
10268            }
10269        }
10270
10271        #[inline]
10272        unsafe fn decode(
10273            &mut self,
10274            decoder: &mut fidl::encoding::Decoder<
10275                '_,
10276                fidl::encoding::DefaultFuchsiaResourceDialect,
10277            >,
10278            offset: usize,
10279            _depth: fidl::encoding::Depth,
10280        ) -> fidl::Result<()> {
10281            decoder.debug_check_bounds::<Self>(offset);
10282            // Verify that padding bytes are zero.
10283            fidl::decode!(
10284                GuestInfo,
10285                fidl::encoding::DefaultFuchsiaResourceDialect,
10286                &mut self.guest_info,
10287                decoder,
10288                offset + 0,
10289                _depth
10290            )?;
10291            Ok(())
10292        }
10293    }
10294
10295    impl fidl::encoding::ResourceTypeMarker for GuestManagerLaunchRequest {
10296        type Borrowed<'a> = &'a mut Self;
10297        fn take_or_borrow<'a>(
10298            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10299        ) -> Self::Borrowed<'a> {
10300            value
10301        }
10302    }
10303
10304    unsafe impl fidl::encoding::TypeMarker for GuestManagerLaunchRequest {
10305        type Owned = Self;
10306
10307        #[inline(always)]
10308        fn inline_align(_context: fidl::encoding::Context) -> usize {
10309            8
10310        }
10311
10312        #[inline(always)]
10313        fn inline_size(_context: fidl::encoding::Context) -> usize {
10314            24
10315        }
10316    }
10317
10318    unsafe impl
10319        fidl::encoding::Encode<
10320            GuestManagerLaunchRequest,
10321            fidl::encoding::DefaultFuchsiaResourceDialect,
10322        > for &mut GuestManagerLaunchRequest
10323    {
10324        #[inline]
10325        unsafe fn encode(
10326            self,
10327            encoder: &mut fidl::encoding::Encoder<
10328                '_,
10329                fidl::encoding::DefaultFuchsiaResourceDialect,
10330            >,
10331            offset: usize,
10332            _depth: fidl::encoding::Depth,
10333        ) -> fidl::Result<()> {
10334            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
10335            // Delegate to tuple encoding.
10336            fidl::encoding::Encode::<GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10337                (
10338                    <GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest_config),
10339                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10340                ),
10341                encoder, offset, _depth
10342            )
10343        }
10344    }
10345    unsafe impl<
10346            T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
10347            T1: fidl::encoding::Encode<
10348                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10349                fidl::encoding::DefaultFuchsiaResourceDialect,
10350            >,
10351        >
10352        fidl::encoding::Encode<
10353            GuestManagerLaunchRequest,
10354            fidl::encoding::DefaultFuchsiaResourceDialect,
10355        > for (T0, T1)
10356    {
10357        #[inline]
10358        unsafe fn encode(
10359            self,
10360            encoder: &mut fidl::encoding::Encoder<
10361                '_,
10362                fidl::encoding::DefaultFuchsiaResourceDialect,
10363            >,
10364            offset: usize,
10365            depth: fidl::encoding::Depth,
10366        ) -> fidl::Result<()> {
10367            encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
10368            // Zero out padding regions. There's no need to apply masks
10369            // because the unmasked parts will be overwritten by fields.
10370            unsafe {
10371                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10372                (ptr as *mut u64).write_unaligned(0);
10373            }
10374            // Write the fields.
10375            self.0.encode(encoder, offset + 0, depth)?;
10376            self.1.encode(encoder, offset + 16, depth)?;
10377            Ok(())
10378        }
10379    }
10380
10381    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10382        for GuestManagerLaunchRequest
10383    {
10384        #[inline(always)]
10385        fn new_empty() -> Self {
10386            Self {
10387                guest_config: fidl::new_empty!(
10388                    GuestConfig,
10389                    fidl::encoding::DefaultFuchsiaResourceDialect
10390                ),
10391                controller: fidl::new_empty!(
10392                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10393                    fidl::encoding::DefaultFuchsiaResourceDialect
10394                ),
10395            }
10396        }
10397
10398        #[inline]
10399        unsafe fn decode(
10400            &mut self,
10401            decoder: &mut fidl::encoding::Decoder<
10402                '_,
10403                fidl::encoding::DefaultFuchsiaResourceDialect,
10404            >,
10405            offset: usize,
10406            _depth: fidl::encoding::Depth,
10407        ) -> fidl::Result<()> {
10408            decoder.debug_check_bounds::<Self>(offset);
10409            // Verify that padding bytes are zero.
10410            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10411            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10412            let mask = 0xffffffff00000000u64;
10413            let maskedval = padval & mask;
10414            if maskedval != 0 {
10415                return Err(fidl::Error::NonZeroPadding {
10416                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10417                });
10418            }
10419            fidl::decode!(
10420                GuestConfig,
10421                fidl::encoding::DefaultFuchsiaResourceDialect,
10422                &mut self.guest_config,
10423                decoder,
10424                offset + 0,
10425                _depth
10426            )?;
10427            fidl::decode!(
10428                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
10429                fidl::encoding::DefaultFuchsiaResourceDialect,
10430                &mut self.controller,
10431                decoder,
10432                offset + 16,
10433                _depth
10434            )?;
10435            Ok(())
10436        }
10437    }
10438
10439    impl fidl::encoding::ResourceTypeMarker for GuestGetConsoleResponse {
10440        type Borrowed<'a> = &'a mut Self;
10441        fn take_or_borrow<'a>(
10442            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10443        ) -> Self::Borrowed<'a> {
10444            value
10445        }
10446    }
10447
10448    unsafe impl fidl::encoding::TypeMarker for GuestGetConsoleResponse {
10449        type Owned = Self;
10450
10451        #[inline(always)]
10452        fn inline_align(_context: fidl::encoding::Context) -> usize {
10453            4
10454        }
10455
10456        #[inline(always)]
10457        fn inline_size(_context: fidl::encoding::Context) -> usize {
10458            4
10459        }
10460    }
10461
10462    unsafe impl
10463        fidl::encoding::Encode<
10464            GuestGetConsoleResponse,
10465            fidl::encoding::DefaultFuchsiaResourceDialect,
10466        > for &mut GuestGetConsoleResponse
10467    {
10468        #[inline]
10469        unsafe fn encode(
10470            self,
10471            encoder: &mut fidl::encoding::Encoder<
10472                '_,
10473                fidl::encoding::DefaultFuchsiaResourceDialect,
10474            >,
10475            offset: usize,
10476            _depth: fidl::encoding::Depth,
10477        ) -> fidl::Result<()> {
10478            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
10479            // Delegate to tuple encoding.
10480            fidl::encoding::Encode::<
10481                GuestGetConsoleResponse,
10482                fidl::encoding::DefaultFuchsiaResourceDialect,
10483            >::encode(
10484                (<fidl::encoding::HandleType<
10485                    fidl::Socket,
10486                    { fidl::ObjectType::SOCKET.into_raw() },
10487                    2147483648,
10488                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10489                    &mut self.socket
10490                ),),
10491                encoder,
10492                offset,
10493                _depth,
10494            )
10495        }
10496    }
10497    unsafe impl<
10498            T0: fidl::encoding::Encode<
10499                fidl::encoding::HandleType<
10500                    fidl::Socket,
10501                    { fidl::ObjectType::SOCKET.into_raw() },
10502                    2147483648,
10503                >,
10504                fidl::encoding::DefaultFuchsiaResourceDialect,
10505            >,
10506        >
10507        fidl::encoding::Encode<
10508            GuestGetConsoleResponse,
10509            fidl::encoding::DefaultFuchsiaResourceDialect,
10510        > for (T0,)
10511    {
10512        #[inline]
10513        unsafe fn encode(
10514            self,
10515            encoder: &mut fidl::encoding::Encoder<
10516                '_,
10517                fidl::encoding::DefaultFuchsiaResourceDialect,
10518            >,
10519            offset: usize,
10520            depth: fidl::encoding::Depth,
10521        ) -> fidl::Result<()> {
10522            encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
10523            // Zero out padding regions. There's no need to apply masks
10524            // because the unmasked parts will be overwritten by fields.
10525            // Write the fields.
10526            self.0.encode(encoder, offset + 0, depth)?;
10527            Ok(())
10528        }
10529    }
10530
10531    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10532        for GuestGetConsoleResponse
10533    {
10534        #[inline(always)]
10535        fn new_empty() -> Self {
10536            Self {
10537                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10538            }
10539        }
10540
10541        #[inline]
10542        unsafe fn decode(
10543            &mut self,
10544            decoder: &mut fidl::encoding::Decoder<
10545                '_,
10546                fidl::encoding::DefaultFuchsiaResourceDialect,
10547            >,
10548            offset: usize,
10549            _depth: fidl::encoding::Depth,
10550        ) -> fidl::Result<()> {
10551            decoder.debug_check_bounds::<Self>(offset);
10552            // Verify that padding bytes are zero.
10553            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10554            Ok(())
10555        }
10556    }
10557
10558    impl fidl::encoding::ResourceTypeMarker for HostVsockAcceptorAcceptResponse {
10559        type Borrowed<'a> = &'a mut Self;
10560        fn take_or_borrow<'a>(
10561            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10562        ) -> Self::Borrowed<'a> {
10563            value
10564        }
10565    }
10566
10567    unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptResponse {
10568        type Owned = Self;
10569
10570        #[inline(always)]
10571        fn inline_align(_context: fidl::encoding::Context) -> usize {
10572            4
10573        }
10574
10575        #[inline(always)]
10576        fn inline_size(_context: fidl::encoding::Context) -> usize {
10577            4
10578        }
10579    }
10580
10581    unsafe impl
10582        fidl::encoding::Encode<
10583            HostVsockAcceptorAcceptResponse,
10584            fidl::encoding::DefaultFuchsiaResourceDialect,
10585        > for &mut HostVsockAcceptorAcceptResponse
10586    {
10587        #[inline]
10588        unsafe fn encode(
10589            self,
10590            encoder: &mut fidl::encoding::Encoder<
10591                '_,
10592                fidl::encoding::DefaultFuchsiaResourceDialect,
10593            >,
10594            offset: usize,
10595            _depth: fidl::encoding::Depth,
10596        ) -> fidl::Result<()> {
10597            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
10598            // Delegate to tuple encoding.
10599            fidl::encoding::Encode::<
10600                HostVsockAcceptorAcceptResponse,
10601                fidl::encoding::DefaultFuchsiaResourceDialect,
10602            >::encode(
10603                (<fidl::encoding::HandleType<
10604                    fidl::Socket,
10605                    { fidl::ObjectType::SOCKET.into_raw() },
10606                    2147483648,
10607                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10608                    &mut self.socket
10609                ),),
10610                encoder,
10611                offset,
10612                _depth,
10613            )
10614        }
10615    }
10616    unsafe impl<
10617            T0: fidl::encoding::Encode<
10618                fidl::encoding::HandleType<
10619                    fidl::Socket,
10620                    { fidl::ObjectType::SOCKET.into_raw() },
10621                    2147483648,
10622                >,
10623                fidl::encoding::DefaultFuchsiaResourceDialect,
10624            >,
10625        >
10626        fidl::encoding::Encode<
10627            HostVsockAcceptorAcceptResponse,
10628            fidl::encoding::DefaultFuchsiaResourceDialect,
10629        > for (T0,)
10630    {
10631        #[inline]
10632        unsafe fn encode(
10633            self,
10634            encoder: &mut fidl::encoding::Encoder<
10635                '_,
10636                fidl::encoding::DefaultFuchsiaResourceDialect,
10637            >,
10638            offset: usize,
10639            depth: fidl::encoding::Depth,
10640        ) -> fidl::Result<()> {
10641            encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
10642            // Zero out padding regions. There's no need to apply masks
10643            // because the unmasked parts will be overwritten by fields.
10644            // Write the fields.
10645            self.0.encode(encoder, offset + 0, depth)?;
10646            Ok(())
10647        }
10648    }
10649
10650    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10651        for HostVsockAcceptorAcceptResponse
10652    {
10653        #[inline(always)]
10654        fn new_empty() -> Self {
10655            Self {
10656                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10657            }
10658        }
10659
10660        #[inline]
10661        unsafe fn decode(
10662            &mut self,
10663            decoder: &mut fidl::encoding::Decoder<
10664                '_,
10665                fidl::encoding::DefaultFuchsiaResourceDialect,
10666            >,
10667            offset: usize,
10668            _depth: fidl::encoding::Depth,
10669        ) -> fidl::Result<()> {
10670            decoder.debug_check_bounds::<Self>(offset);
10671            // Verify that padding bytes are zero.
10672            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10673            Ok(())
10674        }
10675    }
10676
10677    impl fidl::encoding::ResourceTypeMarker for HostVsockEndpointConnectResponse {
10678        type Borrowed<'a> = &'a mut Self;
10679        fn take_or_borrow<'a>(
10680            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10681        ) -> Self::Borrowed<'a> {
10682            value
10683        }
10684    }
10685
10686    unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectResponse {
10687        type Owned = Self;
10688
10689        #[inline(always)]
10690        fn inline_align(_context: fidl::encoding::Context) -> usize {
10691            4
10692        }
10693
10694        #[inline(always)]
10695        fn inline_size(_context: fidl::encoding::Context) -> usize {
10696            4
10697        }
10698    }
10699
10700    unsafe impl
10701        fidl::encoding::Encode<
10702            HostVsockEndpointConnectResponse,
10703            fidl::encoding::DefaultFuchsiaResourceDialect,
10704        > for &mut HostVsockEndpointConnectResponse
10705    {
10706        #[inline]
10707        unsafe fn encode(
10708            self,
10709            encoder: &mut fidl::encoding::Encoder<
10710                '_,
10711                fidl::encoding::DefaultFuchsiaResourceDialect,
10712            >,
10713            offset: usize,
10714            _depth: fidl::encoding::Depth,
10715        ) -> fidl::Result<()> {
10716            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
10717            // Delegate to tuple encoding.
10718            fidl::encoding::Encode::<
10719                HostVsockEndpointConnectResponse,
10720                fidl::encoding::DefaultFuchsiaResourceDialect,
10721            >::encode(
10722                (<fidl::encoding::HandleType<
10723                    fidl::Socket,
10724                    { fidl::ObjectType::SOCKET.into_raw() },
10725                    2147483648,
10726                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10727                    &mut self.socket
10728                ),),
10729                encoder,
10730                offset,
10731                _depth,
10732            )
10733        }
10734    }
10735    unsafe impl<
10736            T0: fidl::encoding::Encode<
10737                fidl::encoding::HandleType<
10738                    fidl::Socket,
10739                    { fidl::ObjectType::SOCKET.into_raw() },
10740                    2147483648,
10741                >,
10742                fidl::encoding::DefaultFuchsiaResourceDialect,
10743            >,
10744        >
10745        fidl::encoding::Encode<
10746            HostVsockEndpointConnectResponse,
10747            fidl::encoding::DefaultFuchsiaResourceDialect,
10748        > for (T0,)
10749    {
10750        #[inline]
10751        unsafe fn encode(
10752            self,
10753            encoder: &mut fidl::encoding::Encoder<
10754                '_,
10755                fidl::encoding::DefaultFuchsiaResourceDialect,
10756            >,
10757            offset: usize,
10758            depth: fidl::encoding::Depth,
10759        ) -> fidl::Result<()> {
10760            encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
10761            // Zero out padding regions. There's no need to apply masks
10762            // because the unmasked parts will be overwritten by fields.
10763            // Write the fields.
10764            self.0.encode(encoder, offset + 0, depth)?;
10765            Ok(())
10766        }
10767    }
10768
10769    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10770        for HostVsockEndpointConnectResponse
10771    {
10772        #[inline(always)]
10773        fn new_empty() -> Self {
10774            Self {
10775                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10776            }
10777        }
10778
10779        #[inline]
10780        unsafe fn decode(
10781            &mut self,
10782            decoder: &mut fidl::encoding::Decoder<
10783                '_,
10784                fidl::encoding::DefaultFuchsiaResourceDialect,
10785            >,
10786            offset: usize,
10787            _depth: fidl::encoding::Depth,
10788        ) -> fidl::Result<()> {
10789            decoder.debug_check_bounds::<Self>(offset);
10790            // Verify that padding bytes are zero.
10791            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10792            Ok(())
10793        }
10794    }
10795
10796    impl fidl::encoding::ResourceTypeMarker for Listener {
10797        type Borrowed<'a> = &'a mut Self;
10798        fn take_or_borrow<'a>(
10799            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10800        ) -> Self::Borrowed<'a> {
10801            value
10802        }
10803    }
10804
10805    unsafe impl fidl::encoding::TypeMarker for Listener {
10806        type Owned = Self;
10807
10808        #[inline(always)]
10809        fn inline_align(_context: fidl::encoding::Context) -> usize {
10810            4
10811        }
10812
10813        #[inline(always)]
10814        fn inline_size(_context: fidl::encoding::Context) -> usize {
10815            8
10816        }
10817    }
10818
10819    unsafe impl fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
10820        for &mut Listener
10821    {
10822        #[inline]
10823        unsafe fn encode(
10824            self,
10825            encoder: &mut fidl::encoding::Encoder<
10826                '_,
10827                fidl::encoding::DefaultFuchsiaResourceDialect,
10828            >,
10829            offset: usize,
10830            _depth: fidl::encoding::Depth,
10831        ) -> fidl::Result<()> {
10832            encoder.debug_check_bounds::<Listener>(offset);
10833            // Delegate to tuple encoding.
10834            fidl::encoding::Encode::<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10835                (
10836                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
10837                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
10838                ),
10839                encoder, offset, _depth
10840            )
10841        }
10842    }
10843    unsafe impl<
10844            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
10845            T1: fidl::encoding::Encode<
10846                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
10847                fidl::encoding::DefaultFuchsiaResourceDialect,
10848            >,
10849        > fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
10850        for (T0, T1)
10851    {
10852        #[inline]
10853        unsafe fn encode(
10854            self,
10855            encoder: &mut fidl::encoding::Encoder<
10856                '_,
10857                fidl::encoding::DefaultFuchsiaResourceDialect,
10858            >,
10859            offset: usize,
10860            depth: fidl::encoding::Depth,
10861        ) -> fidl::Result<()> {
10862            encoder.debug_check_bounds::<Listener>(offset);
10863            // Zero out padding regions. There's no need to apply masks
10864            // because the unmasked parts will be overwritten by fields.
10865            // Write the fields.
10866            self.0.encode(encoder, offset + 0, depth)?;
10867            self.1.encode(encoder, offset + 4, depth)?;
10868            Ok(())
10869        }
10870    }
10871
10872    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {
10873        #[inline(always)]
10874        fn new_empty() -> Self {
10875            Self {
10876                port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
10877                acceptor: fidl::new_empty!(
10878                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
10879                    fidl::encoding::DefaultFuchsiaResourceDialect
10880                ),
10881            }
10882        }
10883
10884        #[inline]
10885        unsafe fn decode(
10886            &mut self,
10887            decoder: &mut fidl::encoding::Decoder<
10888                '_,
10889                fidl::encoding::DefaultFuchsiaResourceDialect,
10890            >,
10891            offset: usize,
10892            _depth: fidl::encoding::Depth,
10893        ) -> fidl::Result<()> {
10894            decoder.debug_check_bounds::<Self>(offset);
10895            // Verify that padding bytes are zero.
10896            fidl::decode!(
10897                u32,
10898                fidl::encoding::DefaultFuchsiaResourceDialect,
10899                &mut self.port,
10900                decoder,
10901                offset + 0,
10902                _depth
10903            )?;
10904            fidl::decode!(
10905                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
10906                fidl::encoding::DefaultFuchsiaResourceDialect,
10907                &mut self.acceptor,
10908                decoder,
10909                offset + 4,
10910                _depth
10911            )?;
10912            Ok(())
10913        }
10914    }
10915
10916    impl fidl::encoding::ResourceTypeMarker for WaylandDevice {
10917        type Borrowed<'a> = &'a mut Self;
10918        fn take_or_borrow<'a>(
10919            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10920        ) -> Self::Borrowed<'a> {
10921            value
10922        }
10923    }
10924
10925    unsafe impl fidl::encoding::TypeMarker for WaylandDevice {
10926        type Owned = Self;
10927
10928        #[inline(always)]
10929        fn inline_align(_context: fidl::encoding::Context) -> usize {
10930            8
10931        }
10932
10933        #[inline(always)]
10934        fn inline_size(_context: fidl::encoding::Context) -> usize {
10935            16
10936        }
10937    }
10938
10939    unsafe impl fidl::encoding::Encode<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>
10940        for &mut WaylandDevice
10941    {
10942        #[inline]
10943        unsafe fn encode(
10944            self,
10945            encoder: &mut fidl::encoding::Encoder<
10946                '_,
10947                fidl::encoding::DefaultFuchsiaResourceDialect,
10948            >,
10949            offset: usize,
10950            _depth: fidl::encoding::Depth,
10951        ) -> fidl::Result<()> {
10952            encoder.debug_check_bounds::<WaylandDevice>(offset);
10953            // Delegate to tuple encoding.
10954            fidl::encoding::Encode::<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10955                (
10956                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.memory),
10957                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
10958                ),
10959                encoder, offset, _depth
10960            )
10961        }
10962    }
10963    unsafe impl<
10964            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10965            T1: fidl::encoding::Encode<
10966                fidl::encoding::Optional<
10967                    fidl::encoding::Endpoint<
10968                        fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
10969                    >,
10970                >,
10971                fidl::encoding::DefaultFuchsiaResourceDialect,
10972            >,
10973        > fidl::encoding::Encode<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>
10974        for (T0, T1)
10975    {
10976        #[inline]
10977        unsafe fn encode(
10978            self,
10979            encoder: &mut fidl::encoding::Encoder<
10980                '_,
10981                fidl::encoding::DefaultFuchsiaResourceDialect,
10982            >,
10983            offset: usize,
10984            depth: fidl::encoding::Depth,
10985        ) -> fidl::Result<()> {
10986            encoder.debug_check_bounds::<WaylandDevice>(offset);
10987            // Zero out padding regions. There's no need to apply masks
10988            // because the unmasked parts will be overwritten by fields.
10989            unsafe {
10990                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
10991                (ptr as *mut u64).write_unaligned(0);
10992            }
10993            // Write the fields.
10994            self.0.encode(encoder, offset + 0, depth)?;
10995            self.1.encode(encoder, offset + 8, depth)?;
10996            Ok(())
10997        }
10998    }
10999
11000    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WaylandDevice {
11001        #[inline(always)]
11002        fn new_empty() -> Self {
11003            Self {
11004                memory: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11005                server: fidl::new_empty!(
11006                    fidl::encoding::Optional<
11007                        fidl::encoding::Endpoint<
11008                            fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
11009                        >,
11010                    >,
11011                    fidl::encoding::DefaultFuchsiaResourceDialect
11012                ),
11013            }
11014        }
11015
11016        #[inline]
11017        unsafe fn decode(
11018            &mut self,
11019            decoder: &mut fidl::encoding::Decoder<
11020                '_,
11021                fidl::encoding::DefaultFuchsiaResourceDialect,
11022            >,
11023            offset: usize,
11024            _depth: fidl::encoding::Depth,
11025        ) -> fidl::Result<()> {
11026            decoder.debug_check_bounds::<Self>(offset);
11027            // Verify that padding bytes are zero.
11028            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
11029            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11030            let mask = 0xffffffff00000000u64;
11031            let maskedval = padval & mask;
11032            if maskedval != 0 {
11033                return Err(fidl::Error::NonZeroPadding {
11034                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
11035                });
11036            }
11037            fidl::decode!(
11038                u64,
11039                fidl::encoding::DefaultFuchsiaResourceDialect,
11040                &mut self.memory,
11041                decoder,
11042                offset + 0,
11043                _depth
11044            )?;
11045            fidl::decode!(
11046                fidl::encoding::Optional<
11047                    fidl::encoding::Endpoint<
11048                        fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
11049                    >,
11050                >,
11051                fidl::encoding::DefaultFuchsiaResourceDialect,
11052                &mut self.server,
11053                decoder,
11054                offset + 8,
11055                _depth
11056            )?;
11057            Ok(())
11058        }
11059    }
11060
11061    impl GuestConfig {
11062        #[inline(always)]
11063        fn max_ordinal_present(&self) -> u64 {
11064            if let Some(_) = self.virtio_mem_region_alignment {
11065                return 25;
11066            }
11067            if let Some(_) = self.virtio_mem_region_size {
11068                return 24;
11069            }
11070            if let Some(_) = self.virtio_mem_block_size {
11071                return 23;
11072            }
11073            if let Some(_) = self.virtio_mem {
11074                return 22;
11075            }
11076            if let Some(_) = self.vsock_listeners {
11077                return 21;
11078            }
11079            if let Some(_) = self.virtio_sound_input {
11080                return 20;
11081            }
11082            if let Some(_) = self.virtio_sound {
11083                return 19;
11084            }
11085            if let Some(_) = self.virtio_vsock {
11086                return 18;
11087            }
11088            if let Some(_) = self.virtio_rng {
11089                return 17;
11090            }
11091            if let Some(_) = self.virtio_gpu {
11092                return 16;
11093            }
11094            if let Some(_) = self.virtio_console {
11095                return 15;
11096            }
11097            if let Some(_) = self.virtio_balloon {
11098                return 14;
11099            }
11100            if let Some(_) = self.default_net {
11101                return 13;
11102            }
11103            if let Some(_) = self.magma_device {
11104                return 12;
11105            }
11106            if let Some(_) = self.wayland_device {
11107                return 11;
11108            }
11109            if let Some(_) = self.net_devices {
11110                return 10;
11111            }
11112            if let Some(_) = self.block_devices {
11113                return 9;
11114            }
11115            if let Some(_) = self.guest_memory {
11116                return 8;
11117            }
11118            if let Some(_) = self.cpus {
11119                return 7;
11120            }
11121            if let Some(_) = self.cmdline_add {
11122                return 6;
11123            }
11124            if let Some(_) = self.cmdline {
11125                return 5;
11126            }
11127            if let Some(_) = self.dtb_overlay {
11128                return 4;
11129            }
11130            if let Some(_) = self.ramdisk {
11131                return 3;
11132            }
11133            if let Some(_) = self.kernel {
11134                return 2;
11135            }
11136            if let Some(_) = self.kernel_type {
11137                return 1;
11138            }
11139            0
11140        }
11141    }
11142
11143    impl fidl::encoding::ResourceTypeMarker for GuestConfig {
11144        type Borrowed<'a> = &'a mut Self;
11145        fn take_or_borrow<'a>(
11146            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11147        ) -> Self::Borrowed<'a> {
11148            value
11149        }
11150    }
11151
11152    unsafe impl fidl::encoding::TypeMarker for GuestConfig {
11153        type Owned = Self;
11154
11155        #[inline(always)]
11156        fn inline_align(_context: fidl::encoding::Context) -> usize {
11157            8
11158        }
11159
11160        #[inline(always)]
11161        fn inline_size(_context: fidl::encoding::Context) -> usize {
11162            16
11163        }
11164    }
11165
11166    unsafe impl fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
11167        for &mut GuestConfig
11168    {
11169        unsafe fn encode(
11170            self,
11171            encoder: &mut fidl::encoding::Encoder<
11172                '_,
11173                fidl::encoding::DefaultFuchsiaResourceDialect,
11174            >,
11175            offset: usize,
11176            mut depth: fidl::encoding::Depth,
11177        ) -> fidl::Result<()> {
11178            encoder.debug_check_bounds::<GuestConfig>(offset);
11179            // Vector header
11180            let max_ordinal: u64 = self.max_ordinal_present();
11181            encoder.write_num(max_ordinal, offset);
11182            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11183            // Calling encoder.out_of_line_offset(0) is not allowed.
11184            if max_ordinal == 0 {
11185                return Ok(());
11186            }
11187            depth.increment()?;
11188            let envelope_size = 8;
11189            let bytes_len = max_ordinal as usize * envelope_size;
11190            #[allow(unused_variables)]
11191            let offset = encoder.out_of_line_offset(bytes_len);
11192            let mut _prev_end_offset: usize = 0;
11193            if 1 > max_ordinal {
11194                return Ok(());
11195            }
11196
11197            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11198            // are envelope_size bytes.
11199            let cur_offset: usize = (1 - 1) * envelope_size;
11200
11201            // Zero reserved fields.
11202            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11203
11204            // Safety:
11205            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11206            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11207            //   envelope_size bytes, there is always sufficient room.
11208            fidl::encoding::encode_in_envelope_optional::<
11209                KernelType,
11210                fidl::encoding::DefaultFuchsiaResourceDialect,
11211            >(
11212                self.kernel_type
11213                    .as_ref()
11214                    .map(<KernelType as fidl::encoding::ValueTypeMarker>::borrow),
11215                encoder,
11216                offset + cur_offset,
11217                depth,
11218            )?;
11219
11220            _prev_end_offset = cur_offset + envelope_size;
11221            if 2 > max_ordinal {
11222                return Ok(());
11223            }
11224
11225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11226            // are envelope_size bytes.
11227            let cur_offset: usize = (2 - 1) * envelope_size;
11228
11229            // Zero reserved fields.
11230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11231
11232            // Safety:
11233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11235            //   envelope_size bytes, there is always sufficient room.
11236            fidl::encoding::encode_in_envelope_optional::<
11237                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
11238                fidl::encoding::DefaultFuchsiaResourceDialect,
11239            >(
11240                self.kernel.as_mut().map(
11241                    <fidl::encoding::Endpoint<
11242                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11243                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11244                ),
11245                encoder,
11246                offset + cur_offset,
11247                depth,
11248            )?;
11249
11250            _prev_end_offset = cur_offset + envelope_size;
11251            if 3 > max_ordinal {
11252                return Ok(());
11253            }
11254
11255            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11256            // are envelope_size bytes.
11257            let cur_offset: usize = (3 - 1) * envelope_size;
11258
11259            // Zero reserved fields.
11260            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11261
11262            // Safety:
11263            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11264            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11265            //   envelope_size bytes, there is always sufficient room.
11266            fidl::encoding::encode_in_envelope_optional::<
11267                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
11268                fidl::encoding::DefaultFuchsiaResourceDialect,
11269            >(
11270                self.ramdisk.as_mut().map(
11271                    <fidl::encoding::Endpoint<
11272                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11273                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11274                ),
11275                encoder,
11276                offset + cur_offset,
11277                depth,
11278            )?;
11279
11280            _prev_end_offset = cur_offset + envelope_size;
11281            if 4 > max_ordinal {
11282                return Ok(());
11283            }
11284
11285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11286            // are envelope_size bytes.
11287            let cur_offset: usize = (4 - 1) * envelope_size;
11288
11289            // Zero reserved fields.
11290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11291
11292            // Safety:
11293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11295            //   envelope_size bytes, there is always sufficient room.
11296            fidl::encoding::encode_in_envelope_optional::<
11297                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
11298                fidl::encoding::DefaultFuchsiaResourceDialect,
11299            >(
11300                self.dtb_overlay.as_mut().map(
11301                    <fidl::encoding::Endpoint<
11302                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11303                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11304                ),
11305                encoder,
11306                offset + cur_offset,
11307                depth,
11308            )?;
11309
11310            _prev_end_offset = cur_offset + envelope_size;
11311            if 5 > max_ordinal {
11312                return Ok(());
11313            }
11314
11315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11316            // are envelope_size bytes.
11317            let cur_offset: usize = (5 - 1) * envelope_size;
11318
11319            // Zero reserved fields.
11320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11321
11322            // Safety:
11323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11325            //   envelope_size bytes, there is always sufficient room.
11326            fidl::encoding::encode_in_envelope_optional::<
11327                fidl::encoding::UnboundedString,
11328                fidl::encoding::DefaultFuchsiaResourceDialect,
11329            >(
11330                self.cmdline.as_ref().map(
11331                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
11332                ),
11333                encoder,
11334                offset + cur_offset,
11335                depth,
11336            )?;
11337
11338            _prev_end_offset = cur_offset + envelope_size;
11339            if 6 > max_ordinal {
11340                return Ok(());
11341            }
11342
11343            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11344            // are envelope_size bytes.
11345            let cur_offset: usize = (6 - 1) * envelope_size;
11346
11347            // Zero reserved fields.
11348            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11349
11350            // Safety:
11351            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11352            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11353            //   envelope_size bytes, there is always sufficient room.
11354            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11355            self.cmdline_add.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
11356            encoder, offset + cur_offset, depth
11357        )?;
11358
11359            _prev_end_offset = cur_offset + envelope_size;
11360            if 7 > max_ordinal {
11361                return Ok(());
11362            }
11363
11364            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11365            // are envelope_size bytes.
11366            let cur_offset: usize = (7 - 1) * envelope_size;
11367
11368            // Zero reserved fields.
11369            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11370
11371            // Safety:
11372            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11373            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11374            //   envelope_size bytes, there is always sufficient room.
11375            fidl::encoding::encode_in_envelope_optional::<
11376                u8,
11377                fidl::encoding::DefaultFuchsiaResourceDialect,
11378            >(
11379                self.cpus.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11380                encoder,
11381                offset + cur_offset,
11382                depth,
11383            )?;
11384
11385            _prev_end_offset = cur_offset + envelope_size;
11386            if 8 > max_ordinal {
11387                return Ok(());
11388            }
11389
11390            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11391            // are envelope_size bytes.
11392            let cur_offset: usize = (8 - 1) * envelope_size;
11393
11394            // Zero reserved fields.
11395            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11396
11397            // Safety:
11398            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11399            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11400            //   envelope_size bytes, there is always sufficient room.
11401            fidl::encoding::encode_in_envelope_optional::<
11402                u64,
11403                fidl::encoding::DefaultFuchsiaResourceDialect,
11404            >(
11405                self.guest_memory.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
11406                encoder,
11407                offset + cur_offset,
11408                depth,
11409            )?;
11410
11411            _prev_end_offset = cur_offset + envelope_size;
11412            if 9 > max_ordinal {
11413                return Ok(());
11414            }
11415
11416            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11417            // are envelope_size bytes.
11418            let cur_offset: usize = (9 - 1) * envelope_size;
11419
11420            // Zero reserved fields.
11421            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11422
11423            // Safety:
11424            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11425            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11426            //   envelope_size bytes, there is always sufficient room.
11427            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11428            self.block_devices.as_mut().map(<fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11429            encoder, offset + cur_offset, depth
11430        )?;
11431
11432            _prev_end_offset = cur_offset + envelope_size;
11433            if 10 > max_ordinal {
11434                return Ok(());
11435            }
11436
11437            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11438            // are envelope_size bytes.
11439            let cur_offset: usize = (10 - 1) * envelope_size;
11440
11441            // Zero reserved fields.
11442            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11443
11444            // Safety:
11445            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11446            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11447            //   envelope_size bytes, there is always sufficient room.
11448            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11449            self.net_devices.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
11450            encoder, offset + cur_offset, depth
11451        )?;
11452
11453            _prev_end_offset = cur_offset + envelope_size;
11454            if 11 > max_ordinal {
11455                return Ok(());
11456            }
11457
11458            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11459            // are envelope_size bytes.
11460            let cur_offset: usize = (11 - 1) * envelope_size;
11461
11462            // Zero reserved fields.
11463            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11464
11465            // Safety:
11466            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11467            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11468            //   envelope_size bytes, there is always sufficient room.
11469            fidl::encoding::encode_in_envelope_optional::<
11470                WaylandDevice,
11471                fidl::encoding::DefaultFuchsiaResourceDialect,
11472            >(
11473                self.wayland_device
11474                    .as_mut()
11475                    .map(<WaylandDevice as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11476                encoder,
11477                offset + cur_offset,
11478                depth,
11479            )?;
11480
11481            _prev_end_offset = cur_offset + envelope_size;
11482            if 12 > max_ordinal {
11483                return Ok(());
11484            }
11485
11486            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11487            // are envelope_size bytes.
11488            let cur_offset: usize = (12 - 1) * envelope_size;
11489
11490            // Zero reserved fields.
11491            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11492
11493            // Safety:
11494            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11495            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11496            //   envelope_size bytes, there is always sufficient room.
11497            fidl::encoding::encode_in_envelope_optional::<
11498                MagmaDevice,
11499                fidl::encoding::DefaultFuchsiaResourceDialect,
11500            >(
11501                self.magma_device
11502                    .as_ref()
11503                    .map(<MagmaDevice as fidl::encoding::ValueTypeMarker>::borrow),
11504                encoder,
11505                offset + cur_offset,
11506                depth,
11507            )?;
11508
11509            _prev_end_offset = cur_offset + envelope_size;
11510            if 13 > max_ordinal {
11511                return Ok(());
11512            }
11513
11514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11515            // are envelope_size bytes.
11516            let cur_offset: usize = (13 - 1) * envelope_size;
11517
11518            // Zero reserved fields.
11519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11520
11521            // Safety:
11522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11524            //   envelope_size bytes, there is always sufficient room.
11525            fidl::encoding::encode_in_envelope_optional::<
11526                bool,
11527                fidl::encoding::DefaultFuchsiaResourceDialect,
11528            >(
11529                self.default_net.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11530                encoder,
11531                offset + cur_offset,
11532                depth,
11533            )?;
11534
11535            _prev_end_offset = cur_offset + envelope_size;
11536            if 14 > max_ordinal {
11537                return Ok(());
11538            }
11539
11540            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11541            // are envelope_size bytes.
11542            let cur_offset: usize = (14 - 1) * envelope_size;
11543
11544            // Zero reserved fields.
11545            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11546
11547            // Safety:
11548            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11549            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11550            //   envelope_size bytes, there is always sufficient room.
11551            fidl::encoding::encode_in_envelope_optional::<
11552                bool,
11553                fidl::encoding::DefaultFuchsiaResourceDialect,
11554            >(
11555                self.virtio_balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11556                encoder,
11557                offset + cur_offset,
11558                depth,
11559            )?;
11560
11561            _prev_end_offset = cur_offset + envelope_size;
11562            if 15 > max_ordinal {
11563                return Ok(());
11564            }
11565
11566            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11567            // are envelope_size bytes.
11568            let cur_offset: usize = (15 - 1) * envelope_size;
11569
11570            // Zero reserved fields.
11571            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11572
11573            // Safety:
11574            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11575            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11576            //   envelope_size bytes, there is always sufficient room.
11577            fidl::encoding::encode_in_envelope_optional::<
11578                bool,
11579                fidl::encoding::DefaultFuchsiaResourceDialect,
11580            >(
11581                self.virtio_console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11582                encoder,
11583                offset + cur_offset,
11584                depth,
11585            )?;
11586
11587            _prev_end_offset = cur_offset + envelope_size;
11588            if 16 > max_ordinal {
11589                return Ok(());
11590            }
11591
11592            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11593            // are envelope_size bytes.
11594            let cur_offset: usize = (16 - 1) * envelope_size;
11595
11596            // Zero reserved fields.
11597            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11598
11599            // Safety:
11600            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11601            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11602            //   envelope_size bytes, there is always sufficient room.
11603            fidl::encoding::encode_in_envelope_optional::<
11604                bool,
11605                fidl::encoding::DefaultFuchsiaResourceDialect,
11606            >(
11607                self.virtio_gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11608                encoder,
11609                offset + cur_offset,
11610                depth,
11611            )?;
11612
11613            _prev_end_offset = cur_offset + envelope_size;
11614            if 17 > max_ordinal {
11615                return Ok(());
11616            }
11617
11618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11619            // are envelope_size bytes.
11620            let cur_offset: usize = (17 - 1) * envelope_size;
11621
11622            // Zero reserved fields.
11623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11624
11625            // Safety:
11626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11628            //   envelope_size bytes, there is always sufficient room.
11629            fidl::encoding::encode_in_envelope_optional::<
11630                bool,
11631                fidl::encoding::DefaultFuchsiaResourceDialect,
11632            >(
11633                self.virtio_rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11634                encoder,
11635                offset + cur_offset,
11636                depth,
11637            )?;
11638
11639            _prev_end_offset = cur_offset + envelope_size;
11640            if 18 > max_ordinal {
11641                return Ok(());
11642            }
11643
11644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11645            // are envelope_size bytes.
11646            let cur_offset: usize = (18 - 1) * envelope_size;
11647
11648            // Zero reserved fields.
11649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11650
11651            // Safety:
11652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11654            //   envelope_size bytes, there is always sufficient room.
11655            fidl::encoding::encode_in_envelope_optional::<
11656                bool,
11657                fidl::encoding::DefaultFuchsiaResourceDialect,
11658            >(
11659                self.virtio_vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11660                encoder,
11661                offset + cur_offset,
11662                depth,
11663            )?;
11664
11665            _prev_end_offset = cur_offset + envelope_size;
11666            if 19 > max_ordinal {
11667                return Ok(());
11668            }
11669
11670            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11671            // are envelope_size bytes.
11672            let cur_offset: usize = (19 - 1) * envelope_size;
11673
11674            // Zero reserved fields.
11675            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11676
11677            // Safety:
11678            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11679            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11680            //   envelope_size bytes, there is always sufficient room.
11681            fidl::encoding::encode_in_envelope_optional::<
11682                bool,
11683                fidl::encoding::DefaultFuchsiaResourceDialect,
11684            >(
11685                self.virtio_sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11686                encoder,
11687                offset + cur_offset,
11688                depth,
11689            )?;
11690
11691            _prev_end_offset = cur_offset + envelope_size;
11692            if 20 > max_ordinal {
11693                return Ok(());
11694            }
11695
11696            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11697            // are envelope_size bytes.
11698            let cur_offset: usize = (20 - 1) * envelope_size;
11699
11700            // Zero reserved fields.
11701            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11702
11703            // Safety:
11704            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11705            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11706            //   envelope_size bytes, there is always sufficient room.
11707            fidl::encoding::encode_in_envelope_optional::<
11708                bool,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710            >(
11711                self.virtio_sound_input
11712                    .as_ref()
11713                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11714                encoder,
11715                offset + cur_offset,
11716                depth,
11717            )?;
11718
11719            _prev_end_offset = cur_offset + envelope_size;
11720            if 21 > max_ordinal {
11721                return Ok(());
11722            }
11723
11724            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11725            // are envelope_size bytes.
11726            let cur_offset: usize = (21 - 1) * envelope_size;
11727
11728            // Zero reserved fields.
11729            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11730
11731            // Safety:
11732            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11733            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11734            //   envelope_size bytes, there is always sufficient room.
11735            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Listener>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11736            self.vsock_listeners.as_mut().map(<fidl::encoding::UnboundedVector<Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11737            encoder, offset + cur_offset, depth
11738        )?;
11739
11740            _prev_end_offset = cur_offset + envelope_size;
11741            if 22 > max_ordinal {
11742                return Ok(());
11743            }
11744
11745            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11746            // are envelope_size bytes.
11747            let cur_offset: usize = (22 - 1) * envelope_size;
11748
11749            // Zero reserved fields.
11750            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11751
11752            // Safety:
11753            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11754            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11755            //   envelope_size bytes, there is always sufficient room.
11756            fidl::encoding::encode_in_envelope_optional::<
11757                bool,
11758                fidl::encoding::DefaultFuchsiaResourceDialect,
11759            >(
11760                self.virtio_mem.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11761                encoder,
11762                offset + cur_offset,
11763                depth,
11764            )?;
11765
11766            _prev_end_offset = cur_offset + envelope_size;
11767            if 23 > max_ordinal {
11768                return Ok(());
11769            }
11770
11771            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11772            // are envelope_size bytes.
11773            let cur_offset: usize = (23 - 1) * envelope_size;
11774
11775            // Zero reserved fields.
11776            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11777
11778            // Safety:
11779            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11780            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11781            //   envelope_size bytes, there is always sufficient room.
11782            fidl::encoding::encode_in_envelope_optional::<
11783                u64,
11784                fidl::encoding::DefaultFuchsiaResourceDialect,
11785            >(
11786                self.virtio_mem_block_size
11787                    .as_ref()
11788                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
11789                encoder,
11790                offset + cur_offset,
11791                depth,
11792            )?;
11793
11794            _prev_end_offset = cur_offset + envelope_size;
11795            if 24 > max_ordinal {
11796                return Ok(());
11797            }
11798
11799            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11800            // are envelope_size bytes.
11801            let cur_offset: usize = (24 - 1) * envelope_size;
11802
11803            // Zero reserved fields.
11804            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11805
11806            // Safety:
11807            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11808            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11809            //   envelope_size bytes, there is always sufficient room.
11810            fidl::encoding::encode_in_envelope_optional::<
11811                u64,
11812                fidl::encoding::DefaultFuchsiaResourceDialect,
11813            >(
11814                self.virtio_mem_region_size
11815                    .as_ref()
11816                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
11817                encoder,
11818                offset + cur_offset,
11819                depth,
11820            )?;
11821
11822            _prev_end_offset = cur_offset + envelope_size;
11823            if 25 > max_ordinal {
11824                return Ok(());
11825            }
11826
11827            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11828            // are envelope_size bytes.
11829            let cur_offset: usize = (25 - 1) * envelope_size;
11830
11831            // Zero reserved fields.
11832            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11833
11834            // Safety:
11835            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11836            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11837            //   envelope_size bytes, there is always sufficient room.
11838            fidl::encoding::encode_in_envelope_optional::<
11839                u64,
11840                fidl::encoding::DefaultFuchsiaResourceDialect,
11841            >(
11842                self.virtio_mem_region_alignment
11843                    .as_ref()
11844                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
11845                encoder,
11846                offset + cur_offset,
11847                depth,
11848            )?;
11849
11850            _prev_end_offset = cur_offset + envelope_size;
11851
11852            Ok(())
11853        }
11854    }
11855
11856    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {
11857        #[inline(always)]
11858        fn new_empty() -> Self {
11859            Self::default()
11860        }
11861
11862        unsafe fn decode(
11863            &mut self,
11864            decoder: &mut fidl::encoding::Decoder<
11865                '_,
11866                fidl::encoding::DefaultFuchsiaResourceDialect,
11867            >,
11868            offset: usize,
11869            mut depth: fidl::encoding::Depth,
11870        ) -> fidl::Result<()> {
11871            decoder.debug_check_bounds::<Self>(offset);
11872            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11873                None => return Err(fidl::Error::NotNullable),
11874                Some(len) => len,
11875            };
11876            // Calling decoder.out_of_line_offset(0) is not allowed.
11877            if len == 0 {
11878                return Ok(());
11879            };
11880            depth.increment()?;
11881            let envelope_size = 8;
11882            let bytes_len = len * envelope_size;
11883            let offset = decoder.out_of_line_offset(bytes_len)?;
11884            // Decode the envelope for each type.
11885            let mut _next_ordinal_to_read = 0;
11886            let mut next_offset = offset;
11887            let end_offset = offset + bytes_len;
11888            _next_ordinal_to_read += 1;
11889            if next_offset >= end_offset {
11890                return Ok(());
11891            }
11892
11893            // Decode unknown envelopes for gaps in ordinals.
11894            while _next_ordinal_to_read < 1 {
11895                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11896                _next_ordinal_to_read += 1;
11897                next_offset += envelope_size;
11898            }
11899
11900            let next_out_of_line = decoder.next_out_of_line();
11901            let handles_before = decoder.remaining_handles();
11902            if let Some((inlined, num_bytes, num_handles)) =
11903                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11904            {
11905                let member_inline_size =
11906                    <KernelType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11907                if inlined != (member_inline_size <= 4) {
11908                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11909                }
11910                let inner_offset;
11911                let mut inner_depth = depth.clone();
11912                if inlined {
11913                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11914                    inner_offset = next_offset;
11915                } else {
11916                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11917                    inner_depth.increment()?;
11918                }
11919                let val_ref = self.kernel_type.get_or_insert_with(|| {
11920                    fidl::new_empty!(KernelType, fidl::encoding::DefaultFuchsiaResourceDialect)
11921                });
11922                fidl::decode!(
11923                    KernelType,
11924                    fidl::encoding::DefaultFuchsiaResourceDialect,
11925                    val_ref,
11926                    decoder,
11927                    inner_offset,
11928                    inner_depth
11929                )?;
11930                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11931                {
11932                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11933                }
11934                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11935                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11936                }
11937            }
11938
11939            next_offset += envelope_size;
11940            _next_ordinal_to_read += 1;
11941            if next_offset >= end_offset {
11942                return Ok(());
11943            }
11944
11945            // Decode unknown envelopes for gaps in ordinals.
11946            while _next_ordinal_to_read < 2 {
11947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11948                _next_ordinal_to_read += 1;
11949                next_offset += envelope_size;
11950            }
11951
11952            let next_out_of_line = decoder.next_out_of_line();
11953            let handles_before = decoder.remaining_handles();
11954            if let Some((inlined, num_bytes, num_handles)) =
11955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11956            {
11957                let member_inline_size = <fidl::encoding::Endpoint<
11958                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11959                > as fidl::encoding::TypeMarker>::inline_size(
11960                    decoder.context
11961                );
11962                if inlined != (member_inline_size <= 4) {
11963                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11964                }
11965                let inner_offset;
11966                let mut inner_depth = depth.clone();
11967                if inlined {
11968                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11969                    inner_offset = next_offset;
11970                } else {
11971                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11972                    inner_depth.increment()?;
11973                }
11974                let val_ref = self.kernel.get_or_insert_with(|| {
11975                    fidl::new_empty!(
11976                        fidl::encoding::Endpoint<
11977                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11978                        >,
11979                        fidl::encoding::DefaultFuchsiaResourceDialect
11980                    )
11981                });
11982                fidl::decode!(
11983                    fidl::encoding::Endpoint<
11984                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11985                    >,
11986                    fidl::encoding::DefaultFuchsiaResourceDialect,
11987                    val_ref,
11988                    decoder,
11989                    inner_offset,
11990                    inner_depth
11991                )?;
11992                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11993                {
11994                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11995                }
11996                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11997                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11998                }
11999            }
12000
12001            next_offset += envelope_size;
12002            _next_ordinal_to_read += 1;
12003            if next_offset >= end_offset {
12004                return Ok(());
12005            }
12006
12007            // Decode unknown envelopes for gaps in ordinals.
12008            while _next_ordinal_to_read < 3 {
12009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12010                _next_ordinal_to_read += 1;
12011                next_offset += envelope_size;
12012            }
12013
12014            let next_out_of_line = decoder.next_out_of_line();
12015            let handles_before = decoder.remaining_handles();
12016            if let Some((inlined, num_bytes, num_handles)) =
12017                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12018            {
12019                let member_inline_size = <fidl::encoding::Endpoint<
12020                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12021                > as fidl::encoding::TypeMarker>::inline_size(
12022                    decoder.context
12023                );
12024                if inlined != (member_inline_size <= 4) {
12025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12026                }
12027                let inner_offset;
12028                let mut inner_depth = depth.clone();
12029                if inlined {
12030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12031                    inner_offset = next_offset;
12032                } else {
12033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12034                    inner_depth.increment()?;
12035                }
12036                let val_ref = self.ramdisk.get_or_insert_with(|| {
12037                    fidl::new_empty!(
12038                        fidl::encoding::Endpoint<
12039                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12040                        >,
12041                        fidl::encoding::DefaultFuchsiaResourceDialect
12042                    )
12043                });
12044                fidl::decode!(
12045                    fidl::encoding::Endpoint<
12046                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12047                    >,
12048                    fidl::encoding::DefaultFuchsiaResourceDialect,
12049                    val_ref,
12050                    decoder,
12051                    inner_offset,
12052                    inner_depth
12053                )?;
12054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12055                {
12056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12057                }
12058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12060                }
12061            }
12062
12063            next_offset += envelope_size;
12064            _next_ordinal_to_read += 1;
12065            if next_offset >= end_offset {
12066                return Ok(());
12067            }
12068
12069            // Decode unknown envelopes for gaps in ordinals.
12070            while _next_ordinal_to_read < 4 {
12071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12072                _next_ordinal_to_read += 1;
12073                next_offset += envelope_size;
12074            }
12075
12076            let next_out_of_line = decoder.next_out_of_line();
12077            let handles_before = decoder.remaining_handles();
12078            if let Some((inlined, num_bytes, num_handles)) =
12079                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12080            {
12081                let member_inline_size = <fidl::encoding::Endpoint<
12082                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12083                > as fidl::encoding::TypeMarker>::inline_size(
12084                    decoder.context
12085                );
12086                if inlined != (member_inline_size <= 4) {
12087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12088                }
12089                let inner_offset;
12090                let mut inner_depth = depth.clone();
12091                if inlined {
12092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12093                    inner_offset = next_offset;
12094                } else {
12095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12096                    inner_depth.increment()?;
12097                }
12098                let val_ref = self.dtb_overlay.get_or_insert_with(|| {
12099                    fidl::new_empty!(
12100                        fidl::encoding::Endpoint<
12101                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12102                        >,
12103                        fidl::encoding::DefaultFuchsiaResourceDialect
12104                    )
12105                });
12106                fidl::decode!(
12107                    fidl::encoding::Endpoint<
12108                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
12109                    >,
12110                    fidl::encoding::DefaultFuchsiaResourceDialect,
12111                    val_ref,
12112                    decoder,
12113                    inner_offset,
12114                    inner_depth
12115                )?;
12116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12117                {
12118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12119                }
12120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12122                }
12123            }
12124
12125            next_offset += envelope_size;
12126            _next_ordinal_to_read += 1;
12127            if next_offset >= end_offset {
12128                return Ok(());
12129            }
12130
12131            // Decode unknown envelopes for gaps in ordinals.
12132            while _next_ordinal_to_read < 5 {
12133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12134                _next_ordinal_to_read += 1;
12135                next_offset += envelope_size;
12136            }
12137
12138            let next_out_of_line = decoder.next_out_of_line();
12139            let handles_before = decoder.remaining_handles();
12140            if let Some((inlined, num_bytes, num_handles)) =
12141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12142            {
12143                let member_inline_size =
12144                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
12145                        decoder.context,
12146                    );
12147                if inlined != (member_inline_size <= 4) {
12148                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12149                }
12150                let inner_offset;
12151                let mut inner_depth = depth.clone();
12152                if inlined {
12153                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12154                    inner_offset = next_offset;
12155                } else {
12156                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12157                    inner_depth.increment()?;
12158                }
12159                let val_ref = self.cmdline.get_or_insert_with(|| {
12160                    fidl::new_empty!(
12161                        fidl::encoding::UnboundedString,
12162                        fidl::encoding::DefaultFuchsiaResourceDialect
12163                    )
12164                });
12165                fidl::decode!(
12166                    fidl::encoding::UnboundedString,
12167                    fidl::encoding::DefaultFuchsiaResourceDialect,
12168                    val_ref,
12169                    decoder,
12170                    inner_offset,
12171                    inner_depth
12172                )?;
12173                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12174                {
12175                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12176                }
12177                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12178                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12179                }
12180            }
12181
12182            next_offset += envelope_size;
12183            _next_ordinal_to_read += 1;
12184            if next_offset >= end_offset {
12185                return Ok(());
12186            }
12187
12188            // Decode unknown envelopes for gaps in ordinals.
12189            while _next_ordinal_to_read < 6 {
12190                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12191                _next_ordinal_to_read += 1;
12192                next_offset += envelope_size;
12193            }
12194
12195            let next_out_of_line = decoder.next_out_of_line();
12196            let handles_before = decoder.remaining_handles();
12197            if let Some((inlined, num_bytes, num_handles)) =
12198                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12199            {
12200                let member_inline_size = <fidl::encoding::UnboundedVector<
12201                    fidl::encoding::UnboundedString,
12202                > as fidl::encoding::TypeMarker>::inline_size(
12203                    decoder.context
12204                );
12205                if inlined != (member_inline_size <= 4) {
12206                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12207                }
12208                let inner_offset;
12209                let mut inner_depth = depth.clone();
12210                if inlined {
12211                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12212                    inner_offset = next_offset;
12213                } else {
12214                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12215                    inner_depth.increment()?;
12216                }
12217                let val_ref = self.cmdline_add.get_or_insert_with(|| {
12218                    fidl::new_empty!(
12219                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12220                        fidl::encoding::DefaultFuchsiaResourceDialect
12221                    )
12222                });
12223                fidl::decode!(
12224                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
12225                    fidl::encoding::DefaultFuchsiaResourceDialect,
12226                    val_ref,
12227                    decoder,
12228                    inner_offset,
12229                    inner_depth
12230                )?;
12231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12232                {
12233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12234                }
12235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12237                }
12238            }
12239
12240            next_offset += envelope_size;
12241            _next_ordinal_to_read += 1;
12242            if next_offset >= end_offset {
12243                return Ok(());
12244            }
12245
12246            // Decode unknown envelopes for gaps in ordinals.
12247            while _next_ordinal_to_read < 7 {
12248                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12249                _next_ordinal_to_read += 1;
12250                next_offset += envelope_size;
12251            }
12252
12253            let next_out_of_line = decoder.next_out_of_line();
12254            let handles_before = decoder.remaining_handles();
12255            if let Some((inlined, num_bytes, num_handles)) =
12256                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12257            {
12258                let member_inline_size =
12259                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12260                if inlined != (member_inline_size <= 4) {
12261                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12262                }
12263                let inner_offset;
12264                let mut inner_depth = depth.clone();
12265                if inlined {
12266                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12267                    inner_offset = next_offset;
12268                } else {
12269                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12270                    inner_depth.increment()?;
12271                }
12272                let val_ref = self.cpus.get_or_insert_with(|| {
12273                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
12274                });
12275                fidl::decode!(
12276                    u8,
12277                    fidl::encoding::DefaultFuchsiaResourceDialect,
12278                    val_ref,
12279                    decoder,
12280                    inner_offset,
12281                    inner_depth
12282                )?;
12283                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12284                {
12285                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12286                }
12287                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12288                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12289                }
12290            }
12291
12292            next_offset += envelope_size;
12293            _next_ordinal_to_read += 1;
12294            if next_offset >= end_offset {
12295                return Ok(());
12296            }
12297
12298            // Decode unknown envelopes for gaps in ordinals.
12299            while _next_ordinal_to_read < 8 {
12300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12301                _next_ordinal_to_read += 1;
12302                next_offset += envelope_size;
12303            }
12304
12305            let next_out_of_line = decoder.next_out_of_line();
12306            let handles_before = decoder.remaining_handles();
12307            if let Some((inlined, num_bytes, num_handles)) =
12308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12309            {
12310                let member_inline_size =
12311                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12312                if inlined != (member_inline_size <= 4) {
12313                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12314                }
12315                let inner_offset;
12316                let mut inner_depth = depth.clone();
12317                if inlined {
12318                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12319                    inner_offset = next_offset;
12320                } else {
12321                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12322                    inner_depth.increment()?;
12323                }
12324                let val_ref = self.guest_memory.get_or_insert_with(|| {
12325                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
12326                });
12327                fidl::decode!(
12328                    u64,
12329                    fidl::encoding::DefaultFuchsiaResourceDialect,
12330                    val_ref,
12331                    decoder,
12332                    inner_offset,
12333                    inner_depth
12334                )?;
12335                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12336                {
12337                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12338                }
12339                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12340                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12341                }
12342            }
12343
12344            next_offset += envelope_size;
12345            _next_ordinal_to_read += 1;
12346            if next_offset >= end_offset {
12347                return Ok(());
12348            }
12349
12350            // Decode unknown envelopes for gaps in ordinals.
12351            while _next_ordinal_to_read < 9 {
12352                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12353                _next_ordinal_to_read += 1;
12354                next_offset += envelope_size;
12355            }
12356
12357            let next_out_of_line = decoder.next_out_of_line();
12358            let handles_before = decoder.remaining_handles();
12359            if let Some((inlined, num_bytes, num_handles)) =
12360                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12361            {
12362                let member_inline_size = <fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12363                if inlined != (member_inline_size <= 4) {
12364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12365                }
12366                let inner_offset;
12367                let mut inner_depth = depth.clone();
12368                if inlined {
12369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12370                    inner_offset = next_offset;
12371                } else {
12372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12373                    inner_depth.increment()?;
12374                }
12375                let val_ref =
12376                self.block_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
12377                fidl::decode!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12378                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12379                {
12380                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12381                }
12382                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12383                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12384                }
12385            }
12386
12387            next_offset += envelope_size;
12388            _next_ordinal_to_read += 1;
12389            if next_offset >= end_offset {
12390                return Ok(());
12391            }
12392
12393            // Decode unknown envelopes for gaps in ordinals.
12394            while _next_ordinal_to_read < 10 {
12395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12396                _next_ordinal_to_read += 1;
12397                next_offset += envelope_size;
12398            }
12399
12400            let next_out_of_line = decoder.next_out_of_line();
12401            let handles_before = decoder.remaining_handles();
12402            if let Some((inlined, num_bytes, num_handles)) =
12403                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12404            {
12405                let member_inline_size = <fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12406                if inlined != (member_inline_size <= 4) {
12407                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12408                }
12409                let inner_offset;
12410                let mut inner_depth = depth.clone();
12411                if inlined {
12412                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12413                    inner_offset = next_offset;
12414                } else {
12415                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12416                    inner_depth.increment()?;
12417                }
12418                let val_ref =
12419                self.net_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
12420                fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12421                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12422                {
12423                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12424                }
12425                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12426                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12427                }
12428            }
12429
12430            next_offset += envelope_size;
12431            _next_ordinal_to_read += 1;
12432            if next_offset >= end_offset {
12433                return Ok(());
12434            }
12435
12436            // Decode unknown envelopes for gaps in ordinals.
12437            while _next_ordinal_to_read < 11 {
12438                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12439                _next_ordinal_to_read += 1;
12440                next_offset += envelope_size;
12441            }
12442
12443            let next_out_of_line = decoder.next_out_of_line();
12444            let handles_before = decoder.remaining_handles();
12445            if let Some((inlined, num_bytes, num_handles)) =
12446                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12447            {
12448                let member_inline_size =
12449                    <WaylandDevice as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12450                if inlined != (member_inline_size <= 4) {
12451                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12452                }
12453                let inner_offset;
12454                let mut inner_depth = depth.clone();
12455                if inlined {
12456                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12457                    inner_offset = next_offset;
12458                } else {
12459                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12460                    inner_depth.increment()?;
12461                }
12462                let val_ref = self.wayland_device.get_or_insert_with(|| {
12463                    fidl::new_empty!(WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect)
12464                });
12465                fidl::decode!(
12466                    WaylandDevice,
12467                    fidl::encoding::DefaultFuchsiaResourceDialect,
12468                    val_ref,
12469                    decoder,
12470                    inner_offset,
12471                    inner_depth
12472                )?;
12473                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12474                {
12475                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12476                }
12477                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12478                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12479                }
12480            }
12481
12482            next_offset += envelope_size;
12483            _next_ordinal_to_read += 1;
12484            if next_offset >= end_offset {
12485                return Ok(());
12486            }
12487
12488            // Decode unknown envelopes for gaps in ordinals.
12489            while _next_ordinal_to_read < 12 {
12490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12491                _next_ordinal_to_read += 1;
12492                next_offset += envelope_size;
12493            }
12494
12495            let next_out_of_line = decoder.next_out_of_line();
12496            let handles_before = decoder.remaining_handles();
12497            if let Some((inlined, num_bytes, num_handles)) =
12498                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12499            {
12500                let member_inline_size =
12501                    <MagmaDevice as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12502                if inlined != (member_inline_size <= 4) {
12503                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12504                }
12505                let inner_offset;
12506                let mut inner_depth = depth.clone();
12507                if inlined {
12508                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12509                    inner_offset = next_offset;
12510                } else {
12511                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12512                    inner_depth.increment()?;
12513                }
12514                let val_ref = self.magma_device.get_or_insert_with(|| {
12515                    fidl::new_empty!(MagmaDevice, fidl::encoding::DefaultFuchsiaResourceDialect)
12516                });
12517                fidl::decode!(
12518                    MagmaDevice,
12519                    fidl::encoding::DefaultFuchsiaResourceDialect,
12520                    val_ref,
12521                    decoder,
12522                    inner_offset,
12523                    inner_depth
12524                )?;
12525                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12526                {
12527                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12528                }
12529                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12530                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12531                }
12532            }
12533
12534            next_offset += envelope_size;
12535            _next_ordinal_to_read += 1;
12536            if next_offset >= end_offset {
12537                return Ok(());
12538            }
12539
12540            // Decode unknown envelopes for gaps in ordinals.
12541            while _next_ordinal_to_read < 13 {
12542                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12543                _next_ordinal_to_read += 1;
12544                next_offset += envelope_size;
12545            }
12546
12547            let next_out_of_line = decoder.next_out_of_line();
12548            let handles_before = decoder.remaining_handles();
12549            if let Some((inlined, num_bytes, num_handles)) =
12550                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12551            {
12552                let member_inline_size =
12553                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12554                if inlined != (member_inline_size <= 4) {
12555                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12556                }
12557                let inner_offset;
12558                let mut inner_depth = depth.clone();
12559                if inlined {
12560                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12561                    inner_offset = next_offset;
12562                } else {
12563                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12564                    inner_depth.increment()?;
12565                }
12566                let val_ref = self.default_net.get_or_insert_with(|| {
12567                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12568                });
12569                fidl::decode!(
12570                    bool,
12571                    fidl::encoding::DefaultFuchsiaResourceDialect,
12572                    val_ref,
12573                    decoder,
12574                    inner_offset,
12575                    inner_depth
12576                )?;
12577                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12578                {
12579                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12580                }
12581                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12582                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12583                }
12584            }
12585
12586            next_offset += envelope_size;
12587            _next_ordinal_to_read += 1;
12588            if next_offset >= end_offset {
12589                return Ok(());
12590            }
12591
12592            // Decode unknown envelopes for gaps in ordinals.
12593            while _next_ordinal_to_read < 14 {
12594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12595                _next_ordinal_to_read += 1;
12596                next_offset += envelope_size;
12597            }
12598
12599            let next_out_of_line = decoder.next_out_of_line();
12600            let handles_before = decoder.remaining_handles();
12601            if let Some((inlined, num_bytes, num_handles)) =
12602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12603            {
12604                let member_inline_size =
12605                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12606                if inlined != (member_inline_size <= 4) {
12607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12608                }
12609                let inner_offset;
12610                let mut inner_depth = depth.clone();
12611                if inlined {
12612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12613                    inner_offset = next_offset;
12614                } else {
12615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12616                    inner_depth.increment()?;
12617                }
12618                let val_ref = self.virtio_balloon.get_or_insert_with(|| {
12619                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12620                });
12621                fidl::decode!(
12622                    bool,
12623                    fidl::encoding::DefaultFuchsiaResourceDialect,
12624                    val_ref,
12625                    decoder,
12626                    inner_offset,
12627                    inner_depth
12628                )?;
12629                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12630                {
12631                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12632                }
12633                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12634                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12635                }
12636            }
12637
12638            next_offset += envelope_size;
12639            _next_ordinal_to_read += 1;
12640            if next_offset >= end_offset {
12641                return Ok(());
12642            }
12643
12644            // Decode unknown envelopes for gaps in ordinals.
12645            while _next_ordinal_to_read < 15 {
12646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12647                _next_ordinal_to_read += 1;
12648                next_offset += envelope_size;
12649            }
12650
12651            let next_out_of_line = decoder.next_out_of_line();
12652            let handles_before = decoder.remaining_handles();
12653            if let Some((inlined, num_bytes, num_handles)) =
12654                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12655            {
12656                let member_inline_size =
12657                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12658                if inlined != (member_inline_size <= 4) {
12659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12660                }
12661                let inner_offset;
12662                let mut inner_depth = depth.clone();
12663                if inlined {
12664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12665                    inner_offset = next_offset;
12666                } else {
12667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12668                    inner_depth.increment()?;
12669                }
12670                let val_ref = self.virtio_console.get_or_insert_with(|| {
12671                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12672                });
12673                fidl::decode!(
12674                    bool,
12675                    fidl::encoding::DefaultFuchsiaResourceDialect,
12676                    val_ref,
12677                    decoder,
12678                    inner_offset,
12679                    inner_depth
12680                )?;
12681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12682                {
12683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12684                }
12685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12687                }
12688            }
12689
12690            next_offset += envelope_size;
12691            _next_ordinal_to_read += 1;
12692            if next_offset >= end_offset {
12693                return Ok(());
12694            }
12695
12696            // Decode unknown envelopes for gaps in ordinals.
12697            while _next_ordinal_to_read < 16 {
12698                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12699                _next_ordinal_to_read += 1;
12700                next_offset += envelope_size;
12701            }
12702
12703            let next_out_of_line = decoder.next_out_of_line();
12704            let handles_before = decoder.remaining_handles();
12705            if let Some((inlined, num_bytes, num_handles)) =
12706                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12707            {
12708                let member_inline_size =
12709                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12710                if inlined != (member_inline_size <= 4) {
12711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12712                }
12713                let inner_offset;
12714                let mut inner_depth = depth.clone();
12715                if inlined {
12716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12717                    inner_offset = next_offset;
12718                } else {
12719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12720                    inner_depth.increment()?;
12721                }
12722                let val_ref = self.virtio_gpu.get_or_insert_with(|| {
12723                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12724                });
12725                fidl::decode!(
12726                    bool,
12727                    fidl::encoding::DefaultFuchsiaResourceDialect,
12728                    val_ref,
12729                    decoder,
12730                    inner_offset,
12731                    inner_depth
12732                )?;
12733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12734                {
12735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12736                }
12737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12739                }
12740            }
12741
12742            next_offset += envelope_size;
12743            _next_ordinal_to_read += 1;
12744            if next_offset >= end_offset {
12745                return Ok(());
12746            }
12747
12748            // Decode unknown envelopes for gaps in ordinals.
12749            while _next_ordinal_to_read < 17 {
12750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12751                _next_ordinal_to_read += 1;
12752                next_offset += envelope_size;
12753            }
12754
12755            let next_out_of_line = decoder.next_out_of_line();
12756            let handles_before = decoder.remaining_handles();
12757            if let Some((inlined, num_bytes, num_handles)) =
12758                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12759            {
12760                let member_inline_size =
12761                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12762                if inlined != (member_inline_size <= 4) {
12763                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12764                }
12765                let inner_offset;
12766                let mut inner_depth = depth.clone();
12767                if inlined {
12768                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12769                    inner_offset = next_offset;
12770                } else {
12771                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12772                    inner_depth.increment()?;
12773                }
12774                let val_ref = self.virtio_rng.get_or_insert_with(|| {
12775                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12776                });
12777                fidl::decode!(
12778                    bool,
12779                    fidl::encoding::DefaultFuchsiaResourceDialect,
12780                    val_ref,
12781                    decoder,
12782                    inner_offset,
12783                    inner_depth
12784                )?;
12785                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12786                {
12787                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12788                }
12789                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12790                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12791                }
12792            }
12793
12794            next_offset += envelope_size;
12795            _next_ordinal_to_read += 1;
12796            if next_offset >= end_offset {
12797                return Ok(());
12798            }
12799
12800            // Decode unknown envelopes for gaps in ordinals.
12801            while _next_ordinal_to_read < 18 {
12802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12803                _next_ordinal_to_read += 1;
12804                next_offset += envelope_size;
12805            }
12806
12807            let next_out_of_line = decoder.next_out_of_line();
12808            let handles_before = decoder.remaining_handles();
12809            if let Some((inlined, num_bytes, num_handles)) =
12810                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12811            {
12812                let member_inline_size =
12813                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12814                if inlined != (member_inline_size <= 4) {
12815                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12816                }
12817                let inner_offset;
12818                let mut inner_depth = depth.clone();
12819                if inlined {
12820                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12821                    inner_offset = next_offset;
12822                } else {
12823                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12824                    inner_depth.increment()?;
12825                }
12826                let val_ref = self.virtio_vsock.get_or_insert_with(|| {
12827                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12828                });
12829                fidl::decode!(
12830                    bool,
12831                    fidl::encoding::DefaultFuchsiaResourceDialect,
12832                    val_ref,
12833                    decoder,
12834                    inner_offset,
12835                    inner_depth
12836                )?;
12837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12838                {
12839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12840                }
12841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12843                }
12844            }
12845
12846            next_offset += envelope_size;
12847            _next_ordinal_to_read += 1;
12848            if next_offset >= end_offset {
12849                return Ok(());
12850            }
12851
12852            // Decode unknown envelopes for gaps in ordinals.
12853            while _next_ordinal_to_read < 19 {
12854                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12855                _next_ordinal_to_read += 1;
12856                next_offset += envelope_size;
12857            }
12858
12859            let next_out_of_line = decoder.next_out_of_line();
12860            let handles_before = decoder.remaining_handles();
12861            if let Some((inlined, num_bytes, num_handles)) =
12862                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12863            {
12864                let member_inline_size =
12865                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12866                if inlined != (member_inline_size <= 4) {
12867                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12868                }
12869                let inner_offset;
12870                let mut inner_depth = depth.clone();
12871                if inlined {
12872                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12873                    inner_offset = next_offset;
12874                } else {
12875                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12876                    inner_depth.increment()?;
12877                }
12878                let val_ref = self.virtio_sound.get_or_insert_with(|| {
12879                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12880                });
12881                fidl::decode!(
12882                    bool,
12883                    fidl::encoding::DefaultFuchsiaResourceDialect,
12884                    val_ref,
12885                    decoder,
12886                    inner_offset,
12887                    inner_depth
12888                )?;
12889                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12890                {
12891                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12892                }
12893                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12894                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12895                }
12896            }
12897
12898            next_offset += envelope_size;
12899            _next_ordinal_to_read += 1;
12900            if next_offset >= end_offset {
12901                return Ok(());
12902            }
12903
12904            // Decode unknown envelopes for gaps in ordinals.
12905            while _next_ordinal_to_read < 20 {
12906                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12907                _next_ordinal_to_read += 1;
12908                next_offset += envelope_size;
12909            }
12910
12911            let next_out_of_line = decoder.next_out_of_line();
12912            let handles_before = decoder.remaining_handles();
12913            if let Some((inlined, num_bytes, num_handles)) =
12914                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12915            {
12916                let member_inline_size =
12917                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12918                if inlined != (member_inline_size <= 4) {
12919                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12920                }
12921                let inner_offset;
12922                let mut inner_depth = depth.clone();
12923                if inlined {
12924                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12925                    inner_offset = next_offset;
12926                } else {
12927                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12928                    inner_depth.increment()?;
12929                }
12930                let val_ref = self.virtio_sound_input.get_or_insert_with(|| {
12931                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12932                });
12933                fidl::decode!(
12934                    bool,
12935                    fidl::encoding::DefaultFuchsiaResourceDialect,
12936                    val_ref,
12937                    decoder,
12938                    inner_offset,
12939                    inner_depth
12940                )?;
12941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12942                {
12943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12944                }
12945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12947                }
12948            }
12949
12950            next_offset += envelope_size;
12951            _next_ordinal_to_read += 1;
12952            if next_offset >= end_offset {
12953                return Ok(());
12954            }
12955
12956            // Decode unknown envelopes for gaps in ordinals.
12957            while _next_ordinal_to_read < 21 {
12958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12959                _next_ordinal_to_read += 1;
12960                next_offset += envelope_size;
12961            }
12962
12963            let next_out_of_line = decoder.next_out_of_line();
12964            let handles_before = decoder.remaining_handles();
12965            if let Some((inlined, num_bytes, num_handles)) =
12966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12967            {
12968                let member_inline_size = <fidl::encoding::UnboundedVector<Listener> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12969                if inlined != (member_inline_size <= 4) {
12970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12971                }
12972                let inner_offset;
12973                let mut inner_depth = depth.clone();
12974                if inlined {
12975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12976                    inner_offset = next_offset;
12977                } else {
12978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12979                    inner_depth.increment()?;
12980                }
12981                let val_ref = self.vsock_listeners.get_or_insert_with(|| {
12982                    fidl::new_empty!(
12983                        fidl::encoding::UnboundedVector<Listener>,
12984                        fidl::encoding::DefaultFuchsiaResourceDialect
12985                    )
12986                });
12987                fidl::decode!(
12988                    fidl::encoding::UnboundedVector<Listener>,
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 < 22 {
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                    <bool 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.virtio_mem.get_or_insert_with(|| {
13037                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13038                });
13039                fidl::decode!(
13040                    bool,
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 < 23 {
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 =
13075                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13076                if inlined != (member_inline_size <= 4) {
13077                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13078                }
13079                let inner_offset;
13080                let mut inner_depth = depth.clone();
13081                if inlined {
13082                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13083                    inner_offset = next_offset;
13084                } else {
13085                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13086                    inner_depth.increment()?;
13087                }
13088                let val_ref = self.virtio_mem_block_size.get_or_insert_with(|| {
13089                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13090                });
13091                fidl::decode!(
13092                    u64,
13093                    fidl::encoding::DefaultFuchsiaResourceDialect,
13094                    val_ref,
13095                    decoder,
13096                    inner_offset,
13097                    inner_depth
13098                )?;
13099                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13100                {
13101                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13102                }
13103                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13104                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13105                }
13106            }
13107
13108            next_offset += envelope_size;
13109            _next_ordinal_to_read += 1;
13110            if next_offset >= end_offset {
13111                return Ok(());
13112            }
13113
13114            // Decode unknown envelopes for gaps in ordinals.
13115            while _next_ordinal_to_read < 24 {
13116                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13117                _next_ordinal_to_read += 1;
13118                next_offset += envelope_size;
13119            }
13120
13121            let next_out_of_line = decoder.next_out_of_line();
13122            let handles_before = decoder.remaining_handles();
13123            if let Some((inlined, num_bytes, num_handles)) =
13124                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13125            {
13126                let member_inline_size =
13127                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13128                if inlined != (member_inline_size <= 4) {
13129                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13130                }
13131                let inner_offset;
13132                let mut inner_depth = depth.clone();
13133                if inlined {
13134                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13135                    inner_offset = next_offset;
13136                } else {
13137                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13138                    inner_depth.increment()?;
13139                }
13140                let val_ref = self.virtio_mem_region_size.get_or_insert_with(|| {
13141                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13142                });
13143                fidl::decode!(
13144                    u64,
13145                    fidl::encoding::DefaultFuchsiaResourceDialect,
13146                    val_ref,
13147                    decoder,
13148                    inner_offset,
13149                    inner_depth
13150                )?;
13151                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13152                {
13153                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13154                }
13155                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13156                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13157                }
13158            }
13159
13160            next_offset += envelope_size;
13161            _next_ordinal_to_read += 1;
13162            if next_offset >= end_offset {
13163                return Ok(());
13164            }
13165
13166            // Decode unknown envelopes for gaps in ordinals.
13167            while _next_ordinal_to_read < 25 {
13168                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13169                _next_ordinal_to_read += 1;
13170                next_offset += envelope_size;
13171            }
13172
13173            let next_out_of_line = decoder.next_out_of_line();
13174            let handles_before = decoder.remaining_handles();
13175            if let Some((inlined, num_bytes, num_handles)) =
13176                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13177            {
13178                let member_inline_size =
13179                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13180                if inlined != (member_inline_size <= 4) {
13181                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13182                }
13183                let inner_offset;
13184                let mut inner_depth = depth.clone();
13185                if inlined {
13186                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13187                    inner_offset = next_offset;
13188                } else {
13189                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13190                    inner_depth.increment()?;
13191                }
13192                let val_ref = self.virtio_mem_region_alignment.get_or_insert_with(|| {
13193                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
13194                });
13195                fidl::decode!(
13196                    u64,
13197                    fidl::encoding::DefaultFuchsiaResourceDialect,
13198                    val_ref,
13199                    decoder,
13200                    inner_offset,
13201                    inner_depth
13202                )?;
13203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13204                {
13205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13206                }
13207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13209                }
13210            }
13211
13212            next_offset += envelope_size;
13213
13214            // Decode the remaining unknown envelopes.
13215            while next_offset < end_offset {
13216                _next_ordinal_to_read += 1;
13217                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13218                next_offset += envelope_size;
13219            }
13220
13221            Ok(())
13222        }
13223    }
13224
13225    impl fidl::encoding::ResourceTypeMarker for BlockFormat {
13226        type Borrowed<'a> = &'a mut Self;
13227        fn take_or_borrow<'a>(
13228            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13229        ) -> Self::Borrowed<'a> {
13230            value
13231        }
13232    }
13233
13234    unsafe impl fidl::encoding::TypeMarker for BlockFormat {
13235        type Owned = Self;
13236
13237        #[inline(always)]
13238        fn inline_align(_context: fidl::encoding::Context) -> usize {
13239            8
13240        }
13241
13242        #[inline(always)]
13243        fn inline_size(_context: fidl::encoding::Context) -> usize {
13244            16
13245        }
13246    }
13247
13248    unsafe impl fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>
13249        for &mut BlockFormat
13250    {
13251        #[inline]
13252        unsafe fn encode(
13253            self,
13254            encoder: &mut fidl::encoding::Encoder<
13255                '_,
13256                fidl::encoding::DefaultFuchsiaResourceDialect,
13257            >,
13258            offset: usize,
13259            _depth: fidl::encoding::Depth,
13260        ) -> fidl::Result<()> {
13261            encoder.debug_check_bounds::<BlockFormat>(offset);
13262            encoder.write_num::<u64>(self.ordinal(), offset);
13263            match self {
13264                BlockFormat::File(ref mut val) => fidl::encoding::encode_in_envelope::<
13265                    fidl::encoding::Endpoint<
13266                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13267                    >,
13268                    fidl::encoding::DefaultFuchsiaResourceDialect,
13269                >(
13270                    <fidl::encoding::Endpoint<
13271                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13272                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13273                        val
13274                    ),
13275                    encoder,
13276                    offset + 8,
13277                    _depth,
13278                ),
13279                BlockFormat::Qcow(ref mut val) => fidl::encoding::encode_in_envelope::<
13280                    fidl::encoding::HandleType<
13281                        fidl::Channel,
13282                        { fidl::ObjectType::CHANNEL.into_raw() },
13283                        2147483648,
13284                    >,
13285                    fidl::encoding::DefaultFuchsiaResourceDialect,
13286                >(
13287                    <fidl::encoding::HandleType<
13288                        fidl::Channel,
13289                        { fidl::ObjectType::CHANNEL.into_raw() },
13290                        2147483648,
13291                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13292                        val
13293                    ),
13294                    encoder,
13295                    offset + 8,
13296                    _depth,
13297                ),
13298                BlockFormat::Block(ref mut val) => fidl::encoding::encode_in_envelope::<
13299                    fidl::encoding::Endpoint<
13300                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
13301                    >,
13302                    fidl::encoding::DefaultFuchsiaResourceDialect,
13303                >(
13304                    <fidl::encoding::Endpoint<
13305                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
13306                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13307                        val
13308                    ),
13309                    encoder,
13310                    offset + 8,
13311                    _depth,
13312                ),
13313            }
13314        }
13315    }
13316
13317    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {
13318        #[inline(always)]
13319        fn new_empty() -> Self {
13320            Self::File(fidl::new_empty!(
13321                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
13322                fidl::encoding::DefaultFuchsiaResourceDialect
13323            ))
13324        }
13325
13326        #[inline]
13327        unsafe fn decode(
13328            &mut self,
13329            decoder: &mut fidl::encoding::Decoder<
13330                '_,
13331                fidl::encoding::DefaultFuchsiaResourceDialect,
13332            >,
13333            offset: usize,
13334            mut depth: fidl::encoding::Depth,
13335        ) -> fidl::Result<()> {
13336            decoder.debug_check_bounds::<Self>(offset);
13337            #[allow(unused_variables)]
13338            let next_out_of_line = decoder.next_out_of_line();
13339            let handles_before = decoder.remaining_handles();
13340            let (ordinal, inlined, num_bytes, num_handles) =
13341                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13342
13343            let member_inline_size = match ordinal {
13344                1 => <fidl::encoding::Endpoint<
13345                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13346                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13347                2 => <fidl::encoding::HandleType<
13348                    fidl::Channel,
13349                    { fidl::ObjectType::CHANNEL.into_raw() },
13350                    2147483648,
13351                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13352                3 => <fidl::encoding::Endpoint<
13353                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
13354                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13355                _ => return Err(fidl::Error::UnknownUnionTag),
13356            };
13357
13358            if inlined != (member_inline_size <= 4) {
13359                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13360            }
13361            let _inner_offset;
13362            if inlined {
13363                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13364                _inner_offset = offset + 8;
13365            } else {
13366                depth.increment()?;
13367                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13368            }
13369            match ordinal {
13370                1 => {
13371                    #[allow(irrefutable_let_patterns)]
13372                    if let BlockFormat::File(_) = self {
13373                        // Do nothing, read the value into the object
13374                    } else {
13375                        // Initialize `self` to the right variant
13376                        *self = BlockFormat::File(fidl::new_empty!(
13377                            fidl::encoding::Endpoint<
13378                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13379                            >,
13380                            fidl::encoding::DefaultFuchsiaResourceDialect
13381                        ));
13382                    }
13383                    #[allow(irrefutable_let_patterns)]
13384                    if let BlockFormat::File(ref mut val) = self {
13385                        fidl::decode!(
13386                            fidl::encoding::Endpoint<
13387                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
13388                            >,
13389                            fidl::encoding::DefaultFuchsiaResourceDialect,
13390                            val,
13391                            decoder,
13392                            _inner_offset,
13393                            depth
13394                        )?;
13395                    } else {
13396                        unreachable!()
13397                    }
13398                }
13399                2 => {
13400                    #[allow(irrefutable_let_patterns)]
13401                    if let BlockFormat::Qcow(_) = self {
13402                        // Do nothing, read the value into the object
13403                    } else {
13404                        // Initialize `self` to the right variant
13405                        *self = BlockFormat::Qcow(
13406                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13407                        );
13408                    }
13409                    #[allow(irrefutable_let_patterns)]
13410                    if let BlockFormat::Qcow(ref mut val) = self {
13411                        fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
13412                    } else {
13413                        unreachable!()
13414                    }
13415                }
13416                3 => {
13417                    #[allow(irrefutable_let_patterns)]
13418                    if let BlockFormat::Block(_) = self {
13419                        // Do nothing, read the value into the object
13420                    } else {
13421                        // Initialize `self` to the right variant
13422                        *self = BlockFormat::Block(fidl::new_empty!(
13423                            fidl::encoding::Endpoint<
13424                                fidl::endpoints::ClientEnd<
13425                                    fidl_fuchsia_hardware_block::BlockMarker,
13426                                >,
13427                            >,
13428                            fidl::encoding::DefaultFuchsiaResourceDialect
13429                        ));
13430                    }
13431                    #[allow(irrefutable_let_patterns)]
13432                    if let BlockFormat::Block(ref mut val) = self {
13433                        fidl::decode!(
13434                            fidl::encoding::Endpoint<
13435                                fidl::endpoints::ClientEnd<
13436                                    fidl_fuchsia_hardware_block::BlockMarker,
13437                                >,
13438                            >,
13439                            fidl::encoding::DefaultFuchsiaResourceDialect,
13440                            val,
13441                            decoder,
13442                            _inner_offset,
13443                            depth
13444                        )?;
13445                    } else {
13446                        unreachable!()
13447                    }
13448                }
13449                ordinal => panic!("unexpected ordinal {:?}", ordinal),
13450            }
13451            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
13452                return Err(fidl::Error::InvalidNumBytesInEnvelope);
13453            }
13454            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13455                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13456            }
13457            Ok(())
13458        }
13459    }
13460}