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