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