hyperion/api/flat/message/
hyperion_request_generated.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
12#[allow(unused_imports, dead_code)]
13pub mod hyperionnet {
14
15  use core::mem;
16  use core::cmp::Ordering;
17
18  extern crate flatbuffers;
19  use self::flatbuffers::{EndianScalar, Follow};
20
21#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
22pub const ENUM_MIN_IMAGE_TYPE: u8 = 0;
23#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
24pub const ENUM_MAX_IMAGE_TYPE: u8 = 1;
25#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
26#[allow(non_camel_case_types)]
27pub const ENUM_VALUES_IMAGE_TYPE: [ImageType; 2] = [
28  ImageType::NONE,
29  ImageType::RawImage,
30];
31
32#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
33#[repr(transparent)]
34pub struct ImageType(pub u8);
35#[allow(non_upper_case_globals)]
36impl ImageType {
37  pub const NONE: Self = Self(0);
38  pub const RawImage: Self = Self(1);
39
40  pub const ENUM_MIN: u8 = 0;
41  pub const ENUM_MAX: u8 = 1;
42  pub const ENUM_VALUES: &'static [Self] = &[
43    Self::NONE,
44    Self::RawImage,
45  ];
46  /// Returns the variant's name or "" if unknown.
47  pub fn variant_name(self) -> Option<&'static str> {
48    match self {
49      Self::NONE => Some("NONE"),
50      Self::RawImage => Some("RawImage"),
51      _ => None,
52    }
53  }
54}
55impl core::fmt::Debug for ImageType {
56  fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57    if let Some(name) = self.variant_name() {
58      f.write_str(name)
59    } else {
60      f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
61    }
62  }
63}
64impl<'a> flatbuffers::Follow<'a> for ImageType {
65  type Inner = Self;
66  #[inline]
67  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
68    let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
69    Self(b)
70  }
71}
72
73impl flatbuffers::Push for ImageType {
74    type Output = ImageType;
75    #[inline]
76    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
77        flatbuffers::emplace_scalar::<u8>(dst, self.0);
78    }
79}
80
81impl flatbuffers::EndianScalar for ImageType {
82  type Scalar = u8;
83  #[inline]
84  fn to_little_endian(self) -> u8 {
85    self.0.to_le()
86  }
87  #[inline]
88  #[allow(clippy::wrong_self_convention)]
89  fn from_little_endian(v: u8) -> Self {
90    let b = u8::from_le(v);
91    Self(b)
92  }
93}
94
95impl<'a> flatbuffers::Verifiable for ImageType {
96  #[inline]
97  fn run_verifier(
98    v: &mut flatbuffers::Verifier, pos: usize
99  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
100    use self::flatbuffers::Verifiable;
101    u8::run_verifier(v, pos)
102  }
103}
104
105impl flatbuffers::SimpleToVerifyInSlice for ImageType {}
106pub struct ImageTypeUnionTableOffset {}
107
108#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
109pub const ENUM_MIN_COMMAND: u8 = 0;
110#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
111pub const ENUM_MAX_COMMAND: u8 = 4;
112#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
113#[allow(non_camel_case_types)]
114pub const ENUM_VALUES_COMMAND: [Command; 5] = [
115  Command::NONE,
116  Command::Color,
117  Command::Image,
118  Command::Clear,
119  Command::Register,
120];
121
122#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
123#[repr(transparent)]
124pub struct Command(pub u8);
125#[allow(non_upper_case_globals)]
126impl Command {
127  pub const NONE: Self = Self(0);
128  pub const Color: Self = Self(1);
129  pub const Image: Self = Self(2);
130  pub const Clear: Self = Self(3);
131  pub const Register: Self = Self(4);
132
133  pub const ENUM_MIN: u8 = 0;
134  pub const ENUM_MAX: u8 = 4;
135  pub const ENUM_VALUES: &'static [Self] = &[
136    Self::NONE,
137    Self::Color,
138    Self::Image,
139    Self::Clear,
140    Self::Register,
141  ];
142  /// Returns the variant's name or "" if unknown.
143  pub fn variant_name(self) -> Option<&'static str> {
144    match self {
145      Self::NONE => Some("NONE"),
146      Self::Color => Some("Color"),
147      Self::Image => Some("Image"),
148      Self::Clear => Some("Clear"),
149      Self::Register => Some("Register"),
150      _ => None,
151    }
152  }
153}
154impl core::fmt::Debug for Command {
155  fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
156    if let Some(name) = self.variant_name() {
157      f.write_str(name)
158    } else {
159      f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
160    }
161  }
162}
163impl<'a> flatbuffers::Follow<'a> for Command {
164  type Inner = Self;
165  #[inline]
166  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
167    let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
168    Self(b)
169  }
170}
171
172impl flatbuffers::Push for Command {
173    type Output = Command;
174    #[inline]
175    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
176        flatbuffers::emplace_scalar::<u8>(dst, self.0);
177    }
178}
179
180impl flatbuffers::EndianScalar for Command {
181  type Scalar = u8;
182  #[inline]
183  fn to_little_endian(self) -> u8 {
184    self.0.to_le()
185  }
186  #[inline]
187  #[allow(clippy::wrong_self_convention)]
188  fn from_little_endian(v: u8) -> Self {
189    let b = u8::from_le(v);
190    Self(b)
191  }
192}
193
194impl<'a> flatbuffers::Verifiable for Command {
195  #[inline]
196  fn run_verifier(
197    v: &mut flatbuffers::Verifier, pos: usize
198  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
199    use self::flatbuffers::Verifiable;
200    u8::run_verifier(v, pos)
201  }
202}
203
204impl flatbuffers::SimpleToVerifyInSlice for Command {}
205pub struct CommandUnionTableOffset {}
206
207pub enum RegisterOffset {}
208#[derive(Copy, Clone, PartialEq)]
209
210pub struct Register<'a> {
211  pub _tab: flatbuffers::Table<'a>,
212}
213
214impl<'a> flatbuffers::Follow<'a> for Register<'a> {
215  type Inner = Register<'a>;
216  #[inline]
217  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
218    Self { _tab: flatbuffers::Table::new(buf, loc) }
219  }
220}
221
222impl<'a> Register<'a> {
223  pub const VT_ORIGIN: flatbuffers::VOffsetT = 4;
224  pub const VT_PRIORITY: flatbuffers::VOffsetT = 6;
225
226  #[inline]
227  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
228    Register { _tab: table }
229  }
230  #[allow(unused_mut)]
231  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
232    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
233    args: &'args RegisterArgs<'args>
234  ) -> flatbuffers::WIPOffset<Register<'bldr>> {
235    let mut builder = RegisterBuilder::new(_fbb);
236    builder.add_priority(args.priority);
237    if let Some(x) = args.origin { builder.add_origin(x); }
238    builder.finish()
239  }
240
241
242  #[inline]
243  pub fn origin(&self) -> &'a str {
244    // Safety:
245    // Created from valid Table for this object
246    // which contains a valid value in this slot
247    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Register::VT_ORIGIN, None).unwrap()}
248  }
249  #[inline]
250  pub fn priority(&self) -> i32 {
251    // Safety:
252    // Created from valid Table for this object
253    // which contains a valid value in this slot
254    unsafe { self._tab.get::<i32>(Register::VT_PRIORITY, Some(0)).unwrap()}
255  }
256}
257
258impl flatbuffers::Verifiable for Register<'_> {
259  #[inline]
260  fn run_verifier(
261    v: &mut flatbuffers::Verifier, pos: usize
262  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
263    use self::flatbuffers::Verifiable;
264    v.visit_table(pos)?
265     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("origin", Self::VT_ORIGIN, true)?
266     .visit_field::<i32>("priority", Self::VT_PRIORITY, false)?
267     .finish();
268    Ok(())
269  }
270}
271pub struct RegisterArgs<'a> {
272    pub origin: Option<flatbuffers::WIPOffset<&'a str>>,
273    pub priority: i32,
274}
275impl<'a> Default for RegisterArgs<'a> {
276  #[inline]
277  fn default() -> Self {
278    RegisterArgs {
279      origin: None, // required field
280      priority: 0,
281    }
282  }
283}
284
285pub struct RegisterBuilder<'a: 'b, 'b> {
286  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
287  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
288}
289impl<'a: 'b, 'b> RegisterBuilder<'a, 'b> {
290  #[inline]
291  pub fn add_origin(&mut self, origin: flatbuffers::WIPOffset<&'b  str>) {
292    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Register::VT_ORIGIN, origin);
293  }
294  #[inline]
295  pub fn add_priority(&mut self, priority: i32) {
296    self.fbb_.push_slot::<i32>(Register::VT_PRIORITY, priority, 0);
297  }
298  #[inline]
299  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RegisterBuilder<'a, 'b> {
300    let start = _fbb.start_table();
301    RegisterBuilder {
302      fbb_: _fbb,
303      start_: start,
304    }
305  }
306  #[inline]
307  pub fn finish(self) -> flatbuffers::WIPOffset<Register<'a>> {
308    let o = self.fbb_.end_table(self.start_);
309    self.fbb_.required(o, Register::VT_ORIGIN,"origin");
310    flatbuffers::WIPOffset::new(o.value())
311  }
312}
313
314impl core::fmt::Debug for Register<'_> {
315  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
316    let mut ds = f.debug_struct("Register");
317      ds.field("origin", &self.origin());
318      ds.field("priority", &self.priority());
319      ds.finish()
320  }
321}
322pub enum RawImageOffset {}
323#[derive(Copy, Clone, PartialEq)]
324
325pub struct RawImage<'a> {
326  pub _tab: flatbuffers::Table<'a>,
327}
328
329impl<'a> flatbuffers::Follow<'a> for RawImage<'a> {
330  type Inner = RawImage<'a>;
331  #[inline]
332  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
333    Self { _tab: flatbuffers::Table::new(buf, loc) }
334  }
335}
336
337impl<'a> RawImage<'a> {
338  pub const VT_DATA: flatbuffers::VOffsetT = 4;
339  pub const VT_WIDTH: flatbuffers::VOffsetT = 6;
340  pub const VT_HEIGHT: flatbuffers::VOffsetT = 8;
341
342  #[inline]
343  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
344    RawImage { _tab: table }
345  }
346  #[allow(unused_mut)]
347  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
348    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
349    args: &'args RawImageArgs<'args>
350  ) -> flatbuffers::WIPOffset<RawImage<'bldr>> {
351    let mut builder = RawImageBuilder::new(_fbb);
352    builder.add_height(args.height);
353    builder.add_width(args.width);
354    if let Some(x) = args.data { builder.add_data(x); }
355    builder.finish()
356  }
357
358
359  #[inline]
360  pub fn data(&self) -> Option<flatbuffers::Vector<'a, u8>> {
361    // Safety:
362    // Created from valid Table for this object
363    // which contains a valid value in this slot
364    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(RawImage::VT_DATA, None)}
365  }
366  #[inline]
367  pub fn width(&self) -> i32 {
368    // Safety:
369    // Created from valid Table for this object
370    // which contains a valid value in this slot
371    unsafe { self._tab.get::<i32>(RawImage::VT_WIDTH, Some(-1)).unwrap()}
372  }
373  #[inline]
374  pub fn height(&self) -> i32 {
375    // Safety:
376    // Created from valid Table for this object
377    // which contains a valid value in this slot
378    unsafe { self._tab.get::<i32>(RawImage::VT_HEIGHT, Some(-1)).unwrap()}
379  }
380}
381
382impl flatbuffers::Verifiable for RawImage<'_> {
383  #[inline]
384  fn run_verifier(
385    v: &mut flatbuffers::Verifier, pos: usize
386  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
387    use self::flatbuffers::Verifiable;
388    v.visit_table(pos)?
389     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("data", Self::VT_DATA, false)?
390     .visit_field::<i32>("width", Self::VT_WIDTH, false)?
391     .visit_field::<i32>("height", Self::VT_HEIGHT, false)?
392     .finish();
393    Ok(())
394  }
395}
396pub struct RawImageArgs<'a> {
397    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
398    pub width: i32,
399    pub height: i32,
400}
401impl<'a> Default for RawImageArgs<'a> {
402  #[inline]
403  fn default() -> Self {
404    RawImageArgs {
405      data: None,
406      width: -1,
407      height: -1,
408    }
409  }
410}
411
412pub struct RawImageBuilder<'a: 'b, 'b> {
413  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
414  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
415}
416impl<'a: 'b, 'b> RawImageBuilder<'a, 'b> {
417  #[inline]
418  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
419    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(RawImage::VT_DATA, data);
420  }
421  #[inline]
422  pub fn add_width(&mut self, width: i32) {
423    self.fbb_.push_slot::<i32>(RawImage::VT_WIDTH, width, -1);
424  }
425  #[inline]
426  pub fn add_height(&mut self, height: i32) {
427    self.fbb_.push_slot::<i32>(RawImage::VT_HEIGHT, height, -1);
428  }
429  #[inline]
430  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RawImageBuilder<'a, 'b> {
431    let start = _fbb.start_table();
432    RawImageBuilder {
433      fbb_: _fbb,
434      start_: start,
435    }
436  }
437  #[inline]
438  pub fn finish(self) -> flatbuffers::WIPOffset<RawImage<'a>> {
439    let o = self.fbb_.end_table(self.start_);
440    flatbuffers::WIPOffset::new(o.value())
441  }
442}
443
444impl core::fmt::Debug for RawImage<'_> {
445  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
446    let mut ds = f.debug_struct("RawImage");
447      ds.field("data", &self.data());
448      ds.field("width", &self.width());
449      ds.field("height", &self.height());
450      ds.finish()
451  }
452}
453pub enum ImageOffset {}
454#[derive(Copy, Clone, PartialEq)]
455
456pub struct Image<'a> {
457  pub _tab: flatbuffers::Table<'a>,
458}
459
460impl<'a> flatbuffers::Follow<'a> for Image<'a> {
461  type Inner = Image<'a>;
462  #[inline]
463  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
464    Self { _tab: flatbuffers::Table::new(buf, loc) }
465  }
466}
467
468impl<'a> Image<'a> {
469  pub const VT_DATA_TYPE: flatbuffers::VOffsetT = 4;
470  pub const VT_DATA: flatbuffers::VOffsetT = 6;
471  pub const VT_DURATION: flatbuffers::VOffsetT = 8;
472
473  #[inline]
474  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
475    Image { _tab: table }
476  }
477  #[allow(unused_mut)]
478  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
479    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
480    args: &'args ImageArgs
481  ) -> flatbuffers::WIPOffset<Image<'bldr>> {
482    let mut builder = ImageBuilder::new(_fbb);
483    builder.add_duration(args.duration);
484    if let Some(x) = args.data { builder.add_data(x); }
485    builder.add_data_type(args.data_type);
486    builder.finish()
487  }
488
489
490  #[inline]
491  pub fn data_type(&self) -> ImageType {
492    // Safety:
493    // Created from valid Table for this object
494    // which contains a valid value in this slot
495    unsafe { self._tab.get::<ImageType>(Image::VT_DATA_TYPE, Some(ImageType::NONE)).unwrap()}
496  }
497  #[inline]
498  pub fn data(&self) -> flatbuffers::Table<'a> {
499    // Safety:
500    // Created from valid Table for this object
501    // which contains a valid value in this slot
502    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Image::VT_DATA, None).unwrap()}
503  }
504  #[inline]
505  pub fn duration(&self) -> i32 {
506    // Safety:
507    // Created from valid Table for this object
508    // which contains a valid value in this slot
509    unsafe { self._tab.get::<i32>(Image::VT_DURATION, Some(-1)).unwrap()}
510  }
511  #[inline]
512  #[allow(non_snake_case)]
513  pub fn data_as_raw_image(&self) -> Option<RawImage<'a>> {
514    if self.data_type() == ImageType::RawImage {
515      let u = self.data();
516      // Safety:
517      // Created from a valid Table for this object
518      // Which contains a valid union in this slot
519      Some(unsafe { RawImage::init_from_table(u) })
520    } else {
521      None
522    }
523  }
524
525}
526
527impl flatbuffers::Verifiable for Image<'_> {
528  #[inline]
529  fn run_verifier(
530    v: &mut flatbuffers::Verifier, pos: usize
531  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
532    use self::flatbuffers::Verifiable;
533    v.visit_table(pos)?
534     .visit_union::<ImageType, _>("data_type", Self::VT_DATA_TYPE, "data", Self::VT_DATA, true, |key, v, pos| {
535        match key {
536          ImageType::RawImage => v.verify_union_variant::<flatbuffers::ForwardsUOffset<RawImage>>("ImageType::RawImage", pos),
537          _ => Ok(()),
538        }
539     })?
540     .visit_field::<i32>("duration", Self::VT_DURATION, false)?
541     .finish();
542    Ok(())
543  }
544}
545pub struct ImageArgs {
546    pub data_type: ImageType,
547    pub data: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
548    pub duration: i32,
549}
550impl<'a> Default for ImageArgs {
551  #[inline]
552  fn default() -> Self {
553    ImageArgs {
554      data_type: ImageType::NONE,
555      data: None, // required field
556      duration: -1,
557    }
558  }
559}
560
561pub struct ImageBuilder<'a: 'b, 'b> {
562  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
563  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
564}
565impl<'a: 'b, 'b> ImageBuilder<'a, 'b> {
566  #[inline]
567  pub fn add_data_type(&mut self, data_type: ImageType) {
568    self.fbb_.push_slot::<ImageType>(Image::VT_DATA_TYPE, data_type, ImageType::NONE);
569  }
570  #[inline]
571  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
572    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Image::VT_DATA, data);
573  }
574  #[inline]
575  pub fn add_duration(&mut self, duration: i32) {
576    self.fbb_.push_slot::<i32>(Image::VT_DURATION, duration, -1);
577  }
578  #[inline]
579  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ImageBuilder<'a, 'b> {
580    let start = _fbb.start_table();
581    ImageBuilder {
582      fbb_: _fbb,
583      start_: start,
584    }
585  }
586  #[inline]
587  pub fn finish(self) -> flatbuffers::WIPOffset<Image<'a>> {
588    let o = self.fbb_.end_table(self.start_);
589    self.fbb_.required(o, Image::VT_DATA,"data");
590    flatbuffers::WIPOffset::new(o.value())
591  }
592}
593
594impl core::fmt::Debug for Image<'_> {
595  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
596    let mut ds = f.debug_struct("Image");
597      ds.field("data_type", &self.data_type());
598      match self.data_type() {
599        ImageType::RawImage => {
600          if let Some(x) = self.data_as_raw_image() {
601            ds.field("data", &x)
602          } else {
603            ds.field("data", &"InvalidFlatbuffer: Union discriminant does not match value.")
604          }
605        },
606        _ => {
607          let x: Option<()> = None;
608          ds.field("data", &x)
609        },
610      };
611      ds.field("duration", &self.duration());
612      ds.finish()
613  }
614}
615pub enum ClearOffset {}
616#[derive(Copy, Clone, PartialEq)]
617
618pub struct Clear<'a> {
619  pub _tab: flatbuffers::Table<'a>,
620}
621
622impl<'a> flatbuffers::Follow<'a> for Clear<'a> {
623  type Inner = Clear<'a>;
624  #[inline]
625  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
626    Self { _tab: flatbuffers::Table::new(buf, loc) }
627  }
628}
629
630impl<'a> Clear<'a> {
631  pub const VT_PRIORITY: flatbuffers::VOffsetT = 4;
632
633  #[inline]
634  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
635    Clear { _tab: table }
636  }
637  #[allow(unused_mut)]
638  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
639    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
640    args: &'args ClearArgs
641  ) -> flatbuffers::WIPOffset<Clear<'bldr>> {
642    let mut builder = ClearBuilder::new(_fbb);
643    builder.add_priority(args.priority);
644    builder.finish()
645  }
646
647
648  #[inline]
649  pub fn priority(&self) -> i32 {
650    // Safety:
651    // Created from valid Table for this object
652    // which contains a valid value in this slot
653    unsafe { self._tab.get::<i32>(Clear::VT_PRIORITY, Some(0)).unwrap()}
654  }
655}
656
657impl flatbuffers::Verifiable for Clear<'_> {
658  #[inline]
659  fn run_verifier(
660    v: &mut flatbuffers::Verifier, pos: usize
661  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
662    use self::flatbuffers::Verifiable;
663    v.visit_table(pos)?
664     .visit_field::<i32>("priority", Self::VT_PRIORITY, false)?
665     .finish();
666    Ok(())
667  }
668}
669pub struct ClearArgs {
670    pub priority: i32,
671}
672impl<'a> Default for ClearArgs {
673  #[inline]
674  fn default() -> Self {
675    ClearArgs {
676      priority: 0,
677    }
678  }
679}
680
681pub struct ClearBuilder<'a: 'b, 'b> {
682  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
683  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
684}
685impl<'a: 'b, 'b> ClearBuilder<'a, 'b> {
686  #[inline]
687  pub fn add_priority(&mut self, priority: i32) {
688    self.fbb_.push_slot::<i32>(Clear::VT_PRIORITY, priority, 0);
689  }
690  #[inline]
691  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ClearBuilder<'a, 'b> {
692    let start = _fbb.start_table();
693    ClearBuilder {
694      fbb_: _fbb,
695      start_: start,
696    }
697  }
698  #[inline]
699  pub fn finish(self) -> flatbuffers::WIPOffset<Clear<'a>> {
700    let o = self.fbb_.end_table(self.start_);
701    flatbuffers::WIPOffset::new(o.value())
702  }
703}
704
705impl core::fmt::Debug for Clear<'_> {
706  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
707    let mut ds = f.debug_struct("Clear");
708      ds.field("priority", &self.priority());
709      ds.finish()
710  }
711}
712pub enum ColorOffset {}
713#[derive(Copy, Clone, PartialEq)]
714
715pub struct Color<'a> {
716  pub _tab: flatbuffers::Table<'a>,
717}
718
719impl<'a> flatbuffers::Follow<'a> for Color<'a> {
720  type Inner = Color<'a>;
721  #[inline]
722  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
723    Self { _tab: flatbuffers::Table::new(buf, loc) }
724  }
725}
726
727impl<'a> Color<'a> {
728  pub const VT_DATA: flatbuffers::VOffsetT = 4;
729  pub const VT_DURATION: flatbuffers::VOffsetT = 6;
730
731  #[inline]
732  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
733    Color { _tab: table }
734  }
735  #[allow(unused_mut)]
736  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
737    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
738    args: &'args ColorArgs
739  ) -> flatbuffers::WIPOffset<Color<'bldr>> {
740    let mut builder = ColorBuilder::new(_fbb);
741    builder.add_duration(args.duration);
742    builder.add_data(args.data);
743    builder.finish()
744  }
745
746
747  #[inline]
748  pub fn data(&self) -> i32 {
749    // Safety:
750    // Created from valid Table for this object
751    // which contains a valid value in this slot
752    unsafe { self._tab.get::<i32>(Color::VT_DATA, Some(-1)).unwrap()}
753  }
754  #[inline]
755  pub fn duration(&self) -> i32 {
756    // Safety:
757    // Created from valid Table for this object
758    // which contains a valid value in this slot
759    unsafe { self._tab.get::<i32>(Color::VT_DURATION, Some(-1)).unwrap()}
760  }
761}
762
763impl flatbuffers::Verifiable for Color<'_> {
764  #[inline]
765  fn run_verifier(
766    v: &mut flatbuffers::Verifier, pos: usize
767  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
768    use self::flatbuffers::Verifiable;
769    v.visit_table(pos)?
770     .visit_field::<i32>("data", Self::VT_DATA, false)?
771     .visit_field::<i32>("duration", Self::VT_DURATION, false)?
772     .finish();
773    Ok(())
774  }
775}
776pub struct ColorArgs {
777    pub data: i32,
778    pub duration: i32,
779}
780impl<'a> Default for ColorArgs {
781  #[inline]
782  fn default() -> Self {
783    ColorArgs {
784      data: -1,
785      duration: -1,
786    }
787  }
788}
789
790pub struct ColorBuilder<'a: 'b, 'b> {
791  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
792  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
793}
794impl<'a: 'b, 'b> ColorBuilder<'a, 'b> {
795  #[inline]
796  pub fn add_data(&mut self, data: i32) {
797    self.fbb_.push_slot::<i32>(Color::VT_DATA, data, -1);
798  }
799  #[inline]
800  pub fn add_duration(&mut self, duration: i32) {
801    self.fbb_.push_slot::<i32>(Color::VT_DURATION, duration, -1);
802  }
803  #[inline]
804  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ColorBuilder<'a, 'b> {
805    let start = _fbb.start_table();
806    ColorBuilder {
807      fbb_: _fbb,
808      start_: start,
809    }
810  }
811  #[inline]
812  pub fn finish(self) -> flatbuffers::WIPOffset<Color<'a>> {
813    let o = self.fbb_.end_table(self.start_);
814    flatbuffers::WIPOffset::new(o.value())
815  }
816}
817
818impl core::fmt::Debug for Color<'_> {
819  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
820    let mut ds = f.debug_struct("Color");
821      ds.field("data", &self.data());
822      ds.field("duration", &self.duration());
823      ds.finish()
824  }
825}
826pub enum RequestOffset {}
827#[derive(Copy, Clone, PartialEq)]
828
829pub struct Request<'a> {
830  pub _tab: flatbuffers::Table<'a>,
831}
832
833impl<'a> flatbuffers::Follow<'a> for Request<'a> {
834  type Inner = Request<'a>;
835  #[inline]
836  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
837    Self { _tab: flatbuffers::Table::new(buf, loc) }
838  }
839}
840
841impl<'a> Request<'a> {
842  pub const VT_COMMAND_TYPE: flatbuffers::VOffsetT = 4;
843  pub const VT_COMMAND: flatbuffers::VOffsetT = 6;
844
845  #[inline]
846  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
847    Request { _tab: table }
848  }
849  #[allow(unused_mut)]
850  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
851    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
852    args: &'args RequestArgs
853  ) -> flatbuffers::WIPOffset<Request<'bldr>> {
854    let mut builder = RequestBuilder::new(_fbb);
855    if let Some(x) = args.command { builder.add_command(x); }
856    builder.add_command_type(args.command_type);
857    builder.finish()
858  }
859
860
861  #[inline]
862  pub fn command_type(&self) -> Command {
863    // Safety:
864    // Created from valid Table for this object
865    // which contains a valid value in this slot
866    unsafe { self._tab.get::<Command>(Request::VT_COMMAND_TYPE, Some(Command::NONE)).unwrap()}
867  }
868  #[inline]
869  pub fn command(&self) -> flatbuffers::Table<'a> {
870    // Safety:
871    // Created from valid Table for this object
872    // which contains a valid value in this slot
873    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Request::VT_COMMAND, None).unwrap()}
874  }
875  #[inline]
876  #[allow(non_snake_case)]
877  pub fn command_as_color(&self) -> Option<Color<'a>> {
878    if self.command_type() == Command::Color {
879      let u = self.command();
880      // Safety:
881      // Created from a valid Table for this object
882      // Which contains a valid union in this slot
883      Some(unsafe { Color::init_from_table(u) })
884    } else {
885      None
886    }
887  }
888
889  #[inline]
890  #[allow(non_snake_case)]
891  pub fn command_as_image(&self) -> Option<Image<'a>> {
892    if self.command_type() == Command::Image {
893      let u = self.command();
894      // Safety:
895      // Created from a valid Table for this object
896      // Which contains a valid union in this slot
897      Some(unsafe { Image::init_from_table(u) })
898    } else {
899      None
900    }
901  }
902
903  #[inline]
904  #[allow(non_snake_case)]
905  pub fn command_as_clear(&self) -> Option<Clear<'a>> {
906    if self.command_type() == Command::Clear {
907      let u = self.command();
908      // Safety:
909      // Created from a valid Table for this object
910      // Which contains a valid union in this slot
911      Some(unsafe { Clear::init_from_table(u) })
912    } else {
913      None
914    }
915  }
916
917  #[inline]
918  #[allow(non_snake_case)]
919  pub fn command_as_register(&self) -> Option<Register<'a>> {
920    if self.command_type() == Command::Register {
921      let u = self.command();
922      // Safety:
923      // Created from a valid Table for this object
924      // Which contains a valid union in this slot
925      Some(unsafe { Register::init_from_table(u) })
926    } else {
927      None
928    }
929  }
930
931}
932
933impl flatbuffers::Verifiable for Request<'_> {
934  #[inline]
935  fn run_verifier(
936    v: &mut flatbuffers::Verifier, pos: usize
937  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
938    use self::flatbuffers::Verifiable;
939    v.visit_table(pos)?
940     .visit_union::<Command, _>("command_type", Self::VT_COMMAND_TYPE, "command", Self::VT_COMMAND, true, |key, v, pos| {
941        match key {
942          Command::Color => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Color>>("Command::Color", pos),
943          Command::Image => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Image>>("Command::Image", pos),
944          Command::Clear => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Clear>>("Command::Clear", pos),
945          Command::Register => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Register>>("Command::Register", pos),
946          _ => Ok(()),
947        }
948     })?
949     .finish();
950    Ok(())
951  }
952}
953pub struct RequestArgs {
954    pub command_type: Command,
955    pub command: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
956}
957impl<'a> Default for RequestArgs {
958  #[inline]
959  fn default() -> Self {
960    RequestArgs {
961      command_type: Command::NONE,
962      command: None, // required field
963    }
964  }
965}
966
967pub struct RequestBuilder<'a: 'b, 'b> {
968  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
969  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
970}
971impl<'a: 'b, 'b> RequestBuilder<'a, 'b> {
972  #[inline]
973  pub fn add_command_type(&mut self, command_type: Command) {
974    self.fbb_.push_slot::<Command>(Request::VT_COMMAND_TYPE, command_type, Command::NONE);
975  }
976  #[inline]
977  pub fn add_command(&mut self, command: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
978    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Request::VT_COMMAND, command);
979  }
980  #[inline]
981  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RequestBuilder<'a, 'b> {
982    let start = _fbb.start_table();
983    RequestBuilder {
984      fbb_: _fbb,
985      start_: start,
986    }
987  }
988  #[inline]
989  pub fn finish(self) -> flatbuffers::WIPOffset<Request<'a>> {
990    let o = self.fbb_.end_table(self.start_);
991    self.fbb_.required(o, Request::VT_COMMAND,"command");
992    flatbuffers::WIPOffset::new(o.value())
993  }
994}
995
996impl core::fmt::Debug for Request<'_> {
997  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
998    let mut ds = f.debug_struct("Request");
999      ds.field("command_type", &self.command_type());
1000      match self.command_type() {
1001        Command::Color => {
1002          if let Some(x) = self.command_as_color() {
1003            ds.field("command", &x)
1004          } else {
1005            ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
1006          }
1007        },
1008        Command::Image => {
1009          if let Some(x) = self.command_as_image() {
1010            ds.field("command", &x)
1011          } else {
1012            ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
1013          }
1014        },
1015        Command::Clear => {
1016          if let Some(x) = self.command_as_clear() {
1017            ds.field("command", &x)
1018          } else {
1019            ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
1020          }
1021        },
1022        Command::Register => {
1023          if let Some(x) = self.command_as_register() {
1024            ds.field("command", &x)
1025          } else {
1026            ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
1027          }
1028        },
1029        _ => {
1030          let x: Option<()> = None;
1031          ds.field("command", &x)
1032        },
1033      };
1034      ds.finish()
1035  }
1036}
1037#[inline]
1038/// Verifies that a buffer of bytes contains a `Request`
1039/// and returns it.
1040/// Note that verification is still experimental and may not
1041/// catch every error, or be maximally performant. For the
1042/// previous, unchecked, behavior use
1043/// `root_as_request_unchecked`.
1044pub fn root_as_request(buf: &[u8]) -> Result<Request<'_>, flatbuffers::InvalidFlatbuffer> {
1045  flatbuffers::root::<Request>(buf)
1046}
1047#[inline]
1048/// Verifies that a buffer of bytes contains a size prefixed
1049/// `Request` and returns it.
1050/// Note that verification is still experimental and may not
1051/// catch every error, or be maximally performant. For the
1052/// previous, unchecked, behavior use
1053/// `size_prefixed_root_as_request_unchecked`.
1054pub fn size_prefixed_root_as_request(buf: &[u8]) -> Result<Request<'_>, flatbuffers::InvalidFlatbuffer> {
1055  flatbuffers::size_prefixed_root::<Request>(buf)
1056}
1057#[inline]
1058/// Verifies, with the given options, that a buffer of bytes
1059/// contains a `Request` and returns it.
1060/// Note that verification is still experimental and may not
1061/// catch every error, or be maximally performant. For the
1062/// previous, unchecked, behavior use
1063/// `root_as_request_unchecked`.
1064pub fn root_as_request_with_opts<'b, 'o>(
1065  opts: &'o flatbuffers::VerifierOptions,
1066  buf: &'b [u8],
1067) -> Result<Request<'b>, flatbuffers::InvalidFlatbuffer> {
1068  flatbuffers::root_with_opts::<Request<'b>>(opts, buf)
1069}
1070#[inline]
1071/// Verifies, with the given verifier options, that a buffer of
1072/// bytes contains a size prefixed `Request` and returns
1073/// it. Note that verification is still experimental and may not
1074/// catch every error, or be maximally performant. For the
1075/// previous, unchecked, behavior use
1076/// `root_as_request_unchecked`.
1077pub fn size_prefixed_root_as_request_with_opts<'b, 'o>(
1078  opts: &'o flatbuffers::VerifierOptions,
1079  buf: &'b [u8],
1080) -> Result<Request<'b>, flatbuffers::InvalidFlatbuffer> {
1081  flatbuffers::size_prefixed_root_with_opts::<Request<'b>>(opts, buf)
1082}
1083#[inline]
1084/// Assumes, without verification, that a buffer of bytes contains a Request and returns it.
1085/// # Safety
1086/// Callers must trust the given bytes do indeed contain a valid `Request`.
1087pub unsafe fn root_as_request_unchecked(buf: &[u8]) -> Request<'_> {
1088  flatbuffers::root_unchecked::<Request>(buf)
1089}
1090#[inline]
1091/// Assumes, without verification, that a buffer of bytes contains a size prefixed Request and returns it.
1092/// # Safety
1093/// Callers must trust the given bytes do indeed contain a valid size prefixed `Request`.
1094pub unsafe fn size_prefixed_root_as_request_unchecked(buf: &[u8]) -> Request<'_> {
1095  flatbuffers::size_prefixed_root_unchecked::<Request>(buf)
1096}
1097#[inline]
1098pub fn finish_request_buffer<'a, 'b>(
1099    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
1100    root: flatbuffers::WIPOffset<Request<'a>>) {
1101  fbb.finish(root, None);
1102}
1103
1104#[inline]
1105pub fn finish_size_prefixed_request_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Request<'a>>) {
1106  fbb.finish_size_prefixed(root, None);
1107}
1108}  // pub mod hyperionnet
1109