use core::cmp::Ordering;
use core::mem;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod bench {
use core::cmp::Ordering;
use core::mem;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
pub enum PointOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Point<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Point<'a> {
type Inner = Point<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table::new(buf, loc),
}
}
}
impl<'a> Point<'a> {
pub const VT_X: flatbuffers::VOffsetT = 4;
pub const VT_Y: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Point { _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 PointArgs,
) -> flatbuffers::WIPOffset<Point<'bldr>> {
let mut builder = PointBuilder::new(_fbb);
builder.add_y(args.y);
builder.add_x(args.x);
builder.finish()
}
#[inline]
pub fn x(&self) -> f64 {
unsafe { self._tab.get::<f64>(Point::VT_X, Some(0.0)).unwrap() }
}
#[inline]
pub fn y(&self) -> f64 {
unsafe { self._tab.get::<f64>(Point::VT_Y, Some(0.0)).unwrap() }
}
}
impl flatbuffers::Verifiable for Point<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier,
pos: usize,
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<f64>("x", Self::VT_X, false)?
.visit_field::<f64>("y", Self::VT_Y, false)?
.finish();
Ok(())
}
}
pub struct PointArgs {
pub x: f64,
pub y: f64,
}
impl<'a> Default for PointArgs {
#[inline]
fn default() -> Self {
PointArgs { x: 0.0, y: 0.0 }
}
}
pub struct PointBuilder<'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> PointBuilder<'a, 'b, A> {
#[inline]
pub fn add_x(&mut self, x: f64) {
self.fbb_.push_slot::<f64>(Point::VT_X, x, 0.0);
}
#[inline]
pub fn add_y(&mut self, y: f64) {
self.fbb_.push_slot::<f64>(Point::VT_Y, y, 0.0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PointBuilder<'a, 'b, A> {
let start = _fbb.start_table();
PointBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Point<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Point<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Point");
ds.field("x", &self.x());
ds.field("y", &self.y());
ds.finish()
}
}
pub enum LogEventOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct LogEvent<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for LogEvent<'a> {
type Inner = LogEvent<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: flatbuffers::Table::new(buf, loc),
}
}
}
impl<'a> LogEvent<'a> {
pub const VT_SERVICE: flatbuffers::VOffsetT = 4;
pub const VT_LEVEL: flatbuffers::VOffsetT = 6;
pub const VT_MESSAGE: flatbuffers::VOffsetT = 8;
pub const VT_LATENCY_US: flatbuffers::VOffsetT = 10;
pub const VT_POINTS: flatbuffers::VOffsetT = 12;
pub const VT_CODES: flatbuffers::VOffsetT = 14;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
LogEvent { _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 LogEventArgs<'args>,
) -> flatbuffers::WIPOffset<LogEvent<'bldr>> {
let mut builder = LogEventBuilder::new(_fbb);
if let Some(x) = args.codes {
builder.add_codes(x);
}
if let Some(x) = args.points {
builder.add_points(x);
}
builder.add_latency_us(args.latency_us);
if let Some(x) = args.message {
builder.add_message(x);
}
builder.add_level(args.level);
if let Some(x) = args.service {
builder.add_service(x);
}
builder.finish()
}
#[inline]
pub fn service(&self) -> Option<&'a str> {
unsafe {
self._tab
.get::<flatbuffers::ForwardsUOffset<&str>>(LogEvent::VT_SERVICE, None)
}
}
#[inline]
pub fn level(&self) -> u32 {
unsafe { self._tab.get::<u32>(LogEvent::VT_LEVEL, Some(0)).unwrap() }
}
#[inline]
pub fn message(&self) -> Option<&'a str> {
unsafe {
self._tab
.get::<flatbuffers::ForwardsUOffset<&str>>(LogEvent::VT_MESSAGE, None)
}
}
#[inline]
pub fn latency_us(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(LogEvent::VT_LATENCY_US, Some(0))
.unwrap()
}
}
#[inline]
pub fn points(
&self,
) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Point<'a>>>> {
unsafe {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Point>>,
>>(LogEvent::VT_POINTS, None)
}
}
#[inline]
pub fn codes(&self) -> Option<flatbuffers::Vector<'a, u32>> {
unsafe {
self._tab
.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u32>>>(
LogEvent::VT_CODES,
None,
)
}
}
}
impl flatbuffers::Verifiable for LogEvent<'_> {
#[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>>(
"service",
Self::VT_SERVICE,
false,
)?
.visit_field::<u32>("level", Self::VT_LEVEL, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>(
"message",
Self::VT_MESSAGE,
false,
)?
.visit_field::<u32>("latency_us", Self::VT_LATENCY_US, false)?
.visit_field::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Point>>,
>>("points", Self::VT_POINTS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u32>>>(
"codes",
Self::VT_CODES,
false,
)?
.finish();
Ok(())
}
}
pub struct LogEventArgs<'a> {
pub service: Option<flatbuffers::WIPOffset<&'a str>>,
pub level: u32,
pub message: Option<flatbuffers::WIPOffset<&'a str>>,
pub latency_us: u32,
pub points: Option<
flatbuffers::WIPOffset<
flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Point<'a>>>,
>,
>,
pub codes: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u32>>>,
}
impl<'a> Default for LogEventArgs<'a> {
#[inline]
fn default() -> Self {
LogEventArgs {
service: None,
level: 0,
message: None,
latency_us: 0,
points: None,
codes: None,
}
}
}
pub struct LogEventBuilder<'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> LogEventBuilder<'a, 'b, A> {
#[inline]
pub fn add_service(&mut self, service: flatbuffers::WIPOffset<&'b str>) {
self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<_>>(LogEvent::VT_SERVICE, service);
}
#[inline]
pub fn add_level(&mut self, level: u32) {
self.fbb_.push_slot::<u32>(LogEvent::VT_LEVEL, level, 0);
}
#[inline]
pub fn add_message(&mut self, message: flatbuffers::WIPOffset<&'b str>) {
self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<_>>(LogEvent::VT_MESSAGE, message);
}
#[inline]
pub fn add_latency_us(&mut self, latency_us: u32) {
self.fbb_
.push_slot::<u32>(LogEvent::VT_LATENCY_US, latency_us, 0);
}
#[inline]
pub fn add_points(
&mut self,
points: flatbuffers::WIPOffset<
flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<Point<'b>>>,
>,
) {
self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<_>>(LogEvent::VT_POINTS, points);
}
#[inline]
pub fn add_codes(&mut self, codes: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u32>>) {
self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<_>>(LogEvent::VT_CODES, codes);
}
#[inline]
pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
) -> LogEventBuilder<'a, 'b, A> {
let start = _fbb.start_table();
LogEventBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<LogEvent<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for LogEvent<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("LogEvent");
ds.field("service", &self.service());
ds.field("level", &self.level());
ds.field("message", &self.message());
ds.field("latency_us", &self.latency_us());
ds.field("points", &self.points());
ds.field("codes", &self.codes());
ds.finish()
}
}
#[inline]
pub fn root_as_log_event(buf: &[u8]) -> Result<LogEvent, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<LogEvent>(buf)
}
#[inline]
pub fn size_prefixed_root_as_log_event(
buf: &[u8],
) -> Result<LogEvent, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<LogEvent>(buf)
}
#[inline]
pub fn root_as_log_event_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<LogEvent<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<LogEvent<'b>>(opts, buf)
}
#[inline]
pub fn size_prefixed_root_as_log_event_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<LogEvent<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<LogEvent<'b>>(opts, buf)
}
#[inline]
pub unsafe fn root_as_log_event_unchecked(buf: &[u8]) -> LogEvent {
flatbuffers::root_unchecked::<LogEvent>(buf)
}
#[inline]
pub unsafe fn size_prefixed_root_as_log_event_unchecked(buf: &[u8]) -> LogEvent {
flatbuffers::size_prefixed_root_unchecked::<LogEvent>(buf)
}
#[inline]
pub fn finish_log_event_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<LogEvent<'a>>,
) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_log_event_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
root: flatbuffers::WIPOffset<LogEvent<'a>>,
) {
fbb.finish_size_prefixed(root, None);
}
}