extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::cmp::Ordering;
use core::mem;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum FunctionCallOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct FunctionCall<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for FunctionCall<'a> {
type Inner = FunctionCall<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> FunctionCall<'a> {
pub const VT_FUNCTION_NAME: flatbuffers::VOffsetT = 4;
pub const VT_PARAMETERS: flatbuffers::VOffsetT = 6;
pub const VT_FUNCTION_CALL_TYPE: flatbuffers::VOffsetT = 8;
pub const VT_EXPECTED_RETURN_TYPE: flatbuffers::VOffsetT = 10;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
FunctionCall { _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 FunctionCallArgs<'args>,
) -> flatbuffers::WIPOffset<FunctionCall<'bldr>> {
let mut builder = FunctionCallBuilder::new(_fbb);
if let Some(x) = args.parameters {
builder.add_parameters(x);
}
if let Some(x) = args.function_name {
builder.add_function_name(x);
}
builder.add_expected_return_type(args.expected_return_type);
builder.add_function_call_type(args.function_call_type);
builder.finish()
}
#[inline]
pub fn function_name(&self) -> &'a str {
unsafe {
self._tab
.get::<flatbuffers::ForwardsUOffset<&str>>(FunctionCall::VT_FUNCTION_NAME, None)
.unwrap()
}
}
#[inline]
pub fn key_compare_less_than(&self, o: &FunctionCall) -> bool {
self.function_name() < o.function_name()
}
#[inline]
pub fn key_compare_with_value(&self, val: &str) -> ::core::cmp::Ordering {
let key = self.function_name();
key.cmp(val)
}
#[inline]
pub fn parameters(
&self,
) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Parameter<'a>>>> {
unsafe {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Parameter>>,
>>(FunctionCall::VT_PARAMETERS, None)
}
}
#[inline]
pub fn function_call_type(&self) -> FunctionCallType {
unsafe {
self._tab
.get::<FunctionCallType>(
FunctionCall::VT_FUNCTION_CALL_TYPE,
Some(FunctionCallType::none),
)
.unwrap()
}
}
#[inline]
pub fn expected_return_type(&self) -> ReturnType {
unsafe {
self._tab
.get::<ReturnType>(
FunctionCall::VT_EXPECTED_RETURN_TYPE,
Some(ReturnType::hlint),
)
.unwrap()
}
}
}
impl flatbuffers::Verifiable for FunctionCall<'_> {
#[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>>(
"function_name",
Self::VT_FUNCTION_NAME,
true,
)?
.visit_field::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Parameter>>,
>>("parameters", Self::VT_PARAMETERS, false)?
.visit_field::<FunctionCallType>(
"function_call_type",
Self::VT_FUNCTION_CALL_TYPE,
false,
)?
.visit_field::<ReturnType>(
"expected_return_type",
Self::VT_EXPECTED_RETURN_TYPE,
false,
)?
.finish();
Ok(())
}
}
pub struct FunctionCallArgs<'a> {
pub function_name: Option<flatbuffers::WIPOffset<&'a str>>,
pub parameters: Option<
flatbuffers::WIPOffset<
flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Parameter<'a>>>,
>,
>,
pub function_call_type: FunctionCallType,
pub expected_return_type: ReturnType,
}
impl<'a> Default for FunctionCallArgs<'a> {
#[inline]
fn default() -> Self {
FunctionCallArgs {
function_name: None, parameters: None,
function_call_type: FunctionCallType::none,
expected_return_type: ReturnType::hlint,
}
}
}
pub struct FunctionCallBuilder<'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> FunctionCallBuilder<'a, 'b, A> {
#[inline]
pub fn add_function_name(&mut self, function_name: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
FunctionCall::VT_FUNCTION_NAME,
function_name,
);
}
#[inline]
pub fn add_parameters(
&mut self,
parameters: flatbuffers::WIPOffset<
flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<Parameter<'b>>>,
>,
) {
self.fbb_
.push_slot_always::<flatbuffers::WIPOffset<_>>(FunctionCall::VT_PARAMETERS, parameters);
}
#[inline]
pub fn add_function_call_type(&mut self, function_call_type: FunctionCallType) {
self.fbb_.push_slot::<FunctionCallType>(
FunctionCall::VT_FUNCTION_CALL_TYPE,
function_call_type,
FunctionCallType::none,
);
}
#[inline]
pub fn add_expected_return_type(&mut self, expected_return_type: ReturnType) {
self.fbb_.push_slot::<ReturnType>(
FunctionCall::VT_EXPECTED_RETURN_TYPE,
expected_return_type,
ReturnType::hlint,
);
}
#[inline]
pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
) -> FunctionCallBuilder<'a, 'b, A> {
let start = _fbb.start_table();
FunctionCallBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<FunctionCall<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, FunctionCall::VT_FUNCTION_NAME, "function_name");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for FunctionCall<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("FunctionCall");
ds.field("function_name", &self.function_name());
ds.field("parameters", &self.parameters());
ds.field("function_call_type", &self.function_call_type());
ds.field("expected_return_type", &self.expected_return_type());
ds.finish()
}
}