webterm_core/generated/flatbuffers_schema/talk_v1/
r2f_error_generated.rs1extern crate alloc;
4extern crate flatbuffers;
5use alloc::boxed::Box;
6use alloc::string::{String, ToString};
7use alloc::vec::Vec;
8use core::mem;
9use core::cmp::Ordering;
10use self::flatbuffers::{EndianScalar, Follow};
11use super::*;
12pub enum R2fErrorOffset {}
13#[derive(Copy, Clone, PartialEq)]
14
15pub struct R2fError<'a> {
16 pub _tab: flatbuffers::Table<'a>,
17}
18
19impl<'a> flatbuffers::Follow<'a> for R2fError<'a> {
20 type Inner = R2fError<'a>;
21 #[inline]
22 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 Self { _tab: flatbuffers::Table::new(buf, loc) }
24 }
25}
26
27impl<'a> R2fError<'a> {
28 pub const VT_ERROR_TYPE: flatbuffers::VOffsetT = 4;
29 pub const VT_ERROR_MESSAGE: flatbuffers::VOffsetT = 6;
30
31 #[inline]
32 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 R2fError { _tab: table }
34 }
35 #[allow(unused_mut)]
36 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 args: &'args R2fErrorArgs<'args>
39 ) -> flatbuffers::WIPOffset<R2fError<'bldr>> {
40 let mut builder = R2fErrorBuilder::new(_fbb);
41 if let Some(x) = args.error_message { builder.add_error_message(x); }
42 builder.add_error_type(args.error_type);
43 builder.finish()
44 }
45
46
47 #[inline]
48 pub fn error_type(&self) -> R2fErrorType {
49 unsafe { self._tab.get::<R2fErrorType>(R2fError::VT_ERROR_TYPE, Some(R2fErrorType::ErrorUnspecified)).unwrap()}
53 }
54 #[inline]
55 pub fn error_message(&self) -> Option<&'a str> {
56 unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(R2fError::VT_ERROR_MESSAGE, None)}
60 }
61}
62
63impl flatbuffers::Verifiable for R2fError<'_> {
64 #[inline]
65 fn run_verifier(
66 v: &mut flatbuffers::Verifier, pos: usize
67 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 use self::flatbuffers::Verifiable;
69 v.visit_table(pos)?
70 .visit_field::<R2fErrorType>("error_type", Self::VT_ERROR_TYPE, false)?
71 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("error_message", Self::VT_ERROR_MESSAGE, false)?
72 .finish();
73 Ok(())
74 }
75}
76pub struct R2fErrorArgs<'a> {
77 pub error_type: R2fErrorType,
78 pub error_message: Option<flatbuffers::WIPOffset<&'a str>>,
79}
80impl<'a> Default for R2fErrorArgs<'a> {
81 #[inline]
82 fn default() -> Self {
83 R2fErrorArgs {
84 error_type: R2fErrorType::ErrorUnspecified,
85 error_message: None,
86 }
87 }
88}
89
90pub struct R2fErrorBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
93}
94impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> R2fErrorBuilder<'a, 'b, A> {
95 #[inline]
96 pub fn add_error_type(&mut self, error_type: R2fErrorType) {
97 self.fbb_.push_slot::<R2fErrorType>(R2fError::VT_ERROR_TYPE, error_type, R2fErrorType::ErrorUnspecified);
98 }
99 #[inline]
100 pub fn add_error_message(&mut self, error_message: flatbuffers::WIPOffset<&'b str>) {
101 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(R2fError::VT_ERROR_MESSAGE, error_message);
102 }
103 #[inline]
104 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> R2fErrorBuilder<'a, 'b, A> {
105 let start = _fbb.start_table();
106 R2fErrorBuilder {
107 fbb_: _fbb,
108 start_: start,
109 }
110 }
111 #[inline]
112 pub fn finish(self) -> flatbuffers::WIPOffset<R2fError<'a>> {
113 let o = self.fbb_.end_table(self.start_);
114 flatbuffers::WIPOffset::new(o.value())
115 }
116}
117
118impl core::fmt::Debug for R2fError<'_> {
119 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120 let mut ds = f.debug_struct("R2fError");
121 ds.field("error_type", &self.error_type());
122 ds.field("error_message", &self.error_message());
123 ds.finish()
124 }
125}