fidl_fuchsia_netemul_guest__common/
fidl_fuchsia_netemul_guest__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
11pub const MAX_GUEST_NAME_LENGTH: u64 = 32;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14#[repr(u32)]
15pub enum ControllerCreateGuestError {
16 AlreadyRunning = 1,
18 LaunchFailed = 2,
20 AttachFailed = 3,
22}
23
24impl ControllerCreateGuestError {
25 #[inline]
26 pub fn from_primitive(prim: u32) -> Option<Self> {
27 match prim {
28 1 => Some(Self::AlreadyRunning),
29 2 => Some(Self::LaunchFailed),
30 3 => Some(Self::AttachFailed),
31 _ => None,
32 }
33 }
34
35 #[inline]
36 pub const fn into_primitive(self) -> u32 {
37 self as u32
38 }
39}
40
41pub mod controller_ordinals {
42 pub const CREATE_GUEST: u64 = 0x5c49cf5272f818c0;
43}
44
45pub mod guest_ordinals {
46 pub const PUT_FILE: u64 = 0x223bc20da4a7cddd;
47 pub const GET_FILE: u64 = 0x7696bea472ca0f2d;
48 pub const EXECUTE_COMMAND: u64 = 0x612641220a1556d8;
49 pub const SHUTDOWN: u64 = 0x287e71d61642d1cc;
50}
51
52mod internal {
53 use super::*;
54 unsafe impl fidl::encoding::TypeMarker for ControllerCreateGuestError {
55 type Owned = Self;
56
57 #[inline(always)]
58 fn inline_align(_context: fidl::encoding::Context) -> usize {
59 std::mem::align_of::<u32>()
60 }
61
62 #[inline(always)]
63 fn inline_size(_context: fidl::encoding::Context) -> usize {
64 std::mem::size_of::<u32>()
65 }
66
67 #[inline(always)]
68 fn encode_is_copy() -> bool {
69 true
70 }
71
72 #[inline(always)]
73 fn decode_is_copy() -> bool {
74 false
75 }
76 }
77
78 impl fidl::encoding::ValueTypeMarker for ControllerCreateGuestError {
79 type Borrowed<'a> = Self;
80 #[inline(always)]
81 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
82 *value
83 }
84 }
85
86 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
87 for ControllerCreateGuestError
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::<Self>(offset);
97 encoder.write_num(self.into_primitive(), offset);
98 Ok(())
99 }
100 }
101
102 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
103 for ControllerCreateGuestError
104 {
105 #[inline(always)]
106 fn new_empty() -> Self {
107 Self::AlreadyRunning
108 }
109
110 #[inline]
111 unsafe fn decode(
112 &mut self,
113 decoder: &mut fidl::encoding::Decoder<'_, D>,
114 offset: usize,
115 _depth: fidl::encoding::Depth,
116 ) -> fidl::Result<()> {
117 decoder.debug_check_bounds::<Self>(offset);
118 let prim = decoder.read_num::<u32>(offset);
119
120 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
121 Ok(())
122 }
123 }
124}