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 GUID_LEN: u32 = 16;
13
14pub const MAX_NAME_LENGTH: u32 = 32;
15
16bitflags! {
17 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
18 pub struct RamdiskFlag: u32 {
19 const RESUME_ON_WAKE = 1;
24 const DISCARD_NOT_FLUSHED_ON_WAKE = 2;
27 const DISCARD_RANDOM = 4;
31 }
32}
33
34impl RamdiskFlag {}
35
36#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37#[repr(C)]
38pub struct BlockWriteCounts {
39 pub received: u64,
40 pub successful: u64,
41 pub failed: u64,
42}
43
44impl fidl::Persistable for BlockWriteCounts {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49#[repr(C)]
50pub struct Guid {
51 pub value: [u8; 16],
52}
53
54impl fidl::Persistable for Guid {}
55
56#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct RamdiskControllerCreateRequest {
58 pub block_size: u64,
59 pub block_count: u64,
60 pub type_guid: Option<Box<Guid>>,
61}
62
63impl fidl::Persistable for RamdiskControllerCreateRequest {}
64
65#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct RamdiskControllerCreateFromVmoWithParamsResponse {
67 pub name: Option<String>,
68}
69
70impl fidl::Persistable for RamdiskControllerCreateFromVmoWithParamsResponse {}
71
72#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct RamdiskControllerCreateFromVmoResponse {
74 pub name: Option<String>,
75}
76
77impl fidl::Persistable for RamdiskControllerCreateFromVmoResponse {}
78
79#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80pub struct RamdiskControllerCreateResponse {
81 pub name: Option<String>,
82}
83
84impl fidl::Persistable for RamdiskControllerCreateResponse {}
85
86#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
87#[repr(C)]
88pub struct RamdiskGetBlockCountsResponse {
89 pub counts: BlockWriteCounts,
92}
93
94impl fidl::Persistable for RamdiskGetBlockCountsResponse {}
95
96#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct RamdiskSetFlagsRequest {
98 pub flags: RamdiskFlag,
99}
100
101impl fidl::Persistable for RamdiskSetFlagsRequest {}
102
103#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104#[repr(C)]
105pub struct RamdiskSleepAfterRequest {
106 pub count: u64,
107}
108
109impl fidl::Persistable for RamdiskSleepAfterRequest {}
110
111pub mod controller_ordinals {
112 pub const CREATE: u64 = 0x70c20e8a741fecb8;
113}
114
115pub mod ramdisk_ordinals {
116 pub const SET_FLAGS: u64 = 0x1ac23f463dc2c8de;
117 pub const WAKE: u64 = 0x1b2142ad9617bde4;
118 pub const SLEEP_AFTER: u64 = 0x38cafa087fbc1195;
119 pub const GET_BLOCK_COUNTS: u64 = 0x346b0058ac937682;
120}
121
122pub mod ramdisk_controller_ordinals {
123 pub const CREATE: u64 = 0x21cd800cc5ff7c3f;
124 pub const CREATE_FROM_VMO: u64 = 0x5d37434da8f680b4;
125 pub const CREATE_FROM_VMO_WITH_PARAMS: u64 = 0x776dd021e9e6677e;
126}
127
128mod internal {
129 use super::*;
130 unsafe impl fidl::encoding::TypeMarker for RamdiskFlag {
131 type Owned = Self;
132
133 #[inline(always)]
134 fn inline_align(_context: fidl::encoding::Context) -> usize {
135 4
136 }
137
138 #[inline(always)]
139 fn inline_size(_context: fidl::encoding::Context) -> usize {
140 4
141 }
142 }
143
144 impl fidl::encoding::ValueTypeMarker for RamdiskFlag {
145 type Borrowed<'a> = Self;
146 #[inline(always)]
147 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
148 *value
149 }
150 }
151
152 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RamdiskFlag {
153 #[inline]
154 unsafe fn encode(
155 self,
156 encoder: &mut fidl::encoding::Encoder<'_, D>,
157 offset: usize,
158 _depth: fidl::encoding::Depth,
159 ) -> fidl::Result<()> {
160 encoder.debug_check_bounds::<Self>(offset);
161 if self.bits() & Self::all().bits() != self.bits() {
162 return Err(fidl::Error::InvalidBitsValue);
163 }
164 encoder.write_num(self.bits(), offset);
165 Ok(())
166 }
167 }
168
169 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RamdiskFlag {
170 #[inline(always)]
171 fn new_empty() -> Self {
172 Self::empty()
173 }
174
175 #[inline]
176 unsafe fn decode(
177 &mut self,
178 decoder: &mut fidl::encoding::Decoder<'_, D>,
179 offset: usize,
180 _depth: fidl::encoding::Depth,
181 ) -> fidl::Result<()> {
182 decoder.debug_check_bounds::<Self>(offset);
183 let prim = decoder.read_num::<u32>(offset);
184 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
185 Ok(())
186 }
187 }
188
189 impl fidl::encoding::ValueTypeMarker for BlockWriteCounts {
190 type Borrowed<'a> = &'a Self;
191 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
192 value
193 }
194 }
195
196 unsafe impl fidl::encoding::TypeMarker for BlockWriteCounts {
197 type Owned = Self;
198
199 #[inline(always)]
200 fn inline_align(_context: fidl::encoding::Context) -> usize {
201 8
202 }
203
204 #[inline(always)]
205 fn inline_size(_context: fidl::encoding::Context) -> usize {
206 24
207 }
208 #[inline(always)]
209 fn encode_is_copy() -> bool {
210 true
211 }
212
213 #[inline(always)]
214 fn decode_is_copy() -> bool {
215 true
216 }
217 }
218
219 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockWriteCounts, D>
220 for &BlockWriteCounts
221 {
222 #[inline]
223 unsafe fn encode(
224 self,
225 encoder: &mut fidl::encoding::Encoder<'_, D>,
226 offset: usize,
227 _depth: fidl::encoding::Depth,
228 ) -> fidl::Result<()> {
229 encoder.debug_check_bounds::<BlockWriteCounts>(offset);
230 unsafe {
231 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
233 (buf_ptr as *mut BlockWriteCounts)
234 .write_unaligned((self as *const BlockWriteCounts).read());
235 }
238 Ok(())
239 }
240 }
241 unsafe impl<
242 D: fidl::encoding::ResourceDialect,
243 T0: fidl::encoding::Encode<u64, D>,
244 T1: fidl::encoding::Encode<u64, D>,
245 T2: fidl::encoding::Encode<u64, D>,
246 > fidl::encoding::Encode<BlockWriteCounts, D> for (T0, T1, T2)
247 {
248 #[inline]
249 unsafe fn encode(
250 self,
251 encoder: &mut fidl::encoding::Encoder<'_, D>,
252 offset: usize,
253 depth: fidl::encoding::Depth,
254 ) -> fidl::Result<()> {
255 encoder.debug_check_bounds::<BlockWriteCounts>(offset);
256 self.0.encode(encoder, offset + 0, depth)?;
260 self.1.encode(encoder, offset + 8, depth)?;
261 self.2.encode(encoder, offset + 16, depth)?;
262 Ok(())
263 }
264 }
265
266 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockWriteCounts {
267 #[inline(always)]
268 fn new_empty() -> Self {
269 Self {
270 received: fidl::new_empty!(u64, D),
271 successful: fidl::new_empty!(u64, D),
272 failed: fidl::new_empty!(u64, D),
273 }
274 }
275
276 #[inline]
277 unsafe fn decode(
278 &mut self,
279 decoder: &mut fidl::encoding::Decoder<'_, D>,
280 offset: usize,
281 _depth: fidl::encoding::Depth,
282 ) -> fidl::Result<()> {
283 decoder.debug_check_bounds::<Self>(offset);
284 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
285 unsafe {
288 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
289 }
290 Ok(())
291 }
292 }
293
294 impl fidl::encoding::ValueTypeMarker for Guid {
295 type Borrowed<'a> = &'a Self;
296 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
297 value
298 }
299 }
300
301 unsafe impl fidl::encoding::TypeMarker for Guid {
302 type Owned = Self;
303
304 #[inline(always)]
305 fn inline_align(_context: fidl::encoding::Context) -> usize {
306 1
307 }
308
309 #[inline(always)]
310 fn inline_size(_context: fidl::encoding::Context) -> usize {
311 16
312 }
313 #[inline(always)]
314 fn encode_is_copy() -> bool {
315 true
316 }
317
318 #[inline(always)]
319 fn decode_is_copy() -> bool {
320 true
321 }
322 }
323
324 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Guid, D> for &Guid {
325 #[inline]
326 unsafe fn encode(
327 self,
328 encoder: &mut fidl::encoding::Encoder<'_, D>,
329 offset: usize,
330 _depth: fidl::encoding::Depth,
331 ) -> fidl::Result<()> {
332 encoder.debug_check_bounds::<Guid>(offset);
333 unsafe {
334 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
336 (buf_ptr as *mut Guid).write_unaligned((self as *const Guid).read());
337 }
340 Ok(())
341 }
342 }
343 unsafe impl<
344 D: fidl::encoding::ResourceDialect,
345 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
346 > fidl::encoding::Encode<Guid, D> for (T0,)
347 {
348 #[inline]
349 unsafe fn encode(
350 self,
351 encoder: &mut fidl::encoding::Encoder<'_, D>,
352 offset: usize,
353 depth: fidl::encoding::Depth,
354 ) -> fidl::Result<()> {
355 encoder.debug_check_bounds::<Guid>(offset);
356 self.0.encode(encoder, offset + 0, depth)?;
360 Ok(())
361 }
362 }
363
364 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Guid {
365 #[inline(always)]
366 fn new_empty() -> Self {
367 Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
368 }
369
370 #[inline]
371 unsafe fn decode(
372 &mut self,
373 decoder: &mut fidl::encoding::Decoder<'_, D>,
374 offset: usize,
375 _depth: fidl::encoding::Depth,
376 ) -> fidl::Result<()> {
377 decoder.debug_check_bounds::<Self>(offset);
378 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
379 unsafe {
382 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
383 }
384 Ok(())
385 }
386 }
387
388 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateRequest {
389 type Borrowed<'a> = &'a Self;
390 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
391 value
392 }
393 }
394
395 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateRequest {
396 type Owned = Self;
397
398 #[inline(always)]
399 fn inline_align(_context: fidl::encoding::Context) -> usize {
400 8
401 }
402
403 #[inline(always)]
404 fn inline_size(_context: fidl::encoding::Context) -> usize {
405 24
406 }
407 }
408
409 unsafe impl<D: fidl::encoding::ResourceDialect>
410 fidl::encoding::Encode<RamdiskControllerCreateRequest, D>
411 for &RamdiskControllerCreateRequest
412 {
413 #[inline]
414 unsafe fn encode(
415 self,
416 encoder: &mut fidl::encoding::Encoder<'_, D>,
417 offset: usize,
418 _depth: fidl::encoding::Depth,
419 ) -> fidl::Result<()> {
420 encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
421 fidl::encoding::Encode::<RamdiskControllerCreateRequest, D>::encode(
423 (
424 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
425 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
426 <fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
427 &self.type_guid,
428 ),
429 ),
430 encoder,
431 offset,
432 _depth,
433 )
434 }
435 }
436 unsafe impl<
437 D: fidl::encoding::ResourceDialect,
438 T0: fidl::encoding::Encode<u64, D>,
439 T1: fidl::encoding::Encode<u64, D>,
440 T2: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>, D>,
441 > fidl::encoding::Encode<RamdiskControllerCreateRequest, D> for (T0, T1, T2)
442 {
443 #[inline]
444 unsafe fn encode(
445 self,
446 encoder: &mut fidl::encoding::Encoder<'_, D>,
447 offset: usize,
448 depth: fidl::encoding::Depth,
449 ) -> fidl::Result<()> {
450 encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
451 self.0.encode(encoder, offset + 0, depth)?;
455 self.1.encode(encoder, offset + 8, depth)?;
456 self.2.encode(encoder, offset + 16, depth)?;
457 Ok(())
458 }
459 }
460
461 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
462 for RamdiskControllerCreateRequest
463 {
464 #[inline(always)]
465 fn new_empty() -> Self {
466 Self {
467 block_size: fidl::new_empty!(u64, D),
468 block_count: fidl::new_empty!(u64, D),
469 type_guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>, D),
470 }
471 }
472
473 #[inline]
474 unsafe fn decode(
475 &mut self,
476 decoder: &mut fidl::encoding::Decoder<'_, D>,
477 offset: usize,
478 _depth: fidl::encoding::Depth,
479 ) -> fidl::Result<()> {
480 decoder.debug_check_bounds::<Self>(offset);
481 fidl::decode!(u64, D, &mut self.block_size, decoder, offset + 0, _depth)?;
483 fidl::decode!(u64, D, &mut self.block_count, decoder, offset + 8, _depth)?;
484 fidl::decode!(
485 fidl::encoding::Boxed<Guid>,
486 D,
487 &mut self.type_guid,
488 decoder,
489 offset + 16,
490 _depth
491 )?;
492 Ok(())
493 }
494 }
495
496 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
497 type Borrowed<'a> = &'a Self;
498 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
499 value
500 }
501 }
502
503 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
504 type Owned = Self;
505
506 #[inline(always)]
507 fn inline_align(_context: fidl::encoding::Context) -> usize {
508 8
509 }
510
511 #[inline(always)]
512 fn inline_size(_context: fidl::encoding::Context) -> usize {
513 16
514 }
515 }
516
517 unsafe impl<D: fidl::encoding::ResourceDialect>
518 fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D>
519 for &RamdiskControllerCreateFromVmoWithParamsResponse
520 {
521 #[inline]
522 unsafe fn encode(
523 self,
524 encoder: &mut fidl::encoding::Encoder<'_, D>,
525 offset: usize,
526 _depth: fidl::encoding::Depth,
527 ) -> fidl::Result<()> {
528 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
529 fidl::encoding::Encode::<RamdiskControllerCreateFromVmoWithParamsResponse, D>::encode(
531 (
532 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
533 ),
534 encoder, offset, _depth
535 )
536 }
537 }
538 unsafe impl<
539 D: fidl::encoding::ResourceDialect,
540 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
541 > fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D> for (T0,)
542 {
543 #[inline]
544 unsafe fn encode(
545 self,
546 encoder: &mut fidl::encoding::Encoder<'_, D>,
547 offset: usize,
548 depth: fidl::encoding::Depth,
549 ) -> fidl::Result<()> {
550 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
551 self.0.encode(encoder, offset + 0, depth)?;
555 Ok(())
556 }
557 }
558
559 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
560 for RamdiskControllerCreateFromVmoWithParamsResponse
561 {
562 #[inline(always)]
563 fn new_empty() -> Self {
564 Self {
565 name: fidl::new_empty!(
566 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
567 D
568 ),
569 }
570 }
571
572 #[inline]
573 unsafe fn decode(
574 &mut self,
575 decoder: &mut fidl::encoding::Decoder<'_, D>,
576 offset: usize,
577 _depth: fidl::encoding::Depth,
578 ) -> fidl::Result<()> {
579 decoder.debug_check_bounds::<Self>(offset);
580 fidl::decode!(
582 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
583 D,
584 &mut self.name,
585 decoder,
586 offset + 0,
587 _depth
588 )?;
589 Ok(())
590 }
591 }
592
593 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoResponse {
594 type Borrowed<'a> = &'a Self;
595 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
596 value
597 }
598 }
599
600 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoResponse {
601 type Owned = Self;
602
603 #[inline(always)]
604 fn inline_align(_context: fidl::encoding::Context) -> usize {
605 8
606 }
607
608 #[inline(always)]
609 fn inline_size(_context: fidl::encoding::Context) -> usize {
610 16
611 }
612 }
613
614 unsafe impl<D: fidl::encoding::ResourceDialect>
615 fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D>
616 for &RamdiskControllerCreateFromVmoResponse
617 {
618 #[inline]
619 unsafe fn encode(
620 self,
621 encoder: &mut fidl::encoding::Encoder<'_, D>,
622 offset: usize,
623 _depth: fidl::encoding::Depth,
624 ) -> fidl::Result<()> {
625 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
626 fidl::encoding::Encode::<RamdiskControllerCreateFromVmoResponse, D>::encode(
628 (
629 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
630 ),
631 encoder, offset, _depth
632 )
633 }
634 }
635 unsafe impl<
636 D: fidl::encoding::ResourceDialect,
637 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
638 > fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D> for (T0,)
639 {
640 #[inline]
641 unsafe fn encode(
642 self,
643 encoder: &mut fidl::encoding::Encoder<'_, D>,
644 offset: usize,
645 depth: fidl::encoding::Depth,
646 ) -> fidl::Result<()> {
647 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
648 self.0.encode(encoder, offset + 0, depth)?;
652 Ok(())
653 }
654 }
655
656 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
657 for RamdiskControllerCreateFromVmoResponse
658 {
659 #[inline(always)]
660 fn new_empty() -> Self {
661 Self {
662 name: fidl::new_empty!(
663 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
664 D
665 ),
666 }
667 }
668
669 #[inline]
670 unsafe fn decode(
671 &mut self,
672 decoder: &mut fidl::encoding::Decoder<'_, D>,
673 offset: usize,
674 _depth: fidl::encoding::Depth,
675 ) -> fidl::Result<()> {
676 decoder.debug_check_bounds::<Self>(offset);
677 fidl::decode!(
679 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
680 D,
681 &mut self.name,
682 decoder,
683 offset + 0,
684 _depth
685 )?;
686 Ok(())
687 }
688 }
689
690 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateResponse {
691 type Borrowed<'a> = &'a Self;
692 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
693 value
694 }
695 }
696
697 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateResponse {
698 type Owned = Self;
699
700 #[inline(always)]
701 fn inline_align(_context: fidl::encoding::Context) -> usize {
702 8
703 }
704
705 #[inline(always)]
706 fn inline_size(_context: fidl::encoding::Context) -> usize {
707 16
708 }
709 }
710
711 unsafe impl<D: fidl::encoding::ResourceDialect>
712 fidl::encoding::Encode<RamdiskControllerCreateResponse, D>
713 for &RamdiskControllerCreateResponse
714 {
715 #[inline]
716 unsafe fn encode(
717 self,
718 encoder: &mut fidl::encoding::Encoder<'_, D>,
719 offset: usize,
720 _depth: fidl::encoding::Depth,
721 ) -> fidl::Result<()> {
722 encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
723 fidl::encoding::Encode::<RamdiskControllerCreateResponse, D>::encode(
725 (
726 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
727 ),
728 encoder, offset, _depth
729 )
730 }
731 }
732 unsafe impl<
733 D: fidl::encoding::ResourceDialect,
734 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
735 > fidl::encoding::Encode<RamdiskControllerCreateResponse, D> for (T0,)
736 {
737 #[inline]
738 unsafe fn encode(
739 self,
740 encoder: &mut fidl::encoding::Encoder<'_, D>,
741 offset: usize,
742 depth: fidl::encoding::Depth,
743 ) -> fidl::Result<()> {
744 encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
745 self.0.encode(encoder, offset + 0, depth)?;
749 Ok(())
750 }
751 }
752
753 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
754 for RamdiskControllerCreateResponse
755 {
756 #[inline(always)]
757 fn new_empty() -> Self {
758 Self {
759 name: fidl::new_empty!(
760 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
761 D
762 ),
763 }
764 }
765
766 #[inline]
767 unsafe fn decode(
768 &mut self,
769 decoder: &mut fidl::encoding::Decoder<'_, D>,
770 offset: usize,
771 _depth: fidl::encoding::Depth,
772 ) -> fidl::Result<()> {
773 decoder.debug_check_bounds::<Self>(offset);
774 fidl::decode!(
776 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
777 D,
778 &mut self.name,
779 decoder,
780 offset + 0,
781 _depth
782 )?;
783 Ok(())
784 }
785 }
786
787 impl fidl::encoding::ValueTypeMarker for RamdiskGetBlockCountsResponse {
788 type Borrowed<'a> = &'a Self;
789 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
790 value
791 }
792 }
793
794 unsafe impl fidl::encoding::TypeMarker for RamdiskGetBlockCountsResponse {
795 type Owned = Self;
796
797 #[inline(always)]
798 fn inline_align(_context: fidl::encoding::Context) -> usize {
799 8
800 }
801
802 #[inline(always)]
803 fn inline_size(_context: fidl::encoding::Context) -> usize {
804 24
805 }
806 #[inline(always)]
807 fn encode_is_copy() -> bool {
808 true
809 }
810
811 #[inline(always)]
812 fn decode_is_copy() -> bool {
813 true
814 }
815 }
816
817 unsafe impl<D: fidl::encoding::ResourceDialect>
818 fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D>
819 for &RamdiskGetBlockCountsResponse
820 {
821 #[inline]
822 unsafe fn encode(
823 self,
824 encoder: &mut fidl::encoding::Encoder<'_, D>,
825 offset: usize,
826 _depth: fidl::encoding::Depth,
827 ) -> fidl::Result<()> {
828 encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
829 unsafe {
830 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
832 (buf_ptr as *mut RamdiskGetBlockCountsResponse)
833 .write_unaligned((self as *const RamdiskGetBlockCountsResponse).read());
834 }
837 Ok(())
838 }
839 }
840 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockWriteCounts, D>>
841 fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D> for (T0,)
842 {
843 #[inline]
844 unsafe fn encode(
845 self,
846 encoder: &mut fidl::encoding::Encoder<'_, D>,
847 offset: usize,
848 depth: fidl::encoding::Depth,
849 ) -> fidl::Result<()> {
850 encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
851 self.0.encode(encoder, offset + 0, depth)?;
855 Ok(())
856 }
857 }
858
859 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
860 for RamdiskGetBlockCountsResponse
861 {
862 #[inline(always)]
863 fn new_empty() -> Self {
864 Self { counts: fidl::new_empty!(BlockWriteCounts, D) }
865 }
866
867 #[inline]
868 unsafe fn decode(
869 &mut self,
870 decoder: &mut fidl::encoding::Decoder<'_, D>,
871 offset: usize,
872 _depth: fidl::encoding::Depth,
873 ) -> fidl::Result<()> {
874 decoder.debug_check_bounds::<Self>(offset);
875 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
876 unsafe {
879 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
880 }
881 Ok(())
882 }
883 }
884
885 impl fidl::encoding::ValueTypeMarker for RamdiskSetFlagsRequest {
886 type Borrowed<'a> = &'a Self;
887 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
888 value
889 }
890 }
891
892 unsafe impl fidl::encoding::TypeMarker for RamdiskSetFlagsRequest {
893 type Owned = Self;
894
895 #[inline(always)]
896 fn inline_align(_context: fidl::encoding::Context) -> usize {
897 4
898 }
899
900 #[inline(always)]
901 fn inline_size(_context: fidl::encoding::Context) -> usize {
902 4
903 }
904 }
905
906 unsafe impl<D: fidl::encoding::ResourceDialect>
907 fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for &RamdiskSetFlagsRequest
908 {
909 #[inline]
910 unsafe fn encode(
911 self,
912 encoder: &mut fidl::encoding::Encoder<'_, D>,
913 offset: usize,
914 _depth: fidl::encoding::Depth,
915 ) -> fidl::Result<()> {
916 encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
917 fidl::encoding::Encode::<RamdiskSetFlagsRequest, D>::encode(
919 (<RamdiskFlag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
920 encoder,
921 offset,
922 _depth,
923 )
924 }
925 }
926 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RamdiskFlag, D>>
927 fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for (T0,)
928 {
929 #[inline]
930 unsafe fn encode(
931 self,
932 encoder: &mut fidl::encoding::Encoder<'_, D>,
933 offset: usize,
934 depth: fidl::encoding::Depth,
935 ) -> fidl::Result<()> {
936 encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
937 self.0.encode(encoder, offset + 0, depth)?;
941 Ok(())
942 }
943 }
944
945 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
946 for RamdiskSetFlagsRequest
947 {
948 #[inline(always)]
949 fn new_empty() -> Self {
950 Self { flags: fidl::new_empty!(RamdiskFlag, D) }
951 }
952
953 #[inline]
954 unsafe fn decode(
955 &mut self,
956 decoder: &mut fidl::encoding::Decoder<'_, D>,
957 offset: usize,
958 _depth: fidl::encoding::Depth,
959 ) -> fidl::Result<()> {
960 decoder.debug_check_bounds::<Self>(offset);
961 fidl::decode!(RamdiskFlag, D, &mut self.flags, decoder, offset + 0, _depth)?;
963 Ok(())
964 }
965 }
966
967 impl fidl::encoding::ValueTypeMarker for RamdiskSleepAfterRequest {
968 type Borrowed<'a> = &'a Self;
969 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
970 value
971 }
972 }
973
974 unsafe impl fidl::encoding::TypeMarker for RamdiskSleepAfterRequest {
975 type Owned = Self;
976
977 #[inline(always)]
978 fn inline_align(_context: fidl::encoding::Context) -> usize {
979 8
980 }
981
982 #[inline(always)]
983 fn inline_size(_context: fidl::encoding::Context) -> usize {
984 8
985 }
986 #[inline(always)]
987 fn encode_is_copy() -> bool {
988 true
989 }
990
991 #[inline(always)]
992 fn decode_is_copy() -> bool {
993 true
994 }
995 }
996
997 unsafe impl<D: fidl::encoding::ResourceDialect>
998 fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for &RamdiskSleepAfterRequest
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::<RamdiskSleepAfterRequest>(offset);
1008 unsafe {
1009 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1011 (buf_ptr as *mut RamdiskSleepAfterRequest)
1012 .write_unaligned((self as *const RamdiskSleepAfterRequest).read());
1013 }
1016 Ok(())
1017 }
1018 }
1019 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1020 fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for (T0,)
1021 {
1022 #[inline]
1023 unsafe fn encode(
1024 self,
1025 encoder: &mut fidl::encoding::Encoder<'_, D>,
1026 offset: usize,
1027 depth: fidl::encoding::Depth,
1028 ) -> fidl::Result<()> {
1029 encoder.debug_check_bounds::<RamdiskSleepAfterRequest>(offset);
1030 self.0.encode(encoder, offset + 0, depth)?;
1034 Ok(())
1035 }
1036 }
1037
1038 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1039 for RamdiskSleepAfterRequest
1040 {
1041 #[inline(always)]
1042 fn new_empty() -> Self {
1043 Self { count: fidl::new_empty!(u64, D) }
1044 }
1045
1046 #[inline]
1047 unsafe fn decode(
1048 &mut self,
1049 decoder: &mut fidl::encoding::Decoder<'_, D>,
1050 offset: usize,
1051 _depth: fidl::encoding::Depth,
1052 ) -> fidl::Result<()> {
1053 decoder.debug_check_bounds::<Self>(offset);
1054 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1055 unsafe {
1058 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1059 }
1060 Ok(())
1061 }
1062 }
1063}