Skip to main content

fidl_fuchsia_hardware_clock_common/
fidl_fuchsia_hardware_clock_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Maximum length of the clock name.
12pub const MAX_CLOCK_NAME_LEN: u32 = 256;
13
14#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15#[repr(C)]
16pub struct ClockQuerySupportedRateRequest {
17    pub hz_in: u64,
18}
19
20impl fidl::Persistable for ClockQuerySupportedRateRequest {}
21
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct ClockSetInputRequest {
25    pub idx: u32,
26}
27
28impl fidl::Persistable for ClockSetInputRequest {}
29
30#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31#[repr(C)]
32pub struct ClockSetRateRequest {
33    pub hz: u64,
34}
35
36impl fidl::Persistable for ClockSetRateRequest {}
37
38#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39#[repr(C)]
40pub struct ClockGetInputResponse {
41    pub index: u32,
42}
43
44impl fidl::Persistable for ClockGetInputResponse {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47#[repr(C)]
48pub struct ClockGetNumInputsResponse {
49    pub n: u32,
50}
51
52impl fidl::Persistable for ClockGetNumInputsResponse {}
53
54#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct ClockGetPropertiesResponse {
56    /// The platform-specific number of this clock, set as a bind property on the driver node.
57    pub id: u32,
58    /// The human-readable name of this clock. Either provided by the implementation, or the
59    /// device tree.
60    pub name: String,
61}
62
63impl fidl::Persistable for ClockGetPropertiesResponse {}
64
65#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66#[repr(C)]
67pub struct ClockGetRateResponse {
68    pub hz: u64,
69}
70
71impl fidl::Persistable for ClockGetRateResponse {}
72
73#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
74pub struct ClockIsEnabledResponse {
75    pub enabled: bool,
76}
77
78impl fidl::Persistable for ClockIsEnabledResponse {}
79
80#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81#[repr(C)]
82pub struct ClockQuerySupportedRateResponse {
83    pub hz_out: u64,
84}
85
86impl fidl::Persistable for ClockQuerySupportedRateResponse {}
87
88pub mod clock_ordinals {
89    pub const ENABLE: u64 = 0x5e2816e21e9da22e;
90    pub const DISABLE: u64 = 0x798ab22d09abb19;
91    pub const IS_ENABLED: u64 = 0xcf2dc6aafb08d87;
92    pub const SET_RATE: u64 = 0xe55e2c37b5f6e04;
93    pub const QUERY_SUPPORTED_RATE: u64 = 0x3c42f4eb055765d1;
94    pub const GET_RATE: u64 = 0xf8f2c8acaa82e7d;
95    pub const SET_INPUT: u64 = 0x486aad01b832c460;
96    pub const GET_NUM_INPUTS: u64 = 0x7666d4a62c66de43;
97    pub const GET_INPUT: u64 = 0x23de9a9d0640a111;
98    pub const GET_PROPERTIES: u64 = 0x26490b5719bab4da;
99}
100
101mod internal {
102    use super::*;
103
104    impl fidl::encoding::ValueTypeMarker for ClockQuerySupportedRateRequest {
105        type Borrowed<'a> = &'a Self;
106        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
107            value
108        }
109    }
110
111    unsafe impl fidl::encoding::TypeMarker for ClockQuerySupportedRateRequest {
112        type Owned = Self;
113
114        #[inline(always)]
115        fn inline_align(_context: fidl::encoding::Context) -> usize {
116            8
117        }
118
119        #[inline(always)]
120        fn inline_size(_context: fidl::encoding::Context) -> usize {
121            8
122        }
123        #[inline(always)]
124        fn encode_is_copy() -> bool {
125            true
126        }
127
128        #[inline(always)]
129        fn decode_is_copy() -> bool {
130            true
131        }
132    }
133
134    unsafe impl<D: fidl::encoding::ResourceDialect>
135        fidl::encoding::Encode<ClockQuerySupportedRateRequest, D>
136        for &ClockQuerySupportedRateRequest
137    {
138        #[inline]
139        unsafe fn encode(
140            self,
141            encoder: &mut fidl::encoding::Encoder<'_, D>,
142            offset: usize,
143            _depth: fidl::encoding::Depth,
144        ) -> fidl::Result<()> {
145            encoder.debug_check_bounds::<ClockQuerySupportedRateRequest>(offset);
146            unsafe {
147                // Copy the object into the buffer.
148                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
149                (buf_ptr as *mut ClockQuerySupportedRateRequest)
150                    .write_unaligned((self as *const ClockQuerySupportedRateRequest).read());
151                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
152                // done second because the memcpy will write garbage to these bytes.
153            }
154            Ok(())
155        }
156    }
157    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
158        fidl::encoding::Encode<ClockQuerySupportedRateRequest, D> for (T0,)
159    {
160        #[inline]
161        unsafe fn encode(
162            self,
163            encoder: &mut fidl::encoding::Encoder<'_, D>,
164            offset: usize,
165            depth: fidl::encoding::Depth,
166        ) -> fidl::Result<()> {
167            encoder.debug_check_bounds::<ClockQuerySupportedRateRequest>(offset);
168            // Zero out padding regions. There's no need to apply masks
169            // because the unmasked parts will be overwritten by fields.
170            // Write the fields.
171            self.0.encode(encoder, offset + 0, depth)?;
172            Ok(())
173        }
174    }
175
176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
177        for ClockQuerySupportedRateRequest
178    {
179        #[inline(always)]
180        fn new_empty() -> Self {
181            Self { hz_in: fidl::new_empty!(u64, D) }
182        }
183
184        #[inline]
185        unsafe fn decode(
186            &mut self,
187            decoder: &mut fidl::encoding::Decoder<'_, D>,
188            offset: usize,
189            _depth: fidl::encoding::Depth,
190        ) -> fidl::Result<()> {
191            decoder.debug_check_bounds::<Self>(offset);
192            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
193            // Verify that padding bytes are zero.
194            // Copy from the buffer into the object.
195            unsafe {
196                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
197            }
198            Ok(())
199        }
200    }
201
202    impl fidl::encoding::ValueTypeMarker for ClockSetInputRequest {
203        type Borrowed<'a> = &'a Self;
204        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
205            value
206        }
207    }
208
209    unsafe impl fidl::encoding::TypeMarker for ClockSetInputRequest {
210        type Owned = Self;
211
212        #[inline(always)]
213        fn inline_align(_context: fidl::encoding::Context) -> usize {
214            4
215        }
216
217        #[inline(always)]
218        fn inline_size(_context: fidl::encoding::Context) -> usize {
219            4
220        }
221        #[inline(always)]
222        fn encode_is_copy() -> bool {
223            true
224        }
225
226        #[inline(always)]
227        fn decode_is_copy() -> bool {
228            true
229        }
230    }
231
232    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClockSetInputRequest, D>
233        for &ClockSetInputRequest
234    {
235        #[inline]
236        unsafe fn encode(
237            self,
238            encoder: &mut fidl::encoding::Encoder<'_, D>,
239            offset: usize,
240            _depth: fidl::encoding::Depth,
241        ) -> fidl::Result<()> {
242            encoder.debug_check_bounds::<ClockSetInputRequest>(offset);
243            unsafe {
244                // Copy the object into the buffer.
245                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
246                (buf_ptr as *mut ClockSetInputRequest)
247                    .write_unaligned((self as *const ClockSetInputRequest).read());
248                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
249                // done second because the memcpy will write garbage to these bytes.
250            }
251            Ok(())
252        }
253    }
254    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
255        fidl::encoding::Encode<ClockSetInputRequest, D> for (T0,)
256    {
257        #[inline]
258        unsafe fn encode(
259            self,
260            encoder: &mut fidl::encoding::Encoder<'_, D>,
261            offset: usize,
262            depth: fidl::encoding::Depth,
263        ) -> fidl::Result<()> {
264            encoder.debug_check_bounds::<ClockSetInputRequest>(offset);
265            // Zero out padding regions. There's no need to apply masks
266            // because the unmasked parts will be overwritten by fields.
267            // Write the fields.
268            self.0.encode(encoder, offset + 0, depth)?;
269            Ok(())
270        }
271    }
272
273    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClockSetInputRequest {
274        #[inline(always)]
275        fn new_empty() -> Self {
276            Self { idx: fidl::new_empty!(u32, D) }
277        }
278
279        #[inline]
280        unsafe fn decode(
281            &mut self,
282            decoder: &mut fidl::encoding::Decoder<'_, D>,
283            offset: usize,
284            _depth: fidl::encoding::Depth,
285        ) -> fidl::Result<()> {
286            decoder.debug_check_bounds::<Self>(offset);
287            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
288            // Verify that padding bytes are zero.
289            // Copy from the buffer into the object.
290            unsafe {
291                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
292            }
293            Ok(())
294        }
295    }
296
297    impl fidl::encoding::ValueTypeMarker for ClockSetRateRequest {
298        type Borrowed<'a> = &'a Self;
299        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
300            value
301        }
302    }
303
304    unsafe impl fidl::encoding::TypeMarker for ClockSetRateRequest {
305        type Owned = Self;
306
307        #[inline(always)]
308        fn inline_align(_context: fidl::encoding::Context) -> usize {
309            8
310        }
311
312        #[inline(always)]
313        fn inline_size(_context: fidl::encoding::Context) -> usize {
314            8
315        }
316        #[inline(always)]
317        fn encode_is_copy() -> bool {
318            true
319        }
320
321        #[inline(always)]
322        fn decode_is_copy() -> bool {
323            true
324        }
325    }
326
327    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClockSetRateRequest, D>
328        for &ClockSetRateRequest
329    {
330        #[inline]
331        unsafe fn encode(
332            self,
333            encoder: &mut fidl::encoding::Encoder<'_, D>,
334            offset: usize,
335            _depth: fidl::encoding::Depth,
336        ) -> fidl::Result<()> {
337            encoder.debug_check_bounds::<ClockSetRateRequest>(offset);
338            unsafe {
339                // Copy the object into the buffer.
340                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
341                (buf_ptr as *mut ClockSetRateRequest)
342                    .write_unaligned((self as *const ClockSetRateRequest).read());
343                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
344                // done second because the memcpy will write garbage to these bytes.
345            }
346            Ok(())
347        }
348    }
349    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
350        fidl::encoding::Encode<ClockSetRateRequest, D> for (T0,)
351    {
352        #[inline]
353        unsafe fn encode(
354            self,
355            encoder: &mut fidl::encoding::Encoder<'_, D>,
356            offset: usize,
357            depth: fidl::encoding::Depth,
358        ) -> fidl::Result<()> {
359            encoder.debug_check_bounds::<ClockSetRateRequest>(offset);
360            // Zero out padding regions. There's no need to apply masks
361            // because the unmasked parts will be overwritten by fields.
362            // Write the fields.
363            self.0.encode(encoder, offset + 0, depth)?;
364            Ok(())
365        }
366    }
367
368    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClockSetRateRequest {
369        #[inline(always)]
370        fn new_empty() -> Self {
371            Self { hz: fidl::new_empty!(u64, D) }
372        }
373
374        #[inline]
375        unsafe fn decode(
376            &mut self,
377            decoder: &mut fidl::encoding::Decoder<'_, D>,
378            offset: usize,
379            _depth: fidl::encoding::Depth,
380        ) -> fidl::Result<()> {
381            decoder.debug_check_bounds::<Self>(offset);
382            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
383            // Verify that padding bytes are zero.
384            // Copy from the buffer into the object.
385            unsafe {
386                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
387            }
388            Ok(())
389        }
390    }
391
392    impl fidl::encoding::ValueTypeMarker for ClockGetInputResponse {
393        type Borrowed<'a> = &'a Self;
394        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
395            value
396        }
397    }
398
399    unsafe impl fidl::encoding::TypeMarker for ClockGetInputResponse {
400        type Owned = Self;
401
402        #[inline(always)]
403        fn inline_align(_context: fidl::encoding::Context) -> usize {
404            4
405        }
406
407        #[inline(always)]
408        fn inline_size(_context: fidl::encoding::Context) -> usize {
409            4
410        }
411        #[inline(always)]
412        fn encode_is_copy() -> bool {
413            true
414        }
415
416        #[inline(always)]
417        fn decode_is_copy() -> bool {
418            true
419        }
420    }
421
422    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClockGetInputResponse, D>
423        for &ClockGetInputResponse
424    {
425        #[inline]
426        unsafe fn encode(
427            self,
428            encoder: &mut fidl::encoding::Encoder<'_, D>,
429            offset: usize,
430            _depth: fidl::encoding::Depth,
431        ) -> fidl::Result<()> {
432            encoder.debug_check_bounds::<ClockGetInputResponse>(offset);
433            unsafe {
434                // Copy the object into the buffer.
435                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
436                (buf_ptr as *mut ClockGetInputResponse)
437                    .write_unaligned((self as *const ClockGetInputResponse).read());
438                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
439                // done second because the memcpy will write garbage to these bytes.
440            }
441            Ok(())
442        }
443    }
444    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
445        fidl::encoding::Encode<ClockGetInputResponse, D> for (T0,)
446    {
447        #[inline]
448        unsafe fn encode(
449            self,
450            encoder: &mut fidl::encoding::Encoder<'_, D>,
451            offset: usize,
452            depth: fidl::encoding::Depth,
453        ) -> fidl::Result<()> {
454            encoder.debug_check_bounds::<ClockGetInputResponse>(offset);
455            // Zero out padding regions. There's no need to apply masks
456            // because the unmasked parts will be overwritten by fields.
457            // Write the fields.
458            self.0.encode(encoder, offset + 0, depth)?;
459            Ok(())
460        }
461    }
462
463    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClockGetInputResponse {
464        #[inline(always)]
465        fn new_empty() -> Self {
466            Self { index: fidl::new_empty!(u32, D) }
467        }
468
469        #[inline]
470        unsafe fn decode(
471            &mut self,
472            decoder: &mut fidl::encoding::Decoder<'_, D>,
473            offset: usize,
474            _depth: fidl::encoding::Depth,
475        ) -> fidl::Result<()> {
476            decoder.debug_check_bounds::<Self>(offset);
477            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
478            // Verify that padding bytes are zero.
479            // Copy from the buffer into the object.
480            unsafe {
481                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
482            }
483            Ok(())
484        }
485    }
486
487    impl fidl::encoding::ValueTypeMarker for ClockGetNumInputsResponse {
488        type Borrowed<'a> = &'a Self;
489        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
490            value
491        }
492    }
493
494    unsafe impl fidl::encoding::TypeMarker for ClockGetNumInputsResponse {
495        type Owned = Self;
496
497        #[inline(always)]
498        fn inline_align(_context: fidl::encoding::Context) -> usize {
499            4
500        }
501
502        #[inline(always)]
503        fn inline_size(_context: fidl::encoding::Context) -> usize {
504            4
505        }
506        #[inline(always)]
507        fn encode_is_copy() -> bool {
508            true
509        }
510
511        #[inline(always)]
512        fn decode_is_copy() -> bool {
513            true
514        }
515    }
516
517    unsafe impl<D: fidl::encoding::ResourceDialect>
518        fidl::encoding::Encode<ClockGetNumInputsResponse, D> for &ClockGetNumInputsResponse
519    {
520        #[inline]
521        unsafe fn encode(
522            self,
523            encoder: &mut fidl::encoding::Encoder<'_, D>,
524            offset: usize,
525            _depth: fidl::encoding::Depth,
526        ) -> fidl::Result<()> {
527            encoder.debug_check_bounds::<ClockGetNumInputsResponse>(offset);
528            unsafe {
529                // Copy the object into the buffer.
530                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
531                (buf_ptr as *mut ClockGetNumInputsResponse)
532                    .write_unaligned((self as *const ClockGetNumInputsResponse).read());
533                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
534                // done second because the memcpy will write garbage to these bytes.
535            }
536            Ok(())
537        }
538    }
539    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
540        fidl::encoding::Encode<ClockGetNumInputsResponse, D> for (T0,)
541    {
542        #[inline]
543        unsafe fn encode(
544            self,
545            encoder: &mut fidl::encoding::Encoder<'_, D>,
546            offset: usize,
547            depth: fidl::encoding::Depth,
548        ) -> fidl::Result<()> {
549            encoder.debug_check_bounds::<ClockGetNumInputsResponse>(offset);
550            // Zero out padding regions. There's no need to apply masks
551            // because the unmasked parts will be overwritten by fields.
552            // Write the fields.
553            self.0.encode(encoder, offset + 0, depth)?;
554            Ok(())
555        }
556    }
557
558    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
559        for ClockGetNumInputsResponse
560    {
561        #[inline(always)]
562        fn new_empty() -> Self {
563            Self { n: fidl::new_empty!(u32, D) }
564        }
565
566        #[inline]
567        unsafe fn decode(
568            &mut self,
569            decoder: &mut fidl::encoding::Decoder<'_, D>,
570            offset: usize,
571            _depth: fidl::encoding::Depth,
572        ) -> fidl::Result<()> {
573            decoder.debug_check_bounds::<Self>(offset);
574            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
575            // Verify that padding bytes are zero.
576            // Copy from the buffer into the object.
577            unsafe {
578                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
579            }
580            Ok(())
581        }
582    }
583
584    impl fidl::encoding::ValueTypeMarker for ClockGetPropertiesResponse {
585        type Borrowed<'a> = &'a Self;
586        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
587            value
588        }
589    }
590
591    unsafe impl fidl::encoding::TypeMarker for ClockGetPropertiesResponse {
592        type Owned = Self;
593
594        #[inline(always)]
595        fn inline_align(_context: fidl::encoding::Context) -> usize {
596            8
597        }
598
599        #[inline(always)]
600        fn inline_size(_context: fidl::encoding::Context) -> usize {
601            24
602        }
603    }
604
605    unsafe impl<D: fidl::encoding::ResourceDialect>
606        fidl::encoding::Encode<ClockGetPropertiesResponse, D> for &ClockGetPropertiesResponse
607    {
608        #[inline]
609        unsafe fn encode(
610            self,
611            encoder: &mut fidl::encoding::Encoder<'_, D>,
612            offset: usize,
613            _depth: fidl::encoding::Depth,
614        ) -> fidl::Result<()> {
615            encoder.debug_check_bounds::<ClockGetPropertiesResponse>(offset);
616            // Delegate to tuple encoding.
617            fidl::encoding::Encode::<ClockGetPropertiesResponse, D>::encode(
618                (
619                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
620                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
621                        &self.name,
622                    ),
623                ),
624                encoder,
625                offset,
626                _depth,
627            )
628        }
629    }
630    unsafe impl<
631        D: fidl::encoding::ResourceDialect,
632        T0: fidl::encoding::Encode<u32, D>,
633        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
634    > fidl::encoding::Encode<ClockGetPropertiesResponse, D> for (T0, T1)
635    {
636        #[inline]
637        unsafe fn encode(
638            self,
639            encoder: &mut fidl::encoding::Encoder<'_, D>,
640            offset: usize,
641            depth: fidl::encoding::Depth,
642        ) -> fidl::Result<()> {
643            encoder.debug_check_bounds::<ClockGetPropertiesResponse>(offset);
644            // Zero out padding regions. There's no need to apply masks
645            // because the unmasked parts will be overwritten by fields.
646            unsafe {
647                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
648                (ptr as *mut u64).write_unaligned(0);
649            }
650            // Write the fields.
651            self.0.encode(encoder, offset + 0, depth)?;
652            self.1.encode(encoder, offset + 8, depth)?;
653            Ok(())
654        }
655    }
656
657    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
658        for ClockGetPropertiesResponse
659    {
660        #[inline(always)]
661        fn new_empty() -> Self {
662            Self {
663                id: fidl::new_empty!(u32, D),
664                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
665            }
666        }
667
668        #[inline]
669        unsafe fn decode(
670            &mut self,
671            decoder: &mut fidl::encoding::Decoder<'_, D>,
672            offset: usize,
673            _depth: fidl::encoding::Depth,
674        ) -> fidl::Result<()> {
675            decoder.debug_check_bounds::<Self>(offset);
676            // Verify that padding bytes are zero.
677            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
678            let padval = unsafe { (ptr as *const u64).read_unaligned() };
679            let mask = 0xffffffff00000000u64;
680            let maskedval = padval & mask;
681            if maskedval != 0 {
682                return Err(fidl::Error::NonZeroPadding {
683                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
684                });
685            }
686            fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
687            fidl::decode!(
688                fidl::encoding::BoundedString<256>,
689                D,
690                &mut self.name,
691                decoder,
692                offset + 8,
693                _depth
694            )?;
695            Ok(())
696        }
697    }
698
699    impl fidl::encoding::ValueTypeMarker for ClockGetRateResponse {
700        type Borrowed<'a> = &'a Self;
701        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
702            value
703        }
704    }
705
706    unsafe impl fidl::encoding::TypeMarker for ClockGetRateResponse {
707        type Owned = Self;
708
709        #[inline(always)]
710        fn inline_align(_context: fidl::encoding::Context) -> usize {
711            8
712        }
713
714        #[inline(always)]
715        fn inline_size(_context: fidl::encoding::Context) -> usize {
716            8
717        }
718        #[inline(always)]
719        fn encode_is_copy() -> bool {
720            true
721        }
722
723        #[inline(always)]
724        fn decode_is_copy() -> bool {
725            true
726        }
727    }
728
729    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClockGetRateResponse, D>
730        for &ClockGetRateResponse
731    {
732        #[inline]
733        unsafe fn encode(
734            self,
735            encoder: &mut fidl::encoding::Encoder<'_, D>,
736            offset: usize,
737            _depth: fidl::encoding::Depth,
738        ) -> fidl::Result<()> {
739            encoder.debug_check_bounds::<ClockGetRateResponse>(offset);
740            unsafe {
741                // Copy the object into the buffer.
742                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
743                (buf_ptr as *mut ClockGetRateResponse)
744                    .write_unaligned((self as *const ClockGetRateResponse).read());
745                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
746                // done second because the memcpy will write garbage to these bytes.
747            }
748            Ok(())
749        }
750    }
751    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
752        fidl::encoding::Encode<ClockGetRateResponse, D> for (T0,)
753    {
754        #[inline]
755        unsafe fn encode(
756            self,
757            encoder: &mut fidl::encoding::Encoder<'_, D>,
758            offset: usize,
759            depth: fidl::encoding::Depth,
760        ) -> fidl::Result<()> {
761            encoder.debug_check_bounds::<ClockGetRateResponse>(offset);
762            // Zero out padding regions. There's no need to apply masks
763            // because the unmasked parts will be overwritten by fields.
764            // Write the fields.
765            self.0.encode(encoder, offset + 0, depth)?;
766            Ok(())
767        }
768    }
769
770    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClockGetRateResponse {
771        #[inline(always)]
772        fn new_empty() -> Self {
773            Self { hz: fidl::new_empty!(u64, D) }
774        }
775
776        #[inline]
777        unsafe fn decode(
778            &mut self,
779            decoder: &mut fidl::encoding::Decoder<'_, D>,
780            offset: usize,
781            _depth: fidl::encoding::Depth,
782        ) -> fidl::Result<()> {
783            decoder.debug_check_bounds::<Self>(offset);
784            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
785            // Verify that padding bytes are zero.
786            // Copy from the buffer into the object.
787            unsafe {
788                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
789            }
790            Ok(())
791        }
792    }
793
794    impl fidl::encoding::ValueTypeMarker for ClockIsEnabledResponse {
795        type Borrowed<'a> = &'a Self;
796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
797            value
798        }
799    }
800
801    unsafe impl fidl::encoding::TypeMarker for ClockIsEnabledResponse {
802        type Owned = Self;
803
804        #[inline(always)]
805        fn inline_align(_context: fidl::encoding::Context) -> usize {
806            1
807        }
808
809        #[inline(always)]
810        fn inline_size(_context: fidl::encoding::Context) -> usize {
811            1
812        }
813    }
814
815    unsafe impl<D: fidl::encoding::ResourceDialect>
816        fidl::encoding::Encode<ClockIsEnabledResponse, D> for &ClockIsEnabledResponse
817    {
818        #[inline]
819        unsafe fn encode(
820            self,
821            encoder: &mut fidl::encoding::Encoder<'_, D>,
822            offset: usize,
823            _depth: fidl::encoding::Depth,
824        ) -> fidl::Result<()> {
825            encoder.debug_check_bounds::<ClockIsEnabledResponse>(offset);
826            // Delegate to tuple encoding.
827            fidl::encoding::Encode::<ClockIsEnabledResponse, D>::encode(
828                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
829                encoder,
830                offset,
831                _depth,
832            )
833        }
834    }
835    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
836        fidl::encoding::Encode<ClockIsEnabledResponse, D> for (T0,)
837    {
838        #[inline]
839        unsafe fn encode(
840            self,
841            encoder: &mut fidl::encoding::Encoder<'_, D>,
842            offset: usize,
843            depth: fidl::encoding::Depth,
844        ) -> fidl::Result<()> {
845            encoder.debug_check_bounds::<ClockIsEnabledResponse>(offset);
846            // Zero out padding regions. There's no need to apply masks
847            // because the unmasked parts will be overwritten by fields.
848            // Write the fields.
849            self.0.encode(encoder, offset + 0, depth)?;
850            Ok(())
851        }
852    }
853
854    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
855        for ClockIsEnabledResponse
856    {
857        #[inline(always)]
858        fn new_empty() -> Self {
859            Self { enabled: fidl::new_empty!(bool, D) }
860        }
861
862        #[inline]
863        unsafe fn decode(
864            &mut self,
865            decoder: &mut fidl::encoding::Decoder<'_, D>,
866            offset: usize,
867            _depth: fidl::encoding::Depth,
868        ) -> fidl::Result<()> {
869            decoder.debug_check_bounds::<Self>(offset);
870            // Verify that padding bytes are zero.
871            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
872            Ok(())
873        }
874    }
875
876    impl fidl::encoding::ValueTypeMarker for ClockQuerySupportedRateResponse {
877        type Borrowed<'a> = &'a Self;
878        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
879            value
880        }
881    }
882
883    unsafe impl fidl::encoding::TypeMarker for ClockQuerySupportedRateResponse {
884        type Owned = Self;
885
886        #[inline(always)]
887        fn inline_align(_context: fidl::encoding::Context) -> usize {
888            8
889        }
890
891        #[inline(always)]
892        fn inline_size(_context: fidl::encoding::Context) -> usize {
893            8
894        }
895        #[inline(always)]
896        fn encode_is_copy() -> bool {
897            true
898        }
899
900        #[inline(always)]
901        fn decode_is_copy() -> bool {
902            true
903        }
904    }
905
906    unsafe impl<D: fidl::encoding::ResourceDialect>
907        fidl::encoding::Encode<ClockQuerySupportedRateResponse, D>
908        for &ClockQuerySupportedRateResponse
909    {
910        #[inline]
911        unsafe fn encode(
912            self,
913            encoder: &mut fidl::encoding::Encoder<'_, D>,
914            offset: usize,
915            _depth: fidl::encoding::Depth,
916        ) -> fidl::Result<()> {
917            encoder.debug_check_bounds::<ClockQuerySupportedRateResponse>(offset);
918            unsafe {
919                // Copy the object into the buffer.
920                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
921                (buf_ptr as *mut ClockQuerySupportedRateResponse)
922                    .write_unaligned((self as *const ClockQuerySupportedRateResponse).read());
923                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
924                // done second because the memcpy will write garbage to these bytes.
925            }
926            Ok(())
927        }
928    }
929    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
930        fidl::encoding::Encode<ClockQuerySupportedRateResponse, D> for (T0,)
931    {
932        #[inline]
933        unsafe fn encode(
934            self,
935            encoder: &mut fidl::encoding::Encoder<'_, D>,
936            offset: usize,
937            depth: fidl::encoding::Depth,
938        ) -> fidl::Result<()> {
939            encoder.debug_check_bounds::<ClockQuerySupportedRateResponse>(offset);
940            // Zero out padding regions. There's no need to apply masks
941            // because the unmasked parts will be overwritten by fields.
942            // Write the fields.
943            self.0.encode(encoder, offset + 0, depth)?;
944            Ok(())
945        }
946    }
947
948    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
949        for ClockQuerySupportedRateResponse
950    {
951        #[inline(always)]
952        fn new_empty() -> Self {
953            Self { hz_out: fidl::new_empty!(u64, D) }
954        }
955
956        #[inline]
957        unsafe fn decode(
958            &mut self,
959            decoder: &mut fidl::encoding::Decoder<'_, D>,
960            offset: usize,
961            _depth: fidl::encoding::Depth,
962        ) -> fidl::Result<()> {
963            decoder.debug_check_bounds::<Self>(offset);
964            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
965            // Verify that padding bytes are zero.
966            // Copy from the buffer into the object.
967            unsafe {
968                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
969            }
970            Ok(())
971        }
972    }
973}