fidl_fuchsia_hardware_pty/
fidl_fuchsia_hardware_pty.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub const DEVICE_PROTOCOL_NAME: &str = "fuchsia.hardware.pty/Device";
14
15/// The terminal has no active client.
16pub const EVENT_HANGUP: u32 = 1;
17
18/// The terminal received a ^C control character.
19pub const EVENT_INTERRUPT: u32 = 2;
20
21/// All events
22pub const EVENT_MASK: u32 = 15;
23
24/// The terminal received a ^Z control character.
25pub const EVENT_SUSPEND: u32 = 4;
26
27/// The terminal window has resized.
28pub const EVENT_WINDOW_SIZE: u32 = 8;
29
30/// When Feature Raw is enabled, OOB Events like ^c, ^z, etc are not generated.
31/// Instead the character is read from the read() input path.
32pub const FEATURE_RAW: u32 = 1;
33
34#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35#[repr(C)]
36pub struct DeviceClrSetFeatureRequest {
37    pub clr: u32,
38    pub set: u32,
39}
40
41impl fidl::Persistable for DeviceClrSetFeatureRequest {}
42
43#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44#[repr(C)]
45pub struct DeviceClrSetFeatureResponse {
46    pub status: i32,
47    pub features: u32,
48}
49
50impl fidl::Persistable for DeviceClrSetFeatureResponse {}
51
52#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
53#[repr(C)]
54pub struct DeviceGetWindowSizeResponse {
55    pub status: i32,
56    pub size: WindowSize,
57}
58
59impl fidl::Persistable for DeviceGetWindowSizeResponse {}
60
61#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62#[repr(C)]
63pub struct DeviceMakeActiveRequest {
64    pub client_pty_id: u32,
65}
66
67impl fidl::Persistable for DeviceMakeActiveRequest {}
68
69#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70#[repr(C)]
71pub struct DeviceMakeActiveResponse {
72    pub status: i32,
73}
74
75impl fidl::Persistable for DeviceMakeActiveResponse {}
76
77#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct DeviceOpenClientRequest {
79    pub id: u32,
80    pub client: fidl::endpoints::ServerEnd<DeviceMarker>,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceOpenClientRequest {}
84
85#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86#[repr(C)]
87pub struct DeviceOpenClientResponse {
88    pub s: i32,
89}
90
91impl fidl::Persistable for DeviceOpenClientResponse {}
92
93#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94#[repr(C)]
95pub struct DeviceReadEventsResponse {
96    pub status: i32,
97    pub events: u32,
98}
99
100impl fidl::Persistable for DeviceReadEventsResponse {}
101
102#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
103#[repr(C)]
104pub struct DeviceSetWindowSizeRequest {
105    pub size: WindowSize,
106}
107
108impl fidl::Persistable for DeviceSetWindowSizeRequest {}
109
110#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111#[repr(C)]
112pub struct DeviceSetWindowSizeResponse {
113    pub status: i32,
114}
115
116impl fidl::Persistable for DeviceSetWindowSizeResponse {}
117
118#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119#[repr(C)]
120pub struct WindowSize {
121    pub width: u32,
122    pub height: u32,
123}
124
125impl fidl::Persistable for WindowSize {}
126
127#[derive(Debug, Default, PartialEq)]
128pub struct DeviceDescribeResponse {
129    /// An optional event which transmits information about a device's state.
130    ///
131    /// The [`DeviceSignal`] values may be observed on this event.
132    pub event: Option<fidl::EventPair>,
133    #[doc(hidden)]
134    pub __source_breaking: fidl::marker::SourceBreaking,
135}
136
137impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceDescribeResponse {}
138
139#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
140pub struct DeviceMarker;
141
142impl fidl::endpoints::ProtocolMarker for DeviceMarker {
143    type Proxy = DeviceProxy;
144    type RequestStream = DeviceRequestStream;
145    #[cfg(target_os = "fuchsia")]
146    type SynchronousProxy = DeviceSynchronousProxy;
147
148    const DEBUG_NAME: &'static str = "fuchsia.hardware.pty.Device";
149}
150impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
151
152pub trait DeviceProxyInterface: Send + Sync {
153    fn r#clone(
154        &self,
155        request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
156    ) -> Result<(), fidl::Error>;
157    type CloseResponseFut: std::future::Future<
158            Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
159        > + Send;
160    fn r#close(&self) -> Self::CloseResponseFut;
161    type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
162    fn r#query(&self) -> Self::QueryResponseFut;
163    type ReadResponseFut: std::future::Future<Output = Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error>>
164        + Send;
165    fn r#read(&self, count: u64) -> Self::ReadResponseFut;
166    type WriteResponseFut: std::future::Future<Output = Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error>>
167        + Send;
168    fn r#write(&self, data: &[u8]) -> Self::WriteResponseFut;
169    type DescribeResponseFut: std::future::Future<Output = Result<DeviceDescribeResponse, fidl::Error>>
170        + Send;
171    fn r#describe(&self) -> Self::DescribeResponseFut;
172    type OpenClientResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
173    fn r#open_client(
174        &self,
175        id: u32,
176        client: fidl::endpoints::ServerEnd<DeviceMarker>,
177    ) -> Self::OpenClientResponseFut;
178    type ClrSetFeatureResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>>
179        + Send;
180    fn r#clr_set_feature(&self, clr: u32, set: u32) -> Self::ClrSetFeatureResponseFut;
181    type GetWindowSizeResponseFut: std::future::Future<Output = Result<(i32, WindowSize), fidl::Error>>
182        + Send;
183    fn r#get_window_size(&self) -> Self::GetWindowSizeResponseFut;
184    type MakeActiveResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
185    fn r#make_active(&self, client_pty_id: u32) -> Self::MakeActiveResponseFut;
186    type ReadEventsResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>> + Send;
187    fn r#read_events(&self) -> Self::ReadEventsResponseFut;
188    type SetWindowSizeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
189    fn r#set_window_size(&self, size: &WindowSize) -> Self::SetWindowSizeResponseFut;
190}
191#[derive(Debug)]
192#[cfg(target_os = "fuchsia")]
193pub struct DeviceSynchronousProxy {
194    client: fidl::client::sync::Client,
195}
196
197#[cfg(target_os = "fuchsia")]
198impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
199    type Proxy = DeviceProxy;
200    type Protocol = DeviceMarker;
201
202    fn from_channel(inner: fidl::Channel) -> Self {
203        Self::new(inner)
204    }
205
206    fn into_channel(self) -> fidl::Channel {
207        self.client.into_channel()
208    }
209
210    fn as_channel(&self) -> &fidl::Channel {
211        self.client.as_channel()
212    }
213}
214
215#[cfg(target_os = "fuchsia")]
216impl DeviceSynchronousProxy {
217    pub fn new(channel: fidl::Channel) -> Self {
218        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
219        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
220    }
221
222    pub fn into_channel(self) -> fidl::Channel {
223        self.client.into_channel()
224    }
225
226    /// Waits until an event arrives and returns it. It is safe for other
227    /// threads to make concurrent requests while waiting for an event.
228    pub fn wait_for_event(
229        &self,
230        deadline: zx::MonotonicInstant,
231    ) -> Result<DeviceEvent, fidl::Error> {
232        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
233    }
234
235    pub fn r#clone(
236        &self,
237        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
238    ) -> Result<(), fidl::Error> {
239        self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
240            (request,),
241            0x20d8a7aba2168a79,
242            fidl::encoding::DynamicFlags::empty(),
243        )
244    }
245
246    /// Terminates the connection.
247    ///
248    /// After calling `Close`, the client must not send any other requests.
249    ///
250    /// Servers, after sending the status response, should close the connection
251    /// regardless of status and without sending an epitaph.
252    ///
253    /// Closing the client end of the channel should be semantically equivalent
254    /// to calling `Close` without knowing when the close has completed or its
255    /// status.
256    pub fn r#close(
257        &self,
258        ___deadline: zx::MonotonicInstant,
259    ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
260        let _response = self.client.send_query::<
261            fidl::encoding::EmptyPayload,
262            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
263        >(
264            (),
265            0x5ac5d459ad7f657e,
266            fidl::encoding::DynamicFlags::empty(),
267            ___deadline,
268        )?;
269        Ok(_response.map(|x| x))
270    }
271
272    pub fn r#query(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
273        let _response = self.client.send_query::<
274            fidl::encoding::EmptyPayload,
275            fidl_fuchsia_unknown::QueryableQueryResponse,
276        >(
277            (),
278            0x2658edee9decfc06,
279            fidl::encoding::DynamicFlags::empty(),
280            ___deadline,
281        )?;
282        Ok(_response.protocol)
283    }
284
285    /// Reads up to 'count' bytes at the seek offset.
286    /// The seek offset is moved forward by the number of bytes read.
287    ///
288    /// ## Invariants
289    ///
290    /// * The returned `data.length` will never be greater than `count`.
291    /// * If `data.length` is less than `count`, it means that the seek offset
292    ///   has reached the end of file as part of this operation.
293    /// * If `data.length` is zero while `count` is not, it means that the
294    ///   seek offset is already at or beyond the end of file, and no data could
295    ///   be read.
296    /// * If `count` is zero, the server should perform all the checks ensuring
297    ///   read access without actually read anything, and return an empty
298    ///   `data` vector.
299    ///
300    /// This method requires the [`Rights.READ_BYTES`] right.
301    ///
302    /// Returns `ZX_ERR_OUT_OF_RANGE` if `count` is greater than `MAX_TRANSFER_SIZE`.
303    pub fn r#read(
304        &self,
305        mut count: u64,
306        ___deadline: zx::MonotonicInstant,
307    ) -> Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error> {
308        let _response = self.client.send_query::<
309            fidl_fuchsia_io::ReadableReadRequest,
310            fidl::encoding::ResultType<fidl_fuchsia_io::ReadableReadResponse, i32>,
311        >(
312            (count,),
313            0x57e419a298c8ede,
314            fidl::encoding::DynamicFlags::empty(),
315            ___deadline,
316        )?;
317        Ok(_response.map(|x| x.data))
318    }
319
320    /// Writes data at the seek offset.
321    /// The seek offset is moved forward by the number of bytes written.
322    /// If the file is in append mode, the seek offset is first set to the end
323    /// of the file, followed by the write, in one atomic step.
324    ///
325    /// The file size may grow if the seek offset plus `data.length` is beyond
326    /// the current end of file.
327    ///
328    /// + request `data` the byte buffer to write to the file.
329    /// - response `actual_count` the number of bytes written.
330    ///
331    /// ## Invariants
332    ///
333    /// * The returned `actual_count` will never be greater than `data.length`.
334    /// * If the server is unable to write all the data due to e.g. not enough
335    ///   space, `actual_count` may be less than `data.length`.  If no bytes
336    ///   could be written, an error is returned.
337    /// * If `data.length` is zero, the server should perform all the checks
338    ///   ensuring write access without mutating the file and return a
339    ///   successful write of zero bytes.  The seek offset is still updated if
340    ///   in append mode.
341    ///
342    /// This method requires the [`Rights.WRITE_BYTES`] right.
343    pub fn r#write(
344        &self,
345        mut data: &[u8],
346        ___deadline: zx::MonotonicInstant,
347    ) -> Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error> {
348        let _response = self.client.send_query::<
349            fidl_fuchsia_io::WritableWriteRequest,
350            fidl::encoding::ResultType<fidl_fuchsia_io::WritableWriteResponse, i32>,
351        >(
352            (data,),
353            0x6a31437832469f82,
354            fidl::encoding::DynamicFlags::empty(),
355            ___deadline,
356        )?;
357        Ok(_response.map(|x| x.actual_count))
358    }
359
360    pub fn r#describe(
361        &self,
362        ___deadline: zx::MonotonicInstant,
363    ) -> Result<DeviceDescribeResponse, fidl::Error> {
364        let _response =
365            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceDescribeResponse>(
366                (),
367                0x585d4b390fe996f5,
368                fidl::encoding::DynamicFlags::empty(),
369                ___deadline,
370            )?;
371        Ok(_response)
372    }
373
374    /// Open a client PTY device with a unique `id`. `client` should be a handle
375    /// to one endpoint of a channel that (on success) will become an open
376    /// connection to the newly created device. On failure, the channel will be
377    /// closed. Closing the channel will close the connection and release the
378    /// device. If the provided `id` is 0, then the new client is a controlling
379    /// client and has the capability to open additional clients. If the
380    /// current device is not a controlling client, `ZX_ERR_ACCESS_DENIED` will be
381    /// returned. If `id` is not unique, `ZX_ERR_INVALID_ARGS` will be returned.
382    /// Otherwise the status code from `device_add` is passed on.
383    pub fn r#open_client(
384        &self,
385        mut id: u32,
386        mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
387        ___deadline: zx::MonotonicInstant,
388    ) -> Result<i32, fidl::Error> {
389        let _response =
390            self.client.send_query::<DeviceOpenClientRequest, DeviceOpenClientResponse>(
391                (id, client),
392                0x78f040fe6a1ebb3,
393                fidl::encoding::DynamicFlags::empty(),
394                ___deadline,
395            )?;
396        Ok(_response.s)
397    }
398
399    /// allowed on Client PTYs
400    /// -----------------------------
401    /// Clear and/or Set PTY Features
402    pub fn r#clr_set_feature(
403        &self,
404        mut clr: u32,
405        mut set: u32,
406        ___deadline: zx::MonotonicInstant,
407    ) -> Result<(i32, u32), fidl::Error> {
408        let _response =
409            self.client.send_query::<DeviceClrSetFeatureRequest, DeviceClrSetFeatureResponse>(
410                (clr, set),
411                0x6367986e6053a15e,
412                fidl::encoding::DynamicFlags::empty(),
413                ___deadline,
414            )?;
415        Ok((_response.status, _response.features))
416    }
417
418    /// Obtain the window size (in character cells)
419    pub fn r#get_window_size(
420        &self,
421        ___deadline: zx::MonotonicInstant,
422    ) -> Result<(i32, WindowSize), fidl::Error> {
423        let _response =
424            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetWindowSizeResponse>(
425                (),
426                0x747bed0460f5f9f7,
427                fidl::encoding::DynamicFlags::empty(),
428                ___deadline,
429            )?;
430        Ok((_response.status, _response.size))
431    }
432
433    /// allowed on the Controlling PTY
434    /// -------------------------------------
435    /// Select which Client PTY receives input.
436    /// Reads will simply block on non-active PTYs.
437    pub fn r#make_active(
438        &self,
439        mut client_pty_id: u32,
440        ___deadline: zx::MonotonicInstant,
441    ) -> Result<i32, fidl::Error> {
442        let _response =
443            self.client.send_query::<DeviceMakeActiveRequest, DeviceMakeActiveResponse>(
444                (client_pty_id,),
445                0x2763944f30ee2a62,
446                fidl::encoding::DynamicFlags::empty(),
447                ___deadline,
448            )?;
449        Ok(_response.status)
450    }
451
452    /// Returns pending OOB events, simultaneously clearing them
453    pub fn r#read_events(
454        &self,
455        ___deadline: zx::MonotonicInstant,
456    ) -> Result<(i32, u32), fidl::Error> {
457        let _response =
458            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceReadEventsResponse>(
459                (),
460                0xede96f3e3258f62,
461                fidl::encoding::DynamicFlags::empty(),
462                ___deadline,
463            )?;
464        Ok((_response.status, _response.events))
465    }
466
467    /// allowed on the Server PTY
468    /// --------------------------------
469    /// Sets the window size
470    pub fn r#set_window_size(
471        &self,
472        mut size: &WindowSize,
473        ___deadline: zx::MonotonicInstant,
474    ) -> Result<i32, fidl::Error> {
475        let _response =
476            self.client.send_query::<DeviceSetWindowSizeRequest, DeviceSetWindowSizeResponse>(
477                (size,),
478                0x17d1cb37377e7928,
479                fidl::encoding::DynamicFlags::empty(),
480                ___deadline,
481            )?;
482        Ok(_response.status)
483    }
484}
485
486#[derive(Debug, Clone)]
487pub struct DeviceProxy {
488    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
489}
490
491impl fidl::endpoints::Proxy for DeviceProxy {
492    type Protocol = DeviceMarker;
493
494    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
495        Self::new(inner)
496    }
497
498    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
499        self.client.into_channel().map_err(|client| Self { client })
500    }
501
502    fn as_channel(&self) -> &::fidl::AsyncChannel {
503        self.client.as_channel()
504    }
505}
506
507impl DeviceProxy {
508    /// Create a new Proxy for fuchsia.hardware.pty/Device.
509    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
510        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
511        Self { client: fidl::client::Client::new(channel, protocol_name) }
512    }
513
514    /// Get a Stream of events from the remote end of the protocol.
515    ///
516    /// # Panics
517    ///
518    /// Panics if the event stream was already taken.
519    pub fn take_event_stream(&self) -> DeviceEventStream {
520        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
521    }
522
523    pub fn r#clone(
524        &self,
525        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
526    ) -> Result<(), fidl::Error> {
527        DeviceProxyInterface::r#clone(self, request)
528    }
529
530    /// Terminates the connection.
531    ///
532    /// After calling `Close`, the client must not send any other requests.
533    ///
534    /// Servers, after sending the status response, should close the connection
535    /// regardless of status and without sending an epitaph.
536    ///
537    /// Closing the client end of the channel should be semantically equivalent
538    /// to calling `Close` without knowing when the close has completed or its
539    /// status.
540    pub fn r#close(
541        &self,
542    ) -> fidl::client::QueryResponseFut<
543        fidl_fuchsia_unknown::CloseableCloseResult,
544        fidl::encoding::DefaultFuchsiaResourceDialect,
545    > {
546        DeviceProxyInterface::r#close(self)
547    }
548
549    pub fn r#query(
550        &self,
551    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
552    {
553        DeviceProxyInterface::r#query(self)
554    }
555
556    /// Reads up to 'count' bytes at the seek offset.
557    /// The seek offset is moved forward by the number of bytes read.
558    ///
559    /// ## Invariants
560    ///
561    /// * The returned `data.length` will never be greater than `count`.
562    /// * If `data.length` is less than `count`, it means that the seek offset
563    ///   has reached the end of file as part of this operation.
564    /// * If `data.length` is zero while `count` is not, it means that the
565    ///   seek offset is already at or beyond the end of file, and no data could
566    ///   be read.
567    /// * If `count` is zero, the server should perform all the checks ensuring
568    ///   read access without actually read anything, and return an empty
569    ///   `data` vector.
570    ///
571    /// This method requires the [`Rights.READ_BYTES`] right.
572    ///
573    /// Returns `ZX_ERR_OUT_OF_RANGE` if `count` is greater than `MAX_TRANSFER_SIZE`.
574    pub fn r#read(
575        &self,
576        mut count: u64,
577    ) -> fidl::client::QueryResponseFut<
578        fidl_fuchsia_io::ReadableReadResult,
579        fidl::encoding::DefaultFuchsiaResourceDialect,
580    > {
581        DeviceProxyInterface::r#read(self, count)
582    }
583
584    /// Writes data at the seek offset.
585    /// The seek offset is moved forward by the number of bytes written.
586    /// If the file is in append mode, the seek offset is first set to the end
587    /// of the file, followed by the write, in one atomic step.
588    ///
589    /// The file size may grow if the seek offset plus `data.length` is beyond
590    /// the current end of file.
591    ///
592    /// + request `data` the byte buffer to write to the file.
593    /// - response `actual_count` the number of bytes written.
594    ///
595    /// ## Invariants
596    ///
597    /// * The returned `actual_count` will never be greater than `data.length`.
598    /// * If the server is unable to write all the data due to e.g. not enough
599    ///   space, `actual_count` may be less than `data.length`.  If no bytes
600    ///   could be written, an error is returned.
601    /// * If `data.length` is zero, the server should perform all the checks
602    ///   ensuring write access without mutating the file and return a
603    ///   successful write of zero bytes.  The seek offset is still updated if
604    ///   in append mode.
605    ///
606    /// This method requires the [`Rights.WRITE_BYTES`] right.
607    pub fn r#write(
608        &self,
609        mut data: &[u8],
610    ) -> fidl::client::QueryResponseFut<
611        fidl_fuchsia_io::WritableWriteResult,
612        fidl::encoding::DefaultFuchsiaResourceDialect,
613    > {
614        DeviceProxyInterface::r#write(self, data)
615    }
616
617    pub fn r#describe(
618        &self,
619    ) -> fidl::client::QueryResponseFut<
620        DeviceDescribeResponse,
621        fidl::encoding::DefaultFuchsiaResourceDialect,
622    > {
623        DeviceProxyInterface::r#describe(self)
624    }
625
626    /// Open a client PTY device with a unique `id`. `client` should be a handle
627    /// to one endpoint of a channel that (on success) will become an open
628    /// connection to the newly created device. On failure, the channel will be
629    /// closed. Closing the channel will close the connection and release the
630    /// device. If the provided `id` is 0, then the new client is a controlling
631    /// client and has the capability to open additional clients. If the
632    /// current device is not a controlling client, `ZX_ERR_ACCESS_DENIED` will be
633    /// returned. If `id` is not unique, `ZX_ERR_INVALID_ARGS` will be returned.
634    /// Otherwise the status code from `device_add` is passed on.
635    pub fn r#open_client(
636        &self,
637        mut id: u32,
638        mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
639    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
640        DeviceProxyInterface::r#open_client(self, id, client)
641    }
642
643    /// allowed on Client PTYs
644    /// -----------------------------
645    /// Clear and/or Set PTY Features
646    pub fn r#clr_set_feature(
647        &self,
648        mut clr: u32,
649        mut set: u32,
650    ) -> fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
651    {
652        DeviceProxyInterface::r#clr_set_feature(self, clr, set)
653    }
654
655    /// Obtain the window size (in character cells)
656    pub fn r#get_window_size(
657        &self,
658    ) -> fidl::client::QueryResponseFut<
659        (i32, WindowSize),
660        fidl::encoding::DefaultFuchsiaResourceDialect,
661    > {
662        DeviceProxyInterface::r#get_window_size(self)
663    }
664
665    /// allowed on the Controlling PTY
666    /// -------------------------------------
667    /// Select which Client PTY receives input.
668    /// Reads will simply block on non-active PTYs.
669    pub fn r#make_active(
670        &self,
671        mut client_pty_id: u32,
672    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
673        DeviceProxyInterface::r#make_active(self, client_pty_id)
674    }
675
676    /// Returns pending OOB events, simultaneously clearing them
677    pub fn r#read_events(
678        &self,
679    ) -> fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
680    {
681        DeviceProxyInterface::r#read_events(self)
682    }
683
684    /// allowed on the Server PTY
685    /// --------------------------------
686    /// Sets the window size
687    pub fn r#set_window_size(
688        &self,
689        mut size: &WindowSize,
690    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
691        DeviceProxyInterface::r#set_window_size(self, size)
692    }
693}
694
695impl DeviceProxyInterface for DeviceProxy {
696    fn r#clone(
697        &self,
698        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
699    ) -> Result<(), fidl::Error> {
700        self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
701            (request,),
702            0x20d8a7aba2168a79,
703            fidl::encoding::DynamicFlags::empty(),
704        )
705    }
706
707    type CloseResponseFut = fidl::client::QueryResponseFut<
708        fidl_fuchsia_unknown::CloseableCloseResult,
709        fidl::encoding::DefaultFuchsiaResourceDialect,
710    >;
711    fn r#close(&self) -> Self::CloseResponseFut {
712        fn _decode(
713            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
714        ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
715            let _response = fidl::client::decode_transaction_body::<
716                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
717                fidl::encoding::DefaultFuchsiaResourceDialect,
718                0x5ac5d459ad7f657e,
719            >(_buf?)?;
720            Ok(_response.map(|x| x))
721        }
722        self.client.send_query_and_decode::<
723            fidl::encoding::EmptyPayload,
724            fidl_fuchsia_unknown::CloseableCloseResult,
725        >(
726            (),
727            0x5ac5d459ad7f657e,
728            fidl::encoding::DynamicFlags::empty(),
729            _decode,
730        )
731    }
732
733    type QueryResponseFut =
734        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
735    fn r#query(&self) -> Self::QueryResponseFut {
736        fn _decode(
737            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
738        ) -> Result<Vec<u8>, fidl::Error> {
739            let _response = fidl::client::decode_transaction_body::<
740                fidl_fuchsia_unknown::QueryableQueryResponse,
741                fidl::encoding::DefaultFuchsiaResourceDialect,
742                0x2658edee9decfc06,
743            >(_buf?)?;
744            Ok(_response.protocol)
745        }
746        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
747            (),
748            0x2658edee9decfc06,
749            fidl::encoding::DynamicFlags::empty(),
750            _decode,
751        )
752    }
753
754    type ReadResponseFut = fidl::client::QueryResponseFut<
755        fidl_fuchsia_io::ReadableReadResult,
756        fidl::encoding::DefaultFuchsiaResourceDialect,
757    >;
758    fn r#read(&self, mut count: u64) -> Self::ReadResponseFut {
759        fn _decode(
760            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
761        ) -> Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error> {
762            let _response = fidl::client::decode_transaction_body::<
763                fidl::encoding::ResultType<fidl_fuchsia_io::ReadableReadResponse, i32>,
764                fidl::encoding::DefaultFuchsiaResourceDialect,
765                0x57e419a298c8ede,
766            >(_buf?)?;
767            Ok(_response.map(|x| x.data))
768        }
769        self.client.send_query_and_decode::<
770            fidl_fuchsia_io::ReadableReadRequest,
771            fidl_fuchsia_io::ReadableReadResult,
772        >(
773            (count,),
774            0x57e419a298c8ede,
775            fidl::encoding::DynamicFlags::empty(),
776            _decode,
777        )
778    }
779
780    type WriteResponseFut = fidl::client::QueryResponseFut<
781        fidl_fuchsia_io::WritableWriteResult,
782        fidl::encoding::DefaultFuchsiaResourceDialect,
783    >;
784    fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
785        fn _decode(
786            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
787        ) -> Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error> {
788            let _response = fidl::client::decode_transaction_body::<
789                fidl::encoding::ResultType<fidl_fuchsia_io::WritableWriteResponse, i32>,
790                fidl::encoding::DefaultFuchsiaResourceDialect,
791                0x6a31437832469f82,
792            >(_buf?)?;
793            Ok(_response.map(|x| x.actual_count))
794        }
795        self.client.send_query_and_decode::<
796            fidl_fuchsia_io::WritableWriteRequest,
797            fidl_fuchsia_io::WritableWriteResult,
798        >(
799            (data,),
800            0x6a31437832469f82,
801            fidl::encoding::DynamicFlags::empty(),
802            _decode,
803        )
804    }
805
806    type DescribeResponseFut = fidl::client::QueryResponseFut<
807        DeviceDescribeResponse,
808        fidl::encoding::DefaultFuchsiaResourceDialect,
809    >;
810    fn r#describe(&self) -> Self::DescribeResponseFut {
811        fn _decode(
812            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
813        ) -> Result<DeviceDescribeResponse, fidl::Error> {
814            let _response = fidl::client::decode_transaction_body::<
815                DeviceDescribeResponse,
816                fidl::encoding::DefaultFuchsiaResourceDialect,
817                0x585d4b390fe996f5,
818            >(_buf?)?;
819            Ok(_response)
820        }
821        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescribeResponse>(
822            (),
823            0x585d4b390fe996f5,
824            fidl::encoding::DynamicFlags::empty(),
825            _decode,
826        )
827    }
828
829    type OpenClientResponseFut =
830        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
831    fn r#open_client(
832        &self,
833        mut id: u32,
834        mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
835    ) -> Self::OpenClientResponseFut {
836        fn _decode(
837            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
838        ) -> Result<i32, fidl::Error> {
839            let _response = fidl::client::decode_transaction_body::<
840                DeviceOpenClientResponse,
841                fidl::encoding::DefaultFuchsiaResourceDialect,
842                0x78f040fe6a1ebb3,
843            >(_buf?)?;
844            Ok(_response.s)
845        }
846        self.client.send_query_and_decode::<DeviceOpenClientRequest, i32>(
847            (id, client),
848            0x78f040fe6a1ebb3,
849            fidl::encoding::DynamicFlags::empty(),
850            _decode,
851        )
852    }
853
854    type ClrSetFeatureResponseFut =
855        fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
856    fn r#clr_set_feature(&self, mut clr: u32, mut set: u32) -> Self::ClrSetFeatureResponseFut {
857        fn _decode(
858            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
859        ) -> Result<(i32, u32), fidl::Error> {
860            let _response = fidl::client::decode_transaction_body::<
861                DeviceClrSetFeatureResponse,
862                fidl::encoding::DefaultFuchsiaResourceDialect,
863                0x6367986e6053a15e,
864            >(_buf?)?;
865            Ok((_response.status, _response.features))
866        }
867        self.client.send_query_and_decode::<DeviceClrSetFeatureRequest, (i32, u32)>(
868            (clr, set),
869            0x6367986e6053a15e,
870            fidl::encoding::DynamicFlags::empty(),
871            _decode,
872        )
873    }
874
875    type GetWindowSizeResponseFut = fidl::client::QueryResponseFut<
876        (i32, WindowSize),
877        fidl::encoding::DefaultFuchsiaResourceDialect,
878    >;
879    fn r#get_window_size(&self) -> Self::GetWindowSizeResponseFut {
880        fn _decode(
881            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
882        ) -> Result<(i32, WindowSize), fidl::Error> {
883            let _response = fidl::client::decode_transaction_body::<
884                DeviceGetWindowSizeResponse,
885                fidl::encoding::DefaultFuchsiaResourceDialect,
886                0x747bed0460f5f9f7,
887            >(_buf?)?;
888            Ok((_response.status, _response.size))
889        }
890        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, WindowSize)>(
891            (),
892            0x747bed0460f5f9f7,
893            fidl::encoding::DynamicFlags::empty(),
894            _decode,
895        )
896    }
897
898    type MakeActiveResponseFut =
899        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
900    fn r#make_active(&self, mut client_pty_id: u32) -> Self::MakeActiveResponseFut {
901        fn _decode(
902            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
903        ) -> Result<i32, fidl::Error> {
904            let _response = fidl::client::decode_transaction_body::<
905                DeviceMakeActiveResponse,
906                fidl::encoding::DefaultFuchsiaResourceDialect,
907                0x2763944f30ee2a62,
908            >(_buf?)?;
909            Ok(_response.status)
910        }
911        self.client.send_query_and_decode::<DeviceMakeActiveRequest, i32>(
912            (client_pty_id,),
913            0x2763944f30ee2a62,
914            fidl::encoding::DynamicFlags::empty(),
915            _decode,
916        )
917    }
918
919    type ReadEventsResponseFut =
920        fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
921    fn r#read_events(&self) -> Self::ReadEventsResponseFut {
922        fn _decode(
923            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
924        ) -> Result<(i32, u32), fidl::Error> {
925            let _response = fidl::client::decode_transaction_body::<
926                DeviceReadEventsResponse,
927                fidl::encoding::DefaultFuchsiaResourceDialect,
928                0xede96f3e3258f62,
929            >(_buf?)?;
930            Ok((_response.status, _response.events))
931        }
932        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, u32)>(
933            (),
934            0xede96f3e3258f62,
935            fidl::encoding::DynamicFlags::empty(),
936            _decode,
937        )
938    }
939
940    type SetWindowSizeResponseFut =
941        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
942    fn r#set_window_size(&self, mut size: &WindowSize) -> Self::SetWindowSizeResponseFut {
943        fn _decode(
944            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
945        ) -> Result<i32, fidl::Error> {
946            let _response = fidl::client::decode_transaction_body::<
947                DeviceSetWindowSizeResponse,
948                fidl::encoding::DefaultFuchsiaResourceDialect,
949                0x17d1cb37377e7928,
950            >(_buf?)?;
951            Ok(_response.status)
952        }
953        self.client.send_query_and_decode::<DeviceSetWindowSizeRequest, i32>(
954            (size,),
955            0x17d1cb37377e7928,
956            fidl::encoding::DynamicFlags::empty(),
957            _decode,
958        )
959    }
960}
961
962pub struct DeviceEventStream {
963    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
964}
965
966impl std::marker::Unpin for DeviceEventStream {}
967
968impl futures::stream::FusedStream for DeviceEventStream {
969    fn is_terminated(&self) -> bool {
970        self.event_receiver.is_terminated()
971    }
972}
973
974impl futures::Stream for DeviceEventStream {
975    type Item = Result<DeviceEvent, fidl::Error>;
976
977    fn poll_next(
978        mut self: std::pin::Pin<&mut Self>,
979        cx: &mut std::task::Context<'_>,
980    ) -> std::task::Poll<Option<Self::Item>> {
981        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
982            &mut self.event_receiver,
983            cx
984        )?) {
985            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
986            None => std::task::Poll::Ready(None),
987        }
988    }
989}
990
991#[derive(Debug)]
992pub enum DeviceEvent {}
993
994impl DeviceEvent {
995    /// Decodes a message buffer as a [`DeviceEvent`].
996    fn decode(
997        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
998    ) -> Result<DeviceEvent, fidl::Error> {
999        let (bytes, _handles) = buf.split_mut();
1000        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1001        debug_assert_eq!(tx_header.tx_id, 0);
1002        match tx_header.ordinal {
1003            _ => Err(fidl::Error::UnknownOrdinal {
1004                ordinal: tx_header.ordinal,
1005                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1006            }),
1007        }
1008    }
1009}
1010
1011/// A Stream of incoming requests for fuchsia.hardware.pty/Device.
1012pub struct DeviceRequestStream {
1013    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1014    is_terminated: bool,
1015}
1016
1017impl std::marker::Unpin for DeviceRequestStream {}
1018
1019impl futures::stream::FusedStream for DeviceRequestStream {
1020    fn is_terminated(&self) -> bool {
1021        self.is_terminated
1022    }
1023}
1024
1025impl fidl::endpoints::RequestStream for DeviceRequestStream {
1026    type Protocol = DeviceMarker;
1027    type ControlHandle = DeviceControlHandle;
1028
1029    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1030        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1031    }
1032
1033    fn control_handle(&self) -> Self::ControlHandle {
1034        DeviceControlHandle { inner: self.inner.clone() }
1035    }
1036
1037    fn into_inner(
1038        self,
1039    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1040    {
1041        (self.inner, self.is_terminated)
1042    }
1043
1044    fn from_inner(
1045        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1046        is_terminated: bool,
1047    ) -> Self {
1048        Self { inner, is_terminated }
1049    }
1050}
1051
1052impl futures::Stream for DeviceRequestStream {
1053    type Item = Result<DeviceRequest, fidl::Error>;
1054
1055    fn poll_next(
1056        mut self: std::pin::Pin<&mut Self>,
1057        cx: &mut std::task::Context<'_>,
1058    ) -> std::task::Poll<Option<Self::Item>> {
1059        let this = &mut *self;
1060        if this.inner.check_shutdown(cx) {
1061            this.is_terminated = true;
1062            return std::task::Poll::Ready(None);
1063        }
1064        if this.is_terminated {
1065            panic!("polled DeviceRequestStream after completion");
1066        }
1067        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1068            |bytes, handles| {
1069                match this.inner.channel().read_etc(cx, bytes, handles) {
1070                    std::task::Poll::Ready(Ok(())) => {}
1071                    std::task::Poll::Pending => return std::task::Poll::Pending,
1072                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1073                        this.is_terminated = true;
1074                        return std::task::Poll::Ready(None);
1075                    }
1076                    std::task::Poll::Ready(Err(e)) => {
1077                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1078                            e.into(),
1079                        ))))
1080                    }
1081                }
1082
1083                // A message has been received from the channel
1084                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1085
1086                std::task::Poll::Ready(Some(match header.ordinal {
1087                    0x20d8a7aba2168a79 => {
1088                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1089                        let mut req = fidl::new_empty!(
1090                            fidl_fuchsia_unknown::CloneableCloneRequest,
1091                            fidl::encoding::DefaultFuchsiaResourceDialect
1092                        );
1093                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_unknown::CloneableCloneRequest>(&header, _body_bytes, handles, &mut req)?;
1094                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1095                        Ok(DeviceRequest::Clone { request: req.request, control_handle })
1096                    }
1097                    0x5ac5d459ad7f657e => {
1098                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1099                        let mut req = fidl::new_empty!(
1100                            fidl::encoding::EmptyPayload,
1101                            fidl::encoding::DefaultFuchsiaResourceDialect
1102                        );
1103                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1104                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1105                        Ok(DeviceRequest::Close {
1106                            responder: DeviceCloseResponder {
1107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1108                                tx_id: header.tx_id,
1109                            },
1110                        })
1111                    }
1112                    0x2658edee9decfc06 => {
1113                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1114                        let mut req = fidl::new_empty!(
1115                            fidl::encoding::EmptyPayload,
1116                            fidl::encoding::DefaultFuchsiaResourceDialect
1117                        );
1118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1119                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1120                        Ok(DeviceRequest::Query {
1121                            responder: DeviceQueryResponder {
1122                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1123                                tx_id: header.tx_id,
1124                            },
1125                        })
1126                    }
1127                    0x57e419a298c8ede => {
1128                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1129                        let mut req = fidl::new_empty!(
1130                            fidl_fuchsia_io::ReadableReadRequest,
1131                            fidl::encoding::DefaultFuchsiaResourceDialect
1132                        );
1133                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_io::ReadableReadRequest>(&header, _body_bytes, handles, &mut req)?;
1134                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1135                        Ok(DeviceRequest::Read {
1136                            count: req.count,
1137
1138                            responder: DeviceReadResponder {
1139                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1140                                tx_id: header.tx_id,
1141                            },
1142                        })
1143                    }
1144                    0x6a31437832469f82 => {
1145                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1146                        let mut req = fidl::new_empty!(
1147                            fidl_fuchsia_io::WritableWriteRequest,
1148                            fidl::encoding::DefaultFuchsiaResourceDialect
1149                        );
1150                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_io::WritableWriteRequest>(&header, _body_bytes, handles, &mut req)?;
1151                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1152                        Ok(DeviceRequest::Write {
1153                            data: req.data,
1154
1155                            responder: DeviceWriteResponder {
1156                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1157                                tx_id: header.tx_id,
1158                            },
1159                        })
1160                    }
1161                    0x585d4b390fe996f5 => {
1162                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1163                        let mut req = fidl::new_empty!(
1164                            fidl::encoding::EmptyPayload,
1165                            fidl::encoding::DefaultFuchsiaResourceDialect
1166                        );
1167                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1168                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1169                        Ok(DeviceRequest::Describe {
1170                            responder: DeviceDescribeResponder {
1171                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1172                                tx_id: header.tx_id,
1173                            },
1174                        })
1175                    }
1176                    0x78f040fe6a1ebb3 => {
1177                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1178                        let mut req = fidl::new_empty!(
1179                            DeviceOpenClientRequest,
1180                            fidl::encoding::DefaultFuchsiaResourceDialect
1181                        );
1182                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOpenClientRequest>(&header, _body_bytes, handles, &mut req)?;
1183                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1184                        Ok(DeviceRequest::OpenClient {
1185                            id: req.id,
1186                            client: req.client,
1187
1188                            responder: DeviceOpenClientResponder {
1189                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1190                                tx_id: header.tx_id,
1191                            },
1192                        })
1193                    }
1194                    0x6367986e6053a15e => {
1195                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1196                        let mut req = fidl::new_empty!(
1197                            DeviceClrSetFeatureRequest,
1198                            fidl::encoding::DefaultFuchsiaResourceDialect
1199                        );
1200                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceClrSetFeatureRequest>(&header, _body_bytes, handles, &mut req)?;
1201                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1202                        Ok(DeviceRequest::ClrSetFeature {
1203                            clr: req.clr,
1204                            set: req.set,
1205
1206                            responder: DeviceClrSetFeatureResponder {
1207                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1208                                tx_id: header.tx_id,
1209                            },
1210                        })
1211                    }
1212                    0x747bed0460f5f9f7 => {
1213                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1214                        let mut req = fidl::new_empty!(
1215                            fidl::encoding::EmptyPayload,
1216                            fidl::encoding::DefaultFuchsiaResourceDialect
1217                        );
1218                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1219                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1220                        Ok(DeviceRequest::GetWindowSize {
1221                            responder: DeviceGetWindowSizeResponder {
1222                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1223                                tx_id: header.tx_id,
1224                            },
1225                        })
1226                    }
1227                    0x2763944f30ee2a62 => {
1228                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1229                        let mut req = fidl::new_empty!(
1230                            DeviceMakeActiveRequest,
1231                            fidl::encoding::DefaultFuchsiaResourceDialect
1232                        );
1233                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMakeActiveRequest>(&header, _body_bytes, handles, &mut req)?;
1234                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1235                        Ok(DeviceRequest::MakeActive {
1236                            client_pty_id: req.client_pty_id,
1237
1238                            responder: DeviceMakeActiveResponder {
1239                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1240                                tx_id: header.tx_id,
1241                            },
1242                        })
1243                    }
1244                    0xede96f3e3258f62 => {
1245                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1246                        let mut req = fidl::new_empty!(
1247                            fidl::encoding::EmptyPayload,
1248                            fidl::encoding::DefaultFuchsiaResourceDialect
1249                        );
1250                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1251                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1252                        Ok(DeviceRequest::ReadEvents {
1253                            responder: DeviceReadEventsResponder {
1254                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1255                                tx_id: header.tx_id,
1256                            },
1257                        })
1258                    }
1259                    0x17d1cb37377e7928 => {
1260                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1261                        let mut req = fidl::new_empty!(
1262                            DeviceSetWindowSizeRequest,
1263                            fidl::encoding::DefaultFuchsiaResourceDialect
1264                        );
1265                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetWindowSizeRequest>(&header, _body_bytes, handles, &mut req)?;
1266                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1267                        Ok(DeviceRequest::SetWindowSize {
1268                            size: req.size,
1269
1270                            responder: DeviceSetWindowSizeResponder {
1271                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1272                                tx_id: header.tx_id,
1273                            },
1274                        })
1275                    }
1276                    _ => Err(fidl::Error::UnknownOrdinal {
1277                        ordinal: header.ordinal,
1278                        protocol_name:
1279                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1280                    }),
1281                }))
1282            },
1283        )
1284    }
1285}
1286
1287#[derive(Debug)]
1288pub enum DeviceRequest {
1289    Clone {
1290        request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
1291        control_handle: DeviceControlHandle,
1292    },
1293    /// Terminates the connection.
1294    ///
1295    /// After calling `Close`, the client must not send any other requests.
1296    ///
1297    /// Servers, after sending the status response, should close the connection
1298    /// regardless of status and without sending an epitaph.
1299    ///
1300    /// Closing the client end of the channel should be semantically equivalent
1301    /// to calling `Close` without knowing when the close has completed or its
1302    /// status.
1303    Close {
1304        responder: DeviceCloseResponder,
1305    },
1306    Query {
1307        responder: DeviceQueryResponder,
1308    },
1309    /// Reads up to 'count' bytes at the seek offset.
1310    /// The seek offset is moved forward by the number of bytes read.
1311    ///
1312    /// ## Invariants
1313    ///
1314    /// * The returned `data.length` will never be greater than `count`.
1315    /// * If `data.length` is less than `count`, it means that the seek offset
1316    ///   has reached the end of file as part of this operation.
1317    /// * If `data.length` is zero while `count` is not, it means that the
1318    ///   seek offset is already at or beyond the end of file, and no data could
1319    ///   be read.
1320    /// * If `count` is zero, the server should perform all the checks ensuring
1321    ///   read access without actually read anything, and return an empty
1322    ///   `data` vector.
1323    ///
1324    /// This method requires the [`Rights.READ_BYTES`] right.
1325    ///
1326    /// Returns `ZX_ERR_OUT_OF_RANGE` if `count` is greater than `MAX_TRANSFER_SIZE`.
1327    Read {
1328        count: u64,
1329        responder: DeviceReadResponder,
1330    },
1331    /// Writes data at the seek offset.
1332    /// The seek offset is moved forward by the number of bytes written.
1333    /// If the file is in append mode, the seek offset is first set to the end
1334    /// of the file, followed by the write, in one atomic step.
1335    ///
1336    /// The file size may grow if the seek offset plus `data.length` is beyond
1337    /// the current end of file.
1338    ///
1339    /// + request `data` the byte buffer to write to the file.
1340    /// - response `actual_count` the number of bytes written.
1341    ///
1342    /// ## Invariants
1343    ///
1344    /// * The returned `actual_count` will never be greater than `data.length`.
1345    /// * If the server is unable to write all the data due to e.g. not enough
1346    ///   space, `actual_count` may be less than `data.length`.  If no bytes
1347    ///   could be written, an error is returned.
1348    /// * If `data.length` is zero, the server should perform all the checks
1349    ///   ensuring write access without mutating the file and return a
1350    ///   successful write of zero bytes.  The seek offset is still updated if
1351    ///   in append mode.
1352    ///
1353    /// This method requires the [`Rights.WRITE_BYTES`] right.
1354    Write {
1355        data: Vec<u8>,
1356        responder: DeviceWriteResponder,
1357    },
1358    Describe {
1359        responder: DeviceDescribeResponder,
1360    },
1361    /// Open a client PTY device with a unique `id`. `client` should be a handle
1362    /// to one endpoint of a channel that (on success) will become an open
1363    /// connection to the newly created device. On failure, the channel will be
1364    /// closed. Closing the channel will close the connection and release the
1365    /// device. If the provided `id` is 0, then the new client is a controlling
1366    /// client and has the capability to open additional clients. If the
1367    /// current device is not a controlling client, `ZX_ERR_ACCESS_DENIED` will be
1368    /// returned. If `id` is not unique, `ZX_ERR_INVALID_ARGS` will be returned.
1369    /// Otherwise the status code from `device_add` is passed on.
1370    OpenClient {
1371        id: u32,
1372        client: fidl::endpoints::ServerEnd<DeviceMarker>,
1373        responder: DeviceOpenClientResponder,
1374    },
1375    /// allowed on Client PTYs
1376    /// -----------------------------
1377    /// Clear and/or Set PTY Features
1378    ClrSetFeature {
1379        clr: u32,
1380        set: u32,
1381        responder: DeviceClrSetFeatureResponder,
1382    },
1383    /// Obtain the window size (in character cells)
1384    GetWindowSize {
1385        responder: DeviceGetWindowSizeResponder,
1386    },
1387    /// allowed on the Controlling PTY
1388    /// -------------------------------------
1389    /// Select which Client PTY receives input.
1390    /// Reads will simply block on non-active PTYs.
1391    MakeActive {
1392        client_pty_id: u32,
1393        responder: DeviceMakeActiveResponder,
1394    },
1395    /// Returns pending OOB events, simultaneously clearing them
1396    ReadEvents {
1397        responder: DeviceReadEventsResponder,
1398    },
1399    /// allowed on the Server PTY
1400    /// --------------------------------
1401    /// Sets the window size
1402    SetWindowSize {
1403        size: WindowSize,
1404        responder: DeviceSetWindowSizeResponder,
1405    },
1406}
1407
1408impl DeviceRequest {
1409    #[allow(irrefutable_let_patterns)]
1410    pub fn into_clone(
1411        self,
1412    ) -> Option<(
1413        fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
1414        DeviceControlHandle,
1415    )> {
1416        if let DeviceRequest::Clone { request, control_handle } = self {
1417            Some((request, control_handle))
1418        } else {
1419            None
1420        }
1421    }
1422
1423    #[allow(irrefutable_let_patterns)]
1424    pub fn into_close(self) -> Option<(DeviceCloseResponder)> {
1425        if let DeviceRequest::Close { responder } = self {
1426            Some((responder))
1427        } else {
1428            None
1429        }
1430    }
1431
1432    #[allow(irrefutable_let_patterns)]
1433    pub fn into_query(self) -> Option<(DeviceQueryResponder)> {
1434        if let DeviceRequest::Query { responder } = self {
1435            Some((responder))
1436        } else {
1437            None
1438        }
1439    }
1440
1441    #[allow(irrefutable_let_patterns)]
1442    pub fn into_read(self) -> Option<(u64, DeviceReadResponder)> {
1443        if let DeviceRequest::Read { count, responder } = self {
1444            Some((count, responder))
1445        } else {
1446            None
1447        }
1448    }
1449
1450    #[allow(irrefutable_let_patterns)]
1451    pub fn into_write(self) -> Option<(Vec<u8>, DeviceWriteResponder)> {
1452        if let DeviceRequest::Write { data, responder } = self {
1453            Some((data, responder))
1454        } else {
1455            None
1456        }
1457    }
1458
1459    #[allow(irrefutable_let_patterns)]
1460    pub fn into_describe(self) -> Option<(DeviceDescribeResponder)> {
1461        if let DeviceRequest::Describe { responder } = self {
1462            Some((responder))
1463        } else {
1464            None
1465        }
1466    }
1467
1468    #[allow(irrefutable_let_patterns)]
1469    pub fn into_open_client(
1470        self,
1471    ) -> Option<(u32, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceOpenClientResponder)> {
1472        if let DeviceRequest::OpenClient { id, client, responder } = self {
1473            Some((id, client, responder))
1474        } else {
1475            None
1476        }
1477    }
1478
1479    #[allow(irrefutable_let_patterns)]
1480    pub fn into_clr_set_feature(self) -> Option<(u32, u32, DeviceClrSetFeatureResponder)> {
1481        if let DeviceRequest::ClrSetFeature { clr, set, responder } = self {
1482            Some((clr, set, responder))
1483        } else {
1484            None
1485        }
1486    }
1487
1488    #[allow(irrefutable_let_patterns)]
1489    pub fn into_get_window_size(self) -> Option<(DeviceGetWindowSizeResponder)> {
1490        if let DeviceRequest::GetWindowSize { responder } = self {
1491            Some((responder))
1492        } else {
1493            None
1494        }
1495    }
1496
1497    #[allow(irrefutable_let_patterns)]
1498    pub fn into_make_active(self) -> Option<(u32, DeviceMakeActiveResponder)> {
1499        if let DeviceRequest::MakeActive { client_pty_id, responder } = self {
1500            Some((client_pty_id, responder))
1501        } else {
1502            None
1503        }
1504    }
1505
1506    #[allow(irrefutable_let_patterns)]
1507    pub fn into_read_events(self) -> Option<(DeviceReadEventsResponder)> {
1508        if let DeviceRequest::ReadEvents { responder } = self {
1509            Some((responder))
1510        } else {
1511            None
1512        }
1513    }
1514
1515    #[allow(irrefutable_let_patterns)]
1516    pub fn into_set_window_size(self) -> Option<(WindowSize, DeviceSetWindowSizeResponder)> {
1517        if let DeviceRequest::SetWindowSize { size, responder } = self {
1518            Some((size, responder))
1519        } else {
1520            None
1521        }
1522    }
1523
1524    /// Name of the method defined in FIDL
1525    pub fn method_name(&self) -> &'static str {
1526        match *self {
1527            DeviceRequest::Clone { .. } => "clone",
1528            DeviceRequest::Close { .. } => "close",
1529            DeviceRequest::Query { .. } => "query",
1530            DeviceRequest::Read { .. } => "read",
1531            DeviceRequest::Write { .. } => "write",
1532            DeviceRequest::Describe { .. } => "describe",
1533            DeviceRequest::OpenClient { .. } => "open_client",
1534            DeviceRequest::ClrSetFeature { .. } => "clr_set_feature",
1535            DeviceRequest::GetWindowSize { .. } => "get_window_size",
1536            DeviceRequest::MakeActive { .. } => "make_active",
1537            DeviceRequest::ReadEvents { .. } => "read_events",
1538            DeviceRequest::SetWindowSize { .. } => "set_window_size",
1539        }
1540    }
1541}
1542
1543#[derive(Debug, Clone)]
1544pub struct DeviceControlHandle {
1545    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1546}
1547
1548impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1549    fn shutdown(&self) {
1550        self.inner.shutdown()
1551    }
1552    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1553        self.inner.shutdown_with_epitaph(status)
1554    }
1555
1556    fn is_closed(&self) -> bool {
1557        self.inner.channel().is_closed()
1558    }
1559    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1560        self.inner.channel().on_closed()
1561    }
1562
1563    #[cfg(target_os = "fuchsia")]
1564    fn signal_peer(
1565        &self,
1566        clear_mask: zx::Signals,
1567        set_mask: zx::Signals,
1568    ) -> Result<(), zx_status::Status> {
1569        use fidl::Peered;
1570        self.inner.channel().signal_peer(clear_mask, set_mask)
1571    }
1572}
1573
1574impl DeviceControlHandle {}
1575
1576#[must_use = "FIDL methods require a response to be sent"]
1577#[derive(Debug)]
1578pub struct DeviceCloseResponder {
1579    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1580    tx_id: u32,
1581}
1582
1583/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1584/// if the responder is dropped without sending a response, so that the client
1585/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1586impl std::ops::Drop for DeviceCloseResponder {
1587    fn drop(&mut self) {
1588        self.control_handle.shutdown();
1589        // Safety: drops once, never accessed again
1590        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1591    }
1592}
1593
1594impl fidl::endpoints::Responder for DeviceCloseResponder {
1595    type ControlHandle = DeviceControlHandle;
1596
1597    fn control_handle(&self) -> &DeviceControlHandle {
1598        &self.control_handle
1599    }
1600
1601    fn drop_without_shutdown(mut self) {
1602        // Safety: drops once, never accessed again due to mem::forget
1603        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1604        // Prevent Drop from running (which would shut down the channel)
1605        std::mem::forget(self);
1606    }
1607}
1608
1609impl DeviceCloseResponder {
1610    /// Sends a response to the FIDL transaction.
1611    ///
1612    /// Sets the channel to shutdown if an error occurs.
1613    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1614        let _result = self.send_raw(result);
1615        if _result.is_err() {
1616            self.control_handle.shutdown();
1617        }
1618        self.drop_without_shutdown();
1619        _result
1620    }
1621
1622    /// Similar to "send" but does not shutdown the channel if an error occurs.
1623    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1624        let _result = self.send_raw(result);
1625        self.drop_without_shutdown();
1626        _result
1627    }
1628
1629    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1630        self.control_handle
1631            .inner
1632            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1633                result,
1634                self.tx_id,
1635                0x5ac5d459ad7f657e,
1636                fidl::encoding::DynamicFlags::empty(),
1637            )
1638    }
1639}
1640
1641#[must_use = "FIDL methods require a response to be sent"]
1642#[derive(Debug)]
1643pub struct DeviceQueryResponder {
1644    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1645    tx_id: u32,
1646}
1647
1648/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1649/// if the responder is dropped without sending a response, so that the client
1650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1651impl std::ops::Drop for DeviceQueryResponder {
1652    fn drop(&mut self) {
1653        self.control_handle.shutdown();
1654        // Safety: drops once, never accessed again
1655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1656    }
1657}
1658
1659impl fidl::endpoints::Responder for DeviceQueryResponder {
1660    type ControlHandle = DeviceControlHandle;
1661
1662    fn control_handle(&self) -> &DeviceControlHandle {
1663        &self.control_handle
1664    }
1665
1666    fn drop_without_shutdown(mut self) {
1667        // Safety: drops once, never accessed again due to mem::forget
1668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1669        // Prevent Drop from running (which would shut down the channel)
1670        std::mem::forget(self);
1671    }
1672}
1673
1674impl DeviceQueryResponder {
1675    /// Sends a response to the FIDL transaction.
1676    ///
1677    /// Sets the channel to shutdown if an error occurs.
1678    pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1679        let _result = self.send_raw(protocol);
1680        if _result.is_err() {
1681            self.control_handle.shutdown();
1682        }
1683        self.drop_without_shutdown();
1684        _result
1685    }
1686
1687    /// Similar to "send" but does not shutdown the channel if an error occurs.
1688    pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1689        let _result = self.send_raw(protocol);
1690        self.drop_without_shutdown();
1691        _result
1692    }
1693
1694    fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1695        self.control_handle.inner.send::<fidl_fuchsia_unknown::QueryableQueryResponse>(
1696            (protocol,),
1697            self.tx_id,
1698            0x2658edee9decfc06,
1699            fidl::encoding::DynamicFlags::empty(),
1700        )
1701    }
1702}
1703
1704#[must_use = "FIDL methods require a response to be sent"]
1705#[derive(Debug)]
1706pub struct DeviceReadResponder {
1707    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1708    tx_id: u32,
1709}
1710
1711/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1712/// if the responder is dropped without sending a response, so that the client
1713/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1714impl std::ops::Drop for DeviceReadResponder {
1715    fn drop(&mut self) {
1716        self.control_handle.shutdown();
1717        // Safety: drops once, never accessed again
1718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1719    }
1720}
1721
1722impl fidl::endpoints::Responder for DeviceReadResponder {
1723    type ControlHandle = DeviceControlHandle;
1724
1725    fn control_handle(&self) -> &DeviceControlHandle {
1726        &self.control_handle
1727    }
1728
1729    fn drop_without_shutdown(mut self) {
1730        // Safety: drops once, never accessed again due to mem::forget
1731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1732        // Prevent Drop from running (which would shut down the channel)
1733        std::mem::forget(self);
1734    }
1735}
1736
1737impl DeviceReadResponder {
1738    /// Sends a response to the FIDL transaction.
1739    ///
1740    /// Sets the channel to shutdown if an error occurs.
1741    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1742        let _result = self.send_raw(result);
1743        if _result.is_err() {
1744            self.control_handle.shutdown();
1745        }
1746        self.drop_without_shutdown();
1747        _result
1748    }
1749
1750    /// Similar to "send" but does not shutdown the channel if an error occurs.
1751    pub fn send_no_shutdown_on_err(
1752        self,
1753        mut result: Result<&[u8], i32>,
1754    ) -> Result<(), fidl::Error> {
1755        let _result = self.send_raw(result);
1756        self.drop_without_shutdown();
1757        _result
1758    }
1759
1760    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1761        self.control_handle.inner.send::<fidl::encoding::ResultType<
1762            fidl_fuchsia_io::ReadableReadResponse,
1763            i32,
1764        >>(
1765            result.map(|data| (data,)),
1766            self.tx_id,
1767            0x57e419a298c8ede,
1768            fidl::encoding::DynamicFlags::empty(),
1769        )
1770    }
1771}
1772
1773#[must_use = "FIDL methods require a response to be sent"]
1774#[derive(Debug)]
1775pub struct DeviceWriteResponder {
1776    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1777    tx_id: u32,
1778}
1779
1780/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1781/// if the responder is dropped without sending a response, so that the client
1782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1783impl std::ops::Drop for DeviceWriteResponder {
1784    fn drop(&mut self) {
1785        self.control_handle.shutdown();
1786        // Safety: drops once, never accessed again
1787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1788    }
1789}
1790
1791impl fidl::endpoints::Responder for DeviceWriteResponder {
1792    type ControlHandle = DeviceControlHandle;
1793
1794    fn control_handle(&self) -> &DeviceControlHandle {
1795        &self.control_handle
1796    }
1797
1798    fn drop_without_shutdown(mut self) {
1799        // Safety: drops once, never accessed again due to mem::forget
1800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1801        // Prevent Drop from running (which would shut down the channel)
1802        std::mem::forget(self);
1803    }
1804}
1805
1806impl DeviceWriteResponder {
1807    /// Sends a response to the FIDL transaction.
1808    ///
1809    /// Sets the channel to shutdown if an error occurs.
1810    pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1811        let _result = self.send_raw(result);
1812        if _result.is_err() {
1813            self.control_handle.shutdown();
1814        }
1815        self.drop_without_shutdown();
1816        _result
1817    }
1818
1819    /// Similar to "send" but does not shutdown the channel if an error occurs.
1820    pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1821        let _result = self.send_raw(result);
1822        self.drop_without_shutdown();
1823        _result
1824    }
1825
1826    fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1827        self.control_handle.inner.send::<fidl::encoding::ResultType<
1828            fidl_fuchsia_io::WritableWriteResponse,
1829            i32,
1830        >>(
1831            result.map(|actual_count| (actual_count,)),
1832            self.tx_id,
1833            0x6a31437832469f82,
1834            fidl::encoding::DynamicFlags::empty(),
1835        )
1836    }
1837}
1838
1839#[must_use = "FIDL methods require a response to be sent"]
1840#[derive(Debug)]
1841pub struct DeviceDescribeResponder {
1842    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1843    tx_id: u32,
1844}
1845
1846/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1847/// if the responder is dropped without sending a response, so that the client
1848/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1849impl std::ops::Drop for DeviceDescribeResponder {
1850    fn drop(&mut self) {
1851        self.control_handle.shutdown();
1852        // Safety: drops once, never accessed again
1853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1854    }
1855}
1856
1857impl fidl::endpoints::Responder for DeviceDescribeResponder {
1858    type ControlHandle = DeviceControlHandle;
1859
1860    fn control_handle(&self) -> &DeviceControlHandle {
1861        &self.control_handle
1862    }
1863
1864    fn drop_without_shutdown(mut self) {
1865        // Safety: drops once, never accessed again due to mem::forget
1866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1867        // Prevent Drop from running (which would shut down the channel)
1868        std::mem::forget(self);
1869    }
1870}
1871
1872impl DeviceDescribeResponder {
1873    /// Sends a response to the FIDL transaction.
1874    ///
1875    /// Sets the channel to shutdown if an error occurs.
1876    pub fn send(self, mut payload: DeviceDescribeResponse) -> Result<(), fidl::Error> {
1877        let _result = self.send_raw(payload);
1878        if _result.is_err() {
1879            self.control_handle.shutdown();
1880        }
1881        self.drop_without_shutdown();
1882        _result
1883    }
1884
1885    /// Similar to "send" but does not shutdown the channel if an error occurs.
1886    pub fn send_no_shutdown_on_err(
1887        self,
1888        mut payload: DeviceDescribeResponse,
1889    ) -> Result<(), fidl::Error> {
1890        let _result = self.send_raw(payload);
1891        self.drop_without_shutdown();
1892        _result
1893    }
1894
1895    fn send_raw(&self, mut payload: DeviceDescribeResponse) -> Result<(), fidl::Error> {
1896        self.control_handle.inner.send::<DeviceDescribeResponse>(
1897            &mut payload,
1898            self.tx_id,
1899            0x585d4b390fe996f5,
1900            fidl::encoding::DynamicFlags::empty(),
1901        )
1902    }
1903}
1904
1905#[must_use = "FIDL methods require a response to be sent"]
1906#[derive(Debug)]
1907pub struct DeviceOpenClientResponder {
1908    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1909    tx_id: u32,
1910}
1911
1912/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1913/// if the responder is dropped without sending a response, so that the client
1914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1915impl std::ops::Drop for DeviceOpenClientResponder {
1916    fn drop(&mut self) {
1917        self.control_handle.shutdown();
1918        // Safety: drops once, never accessed again
1919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1920    }
1921}
1922
1923impl fidl::endpoints::Responder for DeviceOpenClientResponder {
1924    type ControlHandle = DeviceControlHandle;
1925
1926    fn control_handle(&self) -> &DeviceControlHandle {
1927        &self.control_handle
1928    }
1929
1930    fn drop_without_shutdown(mut self) {
1931        // Safety: drops once, never accessed again due to mem::forget
1932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1933        // Prevent Drop from running (which would shut down the channel)
1934        std::mem::forget(self);
1935    }
1936}
1937
1938impl DeviceOpenClientResponder {
1939    /// Sends a response to the FIDL transaction.
1940    ///
1941    /// Sets the channel to shutdown if an error occurs.
1942    pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1943        let _result = self.send_raw(s);
1944        if _result.is_err() {
1945            self.control_handle.shutdown();
1946        }
1947        self.drop_without_shutdown();
1948        _result
1949    }
1950
1951    /// Similar to "send" but does not shutdown the channel if an error occurs.
1952    pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1953        let _result = self.send_raw(s);
1954        self.drop_without_shutdown();
1955        _result
1956    }
1957
1958    fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1959        self.control_handle.inner.send::<DeviceOpenClientResponse>(
1960            (s,),
1961            self.tx_id,
1962            0x78f040fe6a1ebb3,
1963            fidl::encoding::DynamicFlags::empty(),
1964        )
1965    }
1966}
1967
1968#[must_use = "FIDL methods require a response to be sent"]
1969#[derive(Debug)]
1970pub struct DeviceClrSetFeatureResponder {
1971    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1972    tx_id: u32,
1973}
1974
1975/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1976/// if the responder is dropped without sending a response, so that the client
1977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1978impl std::ops::Drop for DeviceClrSetFeatureResponder {
1979    fn drop(&mut self) {
1980        self.control_handle.shutdown();
1981        // Safety: drops once, never accessed again
1982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1983    }
1984}
1985
1986impl fidl::endpoints::Responder for DeviceClrSetFeatureResponder {
1987    type ControlHandle = DeviceControlHandle;
1988
1989    fn control_handle(&self) -> &DeviceControlHandle {
1990        &self.control_handle
1991    }
1992
1993    fn drop_without_shutdown(mut self) {
1994        // Safety: drops once, never accessed again due to mem::forget
1995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1996        // Prevent Drop from running (which would shut down the channel)
1997        std::mem::forget(self);
1998    }
1999}
2000
2001impl DeviceClrSetFeatureResponder {
2002    /// Sends a response to the FIDL transaction.
2003    ///
2004    /// Sets the channel to shutdown if an error occurs.
2005    pub fn send(self, mut status: i32, mut features: u32) -> Result<(), fidl::Error> {
2006        let _result = self.send_raw(status, features);
2007        if _result.is_err() {
2008            self.control_handle.shutdown();
2009        }
2010        self.drop_without_shutdown();
2011        _result
2012    }
2013
2014    /// Similar to "send" but does not shutdown the channel if an error occurs.
2015    pub fn send_no_shutdown_on_err(
2016        self,
2017        mut status: i32,
2018        mut features: u32,
2019    ) -> Result<(), fidl::Error> {
2020        let _result = self.send_raw(status, features);
2021        self.drop_without_shutdown();
2022        _result
2023    }
2024
2025    fn send_raw(&self, mut status: i32, mut features: u32) -> Result<(), fidl::Error> {
2026        self.control_handle.inner.send::<DeviceClrSetFeatureResponse>(
2027            (status, features),
2028            self.tx_id,
2029            0x6367986e6053a15e,
2030            fidl::encoding::DynamicFlags::empty(),
2031        )
2032    }
2033}
2034
2035#[must_use = "FIDL methods require a response to be sent"]
2036#[derive(Debug)]
2037pub struct DeviceGetWindowSizeResponder {
2038    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2039    tx_id: u32,
2040}
2041
2042/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2043/// if the responder is dropped without sending a response, so that the client
2044/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2045impl std::ops::Drop for DeviceGetWindowSizeResponder {
2046    fn drop(&mut self) {
2047        self.control_handle.shutdown();
2048        // Safety: drops once, never accessed again
2049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2050    }
2051}
2052
2053impl fidl::endpoints::Responder for DeviceGetWindowSizeResponder {
2054    type ControlHandle = DeviceControlHandle;
2055
2056    fn control_handle(&self) -> &DeviceControlHandle {
2057        &self.control_handle
2058    }
2059
2060    fn drop_without_shutdown(mut self) {
2061        // Safety: drops once, never accessed again due to mem::forget
2062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2063        // Prevent Drop from running (which would shut down the channel)
2064        std::mem::forget(self);
2065    }
2066}
2067
2068impl DeviceGetWindowSizeResponder {
2069    /// Sends a response to the FIDL transaction.
2070    ///
2071    /// Sets the channel to shutdown if an error occurs.
2072    pub fn send(self, mut status: i32, mut size: &WindowSize) -> Result<(), fidl::Error> {
2073        let _result = self.send_raw(status, size);
2074        if _result.is_err() {
2075            self.control_handle.shutdown();
2076        }
2077        self.drop_without_shutdown();
2078        _result
2079    }
2080
2081    /// Similar to "send" but does not shutdown the channel if an error occurs.
2082    pub fn send_no_shutdown_on_err(
2083        self,
2084        mut status: i32,
2085        mut size: &WindowSize,
2086    ) -> Result<(), fidl::Error> {
2087        let _result = self.send_raw(status, size);
2088        self.drop_without_shutdown();
2089        _result
2090    }
2091
2092    fn send_raw(&self, mut status: i32, mut size: &WindowSize) -> Result<(), fidl::Error> {
2093        self.control_handle.inner.send::<DeviceGetWindowSizeResponse>(
2094            (status, size),
2095            self.tx_id,
2096            0x747bed0460f5f9f7,
2097            fidl::encoding::DynamicFlags::empty(),
2098        )
2099    }
2100}
2101
2102#[must_use = "FIDL methods require a response to be sent"]
2103#[derive(Debug)]
2104pub struct DeviceMakeActiveResponder {
2105    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2106    tx_id: u32,
2107}
2108
2109/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2110/// if the responder is dropped without sending a response, so that the client
2111/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2112impl std::ops::Drop for DeviceMakeActiveResponder {
2113    fn drop(&mut self) {
2114        self.control_handle.shutdown();
2115        // Safety: drops once, never accessed again
2116        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2117    }
2118}
2119
2120impl fidl::endpoints::Responder for DeviceMakeActiveResponder {
2121    type ControlHandle = DeviceControlHandle;
2122
2123    fn control_handle(&self) -> &DeviceControlHandle {
2124        &self.control_handle
2125    }
2126
2127    fn drop_without_shutdown(mut self) {
2128        // Safety: drops once, never accessed again due to mem::forget
2129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2130        // Prevent Drop from running (which would shut down the channel)
2131        std::mem::forget(self);
2132    }
2133}
2134
2135impl DeviceMakeActiveResponder {
2136    /// Sends a response to the FIDL transaction.
2137    ///
2138    /// Sets the channel to shutdown if an error occurs.
2139    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2140        let _result = self.send_raw(status);
2141        if _result.is_err() {
2142            self.control_handle.shutdown();
2143        }
2144        self.drop_without_shutdown();
2145        _result
2146    }
2147
2148    /// Similar to "send" but does not shutdown the channel if an error occurs.
2149    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2150        let _result = self.send_raw(status);
2151        self.drop_without_shutdown();
2152        _result
2153    }
2154
2155    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2156        self.control_handle.inner.send::<DeviceMakeActiveResponse>(
2157            (status,),
2158            self.tx_id,
2159            0x2763944f30ee2a62,
2160            fidl::encoding::DynamicFlags::empty(),
2161        )
2162    }
2163}
2164
2165#[must_use = "FIDL methods require a response to be sent"]
2166#[derive(Debug)]
2167pub struct DeviceReadEventsResponder {
2168    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2169    tx_id: u32,
2170}
2171
2172/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2173/// if the responder is dropped without sending a response, so that the client
2174/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2175impl std::ops::Drop for DeviceReadEventsResponder {
2176    fn drop(&mut self) {
2177        self.control_handle.shutdown();
2178        // Safety: drops once, never accessed again
2179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2180    }
2181}
2182
2183impl fidl::endpoints::Responder for DeviceReadEventsResponder {
2184    type ControlHandle = DeviceControlHandle;
2185
2186    fn control_handle(&self) -> &DeviceControlHandle {
2187        &self.control_handle
2188    }
2189
2190    fn drop_without_shutdown(mut self) {
2191        // Safety: drops once, never accessed again due to mem::forget
2192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193        // Prevent Drop from running (which would shut down the channel)
2194        std::mem::forget(self);
2195    }
2196}
2197
2198impl DeviceReadEventsResponder {
2199    /// Sends a response to the FIDL transaction.
2200    ///
2201    /// Sets the channel to shutdown if an error occurs.
2202    pub fn send(self, mut status: i32, mut events: u32) -> Result<(), fidl::Error> {
2203        let _result = self.send_raw(status, events);
2204        if _result.is_err() {
2205            self.control_handle.shutdown();
2206        }
2207        self.drop_without_shutdown();
2208        _result
2209    }
2210
2211    /// Similar to "send" but does not shutdown the channel if an error occurs.
2212    pub fn send_no_shutdown_on_err(
2213        self,
2214        mut status: i32,
2215        mut events: u32,
2216    ) -> Result<(), fidl::Error> {
2217        let _result = self.send_raw(status, events);
2218        self.drop_without_shutdown();
2219        _result
2220    }
2221
2222    fn send_raw(&self, mut status: i32, mut events: u32) -> Result<(), fidl::Error> {
2223        self.control_handle.inner.send::<DeviceReadEventsResponse>(
2224            (status, events),
2225            self.tx_id,
2226            0xede96f3e3258f62,
2227            fidl::encoding::DynamicFlags::empty(),
2228        )
2229    }
2230}
2231
2232#[must_use = "FIDL methods require a response to be sent"]
2233#[derive(Debug)]
2234pub struct DeviceSetWindowSizeResponder {
2235    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2236    tx_id: u32,
2237}
2238
2239/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2240/// if the responder is dropped without sending a response, so that the client
2241/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2242impl std::ops::Drop for DeviceSetWindowSizeResponder {
2243    fn drop(&mut self) {
2244        self.control_handle.shutdown();
2245        // Safety: drops once, never accessed again
2246        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2247    }
2248}
2249
2250impl fidl::endpoints::Responder for DeviceSetWindowSizeResponder {
2251    type ControlHandle = DeviceControlHandle;
2252
2253    fn control_handle(&self) -> &DeviceControlHandle {
2254        &self.control_handle
2255    }
2256
2257    fn drop_without_shutdown(mut self) {
2258        // Safety: drops once, never accessed again due to mem::forget
2259        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2260        // Prevent Drop from running (which would shut down the channel)
2261        std::mem::forget(self);
2262    }
2263}
2264
2265impl DeviceSetWindowSizeResponder {
2266    /// Sends a response to the FIDL transaction.
2267    ///
2268    /// Sets the channel to shutdown if an error occurs.
2269    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2270        let _result = self.send_raw(status);
2271        if _result.is_err() {
2272            self.control_handle.shutdown();
2273        }
2274        self.drop_without_shutdown();
2275        _result
2276    }
2277
2278    /// Similar to "send" but does not shutdown the channel if an error occurs.
2279    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2280        let _result = self.send_raw(status);
2281        self.drop_without_shutdown();
2282        _result
2283    }
2284
2285    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2286        self.control_handle.inner.send::<DeviceSetWindowSizeResponse>(
2287            (status,),
2288            self.tx_id,
2289            0x17d1cb37377e7928,
2290            fidl::encoding::DynamicFlags::empty(),
2291        )
2292    }
2293}
2294
2295#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2296pub struct ServiceMarker;
2297
2298#[cfg(target_os = "fuchsia")]
2299impl fidl::endpoints::ServiceMarker for ServiceMarker {
2300    type Proxy = ServiceProxy;
2301    type Request = ServiceRequest;
2302    const SERVICE_NAME: &'static str = "fuchsia.hardware.pty.Service";
2303}
2304
2305/// A request for one of the member protocols of Service.
2306///
2307#[cfg(target_os = "fuchsia")]
2308pub enum ServiceRequest {
2309    Device(DeviceRequestStream),
2310}
2311
2312#[cfg(target_os = "fuchsia")]
2313impl fidl::endpoints::ServiceRequest for ServiceRequest {
2314    type Service = ServiceMarker;
2315
2316    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2317        match name {
2318            "device" => Self::Device(
2319                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2320            ),
2321            _ => panic!("no such member protocol name for service Service"),
2322        }
2323    }
2324
2325    fn member_names() -> &'static [&'static str] {
2326        &["device"]
2327    }
2328}
2329#[cfg(target_os = "fuchsia")]
2330pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2331
2332#[cfg(target_os = "fuchsia")]
2333impl fidl::endpoints::ServiceProxy for ServiceProxy {
2334    type Service = ServiceMarker;
2335
2336    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2337        Self(opener)
2338    }
2339}
2340
2341#[cfg(target_os = "fuchsia")]
2342impl ServiceProxy {
2343    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2344        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2345        self.connect_channel_to_device(server_end)?;
2346        Ok(proxy)
2347    }
2348
2349    /// Like `connect_to_device`, but returns a sync proxy.
2350    /// See [`Self::connect_to_device`] for more details.
2351    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2352        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2353        self.connect_channel_to_device(server_end)?;
2354        Ok(proxy)
2355    }
2356
2357    /// Like `connect_to_device`, but accepts a server end.
2358    /// See [`Self::connect_to_device`] for more details.
2359    pub fn connect_channel_to_device(
2360        &self,
2361        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2362    ) -> Result<(), fidl::Error> {
2363        self.0.open_member("device", server_end.into_channel())
2364    }
2365
2366    pub fn instance_name(&self) -> &str {
2367        self.0.instance_name()
2368    }
2369}
2370
2371mod internal {
2372    use super::*;
2373
2374    impl fidl::encoding::ValueTypeMarker for DeviceClrSetFeatureRequest {
2375        type Borrowed<'a> = &'a Self;
2376        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2377            value
2378        }
2379    }
2380
2381    unsafe impl fidl::encoding::TypeMarker for DeviceClrSetFeatureRequest {
2382        type Owned = Self;
2383
2384        #[inline(always)]
2385        fn inline_align(_context: fidl::encoding::Context) -> usize {
2386            4
2387        }
2388
2389        #[inline(always)]
2390        fn inline_size(_context: fidl::encoding::Context) -> usize {
2391            8
2392        }
2393        #[inline(always)]
2394        fn encode_is_copy() -> bool {
2395            true
2396        }
2397
2398        #[inline(always)]
2399        fn decode_is_copy() -> bool {
2400            true
2401        }
2402    }
2403
2404    unsafe impl<D: fidl::encoding::ResourceDialect>
2405        fidl::encoding::Encode<DeviceClrSetFeatureRequest, D> for &DeviceClrSetFeatureRequest
2406    {
2407        #[inline]
2408        unsafe fn encode(
2409            self,
2410            encoder: &mut fidl::encoding::Encoder<'_, D>,
2411            offset: usize,
2412            _depth: fidl::encoding::Depth,
2413        ) -> fidl::Result<()> {
2414            encoder.debug_check_bounds::<DeviceClrSetFeatureRequest>(offset);
2415            unsafe {
2416                // Copy the object into the buffer.
2417                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2418                (buf_ptr as *mut DeviceClrSetFeatureRequest)
2419                    .write_unaligned((self as *const DeviceClrSetFeatureRequest).read());
2420                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2421                // done second because the memcpy will write garbage to these bytes.
2422            }
2423            Ok(())
2424        }
2425    }
2426    unsafe impl<
2427            D: fidl::encoding::ResourceDialect,
2428            T0: fidl::encoding::Encode<u32, D>,
2429            T1: fidl::encoding::Encode<u32, D>,
2430        > fidl::encoding::Encode<DeviceClrSetFeatureRequest, D> for (T0, T1)
2431    {
2432        #[inline]
2433        unsafe fn encode(
2434            self,
2435            encoder: &mut fidl::encoding::Encoder<'_, D>,
2436            offset: usize,
2437            depth: fidl::encoding::Depth,
2438        ) -> fidl::Result<()> {
2439            encoder.debug_check_bounds::<DeviceClrSetFeatureRequest>(offset);
2440            // Zero out padding regions. There's no need to apply masks
2441            // because the unmasked parts will be overwritten by fields.
2442            // Write the fields.
2443            self.0.encode(encoder, offset + 0, depth)?;
2444            self.1.encode(encoder, offset + 4, depth)?;
2445            Ok(())
2446        }
2447    }
2448
2449    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2450        for DeviceClrSetFeatureRequest
2451    {
2452        #[inline(always)]
2453        fn new_empty() -> Self {
2454            Self { clr: fidl::new_empty!(u32, D), set: fidl::new_empty!(u32, D) }
2455        }
2456
2457        #[inline]
2458        unsafe fn decode(
2459            &mut self,
2460            decoder: &mut fidl::encoding::Decoder<'_, D>,
2461            offset: usize,
2462            _depth: fidl::encoding::Depth,
2463        ) -> fidl::Result<()> {
2464            decoder.debug_check_bounds::<Self>(offset);
2465            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2466            // Verify that padding bytes are zero.
2467            // Copy from the buffer into the object.
2468            unsafe {
2469                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2470            }
2471            Ok(())
2472        }
2473    }
2474
2475    impl fidl::encoding::ValueTypeMarker for DeviceClrSetFeatureResponse {
2476        type Borrowed<'a> = &'a Self;
2477        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2478            value
2479        }
2480    }
2481
2482    unsafe impl fidl::encoding::TypeMarker for DeviceClrSetFeatureResponse {
2483        type Owned = Self;
2484
2485        #[inline(always)]
2486        fn inline_align(_context: fidl::encoding::Context) -> usize {
2487            4
2488        }
2489
2490        #[inline(always)]
2491        fn inline_size(_context: fidl::encoding::Context) -> usize {
2492            8
2493        }
2494        #[inline(always)]
2495        fn encode_is_copy() -> bool {
2496            true
2497        }
2498
2499        #[inline(always)]
2500        fn decode_is_copy() -> bool {
2501            true
2502        }
2503    }
2504
2505    unsafe impl<D: fidl::encoding::ResourceDialect>
2506        fidl::encoding::Encode<DeviceClrSetFeatureResponse, D> for &DeviceClrSetFeatureResponse
2507    {
2508        #[inline]
2509        unsafe fn encode(
2510            self,
2511            encoder: &mut fidl::encoding::Encoder<'_, D>,
2512            offset: usize,
2513            _depth: fidl::encoding::Depth,
2514        ) -> fidl::Result<()> {
2515            encoder.debug_check_bounds::<DeviceClrSetFeatureResponse>(offset);
2516            unsafe {
2517                // Copy the object into the buffer.
2518                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2519                (buf_ptr as *mut DeviceClrSetFeatureResponse)
2520                    .write_unaligned((self as *const DeviceClrSetFeatureResponse).read());
2521                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2522                // done second because the memcpy will write garbage to these bytes.
2523            }
2524            Ok(())
2525        }
2526    }
2527    unsafe impl<
2528            D: fidl::encoding::ResourceDialect,
2529            T0: fidl::encoding::Encode<i32, D>,
2530            T1: fidl::encoding::Encode<u32, D>,
2531        > fidl::encoding::Encode<DeviceClrSetFeatureResponse, D> for (T0, T1)
2532    {
2533        #[inline]
2534        unsafe fn encode(
2535            self,
2536            encoder: &mut fidl::encoding::Encoder<'_, D>,
2537            offset: usize,
2538            depth: fidl::encoding::Depth,
2539        ) -> fidl::Result<()> {
2540            encoder.debug_check_bounds::<DeviceClrSetFeatureResponse>(offset);
2541            // Zero out padding regions. There's no need to apply masks
2542            // because the unmasked parts will be overwritten by fields.
2543            // Write the fields.
2544            self.0.encode(encoder, offset + 0, depth)?;
2545            self.1.encode(encoder, offset + 4, depth)?;
2546            Ok(())
2547        }
2548    }
2549
2550    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2551        for DeviceClrSetFeatureResponse
2552    {
2553        #[inline(always)]
2554        fn new_empty() -> Self {
2555            Self { status: fidl::new_empty!(i32, D), features: fidl::new_empty!(u32, D) }
2556        }
2557
2558        #[inline]
2559        unsafe fn decode(
2560            &mut self,
2561            decoder: &mut fidl::encoding::Decoder<'_, D>,
2562            offset: usize,
2563            _depth: fidl::encoding::Depth,
2564        ) -> fidl::Result<()> {
2565            decoder.debug_check_bounds::<Self>(offset);
2566            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2567            // Verify that padding bytes are zero.
2568            // Copy from the buffer into the object.
2569            unsafe {
2570                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2571            }
2572            Ok(())
2573        }
2574    }
2575
2576    impl fidl::encoding::ValueTypeMarker for DeviceGetWindowSizeResponse {
2577        type Borrowed<'a> = &'a Self;
2578        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2579            value
2580        }
2581    }
2582
2583    unsafe impl fidl::encoding::TypeMarker for DeviceGetWindowSizeResponse {
2584        type Owned = Self;
2585
2586        #[inline(always)]
2587        fn inline_align(_context: fidl::encoding::Context) -> usize {
2588            4
2589        }
2590
2591        #[inline(always)]
2592        fn inline_size(_context: fidl::encoding::Context) -> usize {
2593            12
2594        }
2595        #[inline(always)]
2596        fn encode_is_copy() -> bool {
2597            true
2598        }
2599
2600        #[inline(always)]
2601        fn decode_is_copy() -> bool {
2602            true
2603        }
2604    }
2605
2606    unsafe impl<D: fidl::encoding::ResourceDialect>
2607        fidl::encoding::Encode<DeviceGetWindowSizeResponse, D> for &DeviceGetWindowSizeResponse
2608    {
2609        #[inline]
2610        unsafe fn encode(
2611            self,
2612            encoder: &mut fidl::encoding::Encoder<'_, D>,
2613            offset: usize,
2614            _depth: fidl::encoding::Depth,
2615        ) -> fidl::Result<()> {
2616            encoder.debug_check_bounds::<DeviceGetWindowSizeResponse>(offset);
2617            unsafe {
2618                // Copy the object into the buffer.
2619                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2620                (buf_ptr as *mut DeviceGetWindowSizeResponse)
2621                    .write_unaligned((self as *const DeviceGetWindowSizeResponse).read());
2622                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2623                // done second because the memcpy will write garbage to these bytes.
2624            }
2625            Ok(())
2626        }
2627    }
2628    unsafe impl<
2629            D: fidl::encoding::ResourceDialect,
2630            T0: fidl::encoding::Encode<i32, D>,
2631            T1: fidl::encoding::Encode<WindowSize, D>,
2632        > fidl::encoding::Encode<DeviceGetWindowSizeResponse, D> for (T0, T1)
2633    {
2634        #[inline]
2635        unsafe fn encode(
2636            self,
2637            encoder: &mut fidl::encoding::Encoder<'_, D>,
2638            offset: usize,
2639            depth: fidl::encoding::Depth,
2640        ) -> fidl::Result<()> {
2641            encoder.debug_check_bounds::<DeviceGetWindowSizeResponse>(offset);
2642            // Zero out padding regions. There's no need to apply masks
2643            // because the unmasked parts will be overwritten by fields.
2644            // Write the fields.
2645            self.0.encode(encoder, offset + 0, depth)?;
2646            self.1.encode(encoder, offset + 4, depth)?;
2647            Ok(())
2648        }
2649    }
2650
2651    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2652        for DeviceGetWindowSizeResponse
2653    {
2654        #[inline(always)]
2655        fn new_empty() -> Self {
2656            Self { status: fidl::new_empty!(i32, D), size: fidl::new_empty!(WindowSize, D) }
2657        }
2658
2659        #[inline]
2660        unsafe fn decode(
2661            &mut self,
2662            decoder: &mut fidl::encoding::Decoder<'_, D>,
2663            offset: usize,
2664            _depth: fidl::encoding::Depth,
2665        ) -> fidl::Result<()> {
2666            decoder.debug_check_bounds::<Self>(offset);
2667            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2668            // Verify that padding bytes are zero.
2669            // Copy from the buffer into the object.
2670            unsafe {
2671                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2672            }
2673            Ok(())
2674        }
2675    }
2676
2677    impl fidl::encoding::ValueTypeMarker for DeviceMakeActiveRequest {
2678        type Borrowed<'a> = &'a Self;
2679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2680            value
2681        }
2682    }
2683
2684    unsafe impl fidl::encoding::TypeMarker for DeviceMakeActiveRequest {
2685        type Owned = Self;
2686
2687        #[inline(always)]
2688        fn inline_align(_context: fidl::encoding::Context) -> usize {
2689            4
2690        }
2691
2692        #[inline(always)]
2693        fn inline_size(_context: fidl::encoding::Context) -> usize {
2694            4
2695        }
2696        #[inline(always)]
2697        fn encode_is_copy() -> bool {
2698            true
2699        }
2700
2701        #[inline(always)]
2702        fn decode_is_copy() -> bool {
2703            true
2704        }
2705    }
2706
2707    unsafe impl<D: fidl::encoding::ResourceDialect>
2708        fidl::encoding::Encode<DeviceMakeActiveRequest, D> for &DeviceMakeActiveRequest
2709    {
2710        #[inline]
2711        unsafe fn encode(
2712            self,
2713            encoder: &mut fidl::encoding::Encoder<'_, D>,
2714            offset: usize,
2715            _depth: fidl::encoding::Depth,
2716        ) -> fidl::Result<()> {
2717            encoder.debug_check_bounds::<DeviceMakeActiveRequest>(offset);
2718            unsafe {
2719                // Copy the object into the buffer.
2720                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2721                (buf_ptr as *mut DeviceMakeActiveRequest)
2722                    .write_unaligned((self as *const DeviceMakeActiveRequest).read());
2723                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2724                // done second because the memcpy will write garbage to these bytes.
2725            }
2726            Ok(())
2727        }
2728    }
2729    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2730        fidl::encoding::Encode<DeviceMakeActiveRequest, D> for (T0,)
2731    {
2732        #[inline]
2733        unsafe fn encode(
2734            self,
2735            encoder: &mut fidl::encoding::Encoder<'_, D>,
2736            offset: usize,
2737            depth: fidl::encoding::Depth,
2738        ) -> fidl::Result<()> {
2739            encoder.debug_check_bounds::<DeviceMakeActiveRequest>(offset);
2740            // Zero out padding regions. There's no need to apply masks
2741            // because the unmasked parts will be overwritten by fields.
2742            // Write the fields.
2743            self.0.encode(encoder, offset + 0, depth)?;
2744            Ok(())
2745        }
2746    }
2747
2748    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2749        for DeviceMakeActiveRequest
2750    {
2751        #[inline(always)]
2752        fn new_empty() -> Self {
2753            Self { client_pty_id: fidl::new_empty!(u32, D) }
2754        }
2755
2756        #[inline]
2757        unsafe fn decode(
2758            &mut self,
2759            decoder: &mut fidl::encoding::Decoder<'_, D>,
2760            offset: usize,
2761            _depth: fidl::encoding::Depth,
2762        ) -> fidl::Result<()> {
2763            decoder.debug_check_bounds::<Self>(offset);
2764            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2765            // Verify that padding bytes are zero.
2766            // Copy from the buffer into the object.
2767            unsafe {
2768                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2769            }
2770            Ok(())
2771        }
2772    }
2773
2774    impl fidl::encoding::ValueTypeMarker for DeviceMakeActiveResponse {
2775        type Borrowed<'a> = &'a Self;
2776        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2777            value
2778        }
2779    }
2780
2781    unsafe impl fidl::encoding::TypeMarker for DeviceMakeActiveResponse {
2782        type Owned = Self;
2783
2784        #[inline(always)]
2785        fn inline_align(_context: fidl::encoding::Context) -> usize {
2786            4
2787        }
2788
2789        #[inline(always)]
2790        fn inline_size(_context: fidl::encoding::Context) -> usize {
2791            4
2792        }
2793        #[inline(always)]
2794        fn encode_is_copy() -> bool {
2795            true
2796        }
2797
2798        #[inline(always)]
2799        fn decode_is_copy() -> bool {
2800            true
2801        }
2802    }
2803
2804    unsafe impl<D: fidl::encoding::ResourceDialect>
2805        fidl::encoding::Encode<DeviceMakeActiveResponse, D> for &DeviceMakeActiveResponse
2806    {
2807        #[inline]
2808        unsafe fn encode(
2809            self,
2810            encoder: &mut fidl::encoding::Encoder<'_, D>,
2811            offset: usize,
2812            _depth: fidl::encoding::Depth,
2813        ) -> fidl::Result<()> {
2814            encoder.debug_check_bounds::<DeviceMakeActiveResponse>(offset);
2815            unsafe {
2816                // Copy the object into the buffer.
2817                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2818                (buf_ptr as *mut DeviceMakeActiveResponse)
2819                    .write_unaligned((self as *const DeviceMakeActiveResponse).read());
2820                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2821                // done second because the memcpy will write garbage to these bytes.
2822            }
2823            Ok(())
2824        }
2825    }
2826    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2827        fidl::encoding::Encode<DeviceMakeActiveResponse, D> for (T0,)
2828    {
2829        #[inline]
2830        unsafe fn encode(
2831            self,
2832            encoder: &mut fidl::encoding::Encoder<'_, D>,
2833            offset: usize,
2834            depth: fidl::encoding::Depth,
2835        ) -> fidl::Result<()> {
2836            encoder.debug_check_bounds::<DeviceMakeActiveResponse>(offset);
2837            // Zero out padding regions. There's no need to apply masks
2838            // because the unmasked parts will be overwritten by fields.
2839            // Write the fields.
2840            self.0.encode(encoder, offset + 0, depth)?;
2841            Ok(())
2842        }
2843    }
2844
2845    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2846        for DeviceMakeActiveResponse
2847    {
2848        #[inline(always)]
2849        fn new_empty() -> Self {
2850            Self { status: fidl::new_empty!(i32, D) }
2851        }
2852
2853        #[inline]
2854        unsafe fn decode(
2855            &mut self,
2856            decoder: &mut fidl::encoding::Decoder<'_, D>,
2857            offset: usize,
2858            _depth: fidl::encoding::Depth,
2859        ) -> fidl::Result<()> {
2860            decoder.debug_check_bounds::<Self>(offset);
2861            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2862            // Verify that padding bytes are zero.
2863            // Copy from the buffer into the object.
2864            unsafe {
2865                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2866            }
2867            Ok(())
2868        }
2869    }
2870
2871    impl fidl::encoding::ResourceTypeMarker for DeviceOpenClientRequest {
2872        type Borrowed<'a> = &'a mut Self;
2873        fn take_or_borrow<'a>(
2874            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2875        ) -> Self::Borrowed<'a> {
2876            value
2877        }
2878    }
2879
2880    unsafe impl fidl::encoding::TypeMarker for DeviceOpenClientRequest {
2881        type Owned = Self;
2882
2883        #[inline(always)]
2884        fn inline_align(_context: fidl::encoding::Context) -> usize {
2885            4
2886        }
2887
2888        #[inline(always)]
2889        fn inline_size(_context: fidl::encoding::Context) -> usize {
2890            8
2891        }
2892    }
2893
2894    unsafe impl
2895        fidl::encoding::Encode<
2896            DeviceOpenClientRequest,
2897            fidl::encoding::DefaultFuchsiaResourceDialect,
2898        > for &mut DeviceOpenClientRequest
2899    {
2900        #[inline]
2901        unsafe fn encode(
2902            self,
2903            encoder: &mut fidl::encoding::Encoder<
2904                '_,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906            >,
2907            offset: usize,
2908            _depth: fidl::encoding::Depth,
2909        ) -> fidl::Result<()> {
2910            encoder.debug_check_bounds::<DeviceOpenClientRequest>(offset);
2911            // Delegate to tuple encoding.
2912            fidl::encoding::Encode::<DeviceOpenClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2913                (
2914                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2915                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2916                ),
2917                encoder, offset, _depth
2918            )
2919        }
2920    }
2921    unsafe impl<
2922            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2923            T1: fidl::encoding::Encode<
2924                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2925                fidl::encoding::DefaultFuchsiaResourceDialect,
2926            >,
2927        >
2928        fidl::encoding::Encode<
2929            DeviceOpenClientRequest,
2930            fidl::encoding::DefaultFuchsiaResourceDialect,
2931        > for (T0, T1)
2932    {
2933        #[inline]
2934        unsafe fn encode(
2935            self,
2936            encoder: &mut fidl::encoding::Encoder<
2937                '_,
2938                fidl::encoding::DefaultFuchsiaResourceDialect,
2939            >,
2940            offset: usize,
2941            depth: fidl::encoding::Depth,
2942        ) -> fidl::Result<()> {
2943            encoder.debug_check_bounds::<DeviceOpenClientRequest>(offset);
2944            // Zero out padding regions. There's no need to apply masks
2945            // because the unmasked parts will be overwritten by fields.
2946            // Write the fields.
2947            self.0.encode(encoder, offset + 0, depth)?;
2948            self.1.encode(encoder, offset + 4, depth)?;
2949            Ok(())
2950        }
2951    }
2952
2953    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2954        for DeviceOpenClientRequest
2955    {
2956        #[inline(always)]
2957        fn new_empty() -> Self {
2958            Self {
2959                id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2960                client: fidl::new_empty!(
2961                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2962                    fidl::encoding::DefaultFuchsiaResourceDialect
2963                ),
2964            }
2965        }
2966
2967        #[inline]
2968        unsafe fn decode(
2969            &mut self,
2970            decoder: &mut fidl::encoding::Decoder<
2971                '_,
2972                fidl::encoding::DefaultFuchsiaResourceDialect,
2973            >,
2974            offset: usize,
2975            _depth: fidl::encoding::Depth,
2976        ) -> fidl::Result<()> {
2977            decoder.debug_check_bounds::<Self>(offset);
2978            // Verify that padding bytes are zero.
2979            fidl::decode!(
2980                u32,
2981                fidl::encoding::DefaultFuchsiaResourceDialect,
2982                &mut self.id,
2983                decoder,
2984                offset + 0,
2985                _depth
2986            )?;
2987            fidl::decode!(
2988                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2989                fidl::encoding::DefaultFuchsiaResourceDialect,
2990                &mut self.client,
2991                decoder,
2992                offset + 4,
2993                _depth
2994            )?;
2995            Ok(())
2996        }
2997    }
2998
2999    impl fidl::encoding::ValueTypeMarker for DeviceOpenClientResponse {
3000        type Borrowed<'a> = &'a Self;
3001        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3002            value
3003        }
3004    }
3005
3006    unsafe impl fidl::encoding::TypeMarker for DeviceOpenClientResponse {
3007        type Owned = Self;
3008
3009        #[inline(always)]
3010        fn inline_align(_context: fidl::encoding::Context) -> usize {
3011            4
3012        }
3013
3014        #[inline(always)]
3015        fn inline_size(_context: fidl::encoding::Context) -> usize {
3016            4
3017        }
3018        #[inline(always)]
3019        fn encode_is_copy() -> bool {
3020            true
3021        }
3022
3023        #[inline(always)]
3024        fn decode_is_copy() -> bool {
3025            true
3026        }
3027    }
3028
3029    unsafe impl<D: fidl::encoding::ResourceDialect>
3030        fidl::encoding::Encode<DeviceOpenClientResponse, D> for &DeviceOpenClientResponse
3031    {
3032        #[inline]
3033        unsafe fn encode(
3034            self,
3035            encoder: &mut fidl::encoding::Encoder<'_, D>,
3036            offset: usize,
3037            _depth: fidl::encoding::Depth,
3038        ) -> fidl::Result<()> {
3039            encoder.debug_check_bounds::<DeviceOpenClientResponse>(offset);
3040            unsafe {
3041                // Copy the object into the buffer.
3042                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3043                (buf_ptr as *mut DeviceOpenClientResponse)
3044                    .write_unaligned((self as *const DeviceOpenClientResponse).read());
3045                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3046                // done second because the memcpy will write garbage to these bytes.
3047            }
3048            Ok(())
3049        }
3050    }
3051    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
3052        fidl::encoding::Encode<DeviceOpenClientResponse, D> for (T0,)
3053    {
3054        #[inline]
3055        unsafe fn encode(
3056            self,
3057            encoder: &mut fidl::encoding::Encoder<'_, D>,
3058            offset: usize,
3059            depth: fidl::encoding::Depth,
3060        ) -> fidl::Result<()> {
3061            encoder.debug_check_bounds::<DeviceOpenClientResponse>(offset);
3062            // Zero out padding regions. There's no need to apply masks
3063            // because the unmasked parts will be overwritten by fields.
3064            // Write the fields.
3065            self.0.encode(encoder, offset + 0, depth)?;
3066            Ok(())
3067        }
3068    }
3069
3070    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3071        for DeviceOpenClientResponse
3072    {
3073        #[inline(always)]
3074        fn new_empty() -> Self {
3075            Self { s: fidl::new_empty!(i32, D) }
3076        }
3077
3078        #[inline]
3079        unsafe fn decode(
3080            &mut self,
3081            decoder: &mut fidl::encoding::Decoder<'_, D>,
3082            offset: usize,
3083            _depth: fidl::encoding::Depth,
3084        ) -> fidl::Result<()> {
3085            decoder.debug_check_bounds::<Self>(offset);
3086            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3087            // Verify that padding bytes are zero.
3088            // Copy from the buffer into the object.
3089            unsafe {
3090                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3091            }
3092            Ok(())
3093        }
3094    }
3095
3096    impl fidl::encoding::ValueTypeMarker for DeviceReadEventsResponse {
3097        type Borrowed<'a> = &'a Self;
3098        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3099            value
3100        }
3101    }
3102
3103    unsafe impl fidl::encoding::TypeMarker for DeviceReadEventsResponse {
3104        type Owned = Self;
3105
3106        #[inline(always)]
3107        fn inline_align(_context: fidl::encoding::Context) -> usize {
3108            4
3109        }
3110
3111        #[inline(always)]
3112        fn inline_size(_context: fidl::encoding::Context) -> usize {
3113            8
3114        }
3115        #[inline(always)]
3116        fn encode_is_copy() -> bool {
3117            true
3118        }
3119
3120        #[inline(always)]
3121        fn decode_is_copy() -> bool {
3122            true
3123        }
3124    }
3125
3126    unsafe impl<D: fidl::encoding::ResourceDialect>
3127        fidl::encoding::Encode<DeviceReadEventsResponse, D> for &DeviceReadEventsResponse
3128    {
3129        #[inline]
3130        unsafe fn encode(
3131            self,
3132            encoder: &mut fidl::encoding::Encoder<'_, D>,
3133            offset: usize,
3134            _depth: fidl::encoding::Depth,
3135        ) -> fidl::Result<()> {
3136            encoder.debug_check_bounds::<DeviceReadEventsResponse>(offset);
3137            unsafe {
3138                // Copy the object into the buffer.
3139                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3140                (buf_ptr as *mut DeviceReadEventsResponse)
3141                    .write_unaligned((self as *const DeviceReadEventsResponse).read());
3142                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3143                // done second because the memcpy will write garbage to these bytes.
3144            }
3145            Ok(())
3146        }
3147    }
3148    unsafe impl<
3149            D: fidl::encoding::ResourceDialect,
3150            T0: fidl::encoding::Encode<i32, D>,
3151            T1: fidl::encoding::Encode<u32, D>,
3152        > fidl::encoding::Encode<DeviceReadEventsResponse, D> for (T0, T1)
3153    {
3154        #[inline]
3155        unsafe fn encode(
3156            self,
3157            encoder: &mut fidl::encoding::Encoder<'_, D>,
3158            offset: usize,
3159            depth: fidl::encoding::Depth,
3160        ) -> fidl::Result<()> {
3161            encoder.debug_check_bounds::<DeviceReadEventsResponse>(offset);
3162            // Zero out padding regions. There's no need to apply masks
3163            // because the unmasked parts will be overwritten by fields.
3164            // Write the fields.
3165            self.0.encode(encoder, offset + 0, depth)?;
3166            self.1.encode(encoder, offset + 4, depth)?;
3167            Ok(())
3168        }
3169    }
3170
3171    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3172        for DeviceReadEventsResponse
3173    {
3174        #[inline(always)]
3175        fn new_empty() -> Self {
3176            Self { status: fidl::new_empty!(i32, D), events: fidl::new_empty!(u32, D) }
3177        }
3178
3179        #[inline]
3180        unsafe fn decode(
3181            &mut self,
3182            decoder: &mut fidl::encoding::Decoder<'_, D>,
3183            offset: usize,
3184            _depth: fidl::encoding::Depth,
3185        ) -> fidl::Result<()> {
3186            decoder.debug_check_bounds::<Self>(offset);
3187            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3188            // Verify that padding bytes are zero.
3189            // Copy from the buffer into the object.
3190            unsafe {
3191                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3192            }
3193            Ok(())
3194        }
3195    }
3196
3197    impl fidl::encoding::ValueTypeMarker for DeviceSetWindowSizeRequest {
3198        type Borrowed<'a> = &'a Self;
3199        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3200            value
3201        }
3202    }
3203
3204    unsafe impl fidl::encoding::TypeMarker for DeviceSetWindowSizeRequest {
3205        type Owned = Self;
3206
3207        #[inline(always)]
3208        fn inline_align(_context: fidl::encoding::Context) -> usize {
3209            4
3210        }
3211
3212        #[inline(always)]
3213        fn inline_size(_context: fidl::encoding::Context) -> usize {
3214            8
3215        }
3216        #[inline(always)]
3217        fn encode_is_copy() -> bool {
3218            true
3219        }
3220
3221        #[inline(always)]
3222        fn decode_is_copy() -> bool {
3223            true
3224        }
3225    }
3226
3227    unsafe impl<D: fidl::encoding::ResourceDialect>
3228        fidl::encoding::Encode<DeviceSetWindowSizeRequest, D> for &DeviceSetWindowSizeRequest
3229    {
3230        #[inline]
3231        unsafe fn encode(
3232            self,
3233            encoder: &mut fidl::encoding::Encoder<'_, D>,
3234            offset: usize,
3235            _depth: fidl::encoding::Depth,
3236        ) -> fidl::Result<()> {
3237            encoder.debug_check_bounds::<DeviceSetWindowSizeRequest>(offset);
3238            unsafe {
3239                // Copy the object into the buffer.
3240                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3241                (buf_ptr as *mut DeviceSetWindowSizeRequest)
3242                    .write_unaligned((self as *const DeviceSetWindowSizeRequest).read());
3243                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3244                // done second because the memcpy will write garbage to these bytes.
3245            }
3246            Ok(())
3247        }
3248    }
3249    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<WindowSize, D>>
3250        fidl::encoding::Encode<DeviceSetWindowSizeRequest, D> for (T0,)
3251    {
3252        #[inline]
3253        unsafe fn encode(
3254            self,
3255            encoder: &mut fidl::encoding::Encoder<'_, D>,
3256            offset: usize,
3257            depth: fidl::encoding::Depth,
3258        ) -> fidl::Result<()> {
3259            encoder.debug_check_bounds::<DeviceSetWindowSizeRequest>(offset);
3260            // Zero out padding regions. There's no need to apply masks
3261            // because the unmasked parts will be overwritten by fields.
3262            // Write the fields.
3263            self.0.encode(encoder, offset + 0, depth)?;
3264            Ok(())
3265        }
3266    }
3267
3268    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3269        for DeviceSetWindowSizeRequest
3270    {
3271        #[inline(always)]
3272        fn new_empty() -> Self {
3273            Self { size: fidl::new_empty!(WindowSize, D) }
3274        }
3275
3276        #[inline]
3277        unsafe fn decode(
3278            &mut self,
3279            decoder: &mut fidl::encoding::Decoder<'_, D>,
3280            offset: usize,
3281            _depth: fidl::encoding::Depth,
3282        ) -> fidl::Result<()> {
3283            decoder.debug_check_bounds::<Self>(offset);
3284            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3285            // Verify that padding bytes are zero.
3286            // Copy from the buffer into the object.
3287            unsafe {
3288                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3289            }
3290            Ok(())
3291        }
3292    }
3293
3294    impl fidl::encoding::ValueTypeMarker for DeviceSetWindowSizeResponse {
3295        type Borrowed<'a> = &'a Self;
3296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3297            value
3298        }
3299    }
3300
3301    unsafe impl fidl::encoding::TypeMarker for DeviceSetWindowSizeResponse {
3302        type Owned = Self;
3303
3304        #[inline(always)]
3305        fn inline_align(_context: fidl::encoding::Context) -> usize {
3306            4
3307        }
3308
3309        #[inline(always)]
3310        fn inline_size(_context: fidl::encoding::Context) -> usize {
3311            4
3312        }
3313        #[inline(always)]
3314        fn encode_is_copy() -> bool {
3315            true
3316        }
3317
3318        #[inline(always)]
3319        fn decode_is_copy() -> bool {
3320            true
3321        }
3322    }
3323
3324    unsafe impl<D: fidl::encoding::ResourceDialect>
3325        fidl::encoding::Encode<DeviceSetWindowSizeResponse, D> for &DeviceSetWindowSizeResponse
3326    {
3327        #[inline]
3328        unsafe fn encode(
3329            self,
3330            encoder: &mut fidl::encoding::Encoder<'_, D>,
3331            offset: usize,
3332            _depth: fidl::encoding::Depth,
3333        ) -> fidl::Result<()> {
3334            encoder.debug_check_bounds::<DeviceSetWindowSizeResponse>(offset);
3335            unsafe {
3336                // Copy the object into the buffer.
3337                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3338                (buf_ptr as *mut DeviceSetWindowSizeResponse)
3339                    .write_unaligned((self as *const DeviceSetWindowSizeResponse).read());
3340                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3341                // done second because the memcpy will write garbage to these bytes.
3342            }
3343            Ok(())
3344        }
3345    }
3346    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
3347        fidl::encoding::Encode<DeviceSetWindowSizeResponse, D> for (T0,)
3348    {
3349        #[inline]
3350        unsafe fn encode(
3351            self,
3352            encoder: &mut fidl::encoding::Encoder<'_, D>,
3353            offset: usize,
3354            depth: fidl::encoding::Depth,
3355        ) -> fidl::Result<()> {
3356            encoder.debug_check_bounds::<DeviceSetWindowSizeResponse>(offset);
3357            // Zero out padding regions. There's no need to apply masks
3358            // because the unmasked parts will be overwritten by fields.
3359            // Write the fields.
3360            self.0.encode(encoder, offset + 0, depth)?;
3361            Ok(())
3362        }
3363    }
3364
3365    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3366        for DeviceSetWindowSizeResponse
3367    {
3368        #[inline(always)]
3369        fn new_empty() -> Self {
3370            Self { status: fidl::new_empty!(i32, D) }
3371        }
3372
3373        #[inline]
3374        unsafe fn decode(
3375            &mut self,
3376            decoder: &mut fidl::encoding::Decoder<'_, D>,
3377            offset: usize,
3378            _depth: fidl::encoding::Depth,
3379        ) -> fidl::Result<()> {
3380            decoder.debug_check_bounds::<Self>(offset);
3381            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3382            // Verify that padding bytes are zero.
3383            // Copy from the buffer into the object.
3384            unsafe {
3385                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3386            }
3387            Ok(())
3388        }
3389    }
3390
3391    impl fidl::encoding::ValueTypeMarker for WindowSize {
3392        type Borrowed<'a> = &'a Self;
3393        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3394            value
3395        }
3396    }
3397
3398    unsafe impl fidl::encoding::TypeMarker for WindowSize {
3399        type Owned = Self;
3400
3401        #[inline(always)]
3402        fn inline_align(_context: fidl::encoding::Context) -> usize {
3403            4
3404        }
3405
3406        #[inline(always)]
3407        fn inline_size(_context: fidl::encoding::Context) -> usize {
3408            8
3409        }
3410        #[inline(always)]
3411        fn encode_is_copy() -> bool {
3412            true
3413        }
3414
3415        #[inline(always)]
3416        fn decode_is_copy() -> bool {
3417            true
3418        }
3419    }
3420
3421    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WindowSize, D>
3422        for &WindowSize
3423    {
3424        #[inline]
3425        unsafe fn encode(
3426            self,
3427            encoder: &mut fidl::encoding::Encoder<'_, D>,
3428            offset: usize,
3429            _depth: fidl::encoding::Depth,
3430        ) -> fidl::Result<()> {
3431            encoder.debug_check_bounds::<WindowSize>(offset);
3432            unsafe {
3433                // Copy the object into the buffer.
3434                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3435                (buf_ptr as *mut WindowSize).write_unaligned((self as *const WindowSize).read());
3436                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3437                // done second because the memcpy will write garbage to these bytes.
3438            }
3439            Ok(())
3440        }
3441    }
3442    unsafe impl<
3443            D: fidl::encoding::ResourceDialect,
3444            T0: fidl::encoding::Encode<u32, D>,
3445            T1: fidl::encoding::Encode<u32, D>,
3446        > fidl::encoding::Encode<WindowSize, D> for (T0, T1)
3447    {
3448        #[inline]
3449        unsafe fn encode(
3450            self,
3451            encoder: &mut fidl::encoding::Encoder<'_, D>,
3452            offset: usize,
3453            depth: fidl::encoding::Depth,
3454        ) -> fidl::Result<()> {
3455            encoder.debug_check_bounds::<WindowSize>(offset);
3456            // Zero out padding regions. There's no need to apply masks
3457            // because the unmasked parts will be overwritten by fields.
3458            // Write the fields.
3459            self.0.encode(encoder, offset + 0, depth)?;
3460            self.1.encode(encoder, offset + 4, depth)?;
3461            Ok(())
3462        }
3463    }
3464
3465    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WindowSize {
3466        #[inline(always)]
3467        fn new_empty() -> Self {
3468            Self { width: fidl::new_empty!(u32, D), height: fidl::new_empty!(u32, D) }
3469        }
3470
3471        #[inline]
3472        unsafe fn decode(
3473            &mut self,
3474            decoder: &mut fidl::encoding::Decoder<'_, D>,
3475            offset: usize,
3476            _depth: fidl::encoding::Depth,
3477        ) -> fidl::Result<()> {
3478            decoder.debug_check_bounds::<Self>(offset);
3479            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3480            // Verify that padding bytes are zero.
3481            // Copy from the buffer into the object.
3482            unsafe {
3483                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3484            }
3485            Ok(())
3486        }
3487    }
3488
3489    impl DeviceDescribeResponse {
3490        #[inline(always)]
3491        fn max_ordinal_present(&self) -> u64 {
3492            if let Some(_) = self.event {
3493                return 1;
3494            }
3495            0
3496        }
3497    }
3498
3499    impl fidl::encoding::ResourceTypeMarker for DeviceDescribeResponse {
3500        type Borrowed<'a> = &'a mut Self;
3501        fn take_or_borrow<'a>(
3502            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3503        ) -> Self::Borrowed<'a> {
3504            value
3505        }
3506    }
3507
3508    unsafe impl fidl::encoding::TypeMarker for DeviceDescribeResponse {
3509        type Owned = Self;
3510
3511        #[inline(always)]
3512        fn inline_align(_context: fidl::encoding::Context) -> usize {
3513            8
3514        }
3515
3516        #[inline(always)]
3517        fn inline_size(_context: fidl::encoding::Context) -> usize {
3518            16
3519        }
3520    }
3521
3522    unsafe impl
3523        fidl::encoding::Encode<
3524            DeviceDescribeResponse,
3525            fidl::encoding::DefaultFuchsiaResourceDialect,
3526        > for &mut DeviceDescribeResponse
3527    {
3528        unsafe fn encode(
3529            self,
3530            encoder: &mut fidl::encoding::Encoder<
3531                '_,
3532                fidl::encoding::DefaultFuchsiaResourceDialect,
3533            >,
3534            offset: usize,
3535            mut depth: fidl::encoding::Depth,
3536        ) -> fidl::Result<()> {
3537            encoder.debug_check_bounds::<DeviceDescribeResponse>(offset);
3538            // Vector header
3539            let max_ordinal: u64 = self.max_ordinal_present();
3540            encoder.write_num(max_ordinal, offset);
3541            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3542            // Calling encoder.out_of_line_offset(0) is not allowed.
3543            if max_ordinal == 0 {
3544                return Ok(());
3545            }
3546            depth.increment()?;
3547            let envelope_size = 8;
3548            let bytes_len = max_ordinal as usize * envelope_size;
3549            #[allow(unused_variables)]
3550            let offset = encoder.out_of_line_offset(bytes_len);
3551            let mut _prev_end_offset: usize = 0;
3552            if 1 > max_ordinal {
3553                return Ok(());
3554            }
3555
3556            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3557            // are envelope_size bytes.
3558            let cur_offset: usize = (1 - 1) * envelope_size;
3559
3560            // Zero reserved fields.
3561            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3562
3563            // Safety:
3564            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3565            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3566            //   envelope_size bytes, there is always sufficient room.
3567            fidl::encoding::encode_in_envelope_optional::<
3568                fidl::encoding::HandleType<
3569                    fidl::EventPair,
3570                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3571                    2147483648,
3572                >,
3573                fidl::encoding::DefaultFuchsiaResourceDialect,
3574            >(
3575                self.event.as_mut().map(
3576                    <fidl::encoding::HandleType<
3577                        fidl::EventPair,
3578                        { fidl::ObjectType::EVENTPAIR.into_raw() },
3579                        2147483648,
3580                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3581                ),
3582                encoder,
3583                offset + cur_offset,
3584                depth,
3585            )?;
3586
3587            _prev_end_offset = cur_offset + envelope_size;
3588
3589            Ok(())
3590        }
3591    }
3592
3593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3594        for DeviceDescribeResponse
3595    {
3596        #[inline(always)]
3597        fn new_empty() -> Self {
3598            Self::default()
3599        }
3600
3601        unsafe fn decode(
3602            &mut self,
3603            decoder: &mut fidl::encoding::Decoder<
3604                '_,
3605                fidl::encoding::DefaultFuchsiaResourceDialect,
3606            >,
3607            offset: usize,
3608            mut depth: fidl::encoding::Depth,
3609        ) -> fidl::Result<()> {
3610            decoder.debug_check_bounds::<Self>(offset);
3611            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3612                None => return Err(fidl::Error::NotNullable),
3613                Some(len) => len,
3614            };
3615            // Calling decoder.out_of_line_offset(0) is not allowed.
3616            if len == 0 {
3617                return Ok(());
3618            };
3619            depth.increment()?;
3620            let envelope_size = 8;
3621            let bytes_len = len * envelope_size;
3622            let offset = decoder.out_of_line_offset(bytes_len)?;
3623            // Decode the envelope for each type.
3624            let mut _next_ordinal_to_read = 0;
3625            let mut next_offset = offset;
3626            let end_offset = offset + bytes_len;
3627            _next_ordinal_to_read += 1;
3628            if next_offset >= end_offset {
3629                return Ok(());
3630            }
3631
3632            // Decode unknown envelopes for gaps in ordinals.
3633            while _next_ordinal_to_read < 1 {
3634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3635                _next_ordinal_to_read += 1;
3636                next_offset += envelope_size;
3637            }
3638
3639            let next_out_of_line = decoder.next_out_of_line();
3640            let handles_before = decoder.remaining_handles();
3641            if let Some((inlined, num_bytes, num_handles)) =
3642                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3643            {
3644                let member_inline_size = <fidl::encoding::HandleType<
3645                    fidl::EventPair,
3646                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3647                    2147483648,
3648                > as fidl::encoding::TypeMarker>::inline_size(
3649                    decoder.context
3650                );
3651                if inlined != (member_inline_size <= 4) {
3652                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3653                }
3654                let inner_offset;
3655                let mut inner_depth = depth.clone();
3656                if inlined {
3657                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3658                    inner_offset = next_offset;
3659                } else {
3660                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3661                    inner_depth.increment()?;
3662                }
3663                let val_ref =
3664                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3665                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3666                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3667                {
3668                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3669                }
3670                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3671                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3672                }
3673            }
3674
3675            next_offset += envelope_size;
3676
3677            // Decode the remaining unknown envelopes.
3678            while next_offset < end_offset {
3679                _next_ordinal_to_read += 1;
3680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3681                next_offset += envelope_size;
3682            }
3683
3684            Ok(())
3685        }
3686    }
3687}