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