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
111mod internal {
112 use super::*;
113 unsafe impl fidl::encoding::TypeMarker for RamdiskFlag {
114 type Owned = Self;
115
116 #[inline(always)]
117 fn inline_align(_context: fidl::encoding::Context) -> usize {
118 4
119 }
120
121 #[inline(always)]
122 fn inline_size(_context: fidl::encoding::Context) -> usize {
123 4
124 }
125 }
126
127 impl fidl::encoding::ValueTypeMarker for RamdiskFlag {
128 type Borrowed<'a> = Self;
129 #[inline(always)]
130 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
131 *value
132 }
133 }
134
135 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RamdiskFlag {
136 #[inline]
137 unsafe fn encode(
138 self,
139 encoder: &mut fidl::encoding::Encoder<'_, D>,
140 offset: usize,
141 _depth: fidl::encoding::Depth,
142 ) -> fidl::Result<()> {
143 encoder.debug_check_bounds::<Self>(offset);
144 if self.bits() & Self::all().bits() != self.bits() {
145 return Err(fidl::Error::InvalidBitsValue);
146 }
147 encoder.write_num(self.bits(), offset);
148 Ok(())
149 }
150 }
151
152 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RamdiskFlag {
153 #[inline(always)]
154 fn new_empty() -> Self {
155 Self::empty()
156 }
157
158 #[inline]
159 unsafe fn decode(
160 &mut self,
161 decoder: &mut fidl::encoding::Decoder<'_, D>,
162 offset: usize,
163 _depth: fidl::encoding::Depth,
164 ) -> fidl::Result<()> {
165 decoder.debug_check_bounds::<Self>(offset);
166 let prim = decoder.read_num::<u32>(offset);
167 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
168 Ok(())
169 }
170 }
171
172 impl fidl::encoding::ValueTypeMarker for BlockWriteCounts {
173 type Borrowed<'a> = &'a Self;
174 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
175 value
176 }
177 }
178
179 unsafe impl fidl::encoding::TypeMarker for BlockWriteCounts {
180 type Owned = Self;
181
182 #[inline(always)]
183 fn inline_align(_context: fidl::encoding::Context) -> usize {
184 8
185 }
186
187 #[inline(always)]
188 fn inline_size(_context: fidl::encoding::Context) -> usize {
189 24
190 }
191 #[inline(always)]
192 fn encode_is_copy() -> bool {
193 true
194 }
195
196 #[inline(always)]
197 fn decode_is_copy() -> bool {
198 true
199 }
200 }
201
202 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockWriteCounts, D>
203 for &BlockWriteCounts
204 {
205 #[inline]
206 unsafe fn encode(
207 self,
208 encoder: &mut fidl::encoding::Encoder<'_, D>,
209 offset: usize,
210 _depth: fidl::encoding::Depth,
211 ) -> fidl::Result<()> {
212 encoder.debug_check_bounds::<BlockWriteCounts>(offset);
213 unsafe {
214 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
216 (buf_ptr as *mut BlockWriteCounts)
217 .write_unaligned((self as *const BlockWriteCounts).read());
218 }
221 Ok(())
222 }
223 }
224 unsafe impl<
225 D: fidl::encoding::ResourceDialect,
226 T0: fidl::encoding::Encode<u64, D>,
227 T1: fidl::encoding::Encode<u64, D>,
228 T2: fidl::encoding::Encode<u64, D>,
229 > fidl::encoding::Encode<BlockWriteCounts, D> for (T0, T1, T2)
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::<BlockWriteCounts>(offset);
239 self.0.encode(encoder, offset + 0, depth)?;
243 self.1.encode(encoder, offset + 8, depth)?;
244 self.2.encode(encoder, offset + 16, depth)?;
245 Ok(())
246 }
247 }
248
249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockWriteCounts {
250 #[inline(always)]
251 fn new_empty() -> Self {
252 Self {
253 received: fidl::new_empty!(u64, D),
254 successful: fidl::new_empty!(u64, D),
255 failed: fidl::new_empty!(u64, D),
256 }
257 }
258
259 #[inline]
260 unsafe fn decode(
261 &mut self,
262 decoder: &mut fidl::encoding::Decoder<'_, D>,
263 offset: usize,
264 _depth: fidl::encoding::Depth,
265 ) -> fidl::Result<()> {
266 decoder.debug_check_bounds::<Self>(offset);
267 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
268 unsafe {
271 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
272 }
273 Ok(())
274 }
275 }
276
277 impl fidl::encoding::ValueTypeMarker for Guid {
278 type Borrowed<'a> = &'a Self;
279 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
280 value
281 }
282 }
283
284 unsafe impl fidl::encoding::TypeMarker for Guid {
285 type Owned = Self;
286
287 #[inline(always)]
288 fn inline_align(_context: fidl::encoding::Context) -> usize {
289 1
290 }
291
292 #[inline(always)]
293 fn inline_size(_context: fidl::encoding::Context) -> usize {
294 16
295 }
296 #[inline(always)]
297 fn encode_is_copy() -> bool {
298 true
299 }
300
301 #[inline(always)]
302 fn decode_is_copy() -> bool {
303 true
304 }
305 }
306
307 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Guid, D> for &Guid {
308 #[inline]
309 unsafe fn encode(
310 self,
311 encoder: &mut fidl::encoding::Encoder<'_, D>,
312 offset: usize,
313 _depth: fidl::encoding::Depth,
314 ) -> fidl::Result<()> {
315 encoder.debug_check_bounds::<Guid>(offset);
316 unsafe {
317 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
319 (buf_ptr as *mut Guid).write_unaligned((self as *const Guid).read());
320 }
323 Ok(())
324 }
325 }
326 unsafe impl<
327 D: fidl::encoding::ResourceDialect,
328 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
329 > fidl::encoding::Encode<Guid, D> for (T0,)
330 {
331 #[inline]
332 unsafe fn encode(
333 self,
334 encoder: &mut fidl::encoding::Encoder<'_, D>,
335 offset: usize,
336 depth: fidl::encoding::Depth,
337 ) -> fidl::Result<()> {
338 encoder.debug_check_bounds::<Guid>(offset);
339 self.0.encode(encoder, offset + 0, depth)?;
343 Ok(())
344 }
345 }
346
347 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Guid {
348 #[inline(always)]
349 fn new_empty() -> Self {
350 Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
351 }
352
353 #[inline]
354 unsafe fn decode(
355 &mut self,
356 decoder: &mut fidl::encoding::Decoder<'_, D>,
357 offset: usize,
358 _depth: fidl::encoding::Depth,
359 ) -> fidl::Result<()> {
360 decoder.debug_check_bounds::<Self>(offset);
361 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
362 unsafe {
365 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
366 }
367 Ok(())
368 }
369 }
370
371 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateRequest {
372 type Borrowed<'a> = &'a Self;
373 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
374 value
375 }
376 }
377
378 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateRequest {
379 type Owned = Self;
380
381 #[inline(always)]
382 fn inline_align(_context: fidl::encoding::Context) -> usize {
383 8
384 }
385
386 #[inline(always)]
387 fn inline_size(_context: fidl::encoding::Context) -> usize {
388 24
389 }
390 }
391
392 unsafe impl<D: fidl::encoding::ResourceDialect>
393 fidl::encoding::Encode<RamdiskControllerCreateRequest, D>
394 for &RamdiskControllerCreateRequest
395 {
396 #[inline]
397 unsafe fn encode(
398 self,
399 encoder: &mut fidl::encoding::Encoder<'_, D>,
400 offset: usize,
401 _depth: fidl::encoding::Depth,
402 ) -> fidl::Result<()> {
403 encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
404 fidl::encoding::Encode::<RamdiskControllerCreateRequest, D>::encode(
406 (
407 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
408 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
409 <fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
410 &self.type_guid,
411 ),
412 ),
413 encoder,
414 offset,
415 _depth,
416 )
417 }
418 }
419 unsafe impl<
420 D: fidl::encoding::ResourceDialect,
421 T0: fidl::encoding::Encode<u64, D>,
422 T1: fidl::encoding::Encode<u64, D>,
423 T2: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>, D>,
424 > fidl::encoding::Encode<RamdiskControllerCreateRequest, D> for (T0, T1, T2)
425 {
426 #[inline]
427 unsafe fn encode(
428 self,
429 encoder: &mut fidl::encoding::Encoder<'_, D>,
430 offset: usize,
431 depth: fidl::encoding::Depth,
432 ) -> fidl::Result<()> {
433 encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
434 self.0.encode(encoder, offset + 0, depth)?;
438 self.1.encode(encoder, offset + 8, depth)?;
439 self.2.encode(encoder, offset + 16, depth)?;
440 Ok(())
441 }
442 }
443
444 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
445 for RamdiskControllerCreateRequest
446 {
447 #[inline(always)]
448 fn new_empty() -> Self {
449 Self {
450 block_size: fidl::new_empty!(u64, D),
451 block_count: fidl::new_empty!(u64, D),
452 type_guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>, D),
453 }
454 }
455
456 #[inline]
457 unsafe fn decode(
458 &mut self,
459 decoder: &mut fidl::encoding::Decoder<'_, D>,
460 offset: usize,
461 _depth: fidl::encoding::Depth,
462 ) -> fidl::Result<()> {
463 decoder.debug_check_bounds::<Self>(offset);
464 fidl::decode!(u64, D, &mut self.block_size, decoder, offset + 0, _depth)?;
466 fidl::decode!(u64, D, &mut self.block_count, decoder, offset + 8, _depth)?;
467 fidl::decode!(
468 fidl::encoding::Boxed<Guid>,
469 D,
470 &mut self.type_guid,
471 decoder,
472 offset + 16,
473 _depth
474 )?;
475 Ok(())
476 }
477 }
478
479 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
480 type Borrowed<'a> = &'a Self;
481 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
482 value
483 }
484 }
485
486 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
487 type Owned = Self;
488
489 #[inline(always)]
490 fn inline_align(_context: fidl::encoding::Context) -> usize {
491 8
492 }
493
494 #[inline(always)]
495 fn inline_size(_context: fidl::encoding::Context) -> usize {
496 16
497 }
498 }
499
500 unsafe impl<D: fidl::encoding::ResourceDialect>
501 fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D>
502 for &RamdiskControllerCreateFromVmoWithParamsResponse
503 {
504 #[inline]
505 unsafe fn encode(
506 self,
507 encoder: &mut fidl::encoding::Encoder<'_, D>,
508 offset: usize,
509 _depth: fidl::encoding::Depth,
510 ) -> fidl::Result<()> {
511 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
512 fidl::encoding::Encode::<RamdiskControllerCreateFromVmoWithParamsResponse, D>::encode(
514 (
515 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
516 ),
517 encoder, offset, _depth
518 )
519 }
520 }
521 unsafe impl<
522 D: fidl::encoding::ResourceDialect,
523 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
524 > fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D> for (T0,)
525 {
526 #[inline]
527 unsafe fn encode(
528 self,
529 encoder: &mut fidl::encoding::Encoder<'_, D>,
530 offset: usize,
531 depth: fidl::encoding::Depth,
532 ) -> fidl::Result<()> {
533 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
534 self.0.encode(encoder, offset + 0, depth)?;
538 Ok(())
539 }
540 }
541
542 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
543 for RamdiskControllerCreateFromVmoWithParamsResponse
544 {
545 #[inline(always)]
546 fn new_empty() -> Self {
547 Self {
548 name: fidl::new_empty!(
549 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
550 D
551 ),
552 }
553 }
554
555 #[inline]
556 unsafe fn decode(
557 &mut self,
558 decoder: &mut fidl::encoding::Decoder<'_, D>,
559 offset: usize,
560 _depth: fidl::encoding::Depth,
561 ) -> fidl::Result<()> {
562 decoder.debug_check_bounds::<Self>(offset);
563 fidl::decode!(
565 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
566 D,
567 &mut self.name,
568 decoder,
569 offset + 0,
570 _depth
571 )?;
572 Ok(())
573 }
574 }
575
576 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoResponse {
577 type Borrowed<'a> = &'a Self;
578 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
579 value
580 }
581 }
582
583 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoResponse {
584 type Owned = Self;
585
586 #[inline(always)]
587 fn inline_align(_context: fidl::encoding::Context) -> usize {
588 8
589 }
590
591 #[inline(always)]
592 fn inline_size(_context: fidl::encoding::Context) -> usize {
593 16
594 }
595 }
596
597 unsafe impl<D: fidl::encoding::ResourceDialect>
598 fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D>
599 for &RamdiskControllerCreateFromVmoResponse
600 {
601 #[inline]
602 unsafe fn encode(
603 self,
604 encoder: &mut fidl::encoding::Encoder<'_, D>,
605 offset: usize,
606 _depth: fidl::encoding::Depth,
607 ) -> fidl::Result<()> {
608 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
609 fidl::encoding::Encode::<RamdiskControllerCreateFromVmoResponse, D>::encode(
611 (
612 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
613 ),
614 encoder, offset, _depth
615 )
616 }
617 }
618 unsafe impl<
619 D: fidl::encoding::ResourceDialect,
620 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
621 > fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D> for (T0,)
622 {
623 #[inline]
624 unsafe fn encode(
625 self,
626 encoder: &mut fidl::encoding::Encoder<'_, D>,
627 offset: usize,
628 depth: fidl::encoding::Depth,
629 ) -> fidl::Result<()> {
630 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
631 self.0.encode(encoder, offset + 0, depth)?;
635 Ok(())
636 }
637 }
638
639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
640 for RamdiskControllerCreateFromVmoResponse
641 {
642 #[inline(always)]
643 fn new_empty() -> Self {
644 Self {
645 name: fidl::new_empty!(
646 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
647 D
648 ),
649 }
650 }
651
652 #[inline]
653 unsafe fn decode(
654 &mut self,
655 decoder: &mut fidl::encoding::Decoder<'_, D>,
656 offset: usize,
657 _depth: fidl::encoding::Depth,
658 ) -> fidl::Result<()> {
659 decoder.debug_check_bounds::<Self>(offset);
660 fidl::decode!(
662 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
663 D,
664 &mut self.name,
665 decoder,
666 offset + 0,
667 _depth
668 )?;
669 Ok(())
670 }
671 }
672
673 impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateResponse {
674 type Borrowed<'a> = &'a Self;
675 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
676 value
677 }
678 }
679
680 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateResponse {
681 type Owned = Self;
682
683 #[inline(always)]
684 fn inline_align(_context: fidl::encoding::Context) -> usize {
685 8
686 }
687
688 #[inline(always)]
689 fn inline_size(_context: fidl::encoding::Context) -> usize {
690 16
691 }
692 }
693
694 unsafe impl<D: fidl::encoding::ResourceDialect>
695 fidl::encoding::Encode<RamdiskControllerCreateResponse, D>
696 for &RamdiskControllerCreateResponse
697 {
698 #[inline]
699 unsafe fn encode(
700 self,
701 encoder: &mut fidl::encoding::Encoder<'_, D>,
702 offset: usize,
703 _depth: fidl::encoding::Depth,
704 ) -> fidl::Result<()> {
705 encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
706 fidl::encoding::Encode::<RamdiskControllerCreateResponse, D>::encode(
708 (
709 <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
710 ),
711 encoder, offset, _depth
712 )
713 }
714 }
715 unsafe impl<
716 D: fidl::encoding::ResourceDialect,
717 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
718 > fidl::encoding::Encode<RamdiskControllerCreateResponse, D> for (T0,)
719 {
720 #[inline]
721 unsafe fn encode(
722 self,
723 encoder: &mut fidl::encoding::Encoder<'_, D>,
724 offset: usize,
725 depth: fidl::encoding::Depth,
726 ) -> fidl::Result<()> {
727 encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
728 self.0.encode(encoder, offset + 0, depth)?;
732 Ok(())
733 }
734 }
735
736 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
737 for RamdiskControllerCreateResponse
738 {
739 #[inline(always)]
740 fn new_empty() -> Self {
741 Self {
742 name: fidl::new_empty!(
743 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
744 D
745 ),
746 }
747 }
748
749 #[inline]
750 unsafe fn decode(
751 &mut self,
752 decoder: &mut fidl::encoding::Decoder<'_, D>,
753 offset: usize,
754 _depth: fidl::encoding::Depth,
755 ) -> fidl::Result<()> {
756 decoder.debug_check_bounds::<Self>(offset);
757 fidl::decode!(
759 fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
760 D,
761 &mut self.name,
762 decoder,
763 offset + 0,
764 _depth
765 )?;
766 Ok(())
767 }
768 }
769
770 impl fidl::encoding::ValueTypeMarker for RamdiskGetBlockCountsResponse {
771 type Borrowed<'a> = &'a Self;
772 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
773 value
774 }
775 }
776
777 unsafe impl fidl::encoding::TypeMarker for RamdiskGetBlockCountsResponse {
778 type Owned = Self;
779
780 #[inline(always)]
781 fn inline_align(_context: fidl::encoding::Context) -> usize {
782 8
783 }
784
785 #[inline(always)]
786 fn inline_size(_context: fidl::encoding::Context) -> usize {
787 24
788 }
789 #[inline(always)]
790 fn encode_is_copy() -> bool {
791 true
792 }
793
794 #[inline(always)]
795 fn decode_is_copy() -> bool {
796 true
797 }
798 }
799
800 unsafe impl<D: fidl::encoding::ResourceDialect>
801 fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D>
802 for &RamdiskGetBlockCountsResponse
803 {
804 #[inline]
805 unsafe fn encode(
806 self,
807 encoder: &mut fidl::encoding::Encoder<'_, D>,
808 offset: usize,
809 _depth: fidl::encoding::Depth,
810 ) -> fidl::Result<()> {
811 encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
812 unsafe {
813 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
815 (buf_ptr as *mut RamdiskGetBlockCountsResponse)
816 .write_unaligned((self as *const RamdiskGetBlockCountsResponse).read());
817 }
820 Ok(())
821 }
822 }
823 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockWriteCounts, D>>
824 fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D> for (T0,)
825 {
826 #[inline]
827 unsafe fn encode(
828 self,
829 encoder: &mut fidl::encoding::Encoder<'_, D>,
830 offset: usize,
831 depth: fidl::encoding::Depth,
832 ) -> fidl::Result<()> {
833 encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
834 self.0.encode(encoder, offset + 0, depth)?;
838 Ok(())
839 }
840 }
841
842 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
843 for RamdiskGetBlockCountsResponse
844 {
845 #[inline(always)]
846 fn new_empty() -> Self {
847 Self { counts: fidl::new_empty!(BlockWriteCounts, D) }
848 }
849
850 #[inline]
851 unsafe fn decode(
852 &mut self,
853 decoder: &mut fidl::encoding::Decoder<'_, D>,
854 offset: usize,
855 _depth: fidl::encoding::Depth,
856 ) -> fidl::Result<()> {
857 decoder.debug_check_bounds::<Self>(offset);
858 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
859 unsafe {
862 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
863 }
864 Ok(())
865 }
866 }
867
868 impl fidl::encoding::ValueTypeMarker for RamdiskSetFlagsRequest {
869 type Borrowed<'a> = &'a Self;
870 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
871 value
872 }
873 }
874
875 unsafe impl fidl::encoding::TypeMarker for RamdiskSetFlagsRequest {
876 type Owned = Self;
877
878 #[inline(always)]
879 fn inline_align(_context: fidl::encoding::Context) -> usize {
880 4
881 }
882
883 #[inline(always)]
884 fn inline_size(_context: fidl::encoding::Context) -> usize {
885 4
886 }
887 }
888
889 unsafe impl<D: fidl::encoding::ResourceDialect>
890 fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for &RamdiskSetFlagsRequest
891 {
892 #[inline]
893 unsafe fn encode(
894 self,
895 encoder: &mut fidl::encoding::Encoder<'_, D>,
896 offset: usize,
897 _depth: fidl::encoding::Depth,
898 ) -> fidl::Result<()> {
899 encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
900 fidl::encoding::Encode::<RamdiskSetFlagsRequest, D>::encode(
902 (<RamdiskFlag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
903 encoder,
904 offset,
905 _depth,
906 )
907 }
908 }
909 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RamdiskFlag, D>>
910 fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for (T0,)
911 {
912 #[inline]
913 unsafe fn encode(
914 self,
915 encoder: &mut fidl::encoding::Encoder<'_, D>,
916 offset: usize,
917 depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
920 self.0.encode(encoder, offset + 0, depth)?;
924 Ok(())
925 }
926 }
927
928 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
929 for RamdiskSetFlagsRequest
930 {
931 #[inline(always)]
932 fn new_empty() -> Self {
933 Self { flags: fidl::new_empty!(RamdiskFlag, D) }
934 }
935
936 #[inline]
937 unsafe fn decode(
938 &mut self,
939 decoder: &mut fidl::encoding::Decoder<'_, D>,
940 offset: usize,
941 _depth: fidl::encoding::Depth,
942 ) -> fidl::Result<()> {
943 decoder.debug_check_bounds::<Self>(offset);
944 fidl::decode!(RamdiskFlag, D, &mut self.flags, decoder, offset + 0, _depth)?;
946 Ok(())
947 }
948 }
949
950 impl fidl::encoding::ValueTypeMarker for RamdiskSleepAfterRequest {
951 type Borrowed<'a> = &'a Self;
952 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
953 value
954 }
955 }
956
957 unsafe impl fidl::encoding::TypeMarker for RamdiskSleepAfterRequest {
958 type Owned = Self;
959
960 #[inline(always)]
961 fn inline_align(_context: fidl::encoding::Context) -> usize {
962 8
963 }
964
965 #[inline(always)]
966 fn inline_size(_context: fidl::encoding::Context) -> usize {
967 8
968 }
969 #[inline(always)]
970 fn encode_is_copy() -> bool {
971 true
972 }
973
974 #[inline(always)]
975 fn decode_is_copy() -> bool {
976 true
977 }
978 }
979
980 unsafe impl<D: fidl::encoding::ResourceDialect>
981 fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for &RamdiskSleepAfterRequest
982 {
983 #[inline]
984 unsafe fn encode(
985 self,
986 encoder: &mut fidl::encoding::Encoder<'_, D>,
987 offset: usize,
988 _depth: fidl::encoding::Depth,
989 ) -> fidl::Result<()> {
990 encoder.debug_check_bounds::<RamdiskSleepAfterRequest>(offset);
991 unsafe {
992 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
994 (buf_ptr as *mut RamdiskSleepAfterRequest)
995 .write_unaligned((self as *const RamdiskSleepAfterRequest).read());
996 }
999 Ok(())
1000 }
1001 }
1002 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1003 fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for (T0,)
1004 {
1005 #[inline]
1006 unsafe fn encode(
1007 self,
1008 encoder: &mut fidl::encoding::Encoder<'_, D>,
1009 offset: usize,
1010 depth: fidl::encoding::Depth,
1011 ) -> fidl::Result<()> {
1012 encoder.debug_check_bounds::<RamdiskSleepAfterRequest>(offset);
1013 self.0.encode(encoder, offset + 0, depth)?;
1017 Ok(())
1018 }
1019 }
1020
1021 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1022 for RamdiskSleepAfterRequest
1023 {
1024 #[inline(always)]
1025 fn new_empty() -> Self {
1026 Self { count: 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, 8);
1042 }
1043 Ok(())
1044 }
1045 }
1046}