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 type DriverName = String;
14
15pub const MAX_DRIVERS: u32 = 200;
16
17pub const MAX_DRIVER_URL: u32 = 150;
18
19pub const MAX_SOFTWARE_DEVICES: u32 = 20;
20
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
22#[repr(u32)]
23pub enum Collection {
24 Unknown = 0,
25 BootDrivers = 1,
26 PackageDrivers = 2,
27}
28
29impl Collection {
30 #[inline]
31 pub fn from_primitive(prim: u32) -> Option<Self> {
32 match prim {
33 0 => Some(Self::Unknown),
34 1 => Some(Self::BootDrivers),
35 2 => Some(Self::PackageDrivers),
36 _ => None,
37 }
38 }
39
40 #[inline]
41 pub const fn into_primitive(self) -> u32 {
42 self as u32
43 }
44
45 #[deprecated = "Strict enums should not use `is_unknown`"]
46 #[inline]
47 pub fn is_unknown(&self) -> bool {
48 false
49 }
50}
51
52#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
53pub struct DriverListsGetDriverListsResponse {
54 pub boot_drivers: Vec<String>,
55 pub base_drivers: Vec<String>,
56}
57
58impl fidl::Persistable for DriverListsGetDriverListsResponse {}
59
60#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct DriverLog {
62 pub name: String,
63 pub log_level: fidl_fuchsia_diagnostics_types::Severity,
64}
65
66impl fidl::Persistable for DriverLog {}
67
68#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69pub struct Expose {
70 pub service_name: String,
71 pub collection: Collection,
72}
73
74impl fidl::Persistable for Expose {}
75
76#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct InternalGetBootDriverOverridesResponse {
78 pub boot_overrides: Vec<String>,
79}
80
81impl fidl::Persistable for InternalGetBootDriverOverridesResponse {}
82
83#[derive(Clone, Debug, PartialEq)]
84pub struct InternalGetTestResolutionContextResponse {
85 pub context: Option<Box<fidl_fuchsia_component_resolution::Context>>,
86}
87
88impl fidl::Persistable for InternalGetTestResolutionContextResponse {}
89
90#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct Offer {
92 pub protocol_name: String,
93 pub collection: Collection,
94}
95
96impl fidl::Persistable for Offer {}
97
98#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99pub struct SoftwareDevice {
100 pub device_name: String,
101 pub device_id: u32,
102}
103
104impl fidl::Persistable for SoftwareDevice {}
105
106mod internal {
107 use super::*;
108 unsafe impl fidl::encoding::TypeMarker for Collection {
109 type Owned = Self;
110
111 #[inline(always)]
112 fn inline_align(_context: fidl::encoding::Context) -> usize {
113 std::mem::align_of::<u32>()
114 }
115
116 #[inline(always)]
117 fn inline_size(_context: fidl::encoding::Context) -> usize {
118 std::mem::size_of::<u32>()
119 }
120
121 #[inline(always)]
122 fn encode_is_copy() -> bool {
123 true
124 }
125
126 #[inline(always)]
127 fn decode_is_copy() -> bool {
128 false
129 }
130 }
131
132 impl fidl::encoding::ValueTypeMarker for Collection {
133 type Borrowed<'a> = Self;
134 #[inline(always)]
135 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
136 *value
137 }
138 }
139
140 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Collection {
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::<Self>(offset);
149 encoder.write_num(self.into_primitive(), offset);
150 Ok(())
151 }
152 }
153
154 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Collection {
155 #[inline(always)]
156 fn new_empty() -> Self {
157 Self::Unknown
158 }
159
160 #[inline]
161 unsafe fn decode(
162 &mut self,
163 decoder: &mut fidl::encoding::Decoder<'_, D>,
164 offset: usize,
165 _depth: fidl::encoding::Depth,
166 ) -> fidl::Result<()> {
167 decoder.debug_check_bounds::<Self>(offset);
168 let prim = decoder.read_num::<u32>(offset);
169
170 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
171 Ok(())
172 }
173 }
174
175 impl fidl::encoding::ValueTypeMarker for DriverListsGetDriverListsResponse {
176 type Borrowed<'a> = &'a Self;
177 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
178 value
179 }
180 }
181
182 unsafe impl fidl::encoding::TypeMarker for DriverListsGetDriverListsResponse {
183 type Owned = Self;
184
185 #[inline(always)]
186 fn inline_align(_context: fidl::encoding::Context) -> usize {
187 8
188 }
189
190 #[inline(always)]
191 fn inline_size(_context: fidl::encoding::Context) -> usize {
192 32
193 }
194 }
195
196 unsafe impl<D: fidl::encoding::ResourceDialect>
197 fidl::encoding::Encode<DriverListsGetDriverListsResponse, D>
198 for &DriverListsGetDriverListsResponse
199 {
200 #[inline]
201 unsafe fn encode(
202 self,
203 encoder: &mut fidl::encoding::Encoder<'_, D>,
204 offset: usize,
205 _depth: fidl::encoding::Depth,
206 ) -> fidl::Result<()> {
207 encoder.debug_check_bounds::<DriverListsGetDriverListsResponse>(offset);
208 fidl::encoding::Encode::<DriverListsGetDriverListsResponse, D>::encode(
210 (
211 <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.boot_drivers),
212 <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_drivers),
213 ),
214 encoder, offset, _depth
215 )
216 }
217 }
218 unsafe impl<
219 D: fidl::encoding::ResourceDialect,
220 T0: fidl::encoding::Encode<
221 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
222 D,
223 >,
224 T1: fidl::encoding::Encode<
225 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
226 D,
227 >,
228 > fidl::encoding::Encode<DriverListsGetDriverListsResponse, D> for (T0, T1)
229 {
230 #[inline]
231 unsafe fn encode(
232 self,
233 encoder: &mut fidl::encoding::Encoder<'_, D>,
234 offset: usize,
235 depth: fidl::encoding::Depth,
236 ) -> fidl::Result<()> {
237 encoder.debug_check_bounds::<DriverListsGetDriverListsResponse>(offset);
238 self.0.encode(encoder, offset + 0, depth)?;
242 self.1.encode(encoder, offset + 16, depth)?;
243 Ok(())
244 }
245 }
246
247 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
248 for DriverListsGetDriverListsResponse
249 {
250 #[inline(always)]
251 fn new_empty() -> Self {
252 Self {
253 boot_drivers: fidl::new_empty!(
254 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
255 D
256 ),
257 base_drivers: fidl::new_empty!(
258 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
259 D
260 ),
261 }
262 }
263
264 #[inline]
265 unsafe fn decode(
266 &mut self,
267 decoder: &mut fidl::encoding::Decoder<'_, D>,
268 offset: usize,
269 _depth: fidl::encoding::Depth,
270 ) -> fidl::Result<()> {
271 decoder.debug_check_bounds::<Self>(offset);
272 fidl::decode!(
274 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
275 D,
276 &mut self.boot_drivers,
277 decoder,
278 offset + 0,
279 _depth
280 )?;
281 fidl::decode!(
282 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
283 D,
284 &mut self.base_drivers,
285 decoder,
286 offset + 16,
287 _depth
288 )?;
289 Ok(())
290 }
291 }
292
293 impl fidl::encoding::ValueTypeMarker for DriverLog {
294 type Borrowed<'a> = &'a Self;
295 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
296 value
297 }
298 }
299
300 unsafe impl fidl::encoding::TypeMarker for DriverLog {
301 type Owned = Self;
302
303 #[inline(always)]
304 fn inline_align(_context: fidl::encoding::Context) -> usize {
305 8
306 }
307
308 #[inline(always)]
309 fn inline_size(_context: fidl::encoding::Context) -> usize {
310 24
311 }
312 }
313
314 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DriverLog, D>
315 for &DriverLog
316 {
317 #[inline]
318 unsafe fn encode(
319 self,
320 encoder: &mut fidl::encoding::Encoder<'_, D>,
321 offset: usize,
322 _depth: fidl::encoding::Depth,
323 ) -> fidl::Result<()> {
324 encoder.debug_check_bounds::<DriverLog>(offset);
325 fidl::encoding::Encode::<DriverLog, D>::encode(
327 (
328 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
329 <fidl_fuchsia_diagnostics_types::Severity as fidl::encoding::ValueTypeMarker>::borrow(&self.log_level),
330 ),
331 encoder, offset, _depth
332 )
333 }
334 }
335 unsafe impl<
336 D: fidl::encoding::ResourceDialect,
337 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
338 T1: fidl::encoding::Encode<fidl_fuchsia_diagnostics_types::Severity, D>,
339 > fidl::encoding::Encode<DriverLog, D> for (T0, T1)
340 {
341 #[inline]
342 unsafe fn encode(
343 self,
344 encoder: &mut fidl::encoding::Encoder<'_, D>,
345 offset: usize,
346 depth: fidl::encoding::Depth,
347 ) -> fidl::Result<()> {
348 encoder.debug_check_bounds::<DriverLog>(offset);
349 unsafe {
352 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
353 (ptr as *mut u64).write_unaligned(0);
354 }
355 self.0.encode(encoder, offset + 0, depth)?;
357 self.1.encode(encoder, offset + 16, depth)?;
358 Ok(())
359 }
360 }
361
362 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverLog {
363 #[inline(always)]
364 fn new_empty() -> Self {
365 Self {
366 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
367 log_level: fidl::new_empty!(fidl_fuchsia_diagnostics_types::Severity, D),
368 }
369 }
370
371 #[inline]
372 unsafe fn decode(
373 &mut self,
374 decoder: &mut fidl::encoding::Decoder<'_, D>,
375 offset: usize,
376 _depth: fidl::encoding::Depth,
377 ) -> fidl::Result<()> {
378 decoder.debug_check_bounds::<Self>(offset);
379 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
381 let padval = unsafe { (ptr as *const u64).read_unaligned() };
382 let mask = 0xffffffffffffff00u64;
383 let maskedval = padval & mask;
384 if maskedval != 0 {
385 return Err(fidl::Error::NonZeroPadding {
386 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
387 });
388 }
389 fidl::decode!(
390 fidl::encoding::UnboundedString,
391 D,
392 &mut self.name,
393 decoder,
394 offset + 0,
395 _depth
396 )?;
397 fidl::decode!(
398 fidl_fuchsia_diagnostics_types::Severity,
399 D,
400 &mut self.log_level,
401 decoder,
402 offset + 16,
403 _depth
404 )?;
405 Ok(())
406 }
407 }
408
409 impl fidl::encoding::ValueTypeMarker for Expose {
410 type Borrowed<'a> = &'a Self;
411 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
412 value
413 }
414 }
415
416 unsafe impl fidl::encoding::TypeMarker for Expose {
417 type Owned = Self;
418
419 #[inline(always)]
420 fn inline_align(_context: fidl::encoding::Context) -> usize {
421 8
422 }
423
424 #[inline(always)]
425 fn inline_size(_context: fidl::encoding::Context) -> usize {
426 24
427 }
428 }
429
430 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Expose, D> for &Expose {
431 #[inline]
432 unsafe fn encode(
433 self,
434 encoder: &mut fidl::encoding::Encoder<'_, D>,
435 offset: usize,
436 _depth: fidl::encoding::Depth,
437 ) -> fidl::Result<()> {
438 encoder.debug_check_bounds::<Expose>(offset);
439 fidl::encoding::Encode::<Expose, D>::encode(
441 (
442 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
443 &self.service_name,
444 ),
445 <Collection as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
446 ),
447 encoder,
448 offset,
449 _depth,
450 )
451 }
452 }
453 unsafe impl<
454 D: fidl::encoding::ResourceDialect,
455 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
456 T1: fidl::encoding::Encode<Collection, D>,
457 > fidl::encoding::Encode<Expose, D> for (T0, T1)
458 {
459 #[inline]
460 unsafe fn encode(
461 self,
462 encoder: &mut fidl::encoding::Encoder<'_, D>,
463 offset: usize,
464 depth: fidl::encoding::Depth,
465 ) -> fidl::Result<()> {
466 encoder.debug_check_bounds::<Expose>(offset);
467 unsafe {
470 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
471 (ptr as *mut u64).write_unaligned(0);
472 }
473 self.0.encode(encoder, offset + 0, depth)?;
475 self.1.encode(encoder, offset + 16, depth)?;
476 Ok(())
477 }
478 }
479
480 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Expose {
481 #[inline(always)]
482 fn new_empty() -> Self {
483 Self {
484 service_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
485 collection: fidl::new_empty!(Collection, D),
486 }
487 }
488
489 #[inline]
490 unsafe fn decode(
491 &mut self,
492 decoder: &mut fidl::encoding::Decoder<'_, D>,
493 offset: usize,
494 _depth: fidl::encoding::Depth,
495 ) -> fidl::Result<()> {
496 decoder.debug_check_bounds::<Self>(offset);
497 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
499 let padval = unsafe { (ptr as *const u64).read_unaligned() };
500 let mask = 0xffffffff00000000u64;
501 let maskedval = padval & mask;
502 if maskedval != 0 {
503 return Err(fidl::Error::NonZeroPadding {
504 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
505 });
506 }
507 fidl::decode!(
508 fidl::encoding::UnboundedString,
509 D,
510 &mut self.service_name,
511 decoder,
512 offset + 0,
513 _depth
514 )?;
515 fidl::decode!(Collection, D, &mut self.collection, decoder, offset + 16, _depth)?;
516 Ok(())
517 }
518 }
519
520 impl fidl::encoding::ValueTypeMarker for InternalGetBootDriverOverridesResponse {
521 type Borrowed<'a> = &'a Self;
522 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
523 value
524 }
525 }
526
527 unsafe impl fidl::encoding::TypeMarker for InternalGetBootDriverOverridesResponse {
528 type Owned = Self;
529
530 #[inline(always)]
531 fn inline_align(_context: fidl::encoding::Context) -> usize {
532 8
533 }
534
535 #[inline(always)]
536 fn inline_size(_context: fidl::encoding::Context) -> usize {
537 16
538 }
539 }
540
541 unsafe impl<D: fidl::encoding::ResourceDialect>
542 fidl::encoding::Encode<InternalGetBootDriverOverridesResponse, D>
543 for &InternalGetBootDriverOverridesResponse
544 {
545 #[inline]
546 unsafe fn encode(
547 self,
548 encoder: &mut fidl::encoding::Encoder<'_, D>,
549 offset: usize,
550 _depth: fidl::encoding::Depth,
551 ) -> fidl::Result<()> {
552 encoder.debug_check_bounds::<InternalGetBootDriverOverridesResponse>(offset);
553 fidl::encoding::Encode::<InternalGetBootDriverOverridesResponse, D>::encode(
555 (
556 <fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200> as fidl::encoding::ValueTypeMarker>::borrow(&self.boot_overrides),
557 ),
558 encoder, offset, _depth
559 )
560 }
561 }
562 unsafe impl<
563 D: fidl::encoding::ResourceDialect,
564 T0: fidl::encoding::Encode<
565 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
566 D,
567 >,
568 > fidl::encoding::Encode<InternalGetBootDriverOverridesResponse, D> for (T0,)
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::<InternalGetBootDriverOverridesResponse>(offset);
578 self.0.encode(encoder, offset + 0, depth)?;
582 Ok(())
583 }
584 }
585
586 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
587 for InternalGetBootDriverOverridesResponse
588 {
589 #[inline(always)]
590 fn new_empty() -> Self {
591 Self {
592 boot_overrides: fidl::new_empty!(
593 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
594 D
595 ),
596 }
597 }
598
599 #[inline]
600 unsafe fn decode(
601 &mut self,
602 decoder: &mut fidl::encoding::Decoder<'_, D>,
603 offset: usize,
604 _depth: fidl::encoding::Depth,
605 ) -> fidl::Result<()> {
606 decoder.debug_check_bounds::<Self>(offset);
607 fidl::decode!(
609 fidl::encoding::Vector<fidl::encoding::BoundedString<150>, 200>,
610 D,
611 &mut self.boot_overrides,
612 decoder,
613 offset + 0,
614 _depth
615 )?;
616 Ok(())
617 }
618 }
619
620 impl fidl::encoding::ValueTypeMarker for InternalGetTestResolutionContextResponse {
621 type Borrowed<'a> = &'a Self;
622 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
623 value
624 }
625 }
626
627 unsafe impl fidl::encoding::TypeMarker for InternalGetTestResolutionContextResponse {
628 type Owned = Self;
629
630 #[inline(always)]
631 fn inline_align(_context: fidl::encoding::Context) -> usize {
632 8
633 }
634
635 #[inline(always)]
636 fn inline_size(_context: fidl::encoding::Context) -> usize {
637 8
638 }
639 }
640
641 unsafe impl<D: fidl::encoding::ResourceDialect>
642 fidl::encoding::Encode<InternalGetTestResolutionContextResponse, D>
643 for &InternalGetTestResolutionContextResponse
644 {
645 #[inline]
646 unsafe fn encode(
647 self,
648 encoder: &mut fidl::encoding::Encoder<'_, D>,
649 offset: usize,
650 _depth: fidl::encoding::Depth,
651 ) -> fidl::Result<()> {
652 encoder.debug_check_bounds::<InternalGetTestResolutionContextResponse>(offset);
653 fidl::encoding::Encode::<InternalGetTestResolutionContextResponse, D>::encode(
655 (
656 <fidl::encoding::Boxed<fidl_fuchsia_component_resolution::Context> as fidl::encoding::ValueTypeMarker>::borrow(&self.context),
657 ),
658 encoder, offset, _depth
659 )
660 }
661 }
662 unsafe impl<
663 D: fidl::encoding::ResourceDialect,
664 T0: fidl::encoding::Encode<
665 fidl::encoding::Boxed<fidl_fuchsia_component_resolution::Context>,
666 D,
667 >,
668 > fidl::encoding::Encode<InternalGetTestResolutionContextResponse, D> for (T0,)
669 {
670 #[inline]
671 unsafe fn encode(
672 self,
673 encoder: &mut fidl::encoding::Encoder<'_, D>,
674 offset: usize,
675 depth: fidl::encoding::Depth,
676 ) -> fidl::Result<()> {
677 encoder.debug_check_bounds::<InternalGetTestResolutionContextResponse>(offset);
678 self.0.encode(encoder, offset + 0, depth)?;
682 Ok(())
683 }
684 }
685
686 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
687 for InternalGetTestResolutionContextResponse
688 {
689 #[inline(always)]
690 fn new_empty() -> Self {
691 Self {
692 context: fidl::new_empty!(
693 fidl::encoding::Boxed<fidl_fuchsia_component_resolution::Context>,
694 D
695 ),
696 }
697 }
698
699 #[inline]
700 unsafe fn decode(
701 &mut self,
702 decoder: &mut fidl::encoding::Decoder<'_, D>,
703 offset: usize,
704 _depth: fidl::encoding::Depth,
705 ) -> fidl::Result<()> {
706 decoder.debug_check_bounds::<Self>(offset);
707 fidl::decode!(
709 fidl::encoding::Boxed<fidl_fuchsia_component_resolution::Context>,
710 D,
711 &mut self.context,
712 decoder,
713 offset + 0,
714 _depth
715 )?;
716 Ok(())
717 }
718 }
719
720 impl fidl::encoding::ValueTypeMarker for Offer {
721 type Borrowed<'a> = &'a Self;
722 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
723 value
724 }
725 }
726
727 unsafe impl fidl::encoding::TypeMarker for Offer {
728 type Owned = Self;
729
730 #[inline(always)]
731 fn inline_align(_context: fidl::encoding::Context) -> usize {
732 8
733 }
734
735 #[inline(always)]
736 fn inline_size(_context: fidl::encoding::Context) -> usize {
737 24
738 }
739 }
740
741 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Offer, D> for &Offer {
742 #[inline]
743 unsafe fn encode(
744 self,
745 encoder: &mut fidl::encoding::Encoder<'_, D>,
746 offset: usize,
747 _depth: fidl::encoding::Depth,
748 ) -> fidl::Result<()> {
749 encoder.debug_check_bounds::<Offer>(offset);
750 fidl::encoding::Encode::<Offer, D>::encode(
752 (
753 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
754 &self.protocol_name,
755 ),
756 <Collection as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
757 ),
758 encoder,
759 offset,
760 _depth,
761 )
762 }
763 }
764 unsafe impl<
765 D: fidl::encoding::ResourceDialect,
766 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
767 T1: fidl::encoding::Encode<Collection, D>,
768 > fidl::encoding::Encode<Offer, D> for (T0, T1)
769 {
770 #[inline]
771 unsafe fn encode(
772 self,
773 encoder: &mut fidl::encoding::Encoder<'_, D>,
774 offset: usize,
775 depth: fidl::encoding::Depth,
776 ) -> fidl::Result<()> {
777 encoder.debug_check_bounds::<Offer>(offset);
778 unsafe {
781 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
782 (ptr as *mut u64).write_unaligned(0);
783 }
784 self.0.encode(encoder, offset + 0, depth)?;
786 self.1.encode(encoder, offset + 16, depth)?;
787 Ok(())
788 }
789 }
790
791 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Offer {
792 #[inline(always)]
793 fn new_empty() -> Self {
794 Self {
795 protocol_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
796 collection: fidl::new_empty!(Collection, D),
797 }
798 }
799
800 #[inline]
801 unsafe fn decode(
802 &mut self,
803 decoder: &mut fidl::encoding::Decoder<'_, D>,
804 offset: usize,
805 _depth: fidl::encoding::Depth,
806 ) -> fidl::Result<()> {
807 decoder.debug_check_bounds::<Self>(offset);
808 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
810 let padval = unsafe { (ptr as *const u64).read_unaligned() };
811 let mask = 0xffffffff00000000u64;
812 let maskedval = padval & mask;
813 if maskedval != 0 {
814 return Err(fidl::Error::NonZeroPadding {
815 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
816 });
817 }
818 fidl::decode!(
819 fidl::encoding::UnboundedString,
820 D,
821 &mut self.protocol_name,
822 decoder,
823 offset + 0,
824 _depth
825 )?;
826 fidl::decode!(Collection, D, &mut self.collection, decoder, offset + 16, _depth)?;
827 Ok(())
828 }
829 }
830
831 impl fidl::encoding::ValueTypeMarker for SoftwareDevice {
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 SoftwareDevice {
839 type Owned = Self;
840
841 #[inline(always)]
842 fn inline_align(_context: fidl::encoding::Context) -> usize {
843 8
844 }
845
846 #[inline(always)]
847 fn inline_size(_context: fidl::encoding::Context) -> usize {
848 24
849 }
850 }
851
852 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SoftwareDevice, D>
853 for &SoftwareDevice
854 {
855 #[inline]
856 unsafe fn encode(
857 self,
858 encoder: &mut fidl::encoding::Encoder<'_, D>,
859 offset: usize,
860 _depth: fidl::encoding::Depth,
861 ) -> fidl::Result<()> {
862 encoder.debug_check_bounds::<SoftwareDevice>(offset);
863 fidl::encoding::Encode::<SoftwareDevice, D>::encode(
865 (
866 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
867 &self.device_name,
868 ),
869 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
870 ),
871 encoder,
872 offset,
873 _depth,
874 )
875 }
876 }
877 unsafe impl<
878 D: fidl::encoding::ResourceDialect,
879 T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
880 T1: fidl::encoding::Encode<u32, D>,
881 > fidl::encoding::Encode<SoftwareDevice, D> for (T0, T1)
882 {
883 #[inline]
884 unsafe fn encode(
885 self,
886 encoder: &mut fidl::encoding::Encoder<'_, D>,
887 offset: usize,
888 depth: fidl::encoding::Depth,
889 ) -> fidl::Result<()> {
890 encoder.debug_check_bounds::<SoftwareDevice>(offset);
891 unsafe {
894 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
895 (ptr as *mut u64).write_unaligned(0);
896 }
897 self.0.encode(encoder, offset + 0, depth)?;
899 self.1.encode(encoder, offset + 16, depth)?;
900 Ok(())
901 }
902 }
903
904 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SoftwareDevice {
905 #[inline(always)]
906 fn new_empty() -> Self {
907 Self {
908 device_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
909 device_id: fidl::new_empty!(u32, D),
910 }
911 }
912
913 #[inline]
914 unsafe fn decode(
915 &mut self,
916 decoder: &mut fidl::encoding::Decoder<'_, D>,
917 offset: usize,
918 _depth: fidl::encoding::Depth,
919 ) -> fidl::Result<()> {
920 decoder.debug_check_bounds::<Self>(offset);
921 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
923 let padval = unsafe { (ptr as *const u64).read_unaligned() };
924 let mask = 0xffffffff00000000u64;
925 let maskedval = padval & mask;
926 if maskedval != 0 {
927 return Err(fidl::Error::NonZeroPadding {
928 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
929 });
930 }
931 fidl::decode!(
932 fidl::encoding::UnboundedString,
933 D,
934 &mut self.device_name,
935 decoder,
936 offset + 0,
937 _depth
938 )?;
939 fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 16, _depth)?;
940 Ok(())
941 }
942 }
943}