escp/escp/
session_init.rs

1// automatically generated by the FlatBuffers compiler, do not modify
2
3
4// @generated
5
6use core::mem;
7use core::cmp::Ordering;
8
9extern crate flatbuffers;
10use self::flatbuffers::{EndianScalar, Follow};
11
12pub enum Session_InitOffset {}
13#[derive(Copy, Clone, PartialEq)]
14
15pub struct Session_Init<'a> {
16  pub _tab: flatbuffers::Table<'a>,
17}
18
19impl<'a> flatbuffers::Follow<'a> for Session_Init<'a> {
20  type Inner = Session_Init<'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> Session_Init<'a> {
28  pub const VT_VERSION_MAJOR: flatbuffers::VOffsetT = 4;
29  pub const VT_VERSION_MINOR: flatbuffers::VOffsetT = 6;
30  pub const VT_SESSION_ID: flatbuffers::VOffsetT = 8;
31  pub const VT_CRYPTO_KEY: flatbuffers::VOffsetT = 10;
32  pub const VT_DO_HASH: flatbuffers::VOffsetT = 12;
33  pub const VT_DO_CRYPTO: flatbuffers::VOffsetT = 14;
34  pub const VT_DO_VERBOSE: flatbuffers::VOffsetT = 16;
35  pub const VT_DO_COMPRESSION: flatbuffers::VOffsetT = 18;
36  pub const VT_DO_PRESERVE: flatbuffers::VOffsetT = 20;
37  pub const VT_DO_SPARSE: flatbuffers::VOffsetT = 22;
38  pub const VT_NO_DIRECT: flatbuffers::VOffsetT = 24;
39  pub const VT_IS_ERROR: flatbuffers::VOffsetT = 26;
40  pub const VT_LOG_FILE: flatbuffers::VOffsetT = 28;
41  pub const VT_MESSAGE: flatbuffers::VOffsetT = 30;
42  pub const VT_BIND_INTERFACE: flatbuffers::VOffsetT = 32;
43  pub const VT_PORT_START: flatbuffers::VOffsetT = 34;
44  pub const VT_PORT_END: flatbuffers::VOffsetT = 36;
45  pub const VT_IO_ENGINE: flatbuffers::VOffsetT = 38;
46  pub const VT_THREAD_COUNT: flatbuffers::VOffsetT = 40;
47  pub const VT_BLOCK_SZ: flatbuffers::VOffsetT = 42;
48
49  #[inline]
50  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
51    Session_Init { _tab: table }
52  }
53  #[allow(unused_mut)]
54  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
55    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
56    args: &'args Session_InitArgs<'args>
57  ) -> flatbuffers::WIPOffset<Session_Init<'bldr>> {
58    let mut builder = Session_InitBuilder::new(_fbb);
59    builder.add_session_id(args.session_id);
60    builder.add_block_sz(args.block_sz);
61    builder.add_thread_count(args.thread_count);
62    builder.add_io_engine(args.io_engine);
63    builder.add_port_end(args.port_end);
64    builder.add_port_start(args.port_start);
65    if let Some(x) = args.bind_interface { builder.add_bind_interface(x); }
66    if let Some(x) = args.message { builder.add_message(x); }
67    if let Some(x) = args.log_file { builder.add_log_file(x); }
68    if let Some(x) = args.crypto_key { builder.add_crypto_key(x); }
69    builder.add_version_minor(args.version_minor);
70    builder.add_version_major(args.version_major);
71    builder.add_is_error(args.is_error);
72    builder.add_no_direct(args.no_direct);
73    builder.add_do_sparse(args.do_sparse);
74    builder.add_do_preserve(args.do_preserve);
75    builder.add_do_compression(args.do_compression);
76    builder.add_do_verbose(args.do_verbose);
77    builder.add_do_crypto(args.do_crypto);
78    builder.add_do_hash(args.do_hash);
79    builder.finish()
80  }
81
82
83  #[inline]
84  pub fn version_major(&self) -> i32 {
85    // Safety:
86    // Created from valid Table for this object
87    // which contains a valid value in this slot
88    unsafe { self._tab.get::<i32>(Session_Init::VT_VERSION_MAJOR, Some(0)).unwrap()}
89  }
90  #[inline]
91  pub fn version_minor(&self) -> i32 {
92    // Safety:
93    // Created from valid Table for this object
94    // which contains a valid value in this slot
95    unsafe { self._tab.get::<i32>(Session_Init::VT_VERSION_MINOR, Some(0)).unwrap()}
96  }
97  #[inline]
98  pub fn session_id(&self) -> u64 {
99    // Safety:
100    // Created from valid Table for this object
101    // which contains a valid value in this slot
102    unsafe { self._tab.get::<u64>(Session_Init::VT_SESSION_ID, Some(0)).unwrap()}
103  }
104  #[inline]
105  pub fn crypto_key(&self) -> Option<flatbuffers::Vector<'a, i8>> {
106    // Safety:
107    // Created from valid Table for this object
108    // which contains a valid value in this slot
109    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i8>>>(Session_Init::VT_CRYPTO_KEY, None)}
110  }
111  #[inline]
112  pub fn do_hash(&self) -> bool {
113    // Safety:
114    // Created from valid Table for this object
115    // which contains a valid value in this slot
116    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_HASH, Some(false)).unwrap()}
117  }
118  #[inline]
119  pub fn do_crypto(&self) -> bool {
120    // Safety:
121    // Created from valid Table for this object
122    // which contains a valid value in this slot
123    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_CRYPTO, Some(false)).unwrap()}
124  }
125  #[inline]
126  pub fn do_verbose(&self) -> bool {
127    // Safety:
128    // Created from valid Table for this object
129    // which contains a valid value in this slot
130    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_VERBOSE, Some(false)).unwrap()}
131  }
132  #[inline]
133  pub fn do_compression(&self) -> bool {
134    // Safety:
135    // Created from valid Table for this object
136    // which contains a valid value in this slot
137    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_COMPRESSION, Some(false)).unwrap()}
138  }
139  #[inline]
140  pub fn do_preserve(&self) -> bool {
141    // Safety:
142    // Created from valid Table for this object
143    // which contains a valid value in this slot
144    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_PRESERVE, Some(false)).unwrap()}
145  }
146  #[inline]
147  pub fn do_sparse(&self) -> bool {
148    // Safety:
149    // Created from valid Table for this object
150    // which contains a valid value in this slot
151    unsafe { self._tab.get::<bool>(Session_Init::VT_DO_SPARSE, Some(false)).unwrap()}
152  }
153  #[inline]
154  pub fn no_direct(&self) -> bool {
155    // Safety:
156    // Created from valid Table for this object
157    // which contains a valid value in this slot
158    unsafe { self._tab.get::<bool>(Session_Init::VT_NO_DIRECT, Some(false)).unwrap()}
159  }
160  #[inline]
161  pub fn is_error(&self) -> bool {
162    // Safety:
163    // Created from valid Table for this object
164    // which contains a valid value in this slot
165    unsafe { self._tab.get::<bool>(Session_Init::VT_IS_ERROR, Some(false)).unwrap()}
166  }
167  #[inline]
168  pub fn log_file(&self) -> Option<&'a str> {
169    // Safety:
170    // Created from valid Table for this object
171    // which contains a valid value in this slot
172    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Session_Init::VT_LOG_FILE, None)}
173  }
174  #[inline]
175  pub fn message(&self) -> Option<&'a str> {
176    // Safety:
177    // Created from valid Table for this object
178    // which contains a valid value in this slot
179    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Session_Init::VT_MESSAGE, None)}
180  }
181  #[inline]
182  pub fn bind_interface(&self) -> Option<&'a str> {
183    // Safety:
184    // Created from valid Table for this object
185    // which contains a valid value in this slot
186    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Session_Init::VT_BIND_INTERFACE, None)}
187  }
188  #[inline]
189  pub fn port_start(&self) -> i32 {
190    // Safety:
191    // Created from valid Table for this object
192    // which contains a valid value in this slot
193    unsafe { self._tab.get::<i32>(Session_Init::VT_PORT_START, Some(0)).unwrap()}
194  }
195  #[inline]
196  pub fn port_end(&self) -> i32 {
197    // Safety:
198    // Created from valid Table for this object
199    // which contains a valid value in this slot
200    unsafe { self._tab.get::<i32>(Session_Init::VT_PORT_END, Some(0)).unwrap()}
201  }
202  #[inline]
203  pub fn io_engine(&self) -> i32 {
204    // Safety:
205    // Created from valid Table for this object
206    // which contains a valid value in this slot
207    unsafe { self._tab.get::<i32>(Session_Init::VT_IO_ENGINE, Some(0)).unwrap()}
208  }
209  #[inline]
210  pub fn thread_count(&self) -> i32 {
211    // Safety:
212    // Created from valid Table for this object
213    // which contains a valid value in this slot
214    unsafe { self._tab.get::<i32>(Session_Init::VT_THREAD_COUNT, Some(0)).unwrap()}
215  }
216  #[inline]
217  pub fn block_sz(&self) -> i32 {
218    // Safety:
219    // Created from valid Table for this object
220    // which contains a valid value in this slot
221    unsafe { self._tab.get::<i32>(Session_Init::VT_BLOCK_SZ, Some(0)).unwrap()}
222  }
223}
224
225impl flatbuffers::Verifiable for Session_Init<'_> {
226  #[inline]
227  fn run_verifier(
228    v: &mut flatbuffers::Verifier, pos: usize
229  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
230    use self::flatbuffers::Verifiable;
231    v.visit_table(pos)?
232     .visit_field::<i32>("version_major", Self::VT_VERSION_MAJOR, false)?
233     .visit_field::<i32>("version_minor", Self::VT_VERSION_MINOR, false)?
234     .visit_field::<u64>("session_id", Self::VT_SESSION_ID, false)?
235     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i8>>>("crypto_key", Self::VT_CRYPTO_KEY, false)?
236     .visit_field::<bool>("do_hash", Self::VT_DO_HASH, false)?
237     .visit_field::<bool>("do_crypto", Self::VT_DO_CRYPTO, false)?
238     .visit_field::<bool>("do_verbose", Self::VT_DO_VERBOSE, false)?
239     .visit_field::<bool>("do_compression", Self::VT_DO_COMPRESSION, false)?
240     .visit_field::<bool>("do_preserve", Self::VT_DO_PRESERVE, false)?
241     .visit_field::<bool>("do_sparse", Self::VT_DO_SPARSE, false)?
242     .visit_field::<bool>("no_direct", Self::VT_NO_DIRECT, false)?
243     .visit_field::<bool>("is_error", Self::VT_IS_ERROR, false)?
244     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("log_file", Self::VT_LOG_FILE, false)?
245     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("message", Self::VT_MESSAGE, false)?
246     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("bind_interface", Self::VT_BIND_INTERFACE, false)?
247     .visit_field::<i32>("port_start", Self::VT_PORT_START, false)?
248     .visit_field::<i32>("port_end", Self::VT_PORT_END, false)?
249     .visit_field::<i32>("io_engine", Self::VT_IO_ENGINE, false)?
250     .visit_field::<i32>("thread_count", Self::VT_THREAD_COUNT, false)?
251     .visit_field::<i32>("block_sz", Self::VT_BLOCK_SZ, false)?
252     .finish();
253    Ok(())
254  }
255}
256pub struct Session_InitArgs<'a> {
257    pub version_major: i32,
258    pub version_minor: i32,
259    pub session_id: u64,
260    pub crypto_key: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>,
261    pub do_hash: bool,
262    pub do_crypto: bool,
263    pub do_verbose: bool,
264    pub do_compression: bool,
265    pub do_preserve: bool,
266    pub do_sparse: bool,
267    pub no_direct: bool,
268    pub is_error: bool,
269    pub log_file: Option<flatbuffers::WIPOffset<&'a str>>,
270    pub message: Option<flatbuffers::WIPOffset<&'a str>>,
271    pub bind_interface: Option<flatbuffers::WIPOffset<&'a str>>,
272    pub port_start: i32,
273    pub port_end: i32,
274    pub io_engine: i32,
275    pub thread_count: i32,
276    pub block_sz: i32,
277}
278impl<'a> Default for Session_InitArgs<'a> {
279  #[inline]
280  fn default() -> Self {
281    Session_InitArgs {
282      version_major: 0,
283      version_minor: 0,
284      session_id: 0,
285      crypto_key: None,
286      do_hash: false,
287      do_crypto: false,
288      do_verbose: false,
289      do_compression: false,
290      do_preserve: false,
291      do_sparse: false,
292      no_direct: false,
293      is_error: false,
294      log_file: None,
295      message: None,
296      bind_interface: None,
297      port_start: 0,
298      port_end: 0,
299      io_engine: 0,
300      thread_count: 0,
301      block_sz: 0,
302    }
303  }
304}
305
306pub struct Session_InitBuilder<'a: 'b, 'b> {
307  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
308  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
309}
310impl<'a: 'b, 'b> Session_InitBuilder<'a, 'b> {
311  #[inline]
312  pub fn add_version_major(&mut self, version_major: i32) {
313    self.fbb_.push_slot::<i32>(Session_Init::VT_VERSION_MAJOR, version_major, 0);
314  }
315  #[inline]
316  pub fn add_version_minor(&mut self, version_minor: i32) {
317    self.fbb_.push_slot::<i32>(Session_Init::VT_VERSION_MINOR, version_minor, 0);
318  }
319  #[inline]
320  pub fn add_session_id(&mut self, session_id: u64) {
321    self.fbb_.push_slot::<u64>(Session_Init::VT_SESSION_ID, session_id, 0);
322  }
323  #[inline]
324  pub fn add_crypto_key(&mut self, crypto_key: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i8>>) {
325    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Session_Init::VT_CRYPTO_KEY, crypto_key);
326  }
327  #[inline]
328  pub fn add_do_hash(&mut self, do_hash: bool) {
329    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_HASH, do_hash, false);
330  }
331  #[inline]
332  pub fn add_do_crypto(&mut self, do_crypto: bool) {
333    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_CRYPTO, do_crypto, false);
334  }
335  #[inline]
336  pub fn add_do_verbose(&mut self, do_verbose: bool) {
337    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_VERBOSE, do_verbose, false);
338  }
339  #[inline]
340  pub fn add_do_compression(&mut self, do_compression: bool) {
341    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_COMPRESSION, do_compression, false);
342  }
343  #[inline]
344  pub fn add_do_preserve(&mut self, do_preserve: bool) {
345    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_PRESERVE, do_preserve, false);
346  }
347  #[inline]
348  pub fn add_do_sparse(&mut self, do_sparse: bool) {
349    self.fbb_.push_slot::<bool>(Session_Init::VT_DO_SPARSE, do_sparse, false);
350  }
351  #[inline]
352  pub fn add_no_direct(&mut self, no_direct: bool) {
353    self.fbb_.push_slot::<bool>(Session_Init::VT_NO_DIRECT, no_direct, false);
354  }
355  #[inline]
356  pub fn add_is_error(&mut self, is_error: bool) {
357    self.fbb_.push_slot::<bool>(Session_Init::VT_IS_ERROR, is_error, false);
358  }
359  #[inline]
360  pub fn add_log_file(&mut self, log_file: flatbuffers::WIPOffset<&'b  str>) {
361    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Session_Init::VT_LOG_FILE, log_file);
362  }
363  #[inline]
364  pub fn add_message(&mut self, message: flatbuffers::WIPOffset<&'b  str>) {
365    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Session_Init::VT_MESSAGE, message);
366  }
367  #[inline]
368  pub fn add_bind_interface(&mut self, bind_interface: flatbuffers::WIPOffset<&'b  str>) {
369    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Session_Init::VT_BIND_INTERFACE, bind_interface);
370  }
371  #[inline]
372  pub fn add_port_start(&mut self, port_start: i32) {
373    self.fbb_.push_slot::<i32>(Session_Init::VT_PORT_START, port_start, 0);
374  }
375  #[inline]
376  pub fn add_port_end(&mut self, port_end: i32) {
377    self.fbb_.push_slot::<i32>(Session_Init::VT_PORT_END, port_end, 0);
378  }
379  #[inline]
380  pub fn add_io_engine(&mut self, io_engine: i32) {
381    self.fbb_.push_slot::<i32>(Session_Init::VT_IO_ENGINE, io_engine, 0);
382  }
383  #[inline]
384  pub fn add_thread_count(&mut self, thread_count: i32) {
385    self.fbb_.push_slot::<i32>(Session_Init::VT_THREAD_COUNT, thread_count, 0);
386  }
387  #[inline]
388  pub fn add_block_sz(&mut self, block_sz: i32) {
389    self.fbb_.push_slot::<i32>(Session_Init::VT_BLOCK_SZ, block_sz, 0);
390  }
391  #[inline]
392  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> Session_InitBuilder<'a, 'b> {
393    let start = _fbb.start_table();
394    Session_InitBuilder {
395      fbb_: _fbb,
396      start_: start,
397    }
398  }
399  #[inline]
400  pub fn finish(self) -> flatbuffers::WIPOffset<Session_Init<'a>> {
401    let o = self.fbb_.end_table(self.start_);
402    flatbuffers::WIPOffset::new(o.value())
403  }
404}
405
406impl core::fmt::Debug for Session_Init<'_> {
407  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
408    let mut ds = f.debug_struct("Session_Init");
409      ds.field("version_major", &self.version_major());
410      ds.field("version_minor", &self.version_minor());
411      ds.field("session_id", &self.session_id());
412      ds.field("crypto_key", &self.crypto_key());
413      ds.field("do_hash", &self.do_hash());
414      ds.field("do_crypto", &self.do_crypto());
415      ds.field("do_verbose", &self.do_verbose());
416      ds.field("do_compression", &self.do_compression());
417      ds.field("do_preserve", &self.do_preserve());
418      ds.field("do_sparse", &self.do_sparse());
419      ds.field("no_direct", &self.no_direct());
420      ds.field("is_error", &self.is_error());
421      ds.field("log_file", &self.log_file());
422      ds.field("message", &self.message());
423      ds.field("bind_interface", &self.bind_interface());
424      ds.field("port_start", &self.port_start());
425      ds.field("port_end", &self.port_end());
426      ds.field("io_engine", &self.io_engine());
427      ds.field("thread_count", &self.thread_count());
428      ds.field("block_sz", &self.block_sz());
429      ds.finish()
430  }
431}