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