fidl_test_componentmanager_stresstests__common/
fidl_test_componentmanager_stresstests__common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct ChildRealmCreateChildrenRequest {
14 pub direct_children: u16,
15 pub tree_height: u16,
16}
17
18impl fidl::Persistable for ChildRealmCreateChildrenRequest {}
19
20pub mod child_realm_ordinals {
21 pub const STOP: u64 = 0x36c34aa66f2a56ab;
22 pub const STOP_CHILDREN: u64 = 0x61c8762c3aa05df7;
23 pub const CREATE_CHILDREN: u64 = 0x37a93e012377095c;
24 pub const ON_CONNECTED: u64 = 0x68a2f3384c114a61;
25}
26
27mod internal {
28 use super::*;
29
30 impl fidl::encoding::ValueTypeMarker for ChildRealmCreateChildrenRequest {
31 type Borrowed<'a> = &'a Self;
32 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
33 value
34 }
35 }
36
37 unsafe impl fidl::encoding::TypeMarker for ChildRealmCreateChildrenRequest {
38 type Owned = Self;
39
40 #[inline(always)]
41 fn inline_align(_context: fidl::encoding::Context) -> usize {
42 2
43 }
44
45 #[inline(always)]
46 fn inline_size(_context: fidl::encoding::Context) -> usize {
47 4
48 }
49 #[inline(always)]
50 fn encode_is_copy() -> bool {
51 true
52 }
53
54 #[inline(always)]
55 fn decode_is_copy() -> bool {
56 true
57 }
58 }
59
60 unsafe impl<D: fidl::encoding::ResourceDialect>
61 fidl::encoding::Encode<ChildRealmCreateChildrenRequest, D>
62 for &ChildRealmCreateChildrenRequest
63 {
64 #[inline]
65 unsafe fn encode(
66 self,
67 encoder: &mut fidl::encoding::Encoder<'_, D>,
68 offset: usize,
69 _depth: fidl::encoding::Depth,
70 ) -> fidl::Result<()> {
71 encoder.debug_check_bounds::<ChildRealmCreateChildrenRequest>(offset);
72 unsafe {
73 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
75 (buf_ptr as *mut ChildRealmCreateChildrenRequest)
76 .write_unaligned((self as *const ChildRealmCreateChildrenRequest).read());
77 }
80 Ok(())
81 }
82 }
83 unsafe impl<
84 D: fidl::encoding::ResourceDialect,
85 T0: fidl::encoding::Encode<u16, D>,
86 T1: fidl::encoding::Encode<u16, D>,
87 > fidl::encoding::Encode<ChildRealmCreateChildrenRequest, D> for (T0, T1)
88 {
89 #[inline]
90 unsafe fn encode(
91 self,
92 encoder: &mut fidl::encoding::Encoder<'_, D>,
93 offset: usize,
94 depth: fidl::encoding::Depth,
95 ) -> fidl::Result<()> {
96 encoder.debug_check_bounds::<ChildRealmCreateChildrenRequest>(offset);
97 self.0.encode(encoder, offset + 0, depth)?;
101 self.1.encode(encoder, offset + 2, depth)?;
102 Ok(())
103 }
104 }
105
106 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
107 for ChildRealmCreateChildrenRequest
108 {
109 #[inline(always)]
110 fn new_empty() -> Self {
111 Self {
112 direct_children: fidl::new_empty!(u16, D),
113 tree_height: fidl::new_empty!(u16, D),
114 }
115 }
116
117 #[inline]
118 unsafe fn decode(
119 &mut self,
120 decoder: &mut fidl::encoding::Decoder<'_, D>,
121 offset: usize,
122 _depth: fidl::encoding::Depth,
123 ) -> fidl::Result<()> {
124 decoder.debug_check_bounds::<Self>(offset);
125 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
126 unsafe {
129 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
130 }
131 Ok(())
132 }
133 }
134}