extern crate alloc;
use crate::common_generated::*;
#[allow(unused_imports, dead_code)]
pub mod host_response {
use crate::common_generated::*;
#[deprecated(
since = "2.0.0",
note = "Use associated constants instead. This will no longer be generated in 2021."
)]
pub const ENUM_MIN_CONTRACT_RESPONSE_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_CONTRACT_RESPONSE_TYPE: u8 = 6;
#[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_CONTRACT_RESPONSE_TYPE: [ContractResponseType; 7] = [
ContractResponseType::NONE,
ContractResponseType::GetResponse,
ContractResponseType::PutResponse,
ContractResponseType::UpdateNotification,
ContractResponseType::UpdateResponse,
ContractResponseType::NotFound,
ContractResponseType::SubscribeResponse,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct ContractResponseType(pub u8);
#[allow(non_upper_case_globals)]
impl ContractResponseType {
pub const NONE: Self = Self(0);
pub const GetResponse: Self = Self(1);
pub const PutResponse: Self = Self(2);
pub const UpdateNotification: Self = Self(3);
pub const UpdateResponse: Self = Self(4);
pub const NotFound: Self = Self(5);
pub const SubscribeResponse: Self = Self(6);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 6;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::GetResponse,
Self::PutResponse,
Self::UpdateNotification,
Self::UpdateResponse,
Self::NotFound,
Self::SubscribeResponse,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::GetResponse => Some("GetResponse"),
Self::PutResponse => Some("PutResponse"),
Self::UpdateNotification => Some("UpdateNotification"),
Self::UpdateResponse => Some("UpdateResponse"),
Self::NotFound => Some("NotFound"),
Self::SubscribeResponse => Some("SubscribeResponse"),
_ => None,
}
}
}
impl ::core::fmt::Debug for ContractResponseType {
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 ContractResponseType {
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 ContractResponseType {
type Output = ContractResponseType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
}
}
impl ::flatbuffers::EndianScalar for ContractResponseType {
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 ContractResponseType {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for ContractResponseType {}
pub struct ContractResponseTypeUnionTableOffset {}
#[deprecated(
since = "2.0.0",
note = "Use associated constants instead. This will no longer be generated in 2021."
)]
pub const ENUM_MIN_OUTBOUND_DELEGATE_MSG_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_OUTBOUND_DELEGATE_MSG_TYPE: u8 = 3;
#[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_OUTBOUND_DELEGATE_MSG_TYPE: [OutboundDelegateMsgType; 4] = [
OutboundDelegateMsgType::NONE,
OutboundDelegateMsgType::common_ApplicationMessage,
OutboundDelegateMsgType::RequestUserInput,
OutboundDelegateMsgType::ContextUpdated,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct OutboundDelegateMsgType(pub u8);
#[allow(non_upper_case_globals)]
impl OutboundDelegateMsgType {
pub const NONE: Self = Self(0);
pub const common_ApplicationMessage: Self = Self(1);
pub const RequestUserInput: Self = Self(2);
pub const ContextUpdated: Self = Self(3);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 3;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::common_ApplicationMessage,
Self::RequestUserInput,
Self::ContextUpdated,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::common_ApplicationMessage => Some("common_ApplicationMessage"),
Self::RequestUserInput => Some("RequestUserInput"),
Self::ContextUpdated => Some("ContextUpdated"),
_ => None,
}
}
}
impl ::core::fmt::Debug for OutboundDelegateMsgType {
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 OutboundDelegateMsgType {
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 OutboundDelegateMsgType {
type Output = OutboundDelegateMsgType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
}
}
impl ::flatbuffers::EndianScalar for OutboundDelegateMsgType {
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 OutboundDelegateMsgType {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for OutboundDelegateMsgType {}
pub struct OutboundDelegateMsgTypeUnionTableOffset {}
#[deprecated(
since = "2.0.0",
note = "Use associated constants instead. This will no longer be generated in 2021."
)]
pub const ENUM_MIN_HOST_RESPONSE_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_HOST_RESPONSE_TYPE: u8 = 6;
#[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_HOST_RESPONSE_TYPE: [HostResponseType; 7] = [
HostResponseType::NONE,
HostResponseType::ContractResponse,
HostResponseType::DelegateResponse,
HostResponseType::GenerateRandData,
HostResponseType::Ok,
HostResponseType::Error,
HostResponseType::StreamChunk,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct HostResponseType(pub u8);
#[allow(non_upper_case_globals)]
impl HostResponseType {
pub const NONE: Self = Self(0);
pub const ContractResponse: Self = Self(1);
pub const DelegateResponse: Self = Self(2);
pub const GenerateRandData: Self = Self(3);
pub const Ok: Self = Self(4);
pub const Error: Self = Self(5);
pub const StreamChunk: Self = Self(6);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 6;
pub const ENUM_VALUES: &'static [Self] = &[
Self::NONE,
Self::ContractResponse,
Self::DelegateResponse,
Self::GenerateRandData,
Self::Ok,
Self::Error,
Self::StreamChunk,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::NONE => Some("NONE"),
Self::ContractResponse => Some("ContractResponse"),
Self::DelegateResponse => Some("DelegateResponse"),
Self::GenerateRandData => Some("GenerateRandData"),
Self::Ok => Some("Ok"),
Self::Error => Some("Error"),
Self::StreamChunk => Some("StreamChunk"),
_ => None,
}
}
}
impl ::core::fmt::Debug for HostResponseType {
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 HostResponseType {
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 HostResponseType {
type Output = HostResponseType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
unsafe { ::flatbuffers::emplace_scalar::<u8>(dst, self.0) };
}
}
impl ::flatbuffers::EndianScalar for HostResponseType {
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 HostResponseType {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
u8::run_verifier(v, pos)
}
}
impl ::flatbuffers::SimpleToVerifyInSlice for HostResponseType {}
pub struct HostResponseTypeUnionTableOffset {}
pub enum GetResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct GetResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for GetResponse<'a> {
type Inner = GetResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> GetResponse<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_CONTRACT: ::flatbuffers::VOffsetT = 6;
pub const VT_STATE: ::flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
GetResponse { _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 GetResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<GetResponse<'bldr>> {
let mut builder = GetResponseBuilder::new(_fbb);
if let Some(x) = args.state {
builder.add_state(x);
}
if let Some(x) = args.contract {
builder.add_contract(x);
}
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> super::common::ContractKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
GetResponse::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn contract(&self) -> Option<super::common::ContractContainer<'a>> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractContainer>>(
GetResponse::VT_CONTRACT,
None,
)
}
}
#[inline]
pub fn state(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
GetResponse::VT_STATE,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for GetResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractContainer>>(
"contract",
Self::VT_CONTRACT,
false,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"state",
Self::VT_STATE,
true,
)?
.finish();
Ok(())
}
}
pub struct GetResponseArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<super::common::ContractKey<'a>>>,
pub contract: Option<::flatbuffers::WIPOffset<super::common::ContractContainer<'a>>>,
pub state: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for GetResponseArgs<'a> {
#[inline]
fn default() -> Self {
GetResponseArgs {
key: None, contract: None,
state: None, }
}
}
pub struct GetResponseBuilder<'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> GetResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<super::common::ContractKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractKey>>(
GetResponse::VT_KEY,
key,
);
}
#[inline]
pub fn add_contract(
&mut self,
contract: ::flatbuffers::WIPOffset<super::common::ContractContainer<'b>>,
) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractContainer>>(
GetResponse::VT_CONTRACT,
contract,
);
}
#[inline]
pub fn add_state(
&mut self,
state: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(GetResponse::VT_STATE, state);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> GetResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
GetResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<GetResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, GetResponse::VT_KEY, "key");
self.fbb_.required(o, GetResponse::VT_STATE, "state");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for GetResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("GetResponse");
ds.field("key", &self.key());
ds.field("contract", &self.contract());
ds.field("state", &self.state());
ds.finish()
}
}
pub enum PutResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct PutResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for PutResponse<'a> {
type Inner = PutResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> PutResponse<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
PutResponse { _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 PutResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<PutResponse<'bldr>> {
let mut builder = PutResponseBuilder::new(_fbb);
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> super::common::ContractKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
PutResponse::VT_KEY,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for PutResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
"key",
Self::VT_KEY,
true,
)?
.finish();
Ok(())
}
}
pub struct PutResponseArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<super::common::ContractKey<'a>>>,
}
impl<'a> Default for PutResponseArgs<'a> {
#[inline]
fn default() -> Self {
PutResponseArgs {
key: None, }
}
}
pub struct PutResponseBuilder<'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> PutResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<super::common::ContractKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractKey>>(
PutResponse::VT_KEY,
key,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> PutResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
PutResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<PutResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, PutResponse::VT_KEY, "key");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for PutResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("PutResponse");
ds.field("key", &self.key());
ds.finish()
}
}
pub enum UpdateNotificationOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct UpdateNotification<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for UpdateNotification<'a> {
type Inner = UpdateNotification<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> UpdateNotification<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_UPDATE: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
UpdateNotification { _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 UpdateNotificationArgs<'args>,
) -> ::flatbuffers::WIPOffset<UpdateNotification<'bldr>> {
let mut builder = UpdateNotificationBuilder::new(_fbb);
if let Some(x) = args.update {
builder.add_update(x);
}
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> super::common::ContractKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
UpdateNotification::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn update(&self) -> super::common::UpdateData<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::UpdateData>>(
UpdateNotification::VT_UPDATE,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for UpdateNotification<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::UpdateData>>(
"update",
Self::VT_UPDATE,
true,
)?
.finish();
Ok(())
}
}
pub struct UpdateNotificationArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<super::common::ContractKey<'a>>>,
pub update: Option<::flatbuffers::WIPOffset<super::common::UpdateData<'a>>>,
}
impl<'a> Default for UpdateNotificationArgs<'a> {
#[inline]
fn default() -> Self {
UpdateNotificationArgs {
key: None, update: None, }
}
}
pub struct UpdateNotificationBuilder<'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> UpdateNotificationBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<super::common::ContractKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractKey>>(
UpdateNotification::VT_KEY,
key,
);
}
#[inline]
pub fn add_update(
&mut self,
update: ::flatbuffers::WIPOffset<super::common::UpdateData<'b>>,
) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::UpdateData>>(
UpdateNotification::VT_UPDATE,
update,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> UpdateNotificationBuilder<'a, 'b, A> {
let start = _fbb.start_table();
UpdateNotificationBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<UpdateNotification<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, UpdateNotification::VT_KEY, "key");
self.fbb_
.required(o, UpdateNotification::VT_UPDATE, "update");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for UpdateNotification<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("UpdateNotification");
ds.field("key", &self.key());
ds.field("update", &self.update());
ds.finish()
}
}
pub enum UpdateResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct UpdateResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for UpdateResponse<'a> {
type Inner = UpdateResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> UpdateResponse<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_SUMMARY: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
UpdateResponse { _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 UpdateResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<UpdateResponse<'bldr>> {
let mut builder = UpdateResponseBuilder::new(_fbb);
if let Some(x) = args.summary {
builder.add_summary(x);
}
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> super::common::ContractKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
UpdateResponse::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn summary(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
UpdateResponse::VT_SUMMARY,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for UpdateResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"summary",
Self::VT_SUMMARY,
true,
)?
.finish();
Ok(())
}
}
pub struct UpdateResponseArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<super::common::ContractKey<'a>>>,
pub summary: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for UpdateResponseArgs<'a> {
#[inline]
fn default() -> Self {
UpdateResponseArgs {
key: None, summary: None, }
}
}
pub struct UpdateResponseBuilder<'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> UpdateResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<super::common::ContractKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractKey>>(
UpdateResponse::VT_KEY,
key,
);
}
#[inline]
pub fn add_summary(
&mut self,
summary: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
UpdateResponse::VT_SUMMARY,
summary,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> UpdateResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
UpdateResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<UpdateResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, UpdateResponse::VT_KEY, "key");
self.fbb_.required(o, UpdateResponse::VT_SUMMARY, "summary");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for UpdateResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("UpdateResponse");
ds.field("key", &self.key());
ds.field("summary", &self.summary());
ds.finish()
}
}
pub enum NotFoundOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct NotFound<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for NotFound<'a> {
type Inner = NotFound<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> NotFound<'a> {
pub const VT_INSTANCE_ID: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
NotFound { _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 NotFoundArgs<'args>,
) -> ::flatbuffers::WIPOffset<NotFound<'bldr>> {
let mut builder = NotFoundBuilder::new(_fbb);
if let Some(x) = args.instance_id {
builder.add_instance_id(x);
}
builder.finish()
}
#[inline]
pub fn instance_id(&self) -> super::common::ContractInstanceId<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractInstanceId>>(
NotFound::VT_INSTANCE_ID,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for NotFound<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractInstanceId>>(
"instance_id",
Self::VT_INSTANCE_ID,
true,
)?
.finish();
Ok(())
}
}
pub struct NotFoundArgs<'a> {
pub instance_id: Option<::flatbuffers::WIPOffset<super::common::ContractInstanceId<'a>>>,
}
impl<'a> Default for NotFoundArgs<'a> {
#[inline]
fn default() -> Self {
NotFoundArgs {
instance_id: None, }
}
}
pub struct NotFoundBuilder<'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> NotFoundBuilder<'a, 'b, A> {
#[inline]
pub fn add_instance_id(
&mut self,
instance_id: ::flatbuffers::WIPOffset<super::common::ContractInstanceId<'b>>,
) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractInstanceId>>(
NotFound::VT_INSTANCE_ID,
instance_id,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> NotFoundBuilder<'a, 'b, A> {
let start = _fbb.start_table();
NotFoundBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<NotFound<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, NotFound::VT_INSTANCE_ID, "instance_id");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for NotFound<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("NotFound");
ds.field("instance_id", &self.instance_id());
ds.finish()
}
}
pub enum SubscribeResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct SubscribeResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for SubscribeResponse<'a> {
type Inner = SubscribeResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> SubscribeResponse<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_SUBSCRIBED: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
SubscribeResponse { _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 SubscribeResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<SubscribeResponse<'bldr>> {
let mut builder = SubscribeResponseBuilder::new(_fbb);
if let Some(x) = args.key {
builder.add_key(x);
}
builder.add_subscribed(args.subscribed);
builder.finish()
}
#[inline]
pub fn key(&self) -> super::common::ContractKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
SubscribeResponse::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn subscribed(&self) -> bool {
unsafe {
self._tab
.get::<bool>(SubscribeResponse::VT_SUBSCRIBED, Some(false))
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for SubscribeResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<super::common::ContractKey>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<bool>("subscribed", Self::VT_SUBSCRIBED, false)?
.finish();
Ok(())
}
}
pub struct SubscribeResponseArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<super::common::ContractKey<'a>>>,
pub subscribed: bool,
}
impl<'a> Default for SubscribeResponseArgs<'a> {
#[inline]
fn default() -> Self {
SubscribeResponseArgs {
key: None, subscribed: false,
}
}
}
pub struct SubscribeResponseBuilder<'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> SubscribeResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<super::common::ContractKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<super::common::ContractKey>>(
SubscribeResponse::VT_KEY,
key,
);
}
#[inline]
pub fn add_subscribed(&mut self, subscribed: bool) {
self.fbb_
.push_slot::<bool>(SubscribeResponse::VT_SUBSCRIBED, subscribed, false);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> SubscribeResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
SubscribeResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<SubscribeResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, SubscribeResponse::VT_KEY, "key");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for SubscribeResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("SubscribeResponse");
ds.field("key", &self.key());
ds.field("subscribed", &self.subscribed());
ds.finish()
}
}
pub enum ContractResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ContractResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for ContractResponse<'a> {
type Inner = ContractResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> ContractResponse<'a> {
pub const VT_CONTRACT_RESPONSE_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_CONTRACT_RESPONSE: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ContractResponse { _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 ContractResponseArgs,
) -> ::flatbuffers::WIPOffset<ContractResponse<'bldr>> {
let mut builder = ContractResponseBuilder::new(_fbb);
if let Some(x) = args.contract_response {
builder.add_contract_response(x);
}
builder.add_contract_response_type(args.contract_response_type);
builder.finish()
}
#[inline]
pub fn contract_response_type(&self) -> ContractResponseType {
unsafe {
self._tab
.get::<ContractResponseType>(
ContractResponse::VT_CONTRACT_RESPONSE_TYPE,
Some(ContractResponseType::NONE),
)
.unwrap()
}
}
#[inline]
pub fn contract_response(&self) -> ::flatbuffers::Table<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(
ContractResponse::VT_CONTRACT_RESPONSE,
None,
)
.unwrap()
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_get_response(&self) -> Option<GetResponse<'a>> {
if self.contract_response_type() == ContractResponseType::GetResponse {
let u = self.contract_response();
Some(unsafe { GetResponse::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_put_response(&self) -> Option<PutResponse<'a>> {
if self.contract_response_type() == ContractResponseType::PutResponse {
let u = self.contract_response();
Some(unsafe { PutResponse::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_update_notification(&self) -> Option<UpdateNotification<'a>> {
if self.contract_response_type() == ContractResponseType::UpdateNotification {
let u = self.contract_response();
Some(unsafe { UpdateNotification::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_update_response(&self) -> Option<UpdateResponse<'a>> {
if self.contract_response_type() == ContractResponseType::UpdateResponse {
let u = self.contract_response();
Some(unsafe { UpdateResponse::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_not_found(&self) -> Option<NotFound<'a>> {
if self.contract_response_type() == ContractResponseType::NotFound {
let u = self.contract_response();
Some(unsafe { NotFound::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn contract_response_as_subscribe_response(&self) -> Option<SubscribeResponse<'a>> {
if self.contract_response_type() == ContractResponseType::SubscribeResponse {
let u = self.contract_response();
Some(unsafe { SubscribeResponse::init_from_table(u) })
} else {
None
}
}
}
impl ::flatbuffers::Verifiable for ContractResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_union::<ContractResponseType, _>("contract_response_type", Self::VT_CONTRACT_RESPONSE_TYPE, "contract_response", Self::VT_CONTRACT_RESPONSE, true, |key, v, pos| {
match key {
ContractResponseType::GetResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<GetResponse>>("ContractResponseType::GetResponse", pos),
ContractResponseType::PutResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<PutResponse>>("ContractResponseType::PutResponse", pos),
ContractResponseType::UpdateNotification => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<UpdateNotification>>("ContractResponseType::UpdateNotification", pos),
ContractResponseType::UpdateResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<UpdateResponse>>("ContractResponseType::UpdateResponse", pos),
ContractResponseType::NotFound => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<NotFound>>("ContractResponseType::NotFound", pos),
ContractResponseType::SubscribeResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<SubscribeResponse>>("ContractResponseType::SubscribeResponse", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct ContractResponseArgs {
pub contract_response_type: ContractResponseType,
pub contract_response: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for ContractResponseArgs {
#[inline]
fn default() -> Self {
ContractResponseArgs {
contract_response_type: ContractResponseType::NONE,
contract_response: None, }
}
}
pub struct ContractResponseBuilder<'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> ContractResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_contract_response_type(&mut self, contract_response_type: ContractResponseType) {
self.fbb_.push_slot::<ContractResponseType>(
ContractResponse::VT_CONTRACT_RESPONSE_TYPE,
contract_response_type,
ContractResponseType::NONE,
);
}
#[inline]
pub fn add_contract_response(
&mut self,
contract_response: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
ContractResponse::VT_CONTRACT_RESPONSE,
contract_response,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> ContractResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ContractResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ContractResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(
o,
ContractResponse::VT_CONTRACT_RESPONSE,
"contract_response",
);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for ContractResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ContractResponse");
ds.field("contract_response_type", &self.contract_response_type());
match self.contract_response_type() {
ContractResponseType::GetResponse => {
if let Some(x) = self.contract_response_as_get_response() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
ContractResponseType::PutResponse => {
if let Some(x) = self.contract_response_as_put_response() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
ContractResponseType::UpdateNotification => {
if let Some(x) = self.contract_response_as_update_notification() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
ContractResponseType::UpdateResponse => {
if let Some(x) = self.contract_response_as_update_response() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
ContractResponseType::NotFound => {
if let Some(x) = self.contract_response_as_not_found() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
ContractResponseType::SubscribeResponse => {
if let Some(x) = self.contract_response_as_subscribe_response() {
ds.field("contract_response", &x)
} else {
ds.field(
"contract_response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
_ => {
let x: Option<()> = None;
ds.field("contract_response", &x)
}
};
ds.finish()
}
}
pub enum DelegateKeyOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct DelegateKey<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for DelegateKey<'a> {
type Inner = DelegateKey<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> DelegateKey<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_CODE_HASH: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
DelegateKey { _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 DelegateKeyArgs<'args>,
) -> ::flatbuffers::WIPOffset<DelegateKey<'bldr>> {
let mut builder = DelegateKeyBuilder::new(_fbb);
if let Some(x) = args.code_hash {
builder.add_code_hash(x);
}
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
DelegateKey::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn code_hash(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
DelegateKey::VT_CODE_HASH,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for DelegateKey<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"code_hash",
Self::VT_CODE_HASH,
true,
)?
.finish();
Ok(())
}
}
pub struct DelegateKeyArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
pub code_hash: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for DelegateKeyArgs<'a> {
#[inline]
fn default() -> Self {
DelegateKeyArgs {
key: None, code_hash: None, }
}
}
pub struct DelegateKeyBuilder<'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> DelegateKeyBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(DelegateKey::VT_KEY, key);
}
#[inline]
pub fn add_code_hash(
&mut self,
code_hash: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
DelegateKey::VT_CODE_HASH,
code_hash,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> DelegateKeyBuilder<'a, 'b, A> {
let start = _fbb.start_table();
DelegateKeyBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<DelegateKey<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, DelegateKey::VT_KEY, "key");
self.fbb_
.required(o, DelegateKey::VT_CODE_HASH, "code_hash");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for DelegateKey<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("DelegateKey");
ds.field("key", &self.key());
ds.field("code_hash", &self.code_hash());
ds.finish()
}
}
pub enum UserInputRequestOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct UserInputRequest<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for UserInputRequest<'a> {
type Inner = UserInputRequest<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> UserInputRequest<'a> {
pub const VT_REQUEST_ID: ::flatbuffers::VOffsetT = 4;
pub const VT_MESSAGE: ::flatbuffers::VOffsetT = 6;
pub const VT_RESPONSES: ::flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
UserInputRequest { _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 UserInputRequestArgs<'args>,
) -> ::flatbuffers::WIPOffset<UserInputRequest<'bldr>> {
let mut builder = UserInputRequestBuilder::new(_fbb);
if let Some(x) = args.responses {
builder.add_responses(x);
}
if let Some(x) = args.message {
builder.add_message(x);
}
builder.add_request_id(args.request_id);
builder.finish()
}
#[inline]
pub fn request_id(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(UserInputRequest::VT_REQUEST_ID, Some(0))
.unwrap()
}
}
#[inline]
pub fn message(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
UserInputRequest::VT_MESSAGE,
None,
)
.unwrap()
}
}
#[inline]
pub fn responses(
&self,
) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse<'a>>> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse>>,
>>(UserInputRequest::VT_RESPONSES, None)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for UserInputRequest<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<u32>("request_id", Self::VT_REQUEST_ID, false)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"message",
Self::VT_MESSAGE,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<ClientResponse>>,
>>("responses", Self::VT_RESPONSES, true)?
.finish();
Ok(())
}
}
pub struct UserInputRequestArgs<'a> {
pub request_id: u32,
pub message: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
pub responses: Option<
::flatbuffers::WIPOffset<
::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse<'a>>>,
>,
>,
}
impl<'a> Default for UserInputRequestArgs<'a> {
#[inline]
fn default() -> Self {
UserInputRequestArgs {
request_id: 0,
message: None, responses: None, }
}
}
pub struct UserInputRequestBuilder<'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> UserInputRequestBuilder<'a, 'b, A> {
#[inline]
pub fn add_request_id(&mut self, request_id: u32) {
self.fbb_
.push_slot::<u32>(UserInputRequest::VT_REQUEST_ID, request_id, 0);
}
#[inline]
pub fn add_message(
&mut self,
message: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
UserInputRequest::VT_MESSAGE,
message,
);
}
#[inline]
pub fn add_responses(
&mut self,
responses: ::flatbuffers::WIPOffset<
::flatbuffers::Vector<'b, ::flatbuffers::ForwardsUOffset<ClientResponse<'b>>>,
>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
UserInputRequest::VT_RESPONSES,
responses,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> UserInputRequestBuilder<'a, 'b, A> {
let start = _fbb.start_table();
UserInputRequestBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<UserInputRequest<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, UserInputRequest::VT_MESSAGE, "message");
self.fbb_
.required(o, UserInputRequest::VT_RESPONSES, "responses");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for UserInputRequest<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("UserInputRequest");
ds.field("request_id", &self.request_id());
ds.field("message", &self.message());
ds.field("responses", &self.responses());
ds.finish()
}
}
pub enum ClientResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ClientResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for ClientResponse<'a> {
type Inner = ClientResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> ClientResponse<'a> {
pub const VT_DATA: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ClientResponse { _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 ClientResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<ClientResponse<'bldr>> {
let mut builder = ClientResponseBuilder::new(_fbb);
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>>>(
ClientResponse::VT_DATA,
None,
)
}
}
}
impl ::flatbuffers::Verifiable for ClientResponse<'_> {
#[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,
)?
.finish();
Ok(())
}
}
pub struct ClientResponseArgs<'a> {
pub data: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for ClientResponseArgs<'a> {
#[inline]
fn default() -> Self {
ClientResponseArgs { data: None }
}
}
pub struct ClientResponseBuilder<'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> ClientResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_data(&mut self, data: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(ClientResponse::VT_DATA, data);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> ClientResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ClientResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ClientResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for ClientResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ClientResponse");
ds.field("data", &self.data());
ds.finish()
}
}
pub enum RequestUserInputOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct RequestUserInput<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for RequestUserInput<'a> {
type Inner = RequestUserInput<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> RequestUserInput<'a> {
pub const VT_REQUEST_ID: ::flatbuffers::VOffsetT = 4;
pub const VT_MESSAGE: ::flatbuffers::VOffsetT = 6;
pub const VT_RESPONSES: ::flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
RequestUserInput { _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 RequestUserInputArgs<'args>,
) -> ::flatbuffers::WIPOffset<RequestUserInput<'bldr>> {
let mut builder = RequestUserInputBuilder::new(_fbb);
if let Some(x) = args.responses {
builder.add_responses(x);
}
if let Some(x) = args.message {
builder.add_message(x);
}
builder.add_request_id(args.request_id);
builder.finish()
}
#[inline]
pub fn request_id(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(RequestUserInput::VT_REQUEST_ID, Some(0))
.unwrap()
}
}
#[inline]
pub fn message(&self) -> Option<::flatbuffers::Vector<'a, u8>> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
RequestUserInput::VT_MESSAGE,
None,
)
}
}
#[inline]
pub fn responses(
&self,
) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse<'a>>> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse>>,
>>(RequestUserInput::VT_RESPONSES, None)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for RequestUserInput<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<u32>("request_id", Self::VT_REQUEST_ID, false)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"message",
Self::VT_MESSAGE,
false,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<ClientResponse>>,
>>("responses", Self::VT_RESPONSES, true)?
.finish();
Ok(())
}
}
pub struct RequestUserInputArgs<'a> {
pub request_id: u32,
pub message: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
pub responses: Option<
::flatbuffers::WIPOffset<
::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<ClientResponse<'a>>>,
>,
>,
}
impl<'a> Default for RequestUserInputArgs<'a> {
#[inline]
fn default() -> Self {
RequestUserInputArgs {
request_id: 0,
message: None,
responses: None, }
}
}
pub struct RequestUserInputBuilder<'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> RequestUserInputBuilder<'a, 'b, A> {
#[inline]
pub fn add_request_id(&mut self, request_id: u32) {
self.fbb_
.push_slot::<u32>(RequestUserInput::VT_REQUEST_ID, request_id, 0);
}
#[inline]
pub fn add_message(
&mut self,
message: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
RequestUserInput::VT_MESSAGE,
message,
);
}
#[inline]
pub fn add_responses(
&mut self,
responses: ::flatbuffers::WIPOffset<
::flatbuffers::Vector<'b, ::flatbuffers::ForwardsUOffset<ClientResponse<'b>>>,
>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
RequestUserInput::VT_RESPONSES,
responses,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> RequestUserInputBuilder<'a, 'b, A> {
let start = _fbb.start_table();
RequestUserInputBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<RequestUserInput<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, RequestUserInput::VT_RESPONSES, "responses");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for RequestUserInput<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("RequestUserInput");
ds.field("request_id", &self.request_id());
ds.field("message", &self.message());
ds.field("responses", &self.responses());
ds.finish()
}
}
pub enum ContextUpdatedOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct ContextUpdated<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for ContextUpdated<'a> {
type Inner = ContextUpdated<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> ContextUpdated<'a> {
pub const VT_CONTEXT: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
ContextUpdated { _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 ContextUpdatedArgs<'args>,
) -> ::flatbuffers::WIPOffset<ContextUpdated<'bldr>> {
let mut builder = ContextUpdatedBuilder::new(_fbb);
if let Some(x) = args.context {
builder.add_context(x);
}
builder.finish()
}
#[inline]
pub fn context(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
ContextUpdated::VT_CONTEXT,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for ContextUpdated<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"context",
Self::VT_CONTEXT,
true,
)?
.finish();
Ok(())
}
}
pub struct ContextUpdatedArgs<'a> {
pub context: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for ContextUpdatedArgs<'a> {
#[inline]
fn default() -> Self {
ContextUpdatedArgs {
context: None, }
}
}
pub struct ContextUpdatedBuilder<'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> ContextUpdatedBuilder<'a, 'b, A> {
#[inline]
pub fn add_context(
&mut self,
context: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
ContextUpdated::VT_CONTEXT,
context,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> ContextUpdatedBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ContextUpdatedBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<ContextUpdated<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, ContextUpdated::VT_CONTEXT, "context");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for ContextUpdated<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("ContextUpdated");
ds.field("context", &self.context());
ds.finish()
}
}
pub enum OutboundDelegateMsgOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct OutboundDelegateMsg<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for OutboundDelegateMsg<'a> {
type Inner = OutboundDelegateMsg<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> OutboundDelegateMsg<'a> {
pub const VT_INBOUND_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_INBOUND: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
OutboundDelegateMsg { _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 OutboundDelegateMsgArgs,
) -> ::flatbuffers::WIPOffset<OutboundDelegateMsg<'bldr>> {
let mut builder = OutboundDelegateMsgBuilder::new(_fbb);
if let Some(x) = args.inbound {
builder.add_inbound(x);
}
builder.add_inbound_type(args.inbound_type);
builder.finish()
}
#[inline]
pub fn inbound_type(&self) -> OutboundDelegateMsgType {
unsafe {
self._tab
.get::<OutboundDelegateMsgType>(
OutboundDelegateMsg::VT_INBOUND_TYPE,
Some(OutboundDelegateMsgType::NONE),
)
.unwrap()
}
}
#[inline]
pub fn inbound(&self) -> ::flatbuffers::Table<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(
OutboundDelegateMsg::VT_INBOUND,
None,
)
.unwrap()
}
}
#[inline]
#[allow(non_snake_case)]
pub fn inbound_as_common_application_message(
&self,
) -> Option<super::common::ApplicationMessage<'a>> {
if self.inbound_type() == OutboundDelegateMsgType::common_ApplicationMessage {
let u = self.inbound();
Some(unsafe { super::common::ApplicationMessage::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn inbound_as_request_user_input(&self) -> Option<RequestUserInput<'a>> {
if self.inbound_type() == OutboundDelegateMsgType::RequestUserInput {
let u = self.inbound();
Some(unsafe { RequestUserInput::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn inbound_as_context_updated(&self) -> Option<ContextUpdated<'a>> {
if self.inbound_type() == OutboundDelegateMsgType::ContextUpdated {
let u = self.inbound();
Some(unsafe { ContextUpdated::init_from_table(u) })
} else {
None
}
}
}
impl ::flatbuffers::Verifiable for OutboundDelegateMsg<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_union::<OutboundDelegateMsgType, _>("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| {
match key {
OutboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<super::common::ApplicationMessage>>("OutboundDelegateMsgType::common_ApplicationMessage", pos),
OutboundDelegateMsgType::RequestUserInput => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<RequestUserInput>>("OutboundDelegateMsgType::RequestUserInput", pos),
OutboundDelegateMsgType::ContextUpdated => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<ContextUpdated>>("OutboundDelegateMsgType::ContextUpdated", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct OutboundDelegateMsgArgs {
pub inbound_type: OutboundDelegateMsgType,
pub inbound: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for OutboundDelegateMsgArgs {
#[inline]
fn default() -> Self {
OutboundDelegateMsgArgs {
inbound_type: OutboundDelegateMsgType::NONE,
inbound: None, }
}
}
pub struct OutboundDelegateMsgBuilder<'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> OutboundDelegateMsgBuilder<'a, 'b, A> {
#[inline]
pub fn add_inbound_type(&mut self, inbound_type: OutboundDelegateMsgType) {
self.fbb_.push_slot::<OutboundDelegateMsgType>(
OutboundDelegateMsg::VT_INBOUND_TYPE,
inbound_type,
OutboundDelegateMsgType::NONE,
);
}
#[inline]
pub fn add_inbound(
&mut self,
inbound: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
OutboundDelegateMsg::VT_INBOUND,
inbound,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> OutboundDelegateMsgBuilder<'a, 'b, A> {
let start = _fbb.start_table();
OutboundDelegateMsgBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<OutboundDelegateMsg<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, OutboundDelegateMsg::VT_INBOUND, "inbound");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for OutboundDelegateMsg<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("OutboundDelegateMsg");
ds.field("inbound_type", &self.inbound_type());
match self.inbound_type() {
OutboundDelegateMsgType::common_ApplicationMessage => {
if let Some(x) = self.inbound_as_common_application_message() {
ds.field("inbound", &x)
} else {
ds.field(
"inbound",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
OutboundDelegateMsgType::RequestUserInput => {
if let Some(x) = self.inbound_as_request_user_input() {
ds.field("inbound", &x)
} else {
ds.field(
"inbound",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
OutboundDelegateMsgType::ContextUpdated => {
if let Some(x) = self.inbound_as_context_updated() {
ds.field("inbound", &x)
} else {
ds.field(
"inbound",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
_ => {
let x: Option<()> = None;
ds.field("inbound", &x)
}
};
ds.finish()
}
}
pub enum DelegateResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct DelegateResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for DelegateResponse<'a> {
type Inner = DelegateResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> DelegateResponse<'a> {
pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
pub const VT_VALUES: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
DelegateResponse { _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 DelegateResponseArgs<'args>,
) -> ::flatbuffers::WIPOffset<DelegateResponse<'bldr>> {
let mut builder = DelegateResponseBuilder::new(_fbb);
if let Some(x) = args.values {
builder.add_values(x);
}
if let Some(x) = args.key {
builder.add_key(x);
}
builder.finish()
}
#[inline]
pub fn key(&self) -> DelegateKey<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<DelegateKey>>(
DelegateResponse::VT_KEY,
None,
)
.unwrap()
}
}
#[inline]
pub fn values(
&self,
) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<OutboundDelegateMsg<'a>>>
{
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<
'a,
::flatbuffers::ForwardsUOffset<OutboundDelegateMsg>,
>,
>>(DelegateResponse::VT_VALUES, None)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for DelegateResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<DelegateKey>>(
"key",
Self::VT_KEY,
true,
)?
.visit_field::<::flatbuffers::ForwardsUOffset<
::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<OutboundDelegateMsg>>,
>>("values", Self::VT_VALUES, true)?
.finish();
Ok(())
}
}
pub struct DelegateResponseArgs<'a> {
pub key: Option<::flatbuffers::WIPOffset<DelegateKey<'a>>>,
pub values: Option<
::flatbuffers::WIPOffset<
::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<OutboundDelegateMsg<'a>>>,
>,
>,
}
impl<'a> Default for DelegateResponseArgs<'a> {
#[inline]
fn default() -> Self {
DelegateResponseArgs {
key: None, values: None, }
}
}
pub struct DelegateResponseBuilder<'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> DelegateResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<DelegateKey<'b>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<DelegateKey>>(
DelegateResponse::VT_KEY,
key,
);
}
#[inline]
pub fn add_values(
&mut self,
values: ::flatbuffers::WIPOffset<
::flatbuffers::Vector<'b, ::flatbuffers::ForwardsUOffset<OutboundDelegateMsg<'b>>>,
>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
DelegateResponse::VT_VALUES,
values,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> DelegateResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
DelegateResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<DelegateResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, DelegateResponse::VT_KEY, "key");
self.fbb_.required(o, DelegateResponse::VT_VALUES, "values");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for DelegateResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("DelegateResponse");
ds.field("key", &self.key());
ds.field("values", &self.values());
ds.finish()
}
}
pub enum GenerateRandDataOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct GenerateRandData<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for GenerateRandData<'a> {
type Inner = GenerateRandData<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> GenerateRandData<'a> {
pub const VT_WRAPPED_STATE: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
GenerateRandData { _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 GenerateRandDataArgs<'args>,
) -> ::flatbuffers::WIPOffset<GenerateRandData<'bldr>> {
let mut builder = GenerateRandDataBuilder::new(_fbb);
if let Some(x) = args.wrapped_state {
builder.add_wrapped_state(x);
}
builder.finish()
}
#[inline]
pub fn wrapped_state(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
GenerateRandData::VT_WRAPPED_STATE,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for GenerateRandData<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"wrapped_state",
Self::VT_WRAPPED_STATE,
true,
)?
.finish();
Ok(())
}
}
pub struct GenerateRandDataArgs<'a> {
pub wrapped_state: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for GenerateRandDataArgs<'a> {
#[inline]
fn default() -> Self {
GenerateRandDataArgs {
wrapped_state: None, }
}
}
pub struct GenerateRandDataBuilder<'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> GenerateRandDataBuilder<'a, 'b, A> {
#[inline]
pub fn add_wrapped_state(
&mut self,
wrapped_state: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
GenerateRandData::VT_WRAPPED_STATE,
wrapped_state,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> GenerateRandDataBuilder<'a, 'b, A> {
let start = _fbb.start_table();
GenerateRandDataBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<GenerateRandData<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_
.required(o, GenerateRandData::VT_WRAPPED_STATE, "wrapped_state");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for GenerateRandData<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("GenerateRandData");
ds.field("wrapped_state", &self.wrapped_state());
ds.finish()
}
}
pub enum StreamChunkOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct StreamChunk<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for StreamChunk<'a> {
type Inner = StreamChunk<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> StreamChunk<'a> {
pub const VT_STREAM_ID: ::flatbuffers::VOffsetT = 4;
pub const VT_INDEX: ::flatbuffers::VOffsetT = 6;
pub const VT_TOTAL: ::flatbuffers::VOffsetT = 8;
pub const VT_DATA: ::flatbuffers::VOffsetT = 10;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
StreamChunk { _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 StreamChunkArgs<'args>,
) -> ::flatbuffers::WIPOffset<StreamChunk<'bldr>> {
let mut builder = StreamChunkBuilder::new(_fbb);
if let Some(x) = args.data {
builder.add_data(x);
}
builder.add_total(args.total);
builder.add_index(args.index);
builder.add_stream_id(args.stream_id);
builder.finish()
}
#[inline]
pub fn stream_id(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(StreamChunk::VT_STREAM_ID, Some(0))
.unwrap()
}
}
#[inline]
pub fn index(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(StreamChunk::VT_INDEX, Some(0))
.unwrap()
}
}
#[inline]
pub fn total(&self) -> u32 {
unsafe {
self._tab
.get::<u32>(StreamChunk::VT_TOTAL, Some(0))
.unwrap()
}
}
#[inline]
pub fn data(&self) -> ::flatbuffers::Vector<'a, u8> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, u8>>>(
StreamChunk::VT_DATA,
None,
)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for StreamChunk<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<u32>("stream_id", Self::VT_STREAM_ID, false)?
.visit_field::<u32>("index", Self::VT_INDEX, false)?
.visit_field::<u32>("total", Self::VT_TOTAL, false)?
.visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, u8>>>(
"data",
Self::VT_DATA,
true,
)?
.finish();
Ok(())
}
}
pub struct StreamChunkArgs<'a> {
pub stream_id: u32,
pub index: u32,
pub total: u32,
pub data: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for StreamChunkArgs<'a> {
#[inline]
fn default() -> Self {
StreamChunkArgs {
stream_id: 0,
index: 0,
total: 0,
data: None, }
}
}
pub struct StreamChunkBuilder<'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> StreamChunkBuilder<'a, 'b, A> {
#[inline]
pub fn add_stream_id(&mut self, stream_id: u32) {
self.fbb_
.push_slot::<u32>(StreamChunk::VT_STREAM_ID, stream_id, 0);
}
#[inline]
pub fn add_index(&mut self, index: u32) {
self.fbb_.push_slot::<u32>(StreamChunk::VT_INDEX, index, 0);
}
#[inline]
pub fn add_total(&mut self, total: u32) {
self.fbb_.push_slot::<u32>(StreamChunk::VT_TOTAL, total, 0);
}
#[inline]
pub fn add_data(&mut self, data: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b, u8>>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(StreamChunk::VT_DATA, data);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> StreamChunkBuilder<'a, 'b, A> {
let start = _fbb.start_table();
StreamChunkBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<StreamChunk<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, StreamChunk::VT_DATA, "data");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for StreamChunk<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("StreamChunk");
ds.field("stream_id", &self.stream_id());
ds.field("index", &self.index());
ds.field("total", &self.total());
ds.field("data", &self.data());
ds.finish()
}
}
pub enum OkOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Ok<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Ok<'a> {
type Inner = Ok<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> Ok<'a> {
pub const VT_MSG: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Ok { _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 OkArgs<'args>,
) -> ::flatbuffers::WIPOffset<Ok<'bldr>> {
let mut builder = OkBuilder::new(_fbb);
if let Some(x) = args.msg {
builder.add_msg(x);
}
builder.finish()
}
#[inline]
pub fn msg(&self) -> &'a str {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<&str>>(Ok::VT_MSG, None)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for Ok<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<&str>>("msg", Self::VT_MSG, true)?
.finish();
Ok(())
}
}
pub struct OkArgs<'a> {
pub msg: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for OkArgs<'a> {
#[inline]
fn default() -> Self {
OkArgs {
msg: None, }
}
}
pub struct OkBuilder<'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> OkBuilder<'a, 'b, A> {
#[inline]
pub fn add_msg(&mut self, msg: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(Ok::VT_MSG, msg);
}
#[inline]
pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> OkBuilder<'a, 'b, A> {
let start = _fbb.start_table();
OkBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Ok<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Ok::VT_MSG, "msg");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Ok<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Ok");
ds.field("msg", &self.msg());
ds.finish()
}
}
pub enum ErrorOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Error<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Error<'a> {
type Inner = Error<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> Error<'a> {
pub const VT_MSG: ::flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Error { _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 ErrorArgs<'args>,
) -> ::flatbuffers::WIPOffset<Error<'bldr>> {
let mut builder = ErrorBuilder::new(_fbb);
if let Some(x) = args.msg {
builder.add_msg(x);
}
builder.finish()
}
#[inline]
pub fn msg(&self) -> &'a str {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<&str>>(Error::VT_MSG, None)
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for Error<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<&str>>("msg", Self::VT_MSG, true)?
.finish();
Ok(())
}
}
pub struct ErrorArgs<'a> {
pub msg: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for ErrorArgs<'a> {
#[inline]
fn default() -> Self {
ErrorArgs {
msg: None, }
}
}
pub struct ErrorBuilder<'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> ErrorBuilder<'a, 'b, A> {
#[inline]
pub fn add_msg(&mut self, msg: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(Error::VT_MSG, msg);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> ErrorBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ErrorBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Error<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Error::VT_MSG, "msg");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Error<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Error");
ds.field("msg", &self.msg());
ds.finish()
}
}
pub enum HostResponseOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct HostResponse<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for HostResponse<'a> {
type Inner = HostResponse<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> HostResponse<'a> {
pub const VT_RESPONSE_TYPE: ::flatbuffers::VOffsetT = 4;
pub const VT_RESPONSE: ::flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
HostResponse { _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 HostResponseArgs,
) -> ::flatbuffers::WIPOffset<HostResponse<'bldr>> {
let mut builder = HostResponseBuilder::new(_fbb);
if let Some(x) = args.response {
builder.add_response(x);
}
builder.add_response_type(args.response_type);
builder.finish()
}
#[inline]
pub fn response_type(&self) -> HostResponseType {
unsafe {
self._tab
.get::<HostResponseType>(
HostResponse::VT_RESPONSE_TYPE,
Some(HostResponseType::NONE),
)
.unwrap()
}
}
#[inline]
pub fn response(&self) -> ::flatbuffers::Table<'a> {
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Table<'a>>>(
HostResponse::VT_RESPONSE,
None,
)
.unwrap()
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_contract_response(&self) -> Option<ContractResponse<'a>> {
if self.response_type() == HostResponseType::ContractResponse {
let u = self.response();
Some(unsafe { ContractResponse::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_delegate_response(&self) -> Option<DelegateResponse<'a>> {
if self.response_type() == HostResponseType::DelegateResponse {
let u = self.response();
Some(unsafe { DelegateResponse::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_generate_rand_data(&self) -> Option<GenerateRandData<'a>> {
if self.response_type() == HostResponseType::GenerateRandData {
let u = self.response();
Some(unsafe { GenerateRandData::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_ok(&self) -> Option<Ok<'a>> {
if self.response_type() == HostResponseType::Ok {
let u = self.response();
Some(unsafe { Ok::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_error(&self) -> Option<Error<'a>> {
if self.response_type() == HostResponseType::Error {
let u = self.response();
Some(unsafe { Error::init_from_table(u) })
} else {
None
}
}
#[inline]
#[allow(non_snake_case)]
pub fn response_as_stream_chunk(&self) -> Option<StreamChunk<'a>> {
if self.response_type() == HostResponseType::StreamChunk {
let u = self.response();
Some(unsafe { StreamChunk::init_from_table(u) })
} else {
None
}
}
}
impl ::flatbuffers::Verifiable for HostResponse<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_union::<HostResponseType, _>("response_type", Self::VT_RESPONSE_TYPE, "response", Self::VT_RESPONSE, true, |key, v, pos| {
match key {
HostResponseType::ContractResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<ContractResponse>>("HostResponseType::ContractResponse", pos),
HostResponseType::DelegateResponse => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<DelegateResponse>>("HostResponseType::DelegateResponse", pos),
HostResponseType::GenerateRandData => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<GenerateRandData>>("HostResponseType::GenerateRandData", pos),
HostResponseType::Ok => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<Ok>>("HostResponseType::Ok", pos),
HostResponseType::Error => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<Error>>("HostResponseType::Error", pos),
HostResponseType::StreamChunk => v.verify_union_variant::<::flatbuffers::ForwardsUOffset<StreamChunk>>("HostResponseType::StreamChunk", pos),
_ => Ok(()),
}
})?
.finish();
Ok(())
}
}
pub struct HostResponseArgs {
pub response_type: HostResponseType,
pub response: Option<::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>>,
}
impl<'a> Default for HostResponseArgs {
#[inline]
fn default() -> Self {
HostResponseArgs {
response_type: HostResponseType::NONE,
response: None, }
}
}
pub struct HostResponseBuilder<'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> HostResponseBuilder<'a, 'b, A> {
#[inline]
pub fn add_response_type(&mut self, response_type: HostResponseType) {
self.fbb_.push_slot::<HostResponseType>(
HostResponse::VT_RESPONSE_TYPE,
response_type,
HostResponseType::NONE,
);
}
#[inline]
pub fn add_response(
&mut self,
response: ::flatbuffers::WIPOffset<::flatbuffers::UnionWIPOffset>,
) {
self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(
HostResponse::VT_RESPONSE,
response,
);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> HostResponseBuilder<'a, 'b, A> {
let start = _fbb.start_table();
HostResponseBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<HostResponse<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, HostResponse::VT_RESPONSE, "response");
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for HostResponse<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("HostResponse");
ds.field("response_type", &self.response_type());
match self.response_type() {
HostResponseType::ContractResponse => {
if let Some(x) = self.response_as_contract_response() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
HostResponseType::DelegateResponse => {
if let Some(x) = self.response_as_delegate_response() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
HostResponseType::GenerateRandData => {
if let Some(x) = self.response_as_generate_rand_data() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
HostResponseType::Ok => {
if let Some(x) = self.response_as_ok() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
HostResponseType::Error => {
if let Some(x) = self.response_as_error() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
HostResponseType::StreamChunk => {
if let Some(x) = self.response_as_stream_chunk() {
ds.field("response", &x)
} else {
ds.field(
"response",
&"InvalidFlatbuffer: Union discriminant does not match value.",
)
}
}
_ => {
let x: Option<()> = None;
ds.field("response", &x)
}
};
ds.finish()
}
}
#[inline]
pub fn root_as_host_response(
buf: &[u8],
) -> Result<HostResponse<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<HostResponse>(buf)
}
#[inline]
pub fn size_prefixed_root_as_host_response(
buf: &[u8],
) -> Result<HostResponse<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<HostResponse>(buf)
}
#[inline]
pub fn root_as_host_response_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<HostResponse<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<HostResponse<'b>>(opts, buf)
}
#[inline]
pub fn size_prefixed_root_as_host_response_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<HostResponse<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<HostResponse<'b>>(opts, buf)
}
#[inline]
pub unsafe fn root_as_host_response_unchecked(buf: &[u8]) -> HostResponse<'_> {
unsafe { ::flatbuffers::root_unchecked::<HostResponse>(buf) }
}
#[inline]
pub unsafe fn size_prefixed_root_as_host_response_unchecked(buf: &[u8]) -> HostResponse<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<HostResponse>(buf) }
}
#[inline]
pub fn finish_host_response_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<HostResponse<'a>>,
) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_host_response_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<HostResponse<'a>>,
) {
fbb.finish_size_prefixed(root, None);
}
}