The .fbs files come from HyperHDR (see schema/NOTICE); the *_generated.rs files are flatc output regenerated by scripts/regen-fbs.sh, which refuses to run unless flatc matches the pinned flatbuffers crate.
1532 lines
52 KiB
Rust
1532 lines
52 KiB
Rust
// automatically generated by the FlatBuffers compiler, do not modify
|
|
// @generated
|
|
|
|
extern crate alloc;
|
|
|
|
#[allow(unused_imports, dead_code)]
|
|
pub mod hyperhdrnet {
|
|
|
|
extern crate alloc;
|
|
|
|
#[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 = 2;
|
|
#[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; 3] =
|
|
[ImageType::NONE, ImageType::RawImage, ImageType::NV12Image];
|
|
|
|
#[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 NV12Image: Self = Self(2);
|
|
|
|
pub const ENUM_MIN: u8 = 0;
|
|
pub const ENUM_MAX: u8 = 2;
|
|
pub const ENUM_VALUES: &'static [Self] = &[Self::NONE, Self::RawImage, Self::NV12Image];
|
|
/// Returns the variant's name or "" if unknown.
|
|
pub fn variant_name(self) -> Option<&'static str> {
|
|
match self {
|
|
Self::NONE => Some("NONE"),
|
|
Self::RawImage => Some("RawImage"),
|
|
Self::NV12Image => Some("NV12Image"),
|
|
_ => 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 = unsafe { ::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) {
|
|
unsafe { ::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> {
|
|
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,
|
|
];
|
|
/// Returns the variant's name or "" if unknown.
|
|
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 = unsafe { ::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) {
|
|
unsafe { ::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> {
|
|
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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<::flatbuffers::ForwardsUOffset<&str>>(Register::VT_ORIGIN, None)
|
|
.unwrap()
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn priority(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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> {
|
|
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, // required field
|
|
priority: 0,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct RegisterBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RegisterBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> RegisterBuilder<'a, 'b, A> {
|
|
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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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>> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
|
|
RawImage::VT_DATA,
|
|
None,
|
|
)
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn width(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe { self._tab.get::<i32>(RawImage::VT_WIDTH, Some(-1)).unwrap() }
|
|
}
|
|
#[inline]
|
|
pub fn height(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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> {
|
|
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, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RawImageBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> RawImageBuilder<'a, 'b, A> {
|
|
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 NV12ImageOffset {}
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
pub struct NV12Image<'a> {
|
|
pub _tab: ::flatbuffers::Table<'a>,
|
|
}
|
|
|
|
impl<'a> ::flatbuffers::Follow<'a> for NV12Image<'a> {
|
|
type Inner = NV12Image<'a>;
|
|
#[inline]
|
|
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
|
Self {
|
|
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'a> NV12Image<'a> {
|
|
pub const VT_DATA_Y: ::flatbuffers::VOffsetT = 4;
|
|
pub const VT_DATA_UV: ::flatbuffers::VOffsetT = 6;
|
|
pub const VT_WIDTH: ::flatbuffers::VOffsetT = 8;
|
|
pub const VT_HEIGHT: ::flatbuffers::VOffsetT = 10;
|
|
pub const VT_STRIDE_Y: ::flatbuffers::VOffsetT = 12;
|
|
pub const VT_STRIDE_UV: ::flatbuffers::VOffsetT = 14;
|
|
|
|
#[inline]
|
|
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
|
|
NV12Image { _tab: table }
|
|
}
|
|
#[allow(unused_mut)]
|
|
pub fn create<
|
|
'bldr: 'args,
|
|
'args: 'mut_bldr,
|
|
'mut_bldr,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
args: &'args NV12ImageArgs<'args>,
|
|
) -> ::flatbuffers::WIPOffset<NV12Image<'bldr>> {
|
|
let mut builder = NV12ImageBuilder::new(_fbb);
|
|
builder.add_stride_uv(args.stride_uv);
|
|
builder.add_stride_y(args.stride_y);
|
|
builder.add_height(args.height);
|
|
builder.add_width(args.width);
|
|
if let Some(x) = args.data_uv {
|
|
builder.add_data_uv(x);
|
|
}
|
|
if let Some(x) = args.data_y {
|
|
builder.add_data_y(x);
|
|
}
|
|
builder.finish()
|
|
}
|
|
|
|
#[inline]
|
|
pub fn data_y(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
|
|
NV12Image::VT_DATA_Y,
|
|
None,
|
|
)
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn data_uv(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
|
|
NV12Image::VT_DATA_UV,
|
|
None,
|
|
)
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn width(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe { self._tab.get::<i32>(NV12Image::VT_WIDTH, Some(0)).unwrap() }
|
|
}
|
|
#[inline]
|
|
pub fn height(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe { self._tab.get::<i32>(NV12Image::VT_HEIGHT, Some(0)).unwrap() }
|
|
}
|
|
#[inline]
|
|
pub fn stride_y(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<i32>(NV12Image::VT_STRIDE_Y, Some(0))
|
|
.unwrap()
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn stride_uv(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<i32>(NV12Image::VT_STRIDE_UV, Some(0))
|
|
.unwrap()
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ::flatbuffers::Verifiable for NV12Image<'_> {
|
|
#[inline]
|
|
fn run_verifier(
|
|
v: &mut ::flatbuffers::Verifier,
|
|
pos: usize,
|
|
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
|
v.visit_table(pos)?
|
|
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
|
|
"data_y",
|
|
Self::VT_DATA_Y,
|
|
false,
|
|
)?
|
|
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
|
|
"data_uv",
|
|
Self::VT_DATA_UV,
|
|
false,
|
|
)?
|
|
.visit_field::<i32>("width", Self::VT_WIDTH, false)?
|
|
.visit_field::<i32>("height", Self::VT_HEIGHT, false)?
|
|
.visit_field::<i32>("stride_y", Self::VT_STRIDE_Y, false)?
|
|
.visit_field::<i32>("stride_uv", Self::VT_STRIDE_UV, false)?
|
|
.finish();
|
|
Ok(())
|
|
}
|
|
}
|
|
pub struct NV12ImageArgs<'a> {
|
|
pub data_y: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
|
|
pub data_uv: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
|
|
pub width: i32,
|
|
pub height: i32,
|
|
pub stride_y: i32,
|
|
pub stride_uv: i32,
|
|
}
|
|
impl<'a> Default for NV12ImageArgs<'a> {
|
|
#[inline]
|
|
fn default() -> Self {
|
|
NV12ImageArgs {
|
|
data_y: None,
|
|
data_uv: None,
|
|
width: 0,
|
|
height: 0,
|
|
stride_y: 0,
|
|
stride_uv: 0,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct NV12ImageBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> NV12ImageBuilder<'a, 'b, A> {
|
|
#[inline]
|
|
pub fn add_data_y(
|
|
&mut self,
|
|
data_y: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
|
|
) {
|
|
self.fbb_
|
|
.push_slot_always::<::flatbuffers::WIPOffset<_>>(NV12Image::VT_DATA_Y, data_y);
|
|
}
|
|
#[inline]
|
|
pub fn add_data_uv(
|
|
&mut self,
|
|
data_uv: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
|
|
) {
|
|
self.fbb_
|
|
.push_slot_always::<::flatbuffers::WIPOffset<_>>(NV12Image::VT_DATA_UV, data_uv);
|
|
}
|
|
#[inline]
|
|
pub fn add_width(&mut self, width: i32) {
|
|
self.fbb_.push_slot::<i32>(NV12Image::VT_WIDTH, width, 0);
|
|
}
|
|
#[inline]
|
|
pub fn add_height(&mut self, height: i32) {
|
|
self.fbb_.push_slot::<i32>(NV12Image::VT_HEIGHT, height, 0);
|
|
}
|
|
#[inline]
|
|
pub fn add_stride_y(&mut self, stride_y: i32) {
|
|
self.fbb_
|
|
.push_slot::<i32>(NV12Image::VT_STRIDE_Y, stride_y, 0);
|
|
}
|
|
#[inline]
|
|
pub fn add_stride_uv(&mut self, stride_uv: i32) {
|
|
self.fbb_
|
|
.push_slot::<i32>(NV12Image::VT_STRIDE_UV, stride_uv, 0);
|
|
}
|
|
#[inline]
|
|
pub fn new(
|
|
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
) -> NV12ImageBuilder<'a, 'b, A> {
|
|
let start = _fbb.start_table();
|
|
NV12ImageBuilder {
|
|
fbb_: _fbb,
|
|
start_: start,
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn finish(self) -> ::flatbuffers::WIPOffset<NV12Image<'a>> {
|
|
let o = self.fbb_.end_table(self.start_);
|
|
::flatbuffers::WIPOffset::new(o.value())
|
|
}
|
|
}
|
|
|
|
impl ::core::fmt::Debug for NV12Image<'_> {
|
|
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
|
let mut ds = f.debug_struct("NV12Image");
|
|
ds.field("data_y", &self.data_y());
|
|
ds.field("data_uv", &self.data_uv());
|
|
ds.field("width", &self.width());
|
|
ds.field("height", &self.height());
|
|
ds.field("stride_y", &self.stride_y());
|
|
ds.field("stride_uv", &self.stride_uv());
|
|
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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<ImageType>(Image::VT_DATA_TYPE, Some(ImageType::NONE))
|
|
.unwrap()
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn data(&self) -> ::flatbuffers::Table<'a> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(
|
|
Image::VT_DATA,
|
|
None,
|
|
)
|
|
.unwrap()
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn duration(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
Some(unsafe { RawImage::init_from_table(u) })
|
|
} else {
|
|
None
|
|
}
|
|
}
|
|
|
|
#[inline]
|
|
#[allow(non_snake_case)]
|
|
pub fn data_as_nv12_image(&self) -> Option<NV12Image<'a>> {
|
|
if self.data_type() == ImageType::NV12Image {
|
|
let u = self.data();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
Some(unsafe { NV12Image::init_from_table(u) })
|
|
} else {
|
|
None
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ::flatbuffers::Verifiable for Image<'_> {
|
|
#[inline]
|
|
fn run_verifier(
|
|
v: &mut ::flatbuffers::Verifier,
|
|
pos: usize,
|
|
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
|
|
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,
|
|
),
|
|
ImageType::NV12Image => v
|
|
.verify_union_variant::<::flatbuffers::ForwardsUOffset<NV12Image>>(
|
|
"ImageType::NV12Image",
|
|
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, // required field
|
|
duration: -1,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct ImageBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ImageBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> ImageBuilder<'a, 'b, A> {
|
|
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.",
|
|
)
|
|
}
|
|
}
|
|
ImageType::NV12Image => {
|
|
if let Some(x) = self.data_as_nv12_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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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> {
|
|
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, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ClearBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> ClearBuilder<'a, 'b, A> {
|
|
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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe { self._tab.get::<i32>(Color::VT_DATA, Some(-1)).unwrap() }
|
|
}
|
|
#[inline]
|
|
pub fn duration(&self) -> i32 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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> {
|
|
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, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ColorBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> ColorBuilder<'a, 'b, A> {
|
|
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: unsafe { ::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,
|
|
A: ::flatbuffers::Allocator + 'bldr,
|
|
>(
|
|
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
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 {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<Command>(Request::VT_COMMAND_TYPE, Some(Command::NONE))
|
|
.unwrap()
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn command(&self) -> ::flatbuffers::Table<'a> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
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();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
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();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
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();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
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();
|
|
// Safety:
|
|
// Created from a valid Table for this object
|
|
// Which contains a valid union in this slot
|
|
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> {
|
|
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, // required field
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct RequestBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RequestBuilder<'a, 'b, A> {
|
|
#[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, A>,
|
|
) -> RequestBuilder<'a, 'b, A> {
|
|
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]
|
|
/// Verifies that a buffer of bytes contains a `Request`
|
|
/// and returns it.
|
|
/// Note that verification is still experimental and may not
|
|
/// catch every error, or be maximally performant. For the
|
|
/// previous, unchecked, behavior use
|
|
/// `root_as_request_unchecked`.
|
|
pub fn root_as_request(buf: &[u8]) -> Result<Request<'_>, ::flatbuffers::InvalidFlatbuffer> {
|
|
::flatbuffers::root::<Request>(buf)
|
|
}
|
|
#[inline]
|
|
/// Verifies that a buffer of bytes contains a size prefixed
|
|
/// `Request` and returns it.
|
|
/// Note that verification is still experimental and may not
|
|
/// catch every error, or be maximally performant. For the
|
|
/// previous, unchecked, behavior use
|
|
/// `size_prefixed_root_as_request_unchecked`.
|
|
pub fn size_prefixed_root_as_request(
|
|
buf: &[u8],
|
|
) -> Result<Request<'_>, ::flatbuffers::InvalidFlatbuffer> {
|
|
::flatbuffers::size_prefixed_root::<Request>(buf)
|
|
}
|
|
#[inline]
|
|
/// Verifies, with the given options, that a buffer of bytes
|
|
/// contains a `Request` and returns it.
|
|
/// Note that verification is still experimental and may not
|
|
/// catch every error, or be maximally performant. For the
|
|
/// previous, unchecked, behavior use
|
|
/// `root_as_request_unchecked`.
|
|
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]
|
|
/// Verifies, with the given verifier options, that a buffer of
|
|
/// bytes contains a size prefixed `Request` and returns
|
|
/// it. Note that verification is still experimental and may not
|
|
/// catch every error, or be maximally performant. For the
|
|
/// previous, unchecked, behavior use
|
|
/// `root_as_request_unchecked`.
|
|
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]
|
|
/// Assumes, without verification, that a buffer of bytes contains a Request and returns it.
|
|
/// # Safety
|
|
/// Callers must trust the given bytes do indeed contain a valid `Request`.
|
|
pub unsafe fn root_as_request_unchecked(buf: &[u8]) -> Request<'_> {
|
|
unsafe { ::flatbuffers::root_unchecked::<Request>(buf) }
|
|
}
|
|
#[inline]
|
|
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Request and returns it.
|
|
/// # Safety
|
|
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Request`.
|
|
pub unsafe fn size_prefixed_root_as_request_unchecked(buf: &[u8]) -> Request<'_> {
|
|
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Request>(buf) }
|
|
}
|
|
#[inline]
|
|
pub fn finish_request_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
|
|
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
root: ::flatbuffers::WIPOffset<Request<'a>>,
|
|
) {
|
|
fbb.finish(root, None);
|
|
}
|
|
|
|
#[inline]
|
|
pub fn finish_size_prefixed_request_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
|
|
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
|
|
root: ::flatbuffers::WIPOffset<Request<'a>>,
|
|
) {
|
|
fbb.finish_size_prefixed(root, None);
|
|
}
|
|
} // pub mod hyperhdrnet
|