use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod hyperionnet {
use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_IMAGE_TYPE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_IMAGE_TYPE: u8 = 1;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_IMAGE_TYPE: [ImageType; 2] = [
ImageType::NONE,
ImageType::RawImage,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct ImageType(pub u8);
#[allow(non_upper_case_globals)]
impl ImageType {
pub const NONE: Self = Self(0);
pub const RawImage: Self = Self(1);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 1;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::RawImage,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::RawImage => Some("RawImage"),
_ => None,
}
}
}
impl core::fmt::Debug for ImageType {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for ImageType {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for ImageType {
type Output = ImageType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for ImageType {
type Scalar = u8;
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for ImageType {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for ImageType {}
pub struct ImageTypeUnionTableOffset {}
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_COMMAND: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_COMMAND: u8 = 4;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_COMMAND: [Command; 5] = [
Command::NONE,
Command::Color,
Command::Image,
Command::Clear,
Command::Register,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct Command(pub u8);
#[allow(non_upper_case_globals)]
impl Command {
pub const NONE: Self = Self(0);
pub const Color: Self = Self(1);
pub const Image: Self = Self(2);
pub const Clear: Self = Self(3);
pub const Register: Self = Self(4);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 4;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::Color,
Self::Image,
Self::Clear,
Self::Register,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::Color => Some("Color"),
Self::Image => Some("Image"),
Self::Clear => Some("Clear"),
Self::Register => Some("Register"),
_ => None,
}
}
}
impl core::fmt::Debug for Command {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for Command {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for Command {
type Output = Command;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for Command {
type Scalar = u8;
#[inline]
fn to_little_endian(self) -> u8 {
self.0.to_le()
}
#[inline]
#[allow(clippy::wrong_self_convention)]
fn from_little_endian(v: u8) -> Self {
let b = u8::from_le(v);
Self(b)
}
}
impl<'a> flatbuffers::Verifiable for Command {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
u8::run_verifier(v, pos)
}
}
impl flatbuffers::SimpleToVerifyInSlice for Command {}
pub struct CommandUnionTableOffset {}
pub enum RegisterOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Register<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Register<'a> {
type Inner = Register<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Register<'a> {
pub const VT_ORIGIN: flatbuffers::VOffsetT = 4;
pub const VT_PRIORITY: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Register { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args RegisterArgs<'args>
) -> flatbuffers::WIPOffset<Register<'bldr>> {
let mut builder = RegisterBuilder::new(_fbb);
builder.add_priority(args.priority);
if let Some(x) = args.origin { builder.add_origin(x); }
builder.finish()
}
#[inline]
pub fn origin(&self) -> &'a str {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Register::VT_ORIGIN, None).unwrap()}
}
#[inline]
pub fn priority(&self) -> i32 {
unsafe { self._tab.get::<i32>(Register::VT_PRIORITY, Some(0)).unwrap()}
}
}
impl flatbuffers::Verifiable for Register<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("origin", Self::VT_ORIGIN, true)?
.visit_field::<i32>("priority", Self::VT_PRIORITY, false)?
.finish();
Ok(())
}
}
pub struct RegisterArgs<'a> {
pub origin: Option<flatbuffers::WIPOffset<&'a str>>,
pub priority: i32,
}
impl<'a> Default for RegisterArgs<'a> {
#[inline]
fn default() -> Self {
RegisterArgs {
origin: None, priority: 0,
}
}
}
pub struct RegisterBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> RegisterBuilder<'a, 'b> {
#[inline]
pub fn add_origin(&mut self, origin: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Register::VT_ORIGIN, origin);
}
#[inline]
pub fn add_priority(&mut self, priority: i32) {
self.fbb_.push_slot::<i32>(Register::VT_PRIORITY, priority, 0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RegisterBuilder<'a, 'b> {
let start = _fbb.start_table();
RegisterBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Register<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Register::VT_ORIGIN,"origin");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Register<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Register");
ds.field("origin", &self.origin());
ds.field("priority", &self.priority());
ds.finish()
}
}
pub enum RawImageOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct RawImage<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for RawImage<'a> {
type Inner = RawImage<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> RawImage<'a> {
pub const VT_DATA: flatbuffers::VOffsetT = 4;
pub const VT_WIDTH: flatbuffers::VOffsetT = 6;
pub const VT_HEIGHT: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
RawImage { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args RawImageArgs<'args>
) -> flatbuffers::WIPOffset<RawImage<'bldr>> {
let mut builder = RawImageBuilder::new(_fbb);
builder.add_height(args.height);
builder.add_width(args.width);
if let Some(x) = args.data { builder.add_data(x); }
builder.finish()
}
#[inline]
pub fn data(&self) -> Option<flatbuffers::Vector<'a, u8>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(RawImage::VT_DATA, None)}
}
#[inline]
pub fn width(&self) -> i32 {
unsafe { self._tab.get::<i32>(RawImage::VT_WIDTH, Some(-1)).unwrap()}
}
#[inline]
pub fn height(&self) -> i32 {
unsafe { self._tab.get::<i32>(RawImage::VT_HEIGHT, Some(-1)).unwrap()}
}
}
impl flatbuffers::Verifiable for RawImage<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("data", Self::VT_DATA, false)?
.visit_field::<i32>("width", Self::VT_WIDTH, false)?
.visit_field::<i32>("height", Self::VT_HEIGHT, false)?
.finish();
Ok(())
}
}
pub struct RawImageArgs<'a> {
pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
pub width: i32,
pub height: i32,
}
impl<'a> Default for RawImageArgs<'a> {
#[inline]
fn default() -> Self {
RawImageArgs {
data: None,
width: -1,
height: -1,
}
}
}
pub struct RawImageBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> RawImageBuilder<'a, 'b> {
#[inline]
pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(RawImage::VT_DATA, data);
}
#[inline]
pub fn add_width(&mut self, width: i32) {
self.fbb_.push_slot::<i32>(RawImage::VT_WIDTH, width, -1);
}
#[inline]
pub fn add_height(&mut self, height: i32) {
self.fbb_.push_slot::<i32>(RawImage::VT_HEIGHT, height, -1);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RawImageBuilder<'a, 'b> {
let start = _fbb.start_table();
RawImageBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<RawImage<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for RawImage<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("RawImage");
ds.field("data", &self.data());
ds.field("width", &self.width());
ds.field("height", &self.height());
ds.finish()
}
}
pub enum ImageOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Image<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Image<'a> {
type Inner = Image<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Image<'a> {
pub const VT_DATA_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_DATA: flatbuffers::VOffsetT = 6;
pub const VT_DURATION: flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Image { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args ImageArgs
) -> flatbuffers::WIPOffset<Image<'bldr>> {
let mut builder = ImageBuilder::new(_fbb);
builder.add_duration(args.duration);
if let Some(x) = args.data { builder.add_data(x); }
builder.add_data_type(args.data_type);
builder.finish()
}
#[inline]
pub fn data_type(&self) -> ImageType {
unsafe { self._tab.get::<ImageType>(Image::VT_DATA_TYPE, Some(ImageType::NONE)).unwrap()}
}
#[inline]
pub fn data(&self) -> flatbuffers::Table<'a> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Image::VT_DATA, None).unwrap()}
}
#[inline]
pub fn duration(&self) -> i32 {
unsafe { self._tab.get::<i32>(Image::VT_DURATION, Some(-1)).unwrap()}
}
#[inline]
#[allow(non_snake_case)]
pub fn data_as_raw_image(&self) -> Option<RawImage<'a>> {
if self.data_type() == ImageType::RawImage {
let u = self.data();
Some(unsafe { RawImage::init_from_table(u) })
} else {
None
}
}
}
impl flatbuffers::Verifiable for Image<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_union::<ImageType, _>("data_type", Self::VT_DATA_TYPE, "data", Self::VT_DATA, true, |key, v, pos| {
match key {
ImageType::RawImage => v.verify_union_variant::<flatbuffers::ForwardsUOffset<RawImage>>("ImageType::RawImage", pos),
_ => Ok(()),
}
})?
.visit_field::<i32>("duration", Self::VT_DURATION, false)?
.finish();
Ok(())
}
}
pub struct ImageArgs {
pub data_type: ImageType,
pub data: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
pub duration: i32,
}
impl<'a> Default for ImageArgs {
#[inline]
fn default() -> Self {
ImageArgs {
data_type: ImageType::NONE,
data: None, duration: -1,
}
}
}
pub struct ImageBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> ImageBuilder<'a, 'b> {
#[inline]
pub fn add_data_type(&mut self, data_type: ImageType) {
self.fbb_.push_slot::<ImageType>(Image::VT_DATA_TYPE, data_type, ImageType::NONE);
}
#[inline]
pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Image::VT_DATA, data);
}
#[inline]
pub fn add_duration(&mut self, duration: i32) {
self.fbb_.push_slot::<i32>(Image::VT_DURATION, duration, -1);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ImageBuilder<'a, 'b> {
let start = _fbb.start_table();
ImageBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Image<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Image::VT_DATA,"data");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Image<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Image");
ds.field("data_type", &self.data_type());
match self.data_type() {
ImageType::RawImage => {
if let Some(x) = self.data_as_raw_image() {
ds.field("data", &x)
} else {
ds.field("data", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
_ => {
let x: Option<()> = None;
ds.field("data", &x)
},
};
ds.field("duration", &self.duration());
ds.finish()
}
}
pub enum ClearOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Clear<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Clear<'a> {
type Inner = Clear<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Clear<'a> {
pub const VT_PRIORITY: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Clear { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args ClearArgs
) -> flatbuffers::WIPOffset<Clear<'bldr>> {
let mut builder = ClearBuilder::new(_fbb);
builder.add_priority(args.priority);
builder.finish()
}
#[inline]
pub fn priority(&self) -> i32 {
unsafe { self._tab.get::<i32>(Clear::VT_PRIORITY, Some(0)).unwrap()}
}
}
impl flatbuffers::Verifiable for Clear<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<i32>("priority", Self::VT_PRIORITY, false)?
.finish();
Ok(())
}
}
pub struct ClearArgs {
pub priority: i32,
}
impl<'a> Default for ClearArgs {
#[inline]
fn default() -> Self {
ClearArgs {
priority: 0,
}
}
}
pub struct ClearBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> ClearBuilder<'a, 'b> {
#[inline]
pub fn add_priority(&mut self, priority: i32) {
self.fbb_.push_slot::<i32>(Clear::VT_PRIORITY, priority, 0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ClearBuilder<'a, 'b> {
let start = _fbb.start_table();
ClearBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Clear<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Clear<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Clear");
ds.field("priority", &self.priority());
ds.finish()
}
}
pub enum ColorOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Color<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Color<'a> {
type Inner = Color<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Color<'a> {
pub const VT_DATA: flatbuffers::VOffsetT = 4;
pub const VT_DURATION: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Color { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args ColorArgs
) -> flatbuffers::WIPOffset<Color<'bldr>> {
let mut builder = ColorBuilder::new(_fbb);
builder.add_duration(args.duration);
builder.add_data(args.data);
builder.finish()
}
#[inline]
pub fn data(&self) -> i32 {
unsafe { self._tab.get::<i32>(Color::VT_DATA, Some(-1)).unwrap()}
}
#[inline]
pub fn duration(&self) -> i32 {
unsafe { self._tab.get::<i32>(Color::VT_DURATION, Some(-1)).unwrap()}
}
}
impl flatbuffers::Verifiable for Color<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<i32>("data", Self::VT_DATA, false)?
.visit_field::<i32>("duration", Self::VT_DURATION, false)?
.finish();
Ok(())
}
}
pub struct ColorArgs {
pub data: i32,
pub duration: i32,
}
impl<'a> Default for ColorArgs {
#[inline]
fn default() -> Self {
ColorArgs {
data: -1,
duration: -1,
}
}
}
pub struct ColorBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> ColorBuilder<'a, 'b> {
#[inline]
pub fn add_data(&mut self, data: i32) {
self.fbb_.push_slot::<i32>(Color::VT_DATA, data, -1);
}
#[inline]
pub fn add_duration(&mut self, duration: i32) {
self.fbb_.push_slot::<i32>(Color::VT_DURATION, duration, -1);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ColorBuilder<'a, 'b> {
let start = _fbb.start_table();
ColorBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Color<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Color<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Color");
ds.field("data", &self.data());
ds.field("duration", &self.duration());
ds.finish()
}
}
pub enum RequestOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Request<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Request<'a> {
type Inner = Request<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Request<'a> {
pub const VT_COMMAND_TYPE: flatbuffers::VOffsetT = 4;
pub const VT_COMMAND: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Request { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args RequestArgs
) -> flatbuffers::WIPOffset<Request<'bldr>> {
let mut builder = RequestBuilder::new(_fbb);
if let Some(x) = args.command { builder.add_command(x); }
builder.add_command_type(args.command_type);
builder.finish()
}
#[inline]
pub fn command_type(&self) -> Command {
unsafe { self._tab.get::<Command>(Request::VT_COMMAND_TYPE, Some(Command::NONE)).unwrap()}
}
#[inline]
pub fn command(&self) -> flatbuffers::Table<'a> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Table<'a>>>(Request::VT_COMMAND, None).unwrap()}
}
#[inline]
#[allow(non_snake_case)]
pub fn command_as_color(&self) -> Option<Color<'a>> {
if self.command_type() == Command::Color {
let u = self.command();
Some(unsafe { Color::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn command_as_image(&self) -> Option<Image<'a>> {
if self.command_type() == Command::Image {
let u = self.command();
Some(unsafe { Image::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn command_as_clear(&self) -> Option<Clear<'a>> {
if self.command_type() == Command::Clear {
let u = self.command();
Some(unsafe { Clear::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn command_as_register(&self) -> Option<Register<'a>> {
if self.command_type() == Command::Register {
let u = self.command();
Some(unsafe { Register::init_from_table(u) })
} else {
None
}
}
}
impl flatbuffers::Verifiable for Request<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_union::<Command, _>("command_type", Self::VT_COMMAND_TYPE, "command", Self::VT_COMMAND, true, |key, v, pos| {
match key {
Command::Color => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Color>>("Command::Color", pos),
Command::Image => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Image>>("Command::Image", pos),
Command::Clear => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Clear>>("Command::Clear", pos),
Command::Register => v.verify_union_variant::<flatbuffers::ForwardsUOffset<Register>>("Command::Register", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct RequestArgs {
pub command_type: Command,
pub command: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for RequestArgs {
#[inline]
fn default() -> Self {
RequestArgs {
command_type: Command::NONE,
command: None, }
}
}
pub struct RequestBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> RequestBuilder<'a, 'b> {
#[inline]
pub fn add_command_type(&mut self, command_type: Command) {
self.fbb_.push_slot::<Command>(Request::VT_COMMAND_TYPE, command_type, Command::NONE);
}
#[inline]
pub fn add_command(&mut self, command: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Request::VT_COMMAND, command);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RequestBuilder<'a, 'b> {
let start = _fbb.start_table();
RequestBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Request<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Request::VT_COMMAND,"command");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Request<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Request");
ds.field("command_type", &self.command_type());
match self.command_type() {
Command::Color => {
if let Some(x) = self.command_as_color() {
ds.field("command", &x)
} else {
ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Command::Image => {
if let Some(x) = self.command_as_image() {
ds.field("command", &x)
} else {
ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Command::Clear => {
if let Some(x) = self.command_as_clear() {
ds.field("command", &x)
} else {
ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
Command::Register => {
if let Some(x) = self.command_as_register() {
ds.field("command", &x)
} else {
ds.field("command", &"InvalidFlatbuffer: Union discriminant does not match value.")
}
},
_ => {
let x: Option<()> = None;
ds.field("command", &x)
},
};
ds.finish()
}
}
#[inline]
pub fn root_as_request(buf: &[u8]) -> Result<Request, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<Request>(buf)
}
#[inline]
pub fn size_prefixed_root_as_request(buf: &[u8]) -> Result<Request, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<Request>(buf)
}
#[inline]
pub fn root_as_request_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Request<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<Request<'b>>(opts, buf)
}
#[inline]
pub fn size_prefixed_root_as_request_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Request<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<Request<'b>>(opts, buf)
}
#[inline]
pub unsafe fn root_as_request_unchecked(buf: &[u8]) -> Request {
flatbuffers::root_unchecked::<Request>(buf)
}
#[inline]
pub unsafe fn size_prefixed_root_as_request_unchecked(buf: &[u8]) -> Request {
flatbuffers::size_prefixed_root_unchecked::<Request>(buf)
}
#[inline]
pub fn finish_request_buffer<'a, 'b>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
root: flatbuffers::WIPOffset<Request<'a>>) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_request_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Request<'a>>) {
fbb.finish_size_prefixed(root, None);
}
}