Skip to main content

fidl_fuchsia_hardware_pty_common/
fidl_fuchsia_hardware_pty_common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// The terminal has no active client.
12pub const EVENT_HANGUP: u32 = 1;
13
14/// The terminal received a ^C control character.
15pub const EVENT_INTERRUPT: u32 = 2;
16
17/// All events
18pub const EVENT_MASK: u32 = 15;
19
20/// The terminal received a ^Z control character.
21pub const EVENT_SUSPEND: u32 = 4;
22
23/// The terminal window has resized.
24pub const EVENT_WINDOW_SIZE: u32 = 8;
25
26/// When Feature Raw is enabled, OOB Events like ^c, ^z, etc are not generated.
27/// Instead the character is read from the read() input path.
28pub const FEATURE_RAW: u32 = 1;
29
30#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31#[repr(C)]
32pub struct DeviceClrSetFeatureRequest {
33    pub clr: u32,
34    pub set: u32,
35}
36
37impl fidl::Persistable for DeviceClrSetFeatureRequest {}
38
39#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40#[repr(C)]
41pub struct DeviceClrSetFeatureResponse {
42    pub status: i32,
43    pub features: u32,
44}
45
46impl fidl::Persistable for DeviceClrSetFeatureResponse {}
47
48#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49#[repr(C)]
50pub struct DeviceGetWindowSizeResponse {
51    pub status: i32,
52    pub size: WindowSize,
53}
54
55impl fidl::Persistable for DeviceGetWindowSizeResponse {}
56
57#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58#[repr(C)]
59pub struct DeviceMakeActiveRequest {
60    pub client_pty_id: u32,
61}
62
63impl fidl::Persistable for DeviceMakeActiveRequest {}
64
65#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66#[repr(C)]
67pub struct DeviceMakeActiveResponse {
68    pub status: i32,
69}
70
71impl fidl::Persistable for DeviceMakeActiveResponse {}
72
73#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
74#[repr(C)]
75pub struct DeviceOpenClientResponse {
76    pub s: i32,
77}
78
79impl fidl::Persistable for DeviceOpenClientResponse {}
80
81#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82#[repr(C)]
83pub struct DeviceReadEventsResponse {
84    pub status: i32,
85    pub events: u32,
86}
87
88impl fidl::Persistable for DeviceReadEventsResponse {}
89
90#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91#[repr(C)]
92pub struct DeviceSetWindowSizeRequest {
93    pub size: WindowSize,
94}
95
96impl fidl::Persistable for DeviceSetWindowSizeRequest {}
97
98#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99#[repr(C)]
100pub struct DeviceSetWindowSizeResponse {
101    pub status: i32,
102}
103
104impl fidl::Persistable for DeviceSetWindowSizeResponse {}
105
106#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107#[repr(C)]
108pub struct WindowSize {
109    pub width: u32,
110    pub height: u32,
111}
112
113impl fidl::Persistable for WindowSize {}
114
115pub mod device_ordinals {
116    pub const CLONE: u64 = 0x20d8a7aba2168a79;
117    pub const CLOSE: u64 = 0x5ac5d459ad7f657e;
118    pub const QUERY: u64 = 0x2658edee9decfc06;
119    pub const READ: u64 = 0x57e419a298c8ede;
120    pub const WRITE: u64 = 0x6a31437832469f82;
121    pub const DESCRIBE: u64 = 0x585d4b390fe996f5;
122    pub const OPEN_CLIENT: u64 = 0x78f040fe6a1ebb3;
123    pub const CLR_SET_FEATURE: u64 = 0x6367986e6053a15e;
124    pub const GET_WINDOW_SIZE: u64 = 0x747bed0460f5f9f7;
125    pub const MAKE_ACTIVE: u64 = 0x2763944f30ee2a62;
126    pub const READ_EVENTS: u64 = 0xede96f3e3258f62;
127    pub const SET_WINDOW_SIZE: u64 = 0x17d1cb37377e7928;
128}
129
130mod internal {
131    use super::*;
132
133    impl fidl::encoding::ValueTypeMarker for DeviceClrSetFeatureRequest {
134        type Borrowed<'a> = &'a Self;
135        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
136            value
137        }
138    }
139
140    unsafe impl fidl::encoding::TypeMarker for DeviceClrSetFeatureRequest {
141        type Owned = Self;
142
143        #[inline(always)]
144        fn inline_align(_context: fidl::encoding::Context) -> usize {
145            4
146        }
147
148        #[inline(always)]
149        fn inline_size(_context: fidl::encoding::Context) -> usize {
150            8
151        }
152        #[inline(always)]
153        fn encode_is_copy() -> bool {
154            true
155        }
156
157        #[inline(always)]
158        fn decode_is_copy() -> bool {
159            true
160        }
161    }
162
163    unsafe impl<D: fidl::encoding::ResourceDialect>
164        fidl::encoding::Encode<DeviceClrSetFeatureRequest, D> for &DeviceClrSetFeatureRequest
165    {
166        #[inline]
167        unsafe fn encode(
168            self,
169            encoder: &mut fidl::encoding::Encoder<'_, D>,
170            offset: usize,
171            _depth: fidl::encoding::Depth,
172        ) -> fidl::Result<()> {
173            encoder.debug_check_bounds::<DeviceClrSetFeatureRequest>(offset);
174            unsafe {
175                // Copy the object into the buffer.
176                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
177                (buf_ptr as *mut DeviceClrSetFeatureRequest)
178                    .write_unaligned((self as *const DeviceClrSetFeatureRequest).read());
179                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
180                // done second because the memcpy will write garbage to these bytes.
181            }
182            Ok(())
183        }
184    }
185    unsafe impl<
186        D: fidl::encoding::ResourceDialect,
187        T0: fidl::encoding::Encode<u32, D>,
188        T1: fidl::encoding::Encode<u32, D>,
189    > fidl::encoding::Encode<DeviceClrSetFeatureRequest, D> for (T0, T1)
190    {
191        #[inline]
192        unsafe fn encode(
193            self,
194            encoder: &mut fidl::encoding::Encoder<'_, D>,
195            offset: usize,
196            depth: fidl::encoding::Depth,
197        ) -> fidl::Result<()> {
198            encoder.debug_check_bounds::<DeviceClrSetFeatureRequest>(offset);
199            // Zero out padding regions. There's no need to apply masks
200            // because the unmasked parts will be overwritten by fields.
201            // Write the fields.
202            self.0.encode(encoder, offset + 0, depth)?;
203            self.1.encode(encoder, offset + 4, depth)?;
204            Ok(())
205        }
206    }
207
208    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
209        for DeviceClrSetFeatureRequest
210    {
211        #[inline(always)]
212        fn new_empty() -> Self {
213            Self { clr: fidl::new_empty!(u32, D), set: fidl::new_empty!(u32, D) }
214        }
215
216        #[inline]
217        unsafe fn decode(
218            &mut self,
219            decoder: &mut fidl::encoding::Decoder<'_, D>,
220            offset: usize,
221            _depth: fidl::encoding::Depth,
222        ) -> fidl::Result<()> {
223            decoder.debug_check_bounds::<Self>(offset);
224            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
225            // Verify that padding bytes are zero.
226            // Copy from the buffer into the object.
227            unsafe {
228                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
229            }
230            Ok(())
231        }
232    }
233
234    impl fidl::encoding::ValueTypeMarker for DeviceClrSetFeatureResponse {
235        type Borrowed<'a> = &'a Self;
236        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
237            value
238        }
239    }
240
241    unsafe impl fidl::encoding::TypeMarker for DeviceClrSetFeatureResponse {
242        type Owned = Self;
243
244        #[inline(always)]
245        fn inline_align(_context: fidl::encoding::Context) -> usize {
246            4
247        }
248
249        #[inline(always)]
250        fn inline_size(_context: fidl::encoding::Context) -> usize {
251            8
252        }
253        #[inline(always)]
254        fn encode_is_copy() -> bool {
255            true
256        }
257
258        #[inline(always)]
259        fn decode_is_copy() -> bool {
260            true
261        }
262    }
263
264    unsafe impl<D: fidl::encoding::ResourceDialect>
265        fidl::encoding::Encode<DeviceClrSetFeatureResponse, D> for &DeviceClrSetFeatureResponse
266    {
267        #[inline]
268        unsafe fn encode(
269            self,
270            encoder: &mut fidl::encoding::Encoder<'_, D>,
271            offset: usize,
272            _depth: fidl::encoding::Depth,
273        ) -> fidl::Result<()> {
274            encoder.debug_check_bounds::<DeviceClrSetFeatureResponse>(offset);
275            unsafe {
276                // Copy the object into the buffer.
277                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
278                (buf_ptr as *mut DeviceClrSetFeatureResponse)
279                    .write_unaligned((self as *const DeviceClrSetFeatureResponse).read());
280                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
281                // done second because the memcpy will write garbage to these bytes.
282            }
283            Ok(())
284        }
285    }
286    unsafe impl<
287        D: fidl::encoding::ResourceDialect,
288        T0: fidl::encoding::Encode<i32, D>,
289        T1: fidl::encoding::Encode<u32, D>,
290    > fidl::encoding::Encode<DeviceClrSetFeatureResponse, D> for (T0, T1)
291    {
292        #[inline]
293        unsafe fn encode(
294            self,
295            encoder: &mut fidl::encoding::Encoder<'_, D>,
296            offset: usize,
297            depth: fidl::encoding::Depth,
298        ) -> fidl::Result<()> {
299            encoder.debug_check_bounds::<DeviceClrSetFeatureResponse>(offset);
300            // Zero out padding regions. There's no need to apply masks
301            // because the unmasked parts will be overwritten by fields.
302            // Write the fields.
303            self.0.encode(encoder, offset + 0, depth)?;
304            self.1.encode(encoder, offset + 4, depth)?;
305            Ok(())
306        }
307    }
308
309    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
310        for DeviceClrSetFeatureResponse
311    {
312        #[inline(always)]
313        fn new_empty() -> Self {
314            Self { status: fidl::new_empty!(i32, D), features: fidl::new_empty!(u32, D) }
315        }
316
317        #[inline]
318        unsafe fn decode(
319            &mut self,
320            decoder: &mut fidl::encoding::Decoder<'_, D>,
321            offset: usize,
322            _depth: fidl::encoding::Depth,
323        ) -> fidl::Result<()> {
324            decoder.debug_check_bounds::<Self>(offset);
325            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
326            // Verify that padding bytes are zero.
327            // Copy from the buffer into the object.
328            unsafe {
329                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
330            }
331            Ok(())
332        }
333    }
334
335    impl fidl::encoding::ValueTypeMarker for DeviceGetWindowSizeResponse {
336        type Borrowed<'a> = &'a Self;
337        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
338            value
339        }
340    }
341
342    unsafe impl fidl::encoding::TypeMarker for DeviceGetWindowSizeResponse {
343        type Owned = Self;
344
345        #[inline(always)]
346        fn inline_align(_context: fidl::encoding::Context) -> usize {
347            4
348        }
349
350        #[inline(always)]
351        fn inline_size(_context: fidl::encoding::Context) -> usize {
352            12
353        }
354        #[inline(always)]
355        fn encode_is_copy() -> bool {
356            true
357        }
358
359        #[inline(always)]
360        fn decode_is_copy() -> bool {
361            true
362        }
363    }
364
365    unsafe impl<D: fidl::encoding::ResourceDialect>
366        fidl::encoding::Encode<DeviceGetWindowSizeResponse, D> for &DeviceGetWindowSizeResponse
367    {
368        #[inline]
369        unsafe fn encode(
370            self,
371            encoder: &mut fidl::encoding::Encoder<'_, D>,
372            offset: usize,
373            _depth: fidl::encoding::Depth,
374        ) -> fidl::Result<()> {
375            encoder.debug_check_bounds::<DeviceGetWindowSizeResponse>(offset);
376            unsafe {
377                // Copy the object into the buffer.
378                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
379                (buf_ptr as *mut DeviceGetWindowSizeResponse)
380                    .write_unaligned((self as *const DeviceGetWindowSizeResponse).read());
381                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
382                // done second because the memcpy will write garbage to these bytes.
383            }
384            Ok(())
385        }
386    }
387    unsafe impl<
388        D: fidl::encoding::ResourceDialect,
389        T0: fidl::encoding::Encode<i32, D>,
390        T1: fidl::encoding::Encode<WindowSize, D>,
391    > fidl::encoding::Encode<DeviceGetWindowSizeResponse, D> for (T0, T1)
392    {
393        #[inline]
394        unsafe fn encode(
395            self,
396            encoder: &mut fidl::encoding::Encoder<'_, D>,
397            offset: usize,
398            depth: fidl::encoding::Depth,
399        ) -> fidl::Result<()> {
400            encoder.debug_check_bounds::<DeviceGetWindowSizeResponse>(offset);
401            // Zero out padding regions. There's no need to apply masks
402            // because the unmasked parts will be overwritten by fields.
403            // Write the fields.
404            self.0.encode(encoder, offset + 0, depth)?;
405            self.1.encode(encoder, offset + 4, depth)?;
406            Ok(())
407        }
408    }
409
410    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
411        for DeviceGetWindowSizeResponse
412    {
413        #[inline(always)]
414        fn new_empty() -> Self {
415            Self { status: fidl::new_empty!(i32, D), size: fidl::new_empty!(WindowSize, D) }
416        }
417
418        #[inline]
419        unsafe fn decode(
420            &mut self,
421            decoder: &mut fidl::encoding::Decoder<'_, D>,
422            offset: usize,
423            _depth: fidl::encoding::Depth,
424        ) -> fidl::Result<()> {
425            decoder.debug_check_bounds::<Self>(offset);
426            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
427            // Verify that padding bytes are zero.
428            // Copy from the buffer into the object.
429            unsafe {
430                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
431            }
432            Ok(())
433        }
434    }
435
436    impl fidl::encoding::ValueTypeMarker for DeviceMakeActiveRequest {
437        type Borrowed<'a> = &'a Self;
438        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
439            value
440        }
441    }
442
443    unsafe impl fidl::encoding::TypeMarker for DeviceMakeActiveRequest {
444        type Owned = Self;
445
446        #[inline(always)]
447        fn inline_align(_context: fidl::encoding::Context) -> usize {
448            4
449        }
450
451        #[inline(always)]
452        fn inline_size(_context: fidl::encoding::Context) -> usize {
453            4
454        }
455        #[inline(always)]
456        fn encode_is_copy() -> bool {
457            true
458        }
459
460        #[inline(always)]
461        fn decode_is_copy() -> bool {
462            true
463        }
464    }
465
466    unsafe impl<D: fidl::encoding::ResourceDialect>
467        fidl::encoding::Encode<DeviceMakeActiveRequest, D> for &DeviceMakeActiveRequest
468    {
469        #[inline]
470        unsafe fn encode(
471            self,
472            encoder: &mut fidl::encoding::Encoder<'_, D>,
473            offset: usize,
474            _depth: fidl::encoding::Depth,
475        ) -> fidl::Result<()> {
476            encoder.debug_check_bounds::<DeviceMakeActiveRequest>(offset);
477            unsafe {
478                // Copy the object into the buffer.
479                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
480                (buf_ptr as *mut DeviceMakeActiveRequest)
481                    .write_unaligned((self as *const DeviceMakeActiveRequest).read());
482                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
483                // done second because the memcpy will write garbage to these bytes.
484            }
485            Ok(())
486        }
487    }
488    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
489        fidl::encoding::Encode<DeviceMakeActiveRequest, D> for (T0,)
490    {
491        #[inline]
492        unsafe fn encode(
493            self,
494            encoder: &mut fidl::encoding::Encoder<'_, D>,
495            offset: usize,
496            depth: fidl::encoding::Depth,
497        ) -> fidl::Result<()> {
498            encoder.debug_check_bounds::<DeviceMakeActiveRequest>(offset);
499            // Zero out padding regions. There's no need to apply masks
500            // because the unmasked parts will be overwritten by fields.
501            // Write the fields.
502            self.0.encode(encoder, offset + 0, depth)?;
503            Ok(())
504        }
505    }
506
507    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
508        for DeviceMakeActiveRequest
509    {
510        #[inline(always)]
511        fn new_empty() -> Self {
512            Self { client_pty_id: fidl::new_empty!(u32, D) }
513        }
514
515        #[inline]
516        unsafe fn decode(
517            &mut self,
518            decoder: &mut fidl::encoding::Decoder<'_, D>,
519            offset: usize,
520            _depth: fidl::encoding::Depth,
521        ) -> fidl::Result<()> {
522            decoder.debug_check_bounds::<Self>(offset);
523            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
524            // Verify that padding bytes are zero.
525            // Copy from the buffer into the object.
526            unsafe {
527                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
528            }
529            Ok(())
530        }
531    }
532
533    impl fidl::encoding::ValueTypeMarker for DeviceMakeActiveResponse {
534        type Borrowed<'a> = &'a Self;
535        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
536            value
537        }
538    }
539
540    unsafe impl fidl::encoding::TypeMarker for DeviceMakeActiveResponse {
541        type Owned = Self;
542
543        #[inline(always)]
544        fn inline_align(_context: fidl::encoding::Context) -> usize {
545            4
546        }
547
548        #[inline(always)]
549        fn inline_size(_context: fidl::encoding::Context) -> usize {
550            4
551        }
552        #[inline(always)]
553        fn encode_is_copy() -> bool {
554            true
555        }
556
557        #[inline(always)]
558        fn decode_is_copy() -> bool {
559            true
560        }
561    }
562
563    unsafe impl<D: fidl::encoding::ResourceDialect>
564        fidl::encoding::Encode<DeviceMakeActiveResponse, D> for &DeviceMakeActiveResponse
565    {
566        #[inline]
567        unsafe fn encode(
568            self,
569            encoder: &mut fidl::encoding::Encoder<'_, D>,
570            offset: usize,
571            _depth: fidl::encoding::Depth,
572        ) -> fidl::Result<()> {
573            encoder.debug_check_bounds::<DeviceMakeActiveResponse>(offset);
574            unsafe {
575                // Copy the object into the buffer.
576                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
577                (buf_ptr as *mut DeviceMakeActiveResponse)
578                    .write_unaligned((self as *const DeviceMakeActiveResponse).read());
579                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
580                // done second because the memcpy will write garbage to these bytes.
581            }
582            Ok(())
583        }
584    }
585    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
586        fidl::encoding::Encode<DeviceMakeActiveResponse, D> for (T0,)
587    {
588        #[inline]
589        unsafe fn encode(
590            self,
591            encoder: &mut fidl::encoding::Encoder<'_, D>,
592            offset: usize,
593            depth: fidl::encoding::Depth,
594        ) -> fidl::Result<()> {
595            encoder.debug_check_bounds::<DeviceMakeActiveResponse>(offset);
596            // Zero out padding regions. There's no need to apply masks
597            // because the unmasked parts will be overwritten by fields.
598            // Write the fields.
599            self.0.encode(encoder, offset + 0, depth)?;
600            Ok(())
601        }
602    }
603
604    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
605        for DeviceMakeActiveResponse
606    {
607        #[inline(always)]
608        fn new_empty() -> Self {
609            Self { status: fidl::new_empty!(i32, D) }
610        }
611
612        #[inline]
613        unsafe fn decode(
614            &mut self,
615            decoder: &mut fidl::encoding::Decoder<'_, D>,
616            offset: usize,
617            _depth: fidl::encoding::Depth,
618        ) -> fidl::Result<()> {
619            decoder.debug_check_bounds::<Self>(offset);
620            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
621            // Verify that padding bytes are zero.
622            // Copy from the buffer into the object.
623            unsafe {
624                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
625            }
626            Ok(())
627        }
628    }
629
630    impl fidl::encoding::ValueTypeMarker for DeviceOpenClientResponse {
631        type Borrowed<'a> = &'a Self;
632        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
633            value
634        }
635    }
636
637    unsafe impl fidl::encoding::TypeMarker for DeviceOpenClientResponse {
638        type Owned = Self;
639
640        #[inline(always)]
641        fn inline_align(_context: fidl::encoding::Context) -> usize {
642            4
643        }
644
645        #[inline(always)]
646        fn inline_size(_context: fidl::encoding::Context) -> usize {
647            4
648        }
649        #[inline(always)]
650        fn encode_is_copy() -> bool {
651            true
652        }
653
654        #[inline(always)]
655        fn decode_is_copy() -> bool {
656            true
657        }
658    }
659
660    unsafe impl<D: fidl::encoding::ResourceDialect>
661        fidl::encoding::Encode<DeviceOpenClientResponse, D> for &DeviceOpenClientResponse
662    {
663        #[inline]
664        unsafe fn encode(
665            self,
666            encoder: &mut fidl::encoding::Encoder<'_, D>,
667            offset: usize,
668            _depth: fidl::encoding::Depth,
669        ) -> fidl::Result<()> {
670            encoder.debug_check_bounds::<DeviceOpenClientResponse>(offset);
671            unsafe {
672                // Copy the object into the buffer.
673                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
674                (buf_ptr as *mut DeviceOpenClientResponse)
675                    .write_unaligned((self as *const DeviceOpenClientResponse).read());
676                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
677                // done second because the memcpy will write garbage to these bytes.
678            }
679            Ok(())
680        }
681    }
682    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
683        fidl::encoding::Encode<DeviceOpenClientResponse, D> for (T0,)
684    {
685        #[inline]
686        unsafe fn encode(
687            self,
688            encoder: &mut fidl::encoding::Encoder<'_, D>,
689            offset: usize,
690            depth: fidl::encoding::Depth,
691        ) -> fidl::Result<()> {
692            encoder.debug_check_bounds::<DeviceOpenClientResponse>(offset);
693            // Zero out padding regions. There's no need to apply masks
694            // because the unmasked parts will be overwritten by fields.
695            // Write the fields.
696            self.0.encode(encoder, offset + 0, depth)?;
697            Ok(())
698        }
699    }
700
701    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
702        for DeviceOpenClientResponse
703    {
704        #[inline(always)]
705        fn new_empty() -> Self {
706            Self { s: fidl::new_empty!(i32, D) }
707        }
708
709        #[inline]
710        unsafe fn decode(
711            &mut self,
712            decoder: &mut fidl::encoding::Decoder<'_, D>,
713            offset: usize,
714            _depth: fidl::encoding::Depth,
715        ) -> fidl::Result<()> {
716            decoder.debug_check_bounds::<Self>(offset);
717            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
718            // Verify that padding bytes are zero.
719            // Copy from the buffer into the object.
720            unsafe {
721                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
722            }
723            Ok(())
724        }
725    }
726
727    impl fidl::encoding::ValueTypeMarker for DeviceReadEventsResponse {
728        type Borrowed<'a> = &'a Self;
729        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
730            value
731        }
732    }
733
734    unsafe impl fidl::encoding::TypeMarker for DeviceReadEventsResponse {
735        type Owned = Self;
736
737        #[inline(always)]
738        fn inline_align(_context: fidl::encoding::Context) -> usize {
739            4
740        }
741
742        #[inline(always)]
743        fn inline_size(_context: fidl::encoding::Context) -> usize {
744            8
745        }
746        #[inline(always)]
747        fn encode_is_copy() -> bool {
748            true
749        }
750
751        #[inline(always)]
752        fn decode_is_copy() -> bool {
753            true
754        }
755    }
756
757    unsafe impl<D: fidl::encoding::ResourceDialect>
758        fidl::encoding::Encode<DeviceReadEventsResponse, D> for &DeviceReadEventsResponse
759    {
760        #[inline]
761        unsafe fn encode(
762            self,
763            encoder: &mut fidl::encoding::Encoder<'_, D>,
764            offset: usize,
765            _depth: fidl::encoding::Depth,
766        ) -> fidl::Result<()> {
767            encoder.debug_check_bounds::<DeviceReadEventsResponse>(offset);
768            unsafe {
769                // Copy the object into the buffer.
770                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
771                (buf_ptr as *mut DeviceReadEventsResponse)
772                    .write_unaligned((self as *const DeviceReadEventsResponse).read());
773                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
774                // done second because the memcpy will write garbage to these bytes.
775            }
776            Ok(())
777        }
778    }
779    unsafe impl<
780        D: fidl::encoding::ResourceDialect,
781        T0: fidl::encoding::Encode<i32, D>,
782        T1: fidl::encoding::Encode<u32, D>,
783    > fidl::encoding::Encode<DeviceReadEventsResponse, D> for (T0, T1)
784    {
785        #[inline]
786        unsafe fn encode(
787            self,
788            encoder: &mut fidl::encoding::Encoder<'_, D>,
789            offset: usize,
790            depth: fidl::encoding::Depth,
791        ) -> fidl::Result<()> {
792            encoder.debug_check_bounds::<DeviceReadEventsResponse>(offset);
793            // Zero out padding regions. There's no need to apply masks
794            // because the unmasked parts will be overwritten by fields.
795            // Write the fields.
796            self.0.encode(encoder, offset + 0, depth)?;
797            self.1.encode(encoder, offset + 4, depth)?;
798            Ok(())
799        }
800    }
801
802    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
803        for DeviceReadEventsResponse
804    {
805        #[inline(always)]
806        fn new_empty() -> Self {
807            Self { status: fidl::new_empty!(i32, D), events: fidl::new_empty!(u32, D) }
808        }
809
810        #[inline]
811        unsafe fn decode(
812            &mut self,
813            decoder: &mut fidl::encoding::Decoder<'_, D>,
814            offset: usize,
815            _depth: fidl::encoding::Depth,
816        ) -> fidl::Result<()> {
817            decoder.debug_check_bounds::<Self>(offset);
818            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
819            // Verify that padding bytes are zero.
820            // Copy from the buffer into the object.
821            unsafe {
822                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
823            }
824            Ok(())
825        }
826    }
827
828    impl fidl::encoding::ValueTypeMarker for DeviceSetWindowSizeRequest {
829        type Borrowed<'a> = &'a Self;
830        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
831            value
832        }
833    }
834
835    unsafe impl fidl::encoding::TypeMarker for DeviceSetWindowSizeRequest {
836        type Owned = Self;
837
838        #[inline(always)]
839        fn inline_align(_context: fidl::encoding::Context) -> usize {
840            4
841        }
842
843        #[inline(always)]
844        fn inline_size(_context: fidl::encoding::Context) -> usize {
845            8
846        }
847        #[inline(always)]
848        fn encode_is_copy() -> bool {
849            true
850        }
851
852        #[inline(always)]
853        fn decode_is_copy() -> bool {
854            true
855        }
856    }
857
858    unsafe impl<D: fidl::encoding::ResourceDialect>
859        fidl::encoding::Encode<DeviceSetWindowSizeRequest, D> for &DeviceSetWindowSizeRequest
860    {
861        #[inline]
862        unsafe fn encode(
863            self,
864            encoder: &mut fidl::encoding::Encoder<'_, D>,
865            offset: usize,
866            _depth: fidl::encoding::Depth,
867        ) -> fidl::Result<()> {
868            encoder.debug_check_bounds::<DeviceSetWindowSizeRequest>(offset);
869            unsafe {
870                // Copy the object into the buffer.
871                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
872                (buf_ptr as *mut DeviceSetWindowSizeRequest)
873                    .write_unaligned((self as *const DeviceSetWindowSizeRequest).read());
874                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
875                // done second because the memcpy will write garbage to these bytes.
876            }
877            Ok(())
878        }
879    }
880    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<WindowSize, D>>
881        fidl::encoding::Encode<DeviceSetWindowSizeRequest, D> for (T0,)
882    {
883        #[inline]
884        unsafe fn encode(
885            self,
886            encoder: &mut fidl::encoding::Encoder<'_, D>,
887            offset: usize,
888            depth: fidl::encoding::Depth,
889        ) -> fidl::Result<()> {
890            encoder.debug_check_bounds::<DeviceSetWindowSizeRequest>(offset);
891            // Zero out padding regions. There's no need to apply masks
892            // because the unmasked parts will be overwritten by fields.
893            // Write the fields.
894            self.0.encode(encoder, offset + 0, depth)?;
895            Ok(())
896        }
897    }
898
899    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
900        for DeviceSetWindowSizeRequest
901    {
902        #[inline(always)]
903        fn new_empty() -> Self {
904            Self { size: fidl::new_empty!(WindowSize, D) }
905        }
906
907        #[inline]
908        unsafe fn decode(
909            &mut self,
910            decoder: &mut fidl::encoding::Decoder<'_, D>,
911            offset: usize,
912            _depth: fidl::encoding::Depth,
913        ) -> fidl::Result<()> {
914            decoder.debug_check_bounds::<Self>(offset);
915            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
916            // Verify that padding bytes are zero.
917            // Copy from the buffer into the object.
918            unsafe {
919                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
920            }
921            Ok(())
922        }
923    }
924
925    impl fidl::encoding::ValueTypeMarker for DeviceSetWindowSizeResponse {
926        type Borrowed<'a> = &'a Self;
927        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
928            value
929        }
930    }
931
932    unsafe impl fidl::encoding::TypeMarker for DeviceSetWindowSizeResponse {
933        type Owned = Self;
934
935        #[inline(always)]
936        fn inline_align(_context: fidl::encoding::Context) -> usize {
937            4
938        }
939
940        #[inline(always)]
941        fn inline_size(_context: fidl::encoding::Context) -> usize {
942            4
943        }
944        #[inline(always)]
945        fn encode_is_copy() -> bool {
946            true
947        }
948
949        #[inline(always)]
950        fn decode_is_copy() -> bool {
951            true
952        }
953    }
954
955    unsafe impl<D: fidl::encoding::ResourceDialect>
956        fidl::encoding::Encode<DeviceSetWindowSizeResponse, D> for &DeviceSetWindowSizeResponse
957    {
958        #[inline]
959        unsafe fn encode(
960            self,
961            encoder: &mut fidl::encoding::Encoder<'_, D>,
962            offset: usize,
963            _depth: fidl::encoding::Depth,
964        ) -> fidl::Result<()> {
965            encoder.debug_check_bounds::<DeviceSetWindowSizeResponse>(offset);
966            unsafe {
967                // Copy the object into the buffer.
968                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
969                (buf_ptr as *mut DeviceSetWindowSizeResponse)
970                    .write_unaligned((self as *const DeviceSetWindowSizeResponse).read());
971                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
972                // done second because the memcpy will write garbage to these bytes.
973            }
974            Ok(())
975        }
976    }
977    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
978        fidl::encoding::Encode<DeviceSetWindowSizeResponse, D> for (T0,)
979    {
980        #[inline]
981        unsafe fn encode(
982            self,
983            encoder: &mut fidl::encoding::Encoder<'_, D>,
984            offset: usize,
985            depth: fidl::encoding::Depth,
986        ) -> fidl::Result<()> {
987            encoder.debug_check_bounds::<DeviceSetWindowSizeResponse>(offset);
988            // Zero out padding regions. There's no need to apply masks
989            // because the unmasked parts will be overwritten by fields.
990            // Write the fields.
991            self.0.encode(encoder, offset + 0, depth)?;
992            Ok(())
993        }
994    }
995
996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
997        for DeviceSetWindowSizeResponse
998    {
999        #[inline(always)]
1000        fn new_empty() -> Self {
1001            Self { status: fidl::new_empty!(i32, D) }
1002        }
1003
1004        #[inline]
1005        unsafe fn decode(
1006            &mut self,
1007            decoder: &mut fidl::encoding::Decoder<'_, D>,
1008            offset: usize,
1009            _depth: fidl::encoding::Depth,
1010        ) -> fidl::Result<()> {
1011            decoder.debug_check_bounds::<Self>(offset);
1012            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1013            // Verify that padding bytes are zero.
1014            // Copy from the buffer into the object.
1015            unsafe {
1016                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1017            }
1018            Ok(())
1019        }
1020    }
1021
1022    impl fidl::encoding::ValueTypeMarker for WindowSize {
1023        type Borrowed<'a> = &'a Self;
1024        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1025            value
1026        }
1027    }
1028
1029    unsafe impl fidl::encoding::TypeMarker for WindowSize {
1030        type Owned = Self;
1031
1032        #[inline(always)]
1033        fn inline_align(_context: fidl::encoding::Context) -> usize {
1034            4
1035        }
1036
1037        #[inline(always)]
1038        fn inline_size(_context: fidl::encoding::Context) -> usize {
1039            8
1040        }
1041        #[inline(always)]
1042        fn encode_is_copy() -> bool {
1043            true
1044        }
1045
1046        #[inline(always)]
1047        fn decode_is_copy() -> bool {
1048            true
1049        }
1050    }
1051
1052    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WindowSize, D>
1053        for &WindowSize
1054    {
1055        #[inline]
1056        unsafe fn encode(
1057            self,
1058            encoder: &mut fidl::encoding::Encoder<'_, D>,
1059            offset: usize,
1060            _depth: fidl::encoding::Depth,
1061        ) -> fidl::Result<()> {
1062            encoder.debug_check_bounds::<WindowSize>(offset);
1063            unsafe {
1064                // Copy the object into the buffer.
1065                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1066                (buf_ptr as *mut WindowSize).write_unaligned((self as *const WindowSize).read());
1067                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1068                // done second because the memcpy will write garbage to these bytes.
1069            }
1070            Ok(())
1071        }
1072    }
1073    unsafe impl<
1074        D: fidl::encoding::ResourceDialect,
1075        T0: fidl::encoding::Encode<u32, D>,
1076        T1: fidl::encoding::Encode<u32, D>,
1077    > fidl::encoding::Encode<WindowSize, D> for (T0, T1)
1078    {
1079        #[inline]
1080        unsafe fn encode(
1081            self,
1082            encoder: &mut fidl::encoding::Encoder<'_, D>,
1083            offset: usize,
1084            depth: fidl::encoding::Depth,
1085        ) -> fidl::Result<()> {
1086            encoder.debug_check_bounds::<WindowSize>(offset);
1087            // Zero out padding regions. There's no need to apply masks
1088            // because the unmasked parts will be overwritten by fields.
1089            // Write the fields.
1090            self.0.encode(encoder, offset + 0, depth)?;
1091            self.1.encode(encoder, offset + 4, depth)?;
1092            Ok(())
1093        }
1094    }
1095
1096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WindowSize {
1097        #[inline(always)]
1098        fn new_empty() -> Self {
1099            Self { width: fidl::new_empty!(u32, D), height: fidl::new_empty!(u32, D) }
1100        }
1101
1102        #[inline]
1103        unsafe fn decode(
1104            &mut self,
1105            decoder: &mut fidl::encoding::Decoder<'_, D>,
1106            offset: usize,
1107            _depth: fidl::encoding::Depth,
1108        ) -> fidl::Result<()> {
1109            decoder.debug_check_bounds::<Self>(offset);
1110            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1111            // Verify that padding bytes are zero.
1112            // Copy from the buffer into the object.
1113            unsafe {
1114                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1115            }
1116            Ok(())
1117        }
1118    }
1119}