hyperlight_common/flatbuffers/hyperlight/generated/
function_call_result_generated.rs1extern crate alloc;
4extern crate flatbuffers;
5use alloc::boxed::Box;
6use alloc::string::{String, ToString};
7use alloc::vec::Vec;
8use core::cmp::Ordering;
9use core::mem;
10
11use self::flatbuffers::{EndianScalar, Follow};
12use super::*;
13pub enum FunctionCallResultOffset {}
14#[derive(Copy, Clone, PartialEq)]
15
16pub struct FunctionCallResult<'a> {
17 pub _tab: flatbuffers::Table<'a>,
18}
19
20impl<'a> flatbuffers::Follow<'a> for FunctionCallResult<'a> {
21 type Inner = FunctionCallResult<'a>;
22 #[inline]
23 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
24 unsafe {
25 Self {
26 _tab: flatbuffers::Table::new(buf, loc),
27 }
28 }
29 }
30}
31
32impl<'a> FunctionCallResult<'a> {
33 pub const VT_RETURN_VALUE_TYPE: flatbuffers::VOffsetT = 4;
34 pub const VT_RETURN_VALUE: flatbuffers::VOffsetT = 6;
35
36 #[inline]
37 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
38 FunctionCallResult { _tab: table }
39 }
40 #[allow(unused_mut)]
41 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
42 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
43 args: &'args FunctionCallResultArgs,
44 ) -> flatbuffers::WIPOffset<FunctionCallResult<'bldr>> {
45 let mut builder = FunctionCallResultBuilder::new(_fbb);
46 if let Some(x) = args.return_value {
47 builder.add_return_value(x);
48 }
49 builder.add_return_value_type(args.return_value_type);
50 builder.finish()
51 }
52
53 #[inline]
54 pub fn return_value_type(&self) -> ReturnValue {
55 unsafe {
59 self._tab
60 .get::<ReturnValue>(
61 FunctionCallResult::VT_RETURN_VALUE_TYPE,
62 Some(ReturnValue::NONE),
63 )
64 .unwrap()
65 }
66 }
67 #[inline]
68 pub fn return_value(&self) -> flatbuffers::Table<'a> {
69 unsafe {
73 self._tab
74 .get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(
75 FunctionCallResult::VT_RETURN_VALUE,
76 None,
77 )
78 .unwrap()
79 }
80 }
81 #[inline]
82 #[allow(non_snake_case)]
83 pub fn return_value_as_hlint(&self) -> Option<hlint<'a>> {
84 if self.return_value_type() == ReturnValue::hlint {
85 let u = self.return_value();
86 Some(unsafe { hlint::init_from_table(u) })
90 } else {
91 None
92 }
93 }
94
95 #[inline]
96 #[allow(non_snake_case)]
97 pub fn return_value_as_hluint(&self) -> Option<hluint<'a>> {
98 if self.return_value_type() == ReturnValue::hluint {
99 let u = self.return_value();
100 Some(unsafe { hluint::init_from_table(u) })
104 } else {
105 None
106 }
107 }
108
109 #[inline]
110 #[allow(non_snake_case)]
111 pub fn return_value_as_hllong(&self) -> Option<hllong<'a>> {
112 if self.return_value_type() == ReturnValue::hllong {
113 let u = self.return_value();
114 Some(unsafe { hllong::init_from_table(u) })
118 } else {
119 None
120 }
121 }
122
123 #[inline]
124 #[allow(non_snake_case)]
125 pub fn return_value_as_hlulong(&self) -> Option<hlulong<'a>> {
126 if self.return_value_type() == ReturnValue::hlulong {
127 let u = self.return_value();
128 Some(unsafe { hlulong::init_from_table(u) })
132 } else {
133 None
134 }
135 }
136
137 #[inline]
138 #[allow(non_snake_case)]
139 pub fn return_value_as_hlfloat(&self) -> Option<hlfloat<'a>> {
140 if self.return_value_type() == ReturnValue::hlfloat {
141 let u = self.return_value();
142 Some(unsafe { hlfloat::init_from_table(u) })
146 } else {
147 None
148 }
149 }
150
151 #[inline]
152 #[allow(non_snake_case)]
153 pub fn return_value_as_hldouble(&self) -> Option<hldouble<'a>> {
154 if self.return_value_type() == ReturnValue::hldouble {
155 let u = self.return_value();
156 Some(unsafe { hldouble::init_from_table(u) })
160 } else {
161 None
162 }
163 }
164
165 #[inline]
166 #[allow(non_snake_case)]
167 pub fn return_value_as_hlstring(&self) -> Option<hlstring<'a>> {
168 if self.return_value_type() == ReturnValue::hlstring {
169 let u = self.return_value();
170 Some(unsafe { hlstring::init_from_table(u) })
174 } else {
175 None
176 }
177 }
178
179 #[inline]
180 #[allow(non_snake_case)]
181 pub fn return_value_as_hlbool(&self) -> Option<hlbool<'a>> {
182 if self.return_value_type() == ReturnValue::hlbool {
183 let u = self.return_value();
184 Some(unsafe { hlbool::init_from_table(u) })
188 } else {
189 None
190 }
191 }
192
193 #[inline]
194 #[allow(non_snake_case)]
195 pub fn return_value_as_hlvoid(&self) -> Option<hlvoid<'a>> {
196 if self.return_value_type() == ReturnValue::hlvoid {
197 let u = self.return_value();
198 Some(unsafe { hlvoid::init_from_table(u) })
202 } else {
203 None
204 }
205 }
206
207 #[inline]
208 #[allow(non_snake_case)]
209 pub fn return_value_as_hlsizeprefixedbuffer(&self) -> Option<hlsizeprefixedbuffer<'a>> {
210 if self.return_value_type() == ReturnValue::hlsizeprefixedbuffer {
211 let u = self.return_value();
212 Some(unsafe { hlsizeprefixedbuffer::init_from_table(u) })
216 } else {
217 None
218 }
219 }
220}
221
222impl flatbuffers::Verifiable for FunctionCallResult<'_> {
223 #[inline]
224 fn run_verifier(
225 v: &mut flatbuffers::Verifier,
226 pos: usize,
227 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
228 use self::flatbuffers::Verifiable;
229 v.visit_table(pos)?
230 .visit_union::<ReturnValue, _>(
231 "return_value_type",
232 Self::VT_RETURN_VALUE_TYPE,
233 "return_value",
234 Self::VT_RETURN_VALUE,
235 true,
236 |key, v, pos| match key {
237 ReturnValue::hlint => v
238 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlint>>(
239 "ReturnValue::hlint",
240 pos,
241 ),
242 ReturnValue::hluint => v
243 .verify_union_variant::<flatbuffers::ForwardsUOffset<hluint>>(
244 "ReturnValue::hluint",
245 pos,
246 ),
247 ReturnValue::hllong => v
248 .verify_union_variant::<flatbuffers::ForwardsUOffset<hllong>>(
249 "ReturnValue::hllong",
250 pos,
251 ),
252 ReturnValue::hlulong => v
253 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlulong>>(
254 "ReturnValue::hlulong",
255 pos,
256 ),
257 ReturnValue::hlfloat => v
258 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlfloat>>(
259 "ReturnValue::hlfloat",
260 pos,
261 ),
262 ReturnValue::hldouble => v
263 .verify_union_variant::<flatbuffers::ForwardsUOffset<hldouble>>(
264 "ReturnValue::hldouble",
265 pos,
266 ),
267 ReturnValue::hlstring => v
268 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlstring>>(
269 "ReturnValue::hlstring",
270 pos,
271 ),
272 ReturnValue::hlbool => v
273 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlbool>>(
274 "ReturnValue::hlbool",
275 pos,
276 ),
277 ReturnValue::hlvoid => v
278 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlvoid>>(
279 "ReturnValue::hlvoid",
280 pos,
281 ),
282 ReturnValue::hlsizeprefixedbuffer => v
283 .verify_union_variant::<flatbuffers::ForwardsUOffset<hlsizeprefixedbuffer>>(
284 "ReturnValue::hlsizeprefixedbuffer",
285 pos,
286 ),
287 _ => Ok(()),
288 },
289 )?
290 .finish();
291 Ok(())
292 }
293}
294pub struct FunctionCallResultArgs {
295 pub return_value_type: ReturnValue,
296 pub return_value: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
297}
298impl<'a> Default for FunctionCallResultArgs {
299 #[inline]
300 fn default() -> Self {
301 FunctionCallResultArgs {
302 return_value_type: ReturnValue::NONE,
303 return_value: None, }
305 }
306}
307
308pub struct FunctionCallResultBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
309 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
310 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
311}
312impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FunctionCallResultBuilder<'a, 'b, A> {
313 #[inline]
314 pub fn add_return_value_type(&mut self, return_value_type: ReturnValue) {
315 self.fbb_.push_slot::<ReturnValue>(
316 FunctionCallResult::VT_RETURN_VALUE_TYPE,
317 return_value_type,
318 ReturnValue::NONE,
319 );
320 }
321 #[inline]
322 pub fn add_return_value(
323 &mut self,
324 return_value: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>,
325 ) {
326 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
327 FunctionCallResult::VT_RETURN_VALUE,
328 return_value,
329 );
330 }
331 #[inline]
332 pub fn new(
333 _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
334 ) -> FunctionCallResultBuilder<'a, 'b, A> {
335 let start = _fbb.start_table();
336 FunctionCallResultBuilder {
337 fbb_: _fbb,
338 start_: start,
339 }
340 }
341 #[inline]
342 pub fn finish(self) -> flatbuffers::WIPOffset<FunctionCallResult<'a>> {
343 let o = self.fbb_.end_table(self.start_);
344 self.fbb_
345 .required(o, FunctionCallResult::VT_RETURN_VALUE, "return_value");
346 flatbuffers::WIPOffset::new(o.value())
347 }
348}
349
350impl core::fmt::Debug for FunctionCallResult<'_> {
351 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
352 let mut ds = f.debug_struct("FunctionCallResult");
353 ds.field("return_value_type", &self.return_value_type());
354 match self.return_value_type() {
355 ReturnValue::hlint => {
356 if let Some(x) = self.return_value_as_hlint() {
357 ds.field("return_value", &x)
358 } else {
359 ds.field(
360 "return_value",
361 &"InvalidFlatbuffer: Union discriminant does not match value.",
362 )
363 }
364 }
365 ReturnValue::hluint => {
366 if let Some(x) = self.return_value_as_hluint() {
367 ds.field("return_value", &x)
368 } else {
369 ds.field(
370 "return_value",
371 &"InvalidFlatbuffer: Union discriminant does not match value.",
372 )
373 }
374 }
375 ReturnValue::hllong => {
376 if let Some(x) = self.return_value_as_hllong() {
377 ds.field("return_value", &x)
378 } else {
379 ds.field(
380 "return_value",
381 &"InvalidFlatbuffer: Union discriminant does not match value.",
382 )
383 }
384 }
385 ReturnValue::hlulong => {
386 if let Some(x) = self.return_value_as_hlulong() {
387 ds.field("return_value", &x)
388 } else {
389 ds.field(
390 "return_value",
391 &"InvalidFlatbuffer: Union discriminant does not match value.",
392 )
393 }
394 }
395 ReturnValue::hlfloat => {
396 if let Some(x) = self.return_value_as_hlfloat() {
397 ds.field("return_value", &x)
398 } else {
399 ds.field(
400 "return_value",
401 &"InvalidFlatbuffer: Union discriminant does not match value.",
402 )
403 }
404 }
405 ReturnValue::hldouble => {
406 if let Some(x) = self.return_value_as_hldouble() {
407 ds.field("return_value", &x)
408 } else {
409 ds.field(
410 "return_value",
411 &"InvalidFlatbuffer: Union discriminant does not match value.",
412 )
413 }
414 }
415 ReturnValue::hlstring => {
416 if let Some(x) = self.return_value_as_hlstring() {
417 ds.field("return_value", &x)
418 } else {
419 ds.field(
420 "return_value",
421 &"InvalidFlatbuffer: Union discriminant does not match value.",
422 )
423 }
424 }
425 ReturnValue::hlbool => {
426 if let Some(x) = self.return_value_as_hlbool() {
427 ds.field("return_value", &x)
428 } else {
429 ds.field(
430 "return_value",
431 &"InvalidFlatbuffer: Union discriminant does not match value.",
432 )
433 }
434 }
435 ReturnValue::hlvoid => {
436 if let Some(x) = self.return_value_as_hlvoid() {
437 ds.field("return_value", &x)
438 } else {
439 ds.field(
440 "return_value",
441 &"InvalidFlatbuffer: Union discriminant does not match value.",
442 )
443 }
444 }
445 ReturnValue::hlsizeprefixedbuffer => {
446 if let Some(x) = self.return_value_as_hlsizeprefixedbuffer() {
447 ds.field("return_value", &x)
448 } else {
449 ds.field(
450 "return_value",
451 &"InvalidFlatbuffer: Union discriminant does not match value.",
452 )
453 }
454 }
455 _ => {
456 let x: Option<()> = None;
457 ds.field("return_value", &x)
458 }
459 };
460 ds.finish()
461 }
462}
463#[inline]
464pub fn root_as_function_call_result(
471 buf: &[u8],
472) -> Result<FunctionCallResult, flatbuffers::InvalidFlatbuffer> {
473 flatbuffers::root::<FunctionCallResult>(buf)
474}
475#[inline]
476pub fn size_prefixed_root_as_function_call_result(
483 buf: &[u8],
484) -> Result<FunctionCallResult, flatbuffers::InvalidFlatbuffer> {
485 flatbuffers::size_prefixed_root::<FunctionCallResult>(buf)
486}
487#[inline]
488pub fn root_as_function_call_result_with_opts<'b, 'o>(
495 opts: &'o flatbuffers::VerifierOptions,
496 buf: &'b [u8],
497) -> Result<FunctionCallResult<'b>, flatbuffers::InvalidFlatbuffer> {
498 flatbuffers::root_with_opts::<FunctionCallResult<'b>>(opts, buf)
499}
500#[inline]
501pub fn size_prefixed_root_as_function_call_result_with_opts<'b, 'o>(
508 opts: &'o flatbuffers::VerifierOptions,
509 buf: &'b [u8],
510) -> Result<FunctionCallResult<'b>, flatbuffers::InvalidFlatbuffer> {
511 flatbuffers::size_prefixed_root_with_opts::<FunctionCallResult<'b>>(opts, buf)
512}
513#[inline]
514pub unsafe fn root_as_function_call_result_unchecked(buf: &[u8]) -> FunctionCallResult {
518 unsafe { flatbuffers::root_unchecked::<FunctionCallResult>(buf) }
519}
520#[inline]
521pub unsafe fn size_prefixed_root_as_function_call_result_unchecked(
525 buf: &[u8],
526) -> FunctionCallResult {
527 unsafe { flatbuffers::size_prefixed_root_unchecked::<FunctionCallResult>(buf) }
528}
529#[inline]
530pub fn finish_function_call_result_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
531 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
532 root: flatbuffers::WIPOffset<FunctionCallResult<'a>>,
533) {
534 fbb.finish(root, None);
535}
536
537#[inline]
538pub fn finish_size_prefixed_function_call_result_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
539 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
540 root: flatbuffers::WIPOffset<FunctionCallResult<'a>>,
541) {
542 fbb.finish_size_prefixed(root, None);
543}