1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAPPINGS_BATCH_SIZE: u8 = 64;
12
13pub const MAX_TRANSFER_UNBOUNDED: u32 = 4294967295;
16
17pub const VMOID_INVALID: u16 = 0;
20
21bitflags! {
22 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
23 pub struct Flag: u32 {
24 const READONLY = 1;
26 const REMOVABLE = 2;
28 const BOOTPART = 4;
30 const TRIM_SUPPORT = 8;
32 const FUA_SUPPORT = 16;
34 }
35}
36
37impl Flag {}
38
39#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct BlockGetStatsRequest {
41 pub clear: bool,
42}
43
44impl fidl::Persistable for BlockGetStatsRequest {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct BlockInfo {
48 pub block_count: u64,
50 pub block_size: u32,
52 pub max_transfer_size: u32,
55 pub flags: Flag,
57}
58
59impl fidl::Persistable for BlockInfo {}
60
61#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64#[repr(C)]
65pub struct BlockOffsetMapping {
66 pub source_block_offset: u64,
67 pub target_block_offset: u64,
68 pub length: u64,
69}
70
71impl fidl::Persistable for BlockOffsetMapping {}
72
73#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct BlockStats {
78 pub read: OperationStats,
80 pub write: OperationStats,
82 pub trim: OperationStats,
84 pub flush: OperationStats,
86}
87
88impl fidl::Persistable for BlockStats {}
89
90#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct BlockGetInfoResponse {
92 pub info: BlockInfo,
93}
94
95impl fidl::Persistable for BlockGetInfoResponse {}
96
97#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98#[repr(C)]
99pub struct BlockGetStatsResponse {
100 pub stats: BlockStats,
101}
102
103impl fidl::Persistable for BlockGetStatsResponse {}
104
105#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
106#[repr(C)]
107pub struct FtlFormatResponse {
108 pub status: i32,
109}
110
111impl fidl::Persistable for FtlFormatResponse {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114#[repr(C)]
115pub struct OffsetMapQueryRequest {
116 pub source_block_offset: u64,
117 pub length: u64,
118}
119
120impl fidl::Persistable for OffsetMapQueryRequest {}
121
122#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct OffsetMapQueryResponse {
124 pub mappings: Vec<BlockOffsetMapping>,
125}
126
127impl fidl::Persistable for OffsetMapQueryResponse {}
128
129#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131#[repr(C)]
132pub struct OperationStats {
133 pub success: RequestStats,
135 pub failure: RequestStats,
137}
138
139impl fidl::Persistable for OperationStats {}
140
141#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
144#[repr(C)]
145pub struct RequestStats {
146 pub minimum_latency: u64,
148 pub maximum_latency: u64,
150 pub total_time_spent: u64,
152 pub total_calls: u64,
154 pub bytes_transferred: u64,
165}
166
167impl fidl::Persistable for RequestStats {}
168
169#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170#[repr(C)]
171pub struct SessionAttachVmoResponse {
172 pub vmoid: VmoId,
173}
174
175impl fidl::Persistable for SessionAttachVmoResponse {}
176
177#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178#[repr(C)]
179pub struct VmoId {
180 pub id: u16,
181}
182
183impl fidl::Persistable for VmoId {}
184
185pub mod block_ordinals {
186 pub const GET_INFO: u64 = 0x79df1a5cdb6cc6a3;
187 pub const GET_STATS: u64 = 0x53d9542a778385ae;
188 pub const OPEN_SESSION: u64 = 0x7241c68d17614a31;
189 pub const OPEN_SESSION_WITH_OFFSET_MAP: u64 = 0x7a8d3ba3d8bfa10f;
190}
191
192pub mod ftl_ordinals {
193 pub const GET_VMO: u64 = 0xf523185c6e67738;
194 pub const FORMAT: u64 = 0x79751d9c0b48a0d6;
195}
196
197pub mod inspect_vmo_provider_ordinals {
198 pub const GET_VMO: u64 = 0xf523185c6e67738;
199}
200
201pub mod offset_map_ordinals {
202 pub const QUERY: u64 = 0x18471939852e45a4;
203}
204
205pub mod session_ordinals {
206 pub const CLOSE: u64 = 0x5ac5d459ad7f657e;
207 pub const GET_FIFO: u64 = 0x61a31a92a206b7d5;
208 pub const ATTACH_VMO: u64 = 0x54edc4641d9569f5;
209}
210
211mod internal {
212 use super::*;
213 unsafe impl fidl::encoding::TypeMarker for Flag {
214 type Owned = Self;
215
216 #[inline(always)]
217 fn inline_align(_context: fidl::encoding::Context) -> usize {
218 4
219 }
220
221 #[inline(always)]
222 fn inline_size(_context: fidl::encoding::Context) -> usize {
223 4
224 }
225 }
226
227 impl fidl::encoding::ValueTypeMarker for Flag {
228 type Borrowed<'a> = Self;
229 #[inline(always)]
230 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
231 *value
232 }
233 }
234
235 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Flag {
236 #[inline]
237 unsafe fn encode(
238 self,
239 encoder: &mut fidl::encoding::Encoder<'_, D>,
240 offset: usize,
241 _depth: fidl::encoding::Depth,
242 ) -> fidl::Result<()> {
243 encoder.debug_check_bounds::<Self>(offset);
244 if self.bits() & Self::all().bits() != self.bits() {
245 return Err(fidl::Error::InvalidBitsValue);
246 }
247 encoder.write_num(self.bits(), offset);
248 Ok(())
249 }
250 }
251
252 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Flag {
253 #[inline(always)]
254 fn new_empty() -> Self {
255 Self::empty()
256 }
257
258 #[inline]
259 unsafe fn decode(
260 &mut self,
261 decoder: &mut fidl::encoding::Decoder<'_, D>,
262 offset: usize,
263 _depth: fidl::encoding::Depth,
264 ) -> fidl::Result<()> {
265 decoder.debug_check_bounds::<Self>(offset);
266 let prim = decoder.read_num::<u32>(offset);
267 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
268 Ok(())
269 }
270 }
271
272 impl fidl::encoding::ValueTypeMarker for BlockGetStatsRequest {
273 type Borrowed<'a> = &'a Self;
274 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
275 value
276 }
277 }
278
279 unsafe impl fidl::encoding::TypeMarker for BlockGetStatsRequest {
280 type Owned = Self;
281
282 #[inline(always)]
283 fn inline_align(_context: fidl::encoding::Context) -> usize {
284 1
285 }
286
287 #[inline(always)]
288 fn inline_size(_context: fidl::encoding::Context) -> usize {
289 1
290 }
291 }
292
293 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetStatsRequest, D>
294 for &BlockGetStatsRequest
295 {
296 #[inline]
297 unsafe fn encode(
298 self,
299 encoder: &mut fidl::encoding::Encoder<'_, D>,
300 offset: usize,
301 _depth: fidl::encoding::Depth,
302 ) -> fidl::Result<()> {
303 encoder.debug_check_bounds::<BlockGetStatsRequest>(offset);
304 fidl::encoding::Encode::<BlockGetStatsRequest, D>::encode(
306 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.clear),),
307 encoder,
308 offset,
309 _depth,
310 )
311 }
312 }
313 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
314 fidl::encoding::Encode<BlockGetStatsRequest, 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::<BlockGetStatsRequest>(offset);
324 self.0.encode(encoder, offset + 0, depth)?;
328 Ok(())
329 }
330 }
331
332 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetStatsRequest {
333 #[inline(always)]
334 fn new_empty() -> Self {
335 Self { clear: fidl::new_empty!(bool, D) }
336 }
337
338 #[inline]
339 unsafe fn decode(
340 &mut self,
341 decoder: &mut fidl::encoding::Decoder<'_, D>,
342 offset: usize,
343 _depth: fidl::encoding::Depth,
344 ) -> fidl::Result<()> {
345 decoder.debug_check_bounds::<Self>(offset);
346 fidl::decode!(bool, D, &mut self.clear, decoder, offset + 0, _depth)?;
348 Ok(())
349 }
350 }
351
352 impl fidl::encoding::ValueTypeMarker for BlockInfo {
353 type Borrowed<'a> = &'a Self;
354 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
355 value
356 }
357 }
358
359 unsafe impl fidl::encoding::TypeMarker for BlockInfo {
360 type Owned = Self;
361
362 #[inline(always)]
363 fn inline_align(_context: fidl::encoding::Context) -> usize {
364 8
365 }
366
367 #[inline(always)]
368 fn inline_size(_context: fidl::encoding::Context) -> usize {
369 24
370 }
371 }
372
373 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockInfo, D>
374 for &BlockInfo
375 {
376 #[inline]
377 unsafe fn encode(
378 self,
379 encoder: &mut fidl::encoding::Encoder<'_, D>,
380 offset: usize,
381 _depth: fidl::encoding::Depth,
382 ) -> fidl::Result<()> {
383 encoder.debug_check_bounds::<BlockInfo>(offset);
384 fidl::encoding::Encode::<BlockInfo, D>::encode(
386 (
387 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
388 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
389 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_transfer_size),
390 <Flag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
391 ),
392 encoder,
393 offset,
394 _depth,
395 )
396 }
397 }
398 unsafe impl<
399 D: fidl::encoding::ResourceDialect,
400 T0: fidl::encoding::Encode<u64, D>,
401 T1: fidl::encoding::Encode<u32, D>,
402 T2: fidl::encoding::Encode<u32, D>,
403 T3: fidl::encoding::Encode<Flag, D>,
404 > fidl::encoding::Encode<BlockInfo, D> for (T0, T1, T2, T3)
405 {
406 #[inline]
407 unsafe fn encode(
408 self,
409 encoder: &mut fidl::encoding::Encoder<'_, D>,
410 offset: usize,
411 depth: fidl::encoding::Depth,
412 ) -> fidl::Result<()> {
413 encoder.debug_check_bounds::<BlockInfo>(offset);
414 unsafe {
417 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
418 (ptr as *mut u64).write_unaligned(0);
419 }
420 self.0.encode(encoder, offset + 0, depth)?;
422 self.1.encode(encoder, offset + 8, depth)?;
423 self.2.encode(encoder, offset + 12, depth)?;
424 self.3.encode(encoder, offset + 16, depth)?;
425 Ok(())
426 }
427 }
428
429 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockInfo {
430 #[inline(always)]
431 fn new_empty() -> Self {
432 Self {
433 block_count: fidl::new_empty!(u64, D),
434 block_size: fidl::new_empty!(u32, D),
435 max_transfer_size: fidl::new_empty!(u32, D),
436 flags: fidl::new_empty!(Flag, D),
437 }
438 }
439
440 #[inline]
441 unsafe fn decode(
442 &mut self,
443 decoder: &mut fidl::encoding::Decoder<'_, D>,
444 offset: usize,
445 _depth: fidl::encoding::Depth,
446 ) -> fidl::Result<()> {
447 decoder.debug_check_bounds::<Self>(offset);
448 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
450 let padval = unsafe { (ptr as *const u64).read_unaligned() };
451 let mask = 0xffffffff00000000u64;
452 let maskedval = padval & mask;
453 if maskedval != 0 {
454 return Err(fidl::Error::NonZeroPadding {
455 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
456 });
457 }
458 fidl::decode!(u64, D, &mut self.block_count, decoder, offset + 0, _depth)?;
459 fidl::decode!(u32, D, &mut self.block_size, decoder, offset + 8, _depth)?;
460 fidl::decode!(u32, D, &mut self.max_transfer_size, decoder, offset + 12, _depth)?;
461 fidl::decode!(Flag, D, &mut self.flags, decoder, offset + 16, _depth)?;
462 Ok(())
463 }
464 }
465
466 impl fidl::encoding::ValueTypeMarker for BlockOffsetMapping {
467 type Borrowed<'a> = &'a Self;
468 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
469 value
470 }
471 }
472
473 unsafe impl fidl::encoding::TypeMarker for BlockOffsetMapping {
474 type Owned = Self;
475
476 #[inline(always)]
477 fn inline_align(_context: fidl::encoding::Context) -> usize {
478 8
479 }
480
481 #[inline(always)]
482 fn inline_size(_context: fidl::encoding::Context) -> usize {
483 24
484 }
485 #[inline(always)]
486 fn encode_is_copy() -> bool {
487 true
488 }
489
490 #[inline(always)]
491 fn decode_is_copy() -> bool {
492 true
493 }
494 }
495
496 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockOffsetMapping, D>
497 for &BlockOffsetMapping
498 {
499 #[inline]
500 unsafe fn encode(
501 self,
502 encoder: &mut fidl::encoding::Encoder<'_, D>,
503 offset: usize,
504 _depth: fidl::encoding::Depth,
505 ) -> fidl::Result<()> {
506 encoder.debug_check_bounds::<BlockOffsetMapping>(offset);
507 unsafe {
508 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
510 (buf_ptr as *mut BlockOffsetMapping)
511 .write_unaligned((self as *const BlockOffsetMapping).read());
512 }
515 Ok(())
516 }
517 }
518 unsafe impl<
519 D: fidl::encoding::ResourceDialect,
520 T0: fidl::encoding::Encode<u64, D>,
521 T1: fidl::encoding::Encode<u64, D>,
522 T2: fidl::encoding::Encode<u64, D>,
523 > fidl::encoding::Encode<BlockOffsetMapping, D> for (T0, T1, T2)
524 {
525 #[inline]
526 unsafe fn encode(
527 self,
528 encoder: &mut fidl::encoding::Encoder<'_, D>,
529 offset: usize,
530 depth: fidl::encoding::Depth,
531 ) -> fidl::Result<()> {
532 encoder.debug_check_bounds::<BlockOffsetMapping>(offset);
533 self.0.encode(encoder, offset + 0, depth)?;
537 self.1.encode(encoder, offset + 8, depth)?;
538 self.2.encode(encoder, offset + 16, depth)?;
539 Ok(())
540 }
541 }
542
543 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockOffsetMapping {
544 #[inline(always)]
545 fn new_empty() -> Self {
546 Self {
547 source_block_offset: fidl::new_empty!(u64, D),
548 target_block_offset: fidl::new_empty!(u64, D),
549 length: fidl::new_empty!(u64, D),
550 }
551 }
552
553 #[inline]
554 unsafe fn decode(
555 &mut self,
556 decoder: &mut fidl::encoding::Decoder<'_, D>,
557 offset: usize,
558 _depth: fidl::encoding::Depth,
559 ) -> fidl::Result<()> {
560 decoder.debug_check_bounds::<Self>(offset);
561 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
562 unsafe {
565 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
566 }
567 Ok(())
568 }
569 }
570
571 impl fidl::encoding::ValueTypeMarker for BlockStats {
572 type Borrowed<'a> = &'a Self;
573 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
574 value
575 }
576 }
577
578 unsafe impl fidl::encoding::TypeMarker for BlockStats {
579 type Owned = Self;
580
581 #[inline(always)]
582 fn inline_align(_context: fidl::encoding::Context) -> usize {
583 8
584 }
585
586 #[inline(always)]
587 fn inline_size(_context: fidl::encoding::Context) -> usize {
588 320
589 }
590 #[inline(always)]
591 fn encode_is_copy() -> bool {
592 true
593 }
594
595 #[inline(always)]
596 fn decode_is_copy() -> bool {
597 true
598 }
599 }
600
601 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockStats, D>
602 for &BlockStats
603 {
604 #[inline]
605 unsafe fn encode(
606 self,
607 encoder: &mut fidl::encoding::Encoder<'_, D>,
608 offset: usize,
609 _depth: fidl::encoding::Depth,
610 ) -> fidl::Result<()> {
611 encoder.debug_check_bounds::<BlockStats>(offset);
612 unsafe {
613 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
615 (buf_ptr as *mut BlockStats).write_unaligned((self as *const BlockStats).read());
616 }
619 Ok(())
620 }
621 }
622 unsafe impl<
623 D: fidl::encoding::ResourceDialect,
624 T0: fidl::encoding::Encode<OperationStats, D>,
625 T1: fidl::encoding::Encode<OperationStats, D>,
626 T2: fidl::encoding::Encode<OperationStats, D>,
627 T3: fidl::encoding::Encode<OperationStats, D>,
628 > fidl::encoding::Encode<BlockStats, D> for (T0, T1, T2, T3)
629 {
630 #[inline]
631 unsafe fn encode(
632 self,
633 encoder: &mut fidl::encoding::Encoder<'_, D>,
634 offset: usize,
635 depth: fidl::encoding::Depth,
636 ) -> fidl::Result<()> {
637 encoder.debug_check_bounds::<BlockStats>(offset);
638 self.0.encode(encoder, offset + 0, depth)?;
642 self.1.encode(encoder, offset + 80, depth)?;
643 self.2.encode(encoder, offset + 160, depth)?;
644 self.3.encode(encoder, offset + 240, depth)?;
645 Ok(())
646 }
647 }
648
649 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockStats {
650 #[inline(always)]
651 fn new_empty() -> Self {
652 Self {
653 read: fidl::new_empty!(OperationStats, D),
654 write: fidl::new_empty!(OperationStats, D),
655 trim: fidl::new_empty!(OperationStats, D),
656 flush: fidl::new_empty!(OperationStats, D),
657 }
658 }
659
660 #[inline]
661 unsafe fn decode(
662 &mut self,
663 decoder: &mut fidl::encoding::Decoder<'_, D>,
664 offset: usize,
665 _depth: fidl::encoding::Depth,
666 ) -> fidl::Result<()> {
667 decoder.debug_check_bounds::<Self>(offset);
668 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
669 unsafe {
672 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
673 }
674 Ok(())
675 }
676 }
677
678 impl fidl::encoding::ValueTypeMarker for BlockGetInfoResponse {
679 type Borrowed<'a> = &'a Self;
680 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
681 value
682 }
683 }
684
685 unsafe impl fidl::encoding::TypeMarker for BlockGetInfoResponse {
686 type Owned = Self;
687
688 #[inline(always)]
689 fn inline_align(_context: fidl::encoding::Context) -> usize {
690 8
691 }
692
693 #[inline(always)]
694 fn inline_size(_context: fidl::encoding::Context) -> usize {
695 24
696 }
697 }
698
699 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetInfoResponse, D>
700 for &BlockGetInfoResponse
701 {
702 #[inline]
703 unsafe fn encode(
704 self,
705 encoder: &mut fidl::encoding::Encoder<'_, D>,
706 offset: usize,
707 _depth: fidl::encoding::Depth,
708 ) -> fidl::Result<()> {
709 encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
710 fidl::encoding::Encode::<BlockGetInfoResponse, D>::encode(
712 (<BlockInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
713 encoder,
714 offset,
715 _depth,
716 )
717 }
718 }
719 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockInfo, D>>
720 fidl::encoding::Encode<BlockGetInfoResponse, D> for (T0,)
721 {
722 #[inline]
723 unsafe fn encode(
724 self,
725 encoder: &mut fidl::encoding::Encoder<'_, D>,
726 offset: usize,
727 depth: fidl::encoding::Depth,
728 ) -> fidl::Result<()> {
729 encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
730 self.0.encode(encoder, offset + 0, depth)?;
734 Ok(())
735 }
736 }
737
738 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetInfoResponse {
739 #[inline(always)]
740 fn new_empty() -> Self {
741 Self { info: fidl::new_empty!(BlockInfo, D) }
742 }
743
744 #[inline]
745 unsafe fn decode(
746 &mut self,
747 decoder: &mut fidl::encoding::Decoder<'_, D>,
748 offset: usize,
749 _depth: fidl::encoding::Depth,
750 ) -> fidl::Result<()> {
751 decoder.debug_check_bounds::<Self>(offset);
752 fidl::decode!(BlockInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
754 Ok(())
755 }
756 }
757
758 impl fidl::encoding::ValueTypeMarker for BlockGetStatsResponse {
759 type Borrowed<'a> = &'a Self;
760 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
761 value
762 }
763 }
764
765 unsafe impl fidl::encoding::TypeMarker for BlockGetStatsResponse {
766 type Owned = Self;
767
768 #[inline(always)]
769 fn inline_align(_context: fidl::encoding::Context) -> usize {
770 8
771 }
772
773 #[inline(always)]
774 fn inline_size(_context: fidl::encoding::Context) -> usize {
775 320
776 }
777 #[inline(always)]
778 fn encode_is_copy() -> bool {
779 true
780 }
781
782 #[inline(always)]
783 fn decode_is_copy() -> bool {
784 true
785 }
786 }
787
788 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetStatsResponse, D>
789 for &BlockGetStatsResponse
790 {
791 #[inline]
792 unsafe fn encode(
793 self,
794 encoder: &mut fidl::encoding::Encoder<'_, D>,
795 offset: usize,
796 _depth: fidl::encoding::Depth,
797 ) -> fidl::Result<()> {
798 encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
799 unsafe {
800 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
802 (buf_ptr as *mut BlockGetStatsResponse)
803 .write_unaligned((self as *const BlockGetStatsResponse).read());
804 }
807 Ok(())
808 }
809 }
810 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockStats, D>>
811 fidl::encoding::Encode<BlockGetStatsResponse, D> for (T0,)
812 {
813 #[inline]
814 unsafe fn encode(
815 self,
816 encoder: &mut fidl::encoding::Encoder<'_, D>,
817 offset: usize,
818 depth: fidl::encoding::Depth,
819 ) -> fidl::Result<()> {
820 encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
821 self.0.encode(encoder, offset + 0, depth)?;
825 Ok(())
826 }
827 }
828
829 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetStatsResponse {
830 #[inline(always)]
831 fn new_empty() -> Self {
832 Self { stats: fidl::new_empty!(BlockStats, D) }
833 }
834
835 #[inline]
836 unsafe fn decode(
837 &mut self,
838 decoder: &mut fidl::encoding::Decoder<'_, D>,
839 offset: usize,
840 _depth: fidl::encoding::Depth,
841 ) -> fidl::Result<()> {
842 decoder.debug_check_bounds::<Self>(offset);
843 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
844 unsafe {
847 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
848 }
849 Ok(())
850 }
851 }
852
853 impl fidl::encoding::ValueTypeMarker for FtlFormatResponse {
854 type Borrowed<'a> = &'a Self;
855 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
856 value
857 }
858 }
859
860 unsafe impl fidl::encoding::TypeMarker for FtlFormatResponse {
861 type Owned = Self;
862
863 #[inline(always)]
864 fn inline_align(_context: fidl::encoding::Context) -> usize {
865 4
866 }
867
868 #[inline(always)]
869 fn inline_size(_context: fidl::encoding::Context) -> usize {
870 4
871 }
872 #[inline(always)]
873 fn encode_is_copy() -> bool {
874 true
875 }
876
877 #[inline(always)]
878 fn decode_is_copy() -> bool {
879 true
880 }
881 }
882
883 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FtlFormatResponse, D>
884 for &FtlFormatResponse
885 {
886 #[inline]
887 unsafe fn encode(
888 self,
889 encoder: &mut fidl::encoding::Encoder<'_, D>,
890 offset: usize,
891 _depth: fidl::encoding::Depth,
892 ) -> fidl::Result<()> {
893 encoder.debug_check_bounds::<FtlFormatResponse>(offset);
894 unsafe {
895 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
897 (buf_ptr as *mut FtlFormatResponse)
898 .write_unaligned((self as *const FtlFormatResponse).read());
899 }
902 Ok(())
903 }
904 }
905 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
906 fidl::encoding::Encode<FtlFormatResponse, D> for (T0,)
907 {
908 #[inline]
909 unsafe fn encode(
910 self,
911 encoder: &mut fidl::encoding::Encoder<'_, D>,
912 offset: usize,
913 depth: fidl::encoding::Depth,
914 ) -> fidl::Result<()> {
915 encoder.debug_check_bounds::<FtlFormatResponse>(offset);
916 self.0.encode(encoder, offset + 0, depth)?;
920 Ok(())
921 }
922 }
923
924 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FtlFormatResponse {
925 #[inline(always)]
926 fn new_empty() -> Self {
927 Self { status: fidl::new_empty!(i32, D) }
928 }
929
930 #[inline]
931 unsafe fn decode(
932 &mut self,
933 decoder: &mut fidl::encoding::Decoder<'_, D>,
934 offset: usize,
935 _depth: fidl::encoding::Depth,
936 ) -> fidl::Result<()> {
937 decoder.debug_check_bounds::<Self>(offset);
938 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
939 unsafe {
942 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
943 }
944 Ok(())
945 }
946 }
947
948 impl fidl::encoding::ValueTypeMarker for OffsetMapQueryRequest {
949 type Borrowed<'a> = &'a Self;
950 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
951 value
952 }
953 }
954
955 unsafe impl fidl::encoding::TypeMarker for OffsetMapQueryRequest {
956 type Owned = Self;
957
958 #[inline(always)]
959 fn inline_align(_context: fidl::encoding::Context) -> usize {
960 8
961 }
962
963 #[inline(always)]
964 fn inline_size(_context: fidl::encoding::Context) -> usize {
965 16
966 }
967 #[inline(always)]
968 fn encode_is_copy() -> bool {
969 true
970 }
971
972 #[inline(always)]
973 fn decode_is_copy() -> bool {
974 true
975 }
976 }
977
978 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OffsetMapQueryRequest, D>
979 for &OffsetMapQueryRequest
980 {
981 #[inline]
982 unsafe fn encode(
983 self,
984 encoder: &mut fidl::encoding::Encoder<'_, D>,
985 offset: usize,
986 _depth: fidl::encoding::Depth,
987 ) -> fidl::Result<()> {
988 encoder.debug_check_bounds::<OffsetMapQueryRequest>(offset);
989 unsafe {
990 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
992 (buf_ptr as *mut OffsetMapQueryRequest)
993 .write_unaligned((self as *const OffsetMapQueryRequest).read());
994 }
997 Ok(())
998 }
999 }
1000 unsafe impl<
1001 D: fidl::encoding::ResourceDialect,
1002 T0: fidl::encoding::Encode<u64, D>,
1003 T1: fidl::encoding::Encode<u64, D>,
1004 > fidl::encoding::Encode<OffsetMapQueryRequest, D> for (T0, T1)
1005 {
1006 #[inline]
1007 unsafe fn encode(
1008 self,
1009 encoder: &mut fidl::encoding::Encoder<'_, D>,
1010 offset: usize,
1011 depth: fidl::encoding::Depth,
1012 ) -> fidl::Result<()> {
1013 encoder.debug_check_bounds::<OffsetMapQueryRequest>(offset);
1014 self.0.encode(encoder, offset + 0, depth)?;
1018 self.1.encode(encoder, offset + 8, depth)?;
1019 Ok(())
1020 }
1021 }
1022
1023 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OffsetMapQueryRequest {
1024 #[inline(always)]
1025 fn new_empty() -> Self {
1026 Self { source_block_offset: fidl::new_empty!(u64, D), length: fidl::new_empty!(u64, D) }
1027 }
1028
1029 #[inline]
1030 unsafe fn decode(
1031 &mut self,
1032 decoder: &mut fidl::encoding::Decoder<'_, D>,
1033 offset: usize,
1034 _depth: fidl::encoding::Depth,
1035 ) -> fidl::Result<()> {
1036 decoder.debug_check_bounds::<Self>(offset);
1037 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1038 unsafe {
1041 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1042 }
1043 Ok(())
1044 }
1045 }
1046
1047 impl fidl::encoding::ValueTypeMarker for OffsetMapQueryResponse {
1048 type Borrowed<'a> = &'a Self;
1049 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1050 value
1051 }
1052 }
1053
1054 unsafe impl fidl::encoding::TypeMarker for OffsetMapQueryResponse {
1055 type Owned = Self;
1056
1057 #[inline(always)]
1058 fn inline_align(_context: fidl::encoding::Context) -> usize {
1059 8
1060 }
1061
1062 #[inline(always)]
1063 fn inline_size(_context: fidl::encoding::Context) -> usize {
1064 16
1065 }
1066 }
1067
1068 unsafe impl<D: fidl::encoding::ResourceDialect>
1069 fidl::encoding::Encode<OffsetMapQueryResponse, D> for &OffsetMapQueryResponse
1070 {
1071 #[inline]
1072 unsafe fn encode(
1073 self,
1074 encoder: &mut fidl::encoding::Encoder<'_, D>,
1075 offset: usize,
1076 _depth: fidl::encoding::Depth,
1077 ) -> fidl::Result<()> {
1078 encoder.debug_check_bounds::<OffsetMapQueryResponse>(offset);
1079 fidl::encoding::Encode::<OffsetMapQueryResponse, D>::encode(
1081 (
1082 <fidl::encoding::Vector<BlockOffsetMapping, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.mappings),
1083 ),
1084 encoder, offset, _depth
1085 )
1086 }
1087 }
1088 unsafe impl<
1089 D: fidl::encoding::ResourceDialect,
1090 T0: fidl::encoding::Encode<fidl::encoding::Vector<BlockOffsetMapping, 64>, D>,
1091 > fidl::encoding::Encode<OffsetMapQueryResponse, D> for (T0,)
1092 {
1093 #[inline]
1094 unsafe fn encode(
1095 self,
1096 encoder: &mut fidl::encoding::Encoder<'_, D>,
1097 offset: usize,
1098 depth: fidl::encoding::Depth,
1099 ) -> fidl::Result<()> {
1100 encoder.debug_check_bounds::<OffsetMapQueryResponse>(offset);
1101 self.0.encode(encoder, offset + 0, depth)?;
1105 Ok(())
1106 }
1107 }
1108
1109 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1110 for OffsetMapQueryResponse
1111 {
1112 #[inline(always)]
1113 fn new_empty() -> Self {
1114 Self { mappings: fidl::new_empty!(fidl::encoding::Vector<BlockOffsetMapping, 64>, D) }
1115 }
1116
1117 #[inline]
1118 unsafe fn decode(
1119 &mut self,
1120 decoder: &mut fidl::encoding::Decoder<'_, D>,
1121 offset: usize,
1122 _depth: fidl::encoding::Depth,
1123 ) -> fidl::Result<()> {
1124 decoder.debug_check_bounds::<Self>(offset);
1125 fidl::decode!(fidl::encoding::Vector<BlockOffsetMapping, 64>, D, &mut self.mappings, decoder, offset + 0, _depth)?;
1127 Ok(())
1128 }
1129 }
1130
1131 impl fidl::encoding::ValueTypeMarker for OperationStats {
1132 type Borrowed<'a> = &'a Self;
1133 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1134 value
1135 }
1136 }
1137
1138 unsafe impl fidl::encoding::TypeMarker for OperationStats {
1139 type Owned = Self;
1140
1141 #[inline(always)]
1142 fn inline_align(_context: fidl::encoding::Context) -> usize {
1143 8
1144 }
1145
1146 #[inline(always)]
1147 fn inline_size(_context: fidl::encoding::Context) -> usize {
1148 80
1149 }
1150 #[inline(always)]
1151 fn encode_is_copy() -> bool {
1152 true
1153 }
1154
1155 #[inline(always)]
1156 fn decode_is_copy() -> bool {
1157 true
1158 }
1159 }
1160
1161 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OperationStats, D>
1162 for &OperationStats
1163 {
1164 #[inline]
1165 unsafe fn encode(
1166 self,
1167 encoder: &mut fidl::encoding::Encoder<'_, D>,
1168 offset: usize,
1169 _depth: fidl::encoding::Depth,
1170 ) -> fidl::Result<()> {
1171 encoder.debug_check_bounds::<OperationStats>(offset);
1172 unsafe {
1173 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1175 (buf_ptr as *mut OperationStats)
1176 .write_unaligned((self as *const OperationStats).read());
1177 }
1180 Ok(())
1181 }
1182 }
1183 unsafe impl<
1184 D: fidl::encoding::ResourceDialect,
1185 T0: fidl::encoding::Encode<RequestStats, D>,
1186 T1: fidl::encoding::Encode<RequestStats, D>,
1187 > fidl::encoding::Encode<OperationStats, D> for (T0, T1)
1188 {
1189 #[inline]
1190 unsafe fn encode(
1191 self,
1192 encoder: &mut fidl::encoding::Encoder<'_, D>,
1193 offset: usize,
1194 depth: fidl::encoding::Depth,
1195 ) -> fidl::Result<()> {
1196 encoder.debug_check_bounds::<OperationStats>(offset);
1197 self.0.encode(encoder, offset + 0, depth)?;
1201 self.1.encode(encoder, offset + 40, depth)?;
1202 Ok(())
1203 }
1204 }
1205
1206 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OperationStats {
1207 #[inline(always)]
1208 fn new_empty() -> Self {
1209 Self {
1210 success: fidl::new_empty!(RequestStats, D),
1211 failure: fidl::new_empty!(RequestStats, D),
1212 }
1213 }
1214
1215 #[inline]
1216 unsafe fn decode(
1217 &mut self,
1218 decoder: &mut fidl::encoding::Decoder<'_, D>,
1219 offset: usize,
1220 _depth: fidl::encoding::Depth,
1221 ) -> fidl::Result<()> {
1222 decoder.debug_check_bounds::<Self>(offset);
1223 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1224 unsafe {
1227 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 80);
1228 }
1229 Ok(())
1230 }
1231 }
1232
1233 impl fidl::encoding::ValueTypeMarker for RequestStats {
1234 type Borrowed<'a> = &'a Self;
1235 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1236 value
1237 }
1238 }
1239
1240 unsafe impl fidl::encoding::TypeMarker for RequestStats {
1241 type Owned = Self;
1242
1243 #[inline(always)]
1244 fn inline_align(_context: fidl::encoding::Context) -> usize {
1245 8
1246 }
1247
1248 #[inline(always)]
1249 fn inline_size(_context: fidl::encoding::Context) -> usize {
1250 40
1251 }
1252 #[inline(always)]
1253 fn encode_is_copy() -> bool {
1254 true
1255 }
1256
1257 #[inline(always)]
1258 fn decode_is_copy() -> bool {
1259 true
1260 }
1261 }
1262
1263 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RequestStats, D>
1264 for &RequestStats
1265 {
1266 #[inline]
1267 unsafe fn encode(
1268 self,
1269 encoder: &mut fidl::encoding::Encoder<'_, D>,
1270 offset: usize,
1271 _depth: fidl::encoding::Depth,
1272 ) -> fidl::Result<()> {
1273 encoder.debug_check_bounds::<RequestStats>(offset);
1274 unsafe {
1275 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1277 (buf_ptr as *mut RequestStats)
1278 .write_unaligned((self as *const RequestStats).read());
1279 }
1282 Ok(())
1283 }
1284 }
1285 unsafe impl<
1286 D: fidl::encoding::ResourceDialect,
1287 T0: fidl::encoding::Encode<u64, D>,
1288 T1: fidl::encoding::Encode<u64, D>,
1289 T2: fidl::encoding::Encode<u64, D>,
1290 T3: fidl::encoding::Encode<u64, D>,
1291 T4: fidl::encoding::Encode<u64, D>,
1292 > fidl::encoding::Encode<RequestStats, D> for (T0, T1, T2, T3, T4)
1293 {
1294 #[inline]
1295 unsafe fn encode(
1296 self,
1297 encoder: &mut fidl::encoding::Encoder<'_, D>,
1298 offset: usize,
1299 depth: fidl::encoding::Depth,
1300 ) -> fidl::Result<()> {
1301 encoder.debug_check_bounds::<RequestStats>(offset);
1302 self.0.encode(encoder, offset + 0, depth)?;
1306 self.1.encode(encoder, offset + 8, depth)?;
1307 self.2.encode(encoder, offset + 16, depth)?;
1308 self.3.encode(encoder, offset + 24, depth)?;
1309 self.4.encode(encoder, offset + 32, depth)?;
1310 Ok(())
1311 }
1312 }
1313
1314 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequestStats {
1315 #[inline(always)]
1316 fn new_empty() -> Self {
1317 Self {
1318 minimum_latency: fidl::new_empty!(u64, D),
1319 maximum_latency: fidl::new_empty!(u64, D),
1320 total_time_spent: fidl::new_empty!(u64, D),
1321 total_calls: fidl::new_empty!(u64, D),
1322 bytes_transferred: fidl::new_empty!(u64, D),
1323 }
1324 }
1325
1326 #[inline]
1327 unsafe fn decode(
1328 &mut self,
1329 decoder: &mut fidl::encoding::Decoder<'_, D>,
1330 offset: usize,
1331 _depth: fidl::encoding::Depth,
1332 ) -> fidl::Result<()> {
1333 decoder.debug_check_bounds::<Self>(offset);
1334 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1335 unsafe {
1338 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
1339 }
1340 Ok(())
1341 }
1342 }
1343
1344 impl fidl::encoding::ValueTypeMarker for SessionAttachVmoResponse {
1345 type Borrowed<'a> = &'a Self;
1346 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1347 value
1348 }
1349 }
1350
1351 unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoResponse {
1352 type Owned = Self;
1353
1354 #[inline(always)]
1355 fn inline_align(_context: fidl::encoding::Context) -> usize {
1356 2
1357 }
1358
1359 #[inline(always)]
1360 fn inline_size(_context: fidl::encoding::Context) -> usize {
1361 2
1362 }
1363 #[inline(always)]
1364 fn encode_is_copy() -> bool {
1365 true
1366 }
1367
1368 #[inline(always)]
1369 fn decode_is_copy() -> bool {
1370 true
1371 }
1372 }
1373
1374 unsafe impl<D: fidl::encoding::ResourceDialect>
1375 fidl::encoding::Encode<SessionAttachVmoResponse, D> for &SessionAttachVmoResponse
1376 {
1377 #[inline]
1378 unsafe fn encode(
1379 self,
1380 encoder: &mut fidl::encoding::Encoder<'_, D>,
1381 offset: usize,
1382 _depth: fidl::encoding::Depth,
1383 ) -> fidl::Result<()> {
1384 encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
1385 unsafe {
1386 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1388 (buf_ptr as *mut SessionAttachVmoResponse)
1389 .write_unaligned((self as *const SessionAttachVmoResponse).read());
1390 }
1393 Ok(())
1394 }
1395 }
1396 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<VmoId, D>>
1397 fidl::encoding::Encode<SessionAttachVmoResponse, D> for (T0,)
1398 {
1399 #[inline]
1400 unsafe fn encode(
1401 self,
1402 encoder: &mut fidl::encoding::Encoder<'_, D>,
1403 offset: usize,
1404 depth: fidl::encoding::Depth,
1405 ) -> fidl::Result<()> {
1406 encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
1407 self.0.encode(encoder, offset + 0, depth)?;
1411 Ok(())
1412 }
1413 }
1414
1415 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1416 for SessionAttachVmoResponse
1417 {
1418 #[inline(always)]
1419 fn new_empty() -> Self {
1420 Self { vmoid: fidl::new_empty!(VmoId, D) }
1421 }
1422
1423 #[inline]
1424 unsafe fn decode(
1425 &mut self,
1426 decoder: &mut fidl::encoding::Decoder<'_, D>,
1427 offset: usize,
1428 _depth: fidl::encoding::Depth,
1429 ) -> fidl::Result<()> {
1430 decoder.debug_check_bounds::<Self>(offset);
1431 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1432 unsafe {
1435 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1436 }
1437 Ok(())
1438 }
1439 }
1440
1441 impl fidl::encoding::ValueTypeMarker for VmoId {
1442 type Borrowed<'a> = &'a Self;
1443 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1444 value
1445 }
1446 }
1447
1448 unsafe impl fidl::encoding::TypeMarker for VmoId {
1449 type Owned = Self;
1450
1451 #[inline(always)]
1452 fn inline_align(_context: fidl::encoding::Context) -> usize {
1453 2
1454 }
1455
1456 #[inline(always)]
1457 fn inline_size(_context: fidl::encoding::Context) -> usize {
1458 2
1459 }
1460 #[inline(always)]
1461 fn encode_is_copy() -> bool {
1462 true
1463 }
1464
1465 #[inline(always)]
1466 fn decode_is_copy() -> bool {
1467 true
1468 }
1469 }
1470
1471 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VmoId, D> for &VmoId {
1472 #[inline]
1473 unsafe fn encode(
1474 self,
1475 encoder: &mut fidl::encoding::Encoder<'_, D>,
1476 offset: usize,
1477 _depth: fidl::encoding::Depth,
1478 ) -> fidl::Result<()> {
1479 encoder.debug_check_bounds::<VmoId>(offset);
1480 unsafe {
1481 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1483 (buf_ptr as *mut VmoId).write_unaligned((self as *const VmoId).read());
1484 }
1487 Ok(())
1488 }
1489 }
1490 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
1491 fidl::encoding::Encode<VmoId, D> for (T0,)
1492 {
1493 #[inline]
1494 unsafe fn encode(
1495 self,
1496 encoder: &mut fidl::encoding::Encoder<'_, D>,
1497 offset: usize,
1498 depth: fidl::encoding::Depth,
1499 ) -> fidl::Result<()> {
1500 encoder.debug_check_bounds::<VmoId>(offset);
1501 self.0.encode(encoder, offset + 0, depth)?;
1505 Ok(())
1506 }
1507 }
1508
1509 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VmoId {
1510 #[inline(always)]
1511 fn new_empty() -> Self {
1512 Self { id: fidl::new_empty!(u16, D) }
1513 }
1514
1515 #[inline]
1516 unsafe fn decode(
1517 &mut self,
1518 decoder: &mut fidl::encoding::Decoder<'_, D>,
1519 offset: usize,
1520 _depth: fidl::encoding::Depth,
1521 ) -> fidl::Result<()> {
1522 decoder.debug_check_bounds::<Self>(offset);
1523 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1524 unsafe {
1527 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1528 }
1529 Ok(())
1530 }
1531 }
1532}