From 6bd9dec8142fab99be78f30d80a66f1ccc6573a7 Mon Sep 17 00:00:00 2001 From: Ignacio Duart Date: Tue, 26 Sep 2023 17:25:58 +0200 Subject: [PATCH] Cargo fmt --- rust/src/client_request_generated.rs | 8220 ++++++++++++++------------ rust/src/common_generated.rs | 5176 +++++++++------- rust/src/host_response_generated.rs | 5936 ++++++++++--------- 3 files changed, 10792 insertions(+), 8540 deletions(-) diff --git a/rust/src/client_request_generated.rs b/rust/src/client_request_generated.rs index 52fdaee..aefb673 100644 --- a/rust/src/client_request_generated.rs +++ b/rust/src/client_request_generated.rs @@ -1,3078 +1,3928 @@ // automatically generated by the FlatBuffers compiler, do not modify +// @generated + +use crate::common_generated::*; +use core::cmp::Ordering; +use core::mem; + +extern crate flatbuffers; +use self::flatbuffers::{EndianScalar, Follow}; + +#[allow(unused_imports, dead_code)] +pub mod client_request { + + use crate::common_generated::*; + use core::cmp::Ordering; + use core::mem; + + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_DELEGATE_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_DELEGATE_TYPE: u8 = 1; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_DELEGATE_TYPE: [DelegateType; 2] = + [DelegateType::NONE, DelegateType::WasmDelegateV1]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct DelegateType(pub u8); + #[allow(non_upper_case_globals)] + impl DelegateType { + pub const NONE: Self = Self(0); + pub const WasmDelegateV1: Self = Self(1); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 1; + pub const ENUM_VALUES: &'static [Self] = &[Self::NONE, Self::WasmDelegateV1]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::WasmDelegateV1 => Some("WasmDelegateV1"), + _ => None, + } + } + } + impl core::fmt::Debug for DelegateType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for DelegateType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for DelegateType { + type Output = DelegateType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for DelegateType { + 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 DelegateType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for DelegateType {} + pub struct DelegateTypeUnionTableOffset {} + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_CONTRACT_REQUEST_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_REQUEST_TYPE: u8 = 4; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_CONTRACT_REQUEST_TYPE: [ContractRequestType; 5] = [ + ContractRequestType::NONE, + ContractRequestType::Put, + ContractRequestType::Update, + ContractRequestType::Get, + ContractRequestType::Subscribe, + ]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct ContractRequestType(pub u8); + #[allow(non_upper_case_globals)] + impl ContractRequestType { + pub const NONE: Self = Self(0); + pub const Put: Self = Self(1); + pub const Update: Self = Self(2); + pub const Get: Self = Self(3); + pub const Subscribe: Self = Self(4); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 4; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::Put, + Self::Update, + Self::Get, + Self::Subscribe, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::Put => Some("Put"), + Self::Update => Some("Update"), + Self::Get => Some("Get"), + Self::Subscribe => Some("Subscribe"), + _ => None, + } + } + } + impl core::fmt::Debug for ContractRequestType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for ContractRequestType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for ContractRequestType { + type Output = ContractRequestType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for ContractRequestType { + 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 ContractRequestType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for ContractRequestType {} + pub struct ContractRequestTypeUnionTableOffset {} + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_INBOUND_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_INBOUND_DELEGATE_MSG_TYPE: u8 = 4; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_INBOUND_DELEGATE_MSG_TYPE: [InboundDelegateMsgType; 5] = [ + InboundDelegateMsgType::NONE, + InboundDelegateMsgType::common_ApplicationMessage, + InboundDelegateMsgType::common_GetSecretResponse, + InboundDelegateMsgType::UserInputResponse, + InboundDelegateMsgType::common_GetSecretRequest, + ]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct InboundDelegateMsgType(pub u8); + #[allow(non_upper_case_globals)] + impl InboundDelegateMsgType { + pub const NONE: Self = Self(0); + pub const common_ApplicationMessage: Self = Self(1); + pub const common_GetSecretResponse: Self = Self(2); + pub const UserInputResponse: Self = Self(3); + pub const common_GetSecretRequest: Self = Self(4); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 4; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::common_ApplicationMessage, + Self::common_GetSecretResponse, + Self::UserInputResponse, + Self::common_GetSecretRequest, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::common_ApplicationMessage => Some("common_ApplicationMessage"), + Self::common_GetSecretResponse => Some("common_GetSecretResponse"), + Self::UserInputResponse => Some("UserInputResponse"), + Self::common_GetSecretRequest => Some("common_GetSecretRequest"), + _ => None, + } + } + } + impl core::fmt::Debug for InboundDelegateMsgType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for InboundDelegateMsgType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for InboundDelegateMsgType { + type Output = InboundDelegateMsgType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for InboundDelegateMsgType { + 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 InboundDelegateMsgType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for InboundDelegateMsgType {} + pub struct InboundDelegateMsgTypeUnionTableOffset {} + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_DELEGATE_REQUEST_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_DELEGATE_REQUEST_TYPE: u8 = 4; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_DELEGATE_REQUEST_TYPE: [DelegateRequestType; 5] = [ + DelegateRequestType::NONE, + DelegateRequestType::ApplicationMessages, + DelegateRequestType::GetSecretRequestType, + DelegateRequestType::RegisterDelegate, + DelegateRequestType::UnregisterDelegate, + ]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct DelegateRequestType(pub u8); + #[allow(non_upper_case_globals)] + impl DelegateRequestType { + pub const NONE: Self = Self(0); + pub const ApplicationMessages: Self = Self(1); + pub const GetSecretRequestType: Self = Self(2); + pub const RegisterDelegate: Self = Self(3); + pub const UnregisterDelegate: Self = Self(4); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 4; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::ApplicationMessages, + Self::GetSecretRequestType, + Self::RegisterDelegate, + Self::UnregisterDelegate, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::ApplicationMessages => Some("ApplicationMessages"), + Self::GetSecretRequestType => Some("GetSecretRequestType"), + Self::RegisterDelegate => Some("RegisterDelegate"), + Self::UnregisterDelegate => Some("UnregisterDelegate"), + _ => None, + } + } + } + impl core::fmt::Debug for DelegateRequestType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for DelegateRequestType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for DelegateRequestType { + type Output = DelegateRequestType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for DelegateRequestType { + 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 DelegateRequestType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for DelegateRequestType {} + pub struct DelegateRequestTypeUnionTableOffset {} + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_CLIENT_REQUEST_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_CLIENT_REQUEST_TYPE: u8 = 4; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_CLIENT_REQUEST_TYPE: [ClientRequestType; 5] = [ + ClientRequestType::NONE, + ClientRequestType::ContractRequest, + ClientRequestType::DelegateRequest, + ClientRequestType::Disconnect, + ClientRequestType::Authenticate, + ]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct ClientRequestType(pub u8); + #[allow(non_upper_case_globals)] + impl ClientRequestType { + pub const NONE: Self = Self(0); + pub const ContractRequest: Self = Self(1); + pub const DelegateRequest: Self = Self(2); + pub const Disconnect: Self = Self(3); + pub const Authenticate: Self = Self(4); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 4; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::ContractRequest, + Self::DelegateRequest, + Self::Disconnect, + Self::Authenticate, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::ContractRequest => Some("ContractRequest"), + Self::DelegateRequest => Some("DelegateRequest"), + Self::Disconnect => Some("Disconnect"), + Self::Authenticate => Some("Authenticate"), + _ => None, + } + } + } + impl core::fmt::Debug for ClientRequestType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for ClientRequestType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for ClientRequestType { + type Output = ClientRequestType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for ClientRequestType { + 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 ClientRequestType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for ClientRequestType {} + pub struct ClientRequestTypeUnionTableOffset {} + + pub enum DelegateCodeOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct DelegateCode<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for DelegateCode<'a> { + type Inner = DelegateCode<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> DelegateCode<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + pub const VT_CODE_HASH: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DelegateCode { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateCodeArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = DelegateCodeBuilder::new(_fbb); + if let Some(x) = args.code_hash { + builder.add_code_hash(x); + } + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateCode::VT_DATA, + None, + ) + .unwrap() + } + } + #[inline] + pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateCode::VT_CODE_HASH, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DelegateCode<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + true, + )? + .visit_field::>>( + "code_hash", + Self::VT_CODE_HASH, + true, + )? + .finish(); + Ok(()) + } + } + pub struct DelegateCodeArgs<'a> { + pub data: Option>>, + pub code_hash: Option>>, + } + impl<'a> Default for DelegateCodeArgs<'a> { + #[inline] + fn default() -> Self { + DelegateCodeArgs { + data: None, // required field + code_hash: None, // required field + } + } + } + + pub struct DelegateCodeBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateCodeBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(DelegateCode::VT_DATA, data); + } + #[inline] + pub fn add_code_hash( + &mut self, + code_hash: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + DelegateCode::VT_CODE_HASH, + code_hash, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> DelegateCodeBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateCodeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, DelegateCode::VT_DATA, "data"); + self.fbb_ + .required(o, DelegateCode::VT_CODE_HASH, "code_hash"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for DelegateCode<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DelegateCode"); + ds.field("data", &self.data()); + ds.field("code_hash", &self.code_hash()); + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateKeyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateKey::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateKey::VT_CODE_HASH, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DelegateKey<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "code_hash", + Self::VT_CODE_HASH, + true, + )? + .finish(); + Ok(()) + } + } + pub struct DelegateKeyArgs<'a> { + pub key: Option>>, + pub code_hash: Option>>, + } + impl<'a> Default for DelegateKeyArgs<'a> { + #[inline] + fn default() -> Self { + DelegateKeyArgs { + key: None, // required field + code_hash: None, // required field + } + } + } + + pub struct DelegateKeyBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateKeyBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(DelegateKey::VT_KEY, key); + } + #[inline] + pub fn add_code_hash( + &mut self, + code_hash: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + DelegateKey::VT_CODE_HASH, + code_hash, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateKeyBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateKeyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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 DelegateContextOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct DelegateContext<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for DelegateContext<'a> { + type Inner = DelegateContext<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> DelegateContext<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DelegateContext { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateContextArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = DelegateContextBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateContext::VT_DATA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DelegateContext<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct DelegateContextArgs<'a> { + pub data: Option>>, + } + impl<'a> Default for DelegateContextArgs<'a> { + #[inline] + fn default() -> Self { + DelegateContextArgs { + data: None, // required field + } + } + } + + pub struct DelegateContextBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateContextBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(DelegateContext::VT_DATA, data); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> DelegateContextBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateContextBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, DelegateContext::VT_DATA, "data"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for DelegateContext<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DelegateContext"); + ds.field("data", &self.data()); + ds.finish() + } + } + pub enum WasmDelegateV1Offset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct WasmDelegateV1<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for WasmDelegateV1<'a> { + type Inner = WasmDelegateV1<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> WasmDelegateV1<'a> { + pub const VT_PARAMETERS: flatbuffers::VOffsetT = 4; + pub const VT_DATA: flatbuffers::VOffsetT = 6; + pub const VT_KEY: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + WasmDelegateV1 { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args WasmDelegateV1Args<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = WasmDelegateV1Builder::new(_fbb); + if let Some(x) = args.key { + builder.add_key(x); + } + if let Some(x) = args.data { + builder.add_data(x); + } + if let Some(x) = args.parameters { + builder.add_parameters(x); + } + builder.finish() + } + + #[inline] + pub fn parameters(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + WasmDelegateV1::VT_PARAMETERS, + None, + ) + .unwrap() + } + } + #[inline] + pub fn data(&self) -> DelegateCode<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + WasmDelegateV1::VT_DATA, + None, + ) + .unwrap() + } + } + #[inline] + pub fn key(&self) -> DelegateKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(WasmDelegateV1::VT_KEY, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for WasmDelegateV1<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "parameters", + Self::VT_PARAMETERS, + true, + )? + .visit_field::>( + "data", + Self::VT_DATA, + true, + )? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .finish(); + Ok(()) + } + } + pub struct WasmDelegateV1Args<'a> { + pub parameters: Option>>, + pub data: Option>>, + pub key: Option>>, + } + impl<'a> Default for WasmDelegateV1Args<'a> { + #[inline] + fn default() -> Self { + WasmDelegateV1Args { + parameters: None, // required field + data: None, // required field + key: None, // required field + } + } + } + + pub struct WasmDelegateV1Builder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> WasmDelegateV1Builder<'a, 'b> { + #[inline] + pub fn add_parameters( + &mut self, + parameters: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + WasmDelegateV1::VT_PARAMETERS, + parameters, + ); + } + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + WasmDelegateV1::VT_DATA, + data, + ); + } + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + WasmDelegateV1::VT_KEY, + key, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> WasmDelegateV1Builder<'a, 'b> { + let start = _fbb.start_table(); + WasmDelegateV1Builder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, WasmDelegateV1::VT_PARAMETERS, "parameters"); + self.fbb_.required(o, WasmDelegateV1::VT_DATA, "data"); + self.fbb_.required(o, WasmDelegateV1::VT_KEY, "key"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for WasmDelegateV1<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("WasmDelegateV1"); + ds.field("parameters", &self.parameters()); + ds.field("data", &self.data()); + ds.field("key", &self.key()); + ds.finish() + } + } + pub enum DelegateContainerOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct DelegateContainer<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for DelegateContainer<'a> { + type Inner = DelegateContainer<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> DelegateContainer<'a> { + pub const VT_DELEGATE_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_DELEGATE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DelegateContainer { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateContainerArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = DelegateContainerBuilder::new(_fbb); + if let Some(x) = args.delegate { + builder.add_delegate(x); + } + builder.add_delegate_type(args.delegate_type); + builder.finish() + } + + #[inline] + pub fn delegate_type(&self) -> DelegateType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + DelegateContainer::VT_DELEGATE_TYPE, + Some(DelegateType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn delegate(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateContainer::VT_DELEGATE, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn delegate_as_wasm_delegate_v1(&self) -> Option> { + if self.delegate_type() == DelegateType::WasmDelegateV1 { + let u = self.delegate(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { WasmDelegateV1::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for DelegateContainer<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::( + "delegate_type", + Self::VT_DELEGATE_TYPE, + "delegate", + Self::VT_DELEGATE, + true, + |key, v, pos| match key { + DelegateType::WasmDelegateV1 => v + .verify_union_variant::>( + "DelegateType::WasmDelegateV1", + pos, + ), + _ => Ok(()), + }, + )? + .finish(); + Ok(()) + } + } + pub struct DelegateContainerArgs { + pub delegate_type: DelegateType, + pub delegate: Option>, + } + impl<'a> Default for DelegateContainerArgs { + #[inline] + fn default() -> Self { + DelegateContainerArgs { + delegate_type: DelegateType::NONE, + delegate: None, // required field + } + } + } + + pub struct DelegateContainerBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateContainerBuilder<'a, 'b> { + #[inline] + pub fn add_delegate_type(&mut self, delegate_type: DelegateType) { + self.fbb_.push_slot::( + DelegateContainer::VT_DELEGATE_TYPE, + delegate_type, + DelegateType::NONE, + ); + } + #[inline] + pub fn add_delegate( + &mut self, + delegate: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + DelegateContainer::VT_DELEGATE, + delegate, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> DelegateContainerBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateContainerBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, DelegateContainer::VT_DELEGATE, "delegate"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for DelegateContainer<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DelegateContainer"); + ds.field("delegate_type", &self.delegate_type()); + match self.delegate_type() { + DelegateType::WasmDelegateV1 => { + if let Some(x) = self.delegate_as_wasm_delegate_v1() { + ds.field("delegate", &x) + } else { + ds.field( + "delegate", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("delegate", &x) + } + }; + ds.finish() + } + } + pub enum RelatedContractOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RelatedContract<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RelatedContract<'a> { + type Inner = RelatedContract<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RelatedContract<'a> { + pub const VT_INSTANCE_ID: flatbuffers::VOffsetT = 4; + pub const VT_STATE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RelatedContract { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RelatedContractArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RelatedContractBuilder::new(_fbb); + if let Some(x) = args.state { + builder.add_state(x); + } + if let Some(x) = args.instance_id { + builder.add_instance_id(x); + } + builder.finish() + } + + #[inline] + pub fn instance_id(&self) -> super::common::ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + RelatedContract::VT_INSTANCE_ID, + None, + ) + .unwrap() + } + } + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RelatedContract::VT_STATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RelatedContract<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "instance_id", + Self::VT_INSTANCE_ID, + true, + )? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct RelatedContractArgs<'a> { + pub instance_id: Option>>, + pub state: Option>>, + } + impl<'a> Default for RelatedContractArgs<'a> { + #[inline] + fn default() -> Self { + RelatedContractArgs { + instance_id: None, // required field + state: None, // required field + } + } + } + + pub struct RelatedContractBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RelatedContractBuilder<'a, 'b> { + #[inline] + pub fn add_instance_id( + &mut self, + instance_id: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + RelatedContract::VT_INSTANCE_ID, + instance_id, + ); + } + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(RelatedContract::VT_STATE, state); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RelatedContractBuilder<'a, 'b> { + let start = _fbb.start_table(); + RelatedContractBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RelatedContract::VT_INSTANCE_ID, "instance_id"); + self.fbb_.required(o, RelatedContract::VT_STATE, "state"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for RelatedContract<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RelatedContract"); + ds.field("instance_id", &self.instance_id()); + ds.field("state", &self.state()); + ds.finish() + } + } + pub enum RelatedContractsOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RelatedContracts<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RelatedContracts<'a> { + type Inner = RelatedContracts<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RelatedContracts<'a> { + pub const VT_CONTRACTS: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RelatedContracts { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RelatedContractsArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RelatedContractsBuilder::new(_fbb); + if let Some(x) = args.contracts { + builder.add_contracts(x); + } + builder.finish() + } + + #[inline] + pub fn contracts( + &self, + ) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>, + >>(RelatedContracts::VT_CONTRACTS, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RelatedContracts<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>, + >>("contracts", Self::VT_CONTRACTS, true)? + .finish(); + Ok(()) + } + } + pub struct RelatedContractsArgs<'a> { + pub contracts: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + } + impl<'a> Default for RelatedContractsArgs<'a> { + #[inline] + fn default() -> Self { + RelatedContractsArgs { + contracts: None, // required field + } + } + } + + pub struct RelatedContractsBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RelatedContractsBuilder<'a, 'b> { + #[inline] + pub fn add_contracts( + &mut self, + contracts: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + RelatedContracts::VT_CONTRACTS, + contracts, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RelatedContractsBuilder<'a, 'b> { + let start = _fbb.start_table(); + RelatedContractsBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RelatedContracts::VT_CONTRACTS, "contracts"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for RelatedContracts<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RelatedContracts"); + ds.field("contracts", &self.contracts()); + ds.finish() + } + } + pub enum PutOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Put<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Put<'a> { + type Inner = Put<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Put<'a> { + pub const VT_CONTAINER: flatbuffers::VOffsetT = 4; + pub const VT_WRAPPED_STATE: flatbuffers::VOffsetT = 6; + pub const VT_RELATED_CONTRACTS: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Put { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args PutArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = PutBuilder::new(_fbb); + if let Some(x) = args.related_contracts { + builder.add_related_contracts(x); + } + if let Some(x) = args.wrapped_state { + builder.add_wrapped_state(x); + } + if let Some(x) = args.container { + builder.add_container(x); + } + builder.finish() + } + + #[inline] + pub fn container(&self) -> super::common::ContractContainer<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Put::VT_CONTAINER, + None, + ) + .unwrap() + } + } + #[inline] + pub fn wrapped_state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + Put::VT_WRAPPED_STATE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn related_contracts(&self) -> RelatedContracts<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Put::VT_RELATED_CONTRACTS, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Put<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "container", + Self::VT_CONTAINER, + true, + )? + .visit_field::>>( + "wrapped_state", + Self::VT_WRAPPED_STATE, + true, + )? + .visit_field::>( + "related_contracts", + Self::VT_RELATED_CONTRACTS, + true, + )? + .finish(); + Ok(()) + } + } + pub struct PutArgs<'a> { + pub container: Option>>, + pub wrapped_state: Option>>, + pub related_contracts: Option>>, + } + impl<'a> Default for PutArgs<'a> { + #[inline] + fn default() -> Self { + PutArgs { + container: None, // required field + wrapped_state: None, // required field + related_contracts: None, // required field + } + } + } + + pub struct PutBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> PutBuilder<'a, 'b> { + #[inline] + pub fn add_container( + &mut self, + container: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + Put::VT_CONTAINER, + container, + ); + } + #[inline] + pub fn add_wrapped_state( + &mut self, + wrapped_state: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + Put::VT_WRAPPED_STATE, + wrapped_state, + ); + } + #[inline] + pub fn add_related_contracts( + &mut self, + related_contracts: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + Put::VT_RELATED_CONTRACTS, + related_contracts, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PutBuilder<'a, 'b> { + let start = _fbb.start_table(); + PutBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, Put::VT_CONTAINER, "container"); + self.fbb_ + .required(o, Put::VT_WRAPPED_STATE, "wrapped_state"); + self.fbb_ + .required(o, Put::VT_RELATED_CONTRACTS, "related_contracts"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Put<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Put"); + ds.field("container", &self.container()); + ds.field("wrapped_state", &self.wrapped_state()); + ds.field("related_contracts", &self.related_contracts()); + ds.finish() + } + } + pub enum UpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Update<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Update<'a> { + type Inner = Update<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Update<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_DATA: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Update { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = UpdateBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> super::common::ContractKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Update::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn data(&self) -> super::common::UpdateData<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Update::VT_DATA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Update<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>( + "data", + Self::VT_DATA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct UpdateArgs<'a> { + pub key: Option>>, + pub data: Option>>, + } + impl<'a> Default for UpdateArgs<'a> { + #[inline] + fn default() -> Self { + UpdateArgs { + key: None, // required field + data: None, // required field + } + } + } + + pub struct UpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UpdateBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + Update::VT_KEY, + key, + ); + } + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + Update::VT_DATA, + data, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + UpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, Update::VT_KEY, "key"); + self.fbb_.required(o, Update::VT_DATA, "data"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Update<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Update"); + ds.field("key", &self.key()); + ds.field("data", &self.data()); + ds.finish() + } + } + pub enum GetOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Get<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Get<'a> { + type Inner = Get<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Get<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_FETCH_CONTRACT: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Get { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GetArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = GetBuilder::new(_fbb); + if let Some(x) = args.key { + builder.add_key(x); + } + builder.add_fetch_contract(args.fetch_contract); + builder.finish() + } + + #[inline] + pub fn key(&self) -> super::common::ContractKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Get::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn fetch_contract(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(Get::VT_FETCH_CONTRACT, Some(false)) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Get<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::("fetch_contract", Self::VT_FETCH_CONTRACT, false)? + .finish(); + Ok(()) + } + } + pub struct GetArgs<'a> { + pub key: Option>>, + pub fetch_contract: bool, + } + impl<'a> Default for GetArgs<'a> { + #[inline] + fn default() -> Self { + GetArgs { + key: None, // required field + fetch_contract: false, + } + } + } + + pub struct GetBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GetBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + Get::VT_KEY, + key, + ); + } + #[inline] + pub fn add_fetch_contract(&mut self, fetch_contract: bool) { + self.fbb_ + .push_slot::(Get::VT_FETCH_CONTRACT, fetch_contract, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetBuilder<'a, 'b> { + let start = _fbb.start_table(); + GetBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, Get::VT_KEY, "key"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Get<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Get"); + ds.field("key", &self.key()); + ds.field("fetch_contract", &self.fetch_contract()); + ds.finish() + } + } + pub enum SubscribeOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Subscribe<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Subscribe<'a> { + type Inner = Subscribe<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Subscribe<'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 { + Subscribe { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args SubscribeArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = SubscribeBuilder::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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + Subscribe::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn summary(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + Subscribe::VT_SUMMARY, + None, + ) + } + } + } + + impl flatbuffers::Verifiable for Subscribe<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "summary", + Self::VT_SUMMARY, + false, + )? + .finish(); + Ok(()) + } + } + pub struct SubscribeArgs<'a> { + pub key: Option>>, + pub summary: Option>>, + } + impl<'a> Default for SubscribeArgs<'a> { + #[inline] + fn default() -> Self { + SubscribeArgs { + key: None, // required field + summary: None, + } + } + } + + pub struct SubscribeBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> SubscribeBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + Subscribe::VT_KEY, + key, + ); + } + #[inline] + pub fn add_summary( + &mut self, + summary: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>(Subscribe::VT_SUMMARY, summary); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SubscribeBuilder<'a, 'b> { + let start = _fbb.start_table(); + SubscribeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, Subscribe::VT_KEY, "key"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Subscribe<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Subscribe"); + ds.field("key", &self.key()); + ds.field("summary", &self.summary()); + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ClientResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ClientResponseBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ClientResponse::VT_DATA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ClientResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct ClientResponseArgs<'a> { + pub data: Option>>, + } + impl<'a> Default for ClientResponseArgs<'a> { + #[inline] + fn default() -> Self { + ClientResponseArgs { + data: None, // required field + } + } + } + + pub struct ClientResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ClientResponseBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(ClientResponse::VT_DATA, data); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ClientResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + ClientResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ClientResponse::VT_DATA, "data"); + 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 UserInputResponseOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct UserInputResponse<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for UserInputResponse<'a> { + type Inner = UserInputResponse<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> UserInputResponse<'a> { + pub const VT_REQUEST_ID: flatbuffers::VOffsetT = 4; + pub const VT_RESPONSE: flatbuffers::VOffsetT = 6; + pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + UserInputResponse { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UserInputResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = UserInputResponseBuilder::new(_fbb); + if let Some(x) = args.delegate_context { + builder.add_delegate_context(x); + } + if let Some(x) = args.response { + builder.add_response(x); + } + builder.add_request_id(args.request_id); + builder.finish() + } + + #[inline] + pub fn request_id(&self) -> u32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(UserInputResponse::VT_REQUEST_ID, Some(0)) + .unwrap() + } + } + #[inline] + pub fn response(&self) -> ClientResponse<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + UserInputResponse::VT_RESPONSE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + UserInputResponse::VT_DELEGATE_CONTEXT, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for UserInputResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("request_id", Self::VT_REQUEST_ID, false)? + .visit_field::>( + "response", + Self::VT_RESPONSE, + true, + )? + .visit_field::>>( + "delegate_context", + Self::VT_DELEGATE_CONTEXT, + true, + )? + .finish(); + Ok(()) + } + } + pub struct UserInputResponseArgs<'a> { + pub request_id: u32, + pub response: Option>>, + pub delegate_context: Option>>, + } + impl<'a> Default for UserInputResponseArgs<'a> { + #[inline] + fn default() -> Self { + UserInputResponseArgs { + request_id: 0, + response: None, // required field + delegate_context: None, // required field + } + } + } + + pub struct UserInputResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UserInputResponseBuilder<'a, 'b> { + #[inline] + pub fn add_request_id(&mut self, request_id: u32) { + self.fbb_ + .push_slot::(UserInputResponse::VT_REQUEST_ID, request_id, 0); + } + #[inline] + pub fn add_response(&mut self, response: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + UserInputResponse::VT_RESPONSE, + response, + ); + } + #[inline] + pub fn add_delegate_context( + &mut self, + delegate_context: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + UserInputResponse::VT_DELEGATE_CONTEXT, + delegate_context, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> UserInputResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + UserInputResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, UserInputResponse::VT_RESPONSE, "response"); + self.fbb_.required( + o, + UserInputResponse::VT_DELEGATE_CONTEXT, + "delegate_context", + ); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for UserInputResponse<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("UserInputResponse"); + ds.field("request_id", &self.request_id()); + ds.field("response", &self.response()); + ds.field("delegate_context", &self.delegate_context()); + ds.finish() + } + } + pub enum InboundDelegateMsgOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct InboundDelegateMsg<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for InboundDelegateMsg<'a> { + type Inner = InboundDelegateMsg<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> InboundDelegateMsg<'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 { + InboundDelegateMsg { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args InboundDelegateMsgArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = InboundDelegateMsgBuilder::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) -> InboundDelegateMsgType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + InboundDelegateMsg::VT_INBOUND_TYPE, + Some(InboundDelegateMsgType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn inbound(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + InboundDelegateMsg::VT_INBOUND, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_application_message( + &self, + ) -> Option> { + if self.inbound_type() == InboundDelegateMsgType::common_ApplicationMessage { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { super::common::ApplicationMessage::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_get_secret_response( + &self, + ) -> Option> { + if self.inbound_type() == InboundDelegateMsgType::common_GetSecretResponse { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_user_input_response(&self) -> Option> { + if self.inbound_type() == InboundDelegateMsgType::UserInputResponse { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { UserInputResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_get_secret_request( + &self, + ) -> Option> { + if self.inbound_type() == InboundDelegateMsgType::common_GetSecretRequest { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for InboundDelegateMsg<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| { + match key { + InboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::>("InboundDelegateMsgType::common_ApplicationMessage", pos), + InboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::>("InboundDelegateMsgType::common_GetSecretResponse", pos), + InboundDelegateMsgType::UserInputResponse => v.verify_union_variant::>("InboundDelegateMsgType::UserInputResponse", pos), + InboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::>("InboundDelegateMsgType::common_GetSecretRequest", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } + } + pub struct InboundDelegateMsgArgs { + pub inbound_type: InboundDelegateMsgType, + pub inbound: Option>, + } + impl<'a> Default for InboundDelegateMsgArgs { + #[inline] + fn default() -> Self { + InboundDelegateMsgArgs { + inbound_type: InboundDelegateMsgType::NONE, + inbound: None, // required field + } + } + } + + pub struct InboundDelegateMsgBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> InboundDelegateMsgBuilder<'a, 'b> { + #[inline] + pub fn add_inbound_type(&mut self, inbound_type: InboundDelegateMsgType) { + self.fbb_.push_slot::( + InboundDelegateMsg::VT_INBOUND_TYPE, + inbound_type, + InboundDelegateMsgType::NONE, + ); + } + #[inline] + pub fn add_inbound( + &mut self, + inbound: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + InboundDelegateMsg::VT_INBOUND, + inbound, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> InboundDelegateMsgBuilder<'a, 'b> { + let start = _fbb.start_table(); + InboundDelegateMsgBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, InboundDelegateMsg::VT_INBOUND, "inbound"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for InboundDelegateMsg<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("InboundDelegateMsg"); + ds.field("inbound_type", &self.inbound_type()); + match self.inbound_type() { + InboundDelegateMsgType::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.", + ) + } + } + InboundDelegateMsgType::common_GetSecretResponse => { + if let Some(x) = self.inbound_as_common_get_secret_response() { + ds.field("inbound", &x) + } else { + ds.field( + "inbound", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + InboundDelegateMsgType::UserInputResponse => { + if let Some(x) = self.inbound_as_user_input_response() { + ds.field("inbound", &x) + } else { + ds.field( + "inbound", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + InboundDelegateMsgType::common_GetSecretRequest => { + if let Some(x) = self.inbound_as_common_get_secret_request() { + 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 ApplicationMessagesOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ApplicationMessages<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ApplicationMessages<'a> { + type Inner = ApplicationMessages<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ApplicationMessages<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_PARAMS: flatbuffers::VOffsetT = 6; + pub const VT_INBOUND: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ApplicationMessages { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ApplicationMessagesArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ApplicationMessagesBuilder::new(_fbb); + if let Some(x) = args.inbound { + builder.add_inbound(x); + } + if let Some(x) = args.params { + builder.add_params(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> DelegateKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + ApplicationMessages::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn params(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ApplicationMessages::VT_PARAMS, + None, + ) + .unwrap() + } + } + #[inline] + pub fn inbound( + &self, + ) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>, + >>(ApplicationMessages::VT_INBOUND, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ApplicationMessages<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "params", + Self::VT_PARAMS, + true, + )? + .visit_field::>, + >>("inbound", Self::VT_INBOUND, true)? + .finish(); + Ok(()) + } + } + pub struct ApplicationMessagesArgs<'a> { + pub key: Option>>, + pub params: Option>>, + pub inbound: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + } + impl<'a> Default for ApplicationMessagesArgs<'a> { + #[inline] + fn default() -> Self { + ApplicationMessagesArgs { + key: None, // required field + params: None, // required field + inbound: None, // required field + } + } + } + + pub struct ApplicationMessagesBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ApplicationMessagesBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + ApplicationMessages::VT_KEY, + key, + ); + } + #[inline] + pub fn add_params(&mut self, params: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + ApplicationMessages::VT_PARAMS, + params, + ); + } + #[inline] + pub fn add_inbound( + &mut self, + inbound: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + ApplicationMessages::VT_INBOUND, + inbound, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ApplicationMessagesBuilder<'a, 'b> { + let start = _fbb.start_table(); + ApplicationMessagesBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ApplicationMessages::VT_KEY, "key"); + self.fbb_ + .required(o, ApplicationMessages::VT_PARAMS, "params"); + self.fbb_ + .required(o, ApplicationMessages::VT_INBOUND, "inbound"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ApplicationMessages<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ApplicationMessages"); + ds.field("key", &self.key()); + ds.field("params", &self.params()); + ds.field("inbound", &self.inbound()); + ds.finish() + } + } + pub enum GetSecretRequestTypeOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct GetSecretRequestType<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for GetSecretRequestType<'a> { + type Inner = GetSecretRequestType<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> GetSecretRequestType<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_PARAMS: flatbuffers::VOffsetT = 6; + pub const VT_GET_REQUEST: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + GetSecretRequestType { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GetSecretRequestTypeArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = GetSecretRequestTypeBuilder::new(_fbb); + if let Some(x) = args.get_request { + builder.add_get_request(x); + } + if let Some(x) = args.params { + builder.add_params(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> DelegateKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + GetSecretRequestType::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn params(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GetSecretRequestType::VT_PARAMS, + None, + ) + .unwrap() + } + } + #[inline] + pub fn get_request(&self) -> super::common::GetSecretRequest<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + GetSecretRequestType::VT_GET_REQUEST, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for GetSecretRequestType<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "params", + Self::VT_PARAMS, + true, + )? + .visit_field::>( + "get_request", + Self::VT_GET_REQUEST, + true, + )? + .finish(); + Ok(()) + } + } + pub struct GetSecretRequestTypeArgs<'a> { + pub key: Option>>, + pub params: Option>>, + pub get_request: Option>>, + } + impl<'a> Default for GetSecretRequestTypeArgs<'a> { + #[inline] + fn default() -> Self { + GetSecretRequestTypeArgs { + key: None, // required field + params: None, // required field + get_request: None, // required field + } + } + } + + pub struct GetSecretRequestTypeBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GetSecretRequestTypeBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + GetSecretRequestType::VT_KEY, + key, + ); + } + #[inline] + pub fn add_params(&mut self, params: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + GetSecretRequestType::VT_PARAMS, + params, + ); + } + #[inline] + pub fn add_get_request( + &mut self, + get_request: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + GetSecretRequestType::VT_GET_REQUEST, + get_request, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> GetSecretRequestTypeBuilder<'a, 'b> { + let start = _fbb.start_table(); + GetSecretRequestTypeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, GetSecretRequestType::VT_KEY, "key"); + self.fbb_ + .required(o, GetSecretRequestType::VT_PARAMS, "params"); + self.fbb_ + .required(o, GetSecretRequestType::VT_GET_REQUEST, "get_request"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for GetSecretRequestType<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("GetSecretRequestType"); + ds.field("key", &self.key()); + ds.field("params", &self.params()); + ds.field("get_request", &self.get_request()); + ds.finish() + } + } + pub enum RegisterDelegateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RegisterDelegate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RegisterDelegate<'a> { + type Inner = RegisterDelegate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RegisterDelegate<'a> { + pub const VT_DELEGATE: flatbuffers::VOffsetT = 4; + pub const VT_CIPHER: flatbuffers::VOffsetT = 6; + pub const VT_NONCE: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RegisterDelegate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RegisterDelegateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RegisterDelegateBuilder::new(_fbb); + if let Some(x) = args.nonce { + builder.add_nonce(x); + } + if let Some(x) = args.cipher { + builder.add_cipher(x); + } + if let Some(x) = args.delegate { + builder.add_delegate(x); + } + builder.finish() + } + + #[inline] + pub fn delegate(&self) -> DelegateContainer<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + RegisterDelegate::VT_DELEGATE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn cipher(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RegisterDelegate::VT_CIPHER, + None, + ) + .unwrap() + } + } + #[inline] + pub fn nonce(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RegisterDelegate::VT_NONCE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RegisterDelegate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "delegate", + Self::VT_DELEGATE, + true, + )? + .visit_field::>>( + "cipher", + Self::VT_CIPHER, + true, + )? + .visit_field::>>( + "nonce", + Self::VT_NONCE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct RegisterDelegateArgs<'a> { + pub delegate: Option>>, + pub cipher: Option>>, + pub nonce: Option>>, + } + impl<'a> Default for RegisterDelegateArgs<'a> { + #[inline] + fn default() -> Self { + RegisterDelegateArgs { + delegate: None, // required field + cipher: None, // required field + nonce: None, // required field + } + } + } + + pub struct RegisterDelegateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RegisterDelegateBuilder<'a, 'b> { + #[inline] + pub fn add_delegate(&mut self, delegate: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + RegisterDelegate::VT_DELEGATE, + delegate, + ); + } + #[inline] + pub fn add_cipher(&mut self, cipher: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(RegisterDelegate::VT_CIPHER, cipher); + } + #[inline] + pub fn add_nonce(&mut self, nonce: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(RegisterDelegate::VT_NONCE, nonce); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RegisterDelegateBuilder<'a, 'b> { + let start = _fbb.start_table(); + RegisterDelegateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RegisterDelegate::VT_DELEGATE, "delegate"); + self.fbb_.required(o, RegisterDelegate::VT_CIPHER, "cipher"); + self.fbb_.required(o, RegisterDelegate::VT_NONCE, "nonce"); + flatbuffers::WIPOffset::new(o.value()) + } + } -// @generated + impl core::fmt::Debug for RegisterDelegate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RegisterDelegate"); + ds.field("delegate", &self.delegate()); + ds.field("cipher", &self.cipher()); + ds.field("nonce", &self.nonce()); + ds.finish() + } + } + pub enum UnregisterDelegateOffset {} + #[derive(Copy, Clone, PartialEq)] -use crate::common_generated::*; -use core::mem; -use core::cmp::Ordering; + pub struct UnregisterDelegate<'a> { + pub _tab: flatbuffers::Table<'a>, + } -extern crate flatbuffers; -use self::flatbuffers::{EndianScalar, Follow}; + impl<'a> flatbuffers::Follow<'a> for UnregisterDelegate<'a> { + type Inner = UnregisterDelegate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } -#[allow(unused_imports, dead_code)] -pub mod client_request { + impl<'a> UnregisterDelegate<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; - use crate::common_generated::*; - use core::mem; - use core::cmp::Ordering; - - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DELEGATE_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_DELEGATE_TYPE: u8 = 1; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DELEGATE_TYPE: [DelegateType; 2] = [ - DelegateType::NONE, - DelegateType::WasmDelegateV1, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DelegateType(pub u8); -#[allow(non_upper_case_globals)] -impl DelegateType { - pub const NONE: Self = Self(0); - pub const WasmDelegateV1: Self = Self(1); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 1; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::WasmDelegateV1, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::WasmDelegateV1 => Some("WasmDelegateV1"), - _ => None, - } - } -} -impl core::fmt::Debug for DelegateType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DelegateType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DelegateType { - type Output = DelegateType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DelegateType { - 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 DelegateType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DelegateType {} -pub struct DelegateTypeUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_CONTRACT_REQUEST_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_REQUEST_TYPE: u8 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_CONTRACT_REQUEST_TYPE: [ContractRequestType; 5] = [ - ContractRequestType::NONE, - ContractRequestType::Put, - ContractRequestType::Update, - ContractRequestType::Get, - ContractRequestType::Subscribe, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct ContractRequestType(pub u8); -#[allow(non_upper_case_globals)] -impl ContractRequestType { - pub const NONE: Self = Self(0); - pub const Put: Self = Self(1); - pub const Update: Self = Self(2); - pub const Get: Self = Self(3); - pub const Subscribe: Self = Self(4); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::Put, - Self::Update, - Self::Get, - Self::Subscribe, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::Put => Some("Put"), - Self::Update => Some("Update"), - Self::Get => Some("Get"), - Self::Subscribe => Some("Subscribe"), - _ => None, - } - } -} -impl core::fmt::Debug for ContractRequestType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for ContractRequestType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ContractRequestType { - type Output = ContractRequestType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for ContractRequestType { - 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 ContractRequestType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for ContractRequestType {} -pub struct ContractRequestTypeUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_INBOUND_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_INBOUND_DELEGATE_MSG_TYPE: u8 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_INBOUND_DELEGATE_MSG_TYPE: [InboundDelegateMsgType; 5] = [ - InboundDelegateMsgType::NONE, - InboundDelegateMsgType::common_ApplicationMessage, - InboundDelegateMsgType::common_GetSecretResponse, - InboundDelegateMsgType::UserInputResponse, - InboundDelegateMsgType::common_GetSecretRequest, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct InboundDelegateMsgType(pub u8); -#[allow(non_upper_case_globals)] -impl InboundDelegateMsgType { - pub const NONE: Self = Self(0); - pub const common_ApplicationMessage: Self = Self(1); - pub const common_GetSecretResponse: Self = Self(2); - pub const UserInputResponse: Self = Self(3); - pub const common_GetSecretRequest: Self = Self(4); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::common_ApplicationMessage, - Self::common_GetSecretResponse, - Self::UserInputResponse, - Self::common_GetSecretRequest, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::common_ApplicationMessage => Some("common_ApplicationMessage"), - Self::common_GetSecretResponse => Some("common_GetSecretResponse"), - Self::UserInputResponse => Some("UserInputResponse"), - Self::common_GetSecretRequest => Some("common_GetSecretRequest"), - _ => None, - } - } -} -impl core::fmt::Debug for InboundDelegateMsgType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for InboundDelegateMsgType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for InboundDelegateMsgType { - type Output = InboundDelegateMsgType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for InboundDelegateMsgType { - 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 InboundDelegateMsgType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for InboundDelegateMsgType {} -pub struct InboundDelegateMsgTypeUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DELEGATE_REQUEST_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_DELEGATE_REQUEST_TYPE: u8 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DELEGATE_REQUEST_TYPE: [DelegateRequestType; 5] = [ - DelegateRequestType::NONE, - DelegateRequestType::ApplicationMessages, - DelegateRequestType::GetSecretRequestType, - DelegateRequestType::RegisterDelegate, - DelegateRequestType::UnregisterDelegate, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DelegateRequestType(pub u8); -#[allow(non_upper_case_globals)] -impl DelegateRequestType { - pub const NONE: Self = Self(0); - pub const ApplicationMessages: Self = Self(1); - pub const GetSecretRequestType: Self = Self(2); - pub const RegisterDelegate: Self = Self(3); - pub const UnregisterDelegate: Self = Self(4); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::ApplicationMessages, - Self::GetSecretRequestType, - Self::RegisterDelegate, - Self::UnregisterDelegate, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::ApplicationMessages => Some("ApplicationMessages"), - Self::GetSecretRequestType => Some("GetSecretRequestType"), - Self::RegisterDelegate => Some("RegisterDelegate"), - Self::UnregisterDelegate => Some("UnregisterDelegate"), - _ => None, - } - } -} -impl core::fmt::Debug for DelegateRequestType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DelegateRequestType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DelegateRequestType { - type Output = DelegateRequestType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DelegateRequestType { - 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 DelegateRequestType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DelegateRequestType {} -pub struct DelegateRequestTypeUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_CLIENT_REQUEST_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_CLIENT_REQUEST_TYPE: u8 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_CLIENT_REQUEST_TYPE: [ClientRequestType; 5] = [ - ClientRequestType::NONE, - ClientRequestType::ContractRequest, - ClientRequestType::DelegateRequest, - ClientRequestType::Disconnect, - ClientRequestType::Authenticate, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct ClientRequestType(pub u8); -#[allow(non_upper_case_globals)] -impl ClientRequestType { - pub const NONE: Self = Self(0); - pub const ContractRequest: Self = Self(1); - pub const DelegateRequest: Self = Self(2); - pub const Disconnect: Self = Self(3); - pub const Authenticate: Self = Self(4); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::ContractRequest, - Self::DelegateRequest, - Self::Disconnect, - Self::Authenticate, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::ContractRequest => Some("ContractRequest"), - Self::DelegateRequest => Some("DelegateRequest"), - Self::Disconnect => Some("Disconnect"), - Self::Authenticate => Some("Authenticate"), - _ => None, - } - } -} -impl core::fmt::Debug for ClientRequestType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for ClientRequestType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ClientRequestType { - type Output = ClientRequestType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for ClientRequestType { - 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 ClientRequestType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for ClientRequestType {} -pub struct ClientRequestTypeUnionTableOffset {} - -pub enum DelegateCodeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DelegateCode<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DelegateCode<'a> { - type Inner = DelegateCode<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DelegateCode<'a> { - pub const VT_DATA: flatbuffers::VOffsetT = 4; - pub const VT_CODE_HASH: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DelegateCode { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateCodeArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DelegateCodeBuilder::new(_fbb); - if let Some(x) = args.code_hash { builder.add_code_hash(x); } - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateCode::VT_DATA, None).unwrap()} - } - #[inline] - pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateCode::VT_CODE_HASH, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DelegateCode<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, true)? - .visit_field::>>("code_hash", Self::VT_CODE_HASH, true)? - .finish(); - Ok(()) - } -} -pub struct DelegateCodeArgs<'a> { - pub data: Option>>, - pub code_hash: Option>>, -} -impl<'a> Default for DelegateCodeArgs<'a> { - #[inline] - fn default() -> Self { - DelegateCodeArgs { - data: None, // required field - code_hash: None, // required field - } - } -} - -pub struct DelegateCodeBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateCodeBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateCode::VT_DATA, data); - } - #[inline] - pub fn add_code_hash(&mut self, code_hash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateCode::VT_CODE_HASH, code_hash); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateCodeBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateCodeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DelegateCode::VT_DATA,"data"); - self.fbb_.required(o, DelegateCode::VT_CODE_HASH,"code_hash"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DelegateCode<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DelegateCode"); - ds.field("data", &self.data()); - ds.field("code_hash", &self.code_hash()); - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateKeyArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateKey::VT_KEY, None).unwrap()} - } - #[inline] - pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateKey::VT_CODE_HASH, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DelegateKey<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("key", Self::VT_KEY, true)? - .visit_field::>>("code_hash", Self::VT_CODE_HASH, true)? - .finish(); - Ok(()) - } -} -pub struct DelegateKeyArgs<'a> { - pub key: Option>>, - pub code_hash: Option>>, -} -impl<'a> Default for DelegateKeyArgs<'a> { - #[inline] - fn default() -> Self { - DelegateKeyArgs { - key: None, // required field - code_hash: None, // required field - } - } -} - -pub struct DelegateKeyBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateKeyBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateKey::VT_KEY, key); - } - #[inline] - pub fn add_code_hash(&mut self, code_hash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateKey::VT_CODE_HASH, code_hash); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateKeyBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateKeyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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 DelegateContextOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DelegateContext<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DelegateContext<'a> { - type Inner = DelegateContext<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DelegateContext<'a> { - pub const VT_DATA: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DelegateContext { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateContextArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DelegateContextBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateContext::VT_DATA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DelegateContext<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, true)? - .finish(); - Ok(()) - } -} -pub struct DelegateContextArgs<'a> { - pub data: Option>>, -} -impl<'a> Default for DelegateContextArgs<'a> { - #[inline] - fn default() -> Self { - DelegateContextArgs { - data: None, // required field - } - } -} - -pub struct DelegateContextBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateContextBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateContext::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateContextBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateContextBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DelegateContext::VT_DATA,"data"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DelegateContext<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DelegateContext"); - ds.field("data", &self.data()); - ds.finish() - } -} -pub enum WasmDelegateV1Offset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct WasmDelegateV1<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for WasmDelegateV1<'a> { - type Inner = WasmDelegateV1<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> WasmDelegateV1<'a> { - pub const VT_PARAMETERS: flatbuffers::VOffsetT = 4; - pub const VT_DATA: flatbuffers::VOffsetT = 6; - pub const VT_KEY: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - WasmDelegateV1 { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args WasmDelegateV1Args<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = WasmDelegateV1Builder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.parameters { builder.add_parameters(x); } - builder.finish() - } - - - #[inline] - pub fn parameters(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(WasmDelegateV1::VT_PARAMETERS, None).unwrap()} - } - #[inline] - pub fn data(&self) -> DelegateCode<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(WasmDelegateV1::VT_DATA, None).unwrap()} - } - #[inline] - pub fn key(&self) -> DelegateKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(WasmDelegateV1::VT_KEY, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for WasmDelegateV1<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("parameters", Self::VT_PARAMETERS, true)? - .visit_field::>("data", Self::VT_DATA, true)? - .visit_field::>("key", Self::VT_KEY, true)? - .finish(); - Ok(()) - } -} -pub struct WasmDelegateV1Args<'a> { - pub parameters: Option>>, - pub data: Option>>, - pub key: Option>>, -} -impl<'a> Default for WasmDelegateV1Args<'a> { - #[inline] - fn default() -> Self { - WasmDelegateV1Args { - parameters: None, // required field - data: None, // required field - key: None, // required field - } - } -} - -pub struct WasmDelegateV1Builder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> WasmDelegateV1Builder<'a, 'b> { - #[inline] - pub fn add_parameters(&mut self, parameters: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmDelegateV1::VT_PARAMETERS, parameters); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmDelegateV1::VT_DATA, data); - } - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmDelegateV1::VT_KEY, key); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> WasmDelegateV1Builder<'a, 'b> { - let start = _fbb.start_table(); - WasmDelegateV1Builder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, WasmDelegateV1::VT_PARAMETERS,"parameters"); - self.fbb_.required(o, WasmDelegateV1::VT_DATA,"data"); - self.fbb_.required(o, WasmDelegateV1::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for WasmDelegateV1<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("WasmDelegateV1"); - ds.field("parameters", &self.parameters()); - ds.field("data", &self.data()); - ds.field("key", &self.key()); - ds.finish() - } -} -pub enum DelegateContainerOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DelegateContainer<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DelegateContainer<'a> { - type Inner = DelegateContainer<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DelegateContainer<'a> { - pub const VT_DELEGATE_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_DELEGATE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DelegateContainer { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateContainerArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DelegateContainerBuilder::new(_fbb); - if let Some(x) = args.delegate { builder.add_delegate(x); } - builder.add_delegate_type(args.delegate_type); - builder.finish() - } - - - #[inline] - pub fn delegate_type(&self) -> DelegateType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DelegateContainer::VT_DELEGATE_TYPE, Some(DelegateType::NONE)).unwrap()} - } - #[inline] - pub fn delegate(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateContainer::VT_DELEGATE, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn delegate_as_wasm_delegate_v1(&self) -> Option> { - if self.delegate_type() == DelegateType::WasmDelegateV1 { - let u = self.delegate(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { WasmDelegateV1::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for DelegateContainer<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("delegate_type", Self::VT_DELEGATE_TYPE, "delegate", Self::VT_DELEGATE, true, |key, v, pos| { - match key { - DelegateType::WasmDelegateV1 => v.verify_union_variant::>("DelegateType::WasmDelegateV1", pos), - _ => Ok(()), + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + UnregisterDelegate { _tab: table } } - })? - .finish(); - Ok(()) - } -} -pub struct DelegateContainerArgs { - pub delegate_type: DelegateType, - pub delegate: Option>, -} -impl<'a> Default for DelegateContainerArgs { - #[inline] - fn default() -> Self { - DelegateContainerArgs { - delegate_type: DelegateType::NONE, - delegate: None, // required field - } - } -} - -pub struct DelegateContainerBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateContainerBuilder<'a, 'b> { - #[inline] - pub fn add_delegate_type(&mut self, delegate_type: DelegateType) { - self.fbb_.push_slot::(DelegateContainer::VT_DELEGATE_TYPE, delegate_type, DelegateType::NONE); - } - #[inline] - pub fn add_delegate(&mut self, delegate: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(DelegateContainer::VT_DELEGATE, delegate); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateContainerBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateContainerBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DelegateContainer::VT_DELEGATE,"delegate"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DelegateContainer<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DelegateContainer"); - ds.field("delegate_type", &self.delegate_type()); - match self.delegate_type() { - DelegateType::WasmDelegateV1 => { - if let Some(x) = self.delegate_as_wasm_delegate_v1() { - ds.field("delegate", &x) - } else { - ds.field("delegate", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("delegate", &x) - }, - }; - ds.finish() - } -} -pub enum RelatedContractOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RelatedContract<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RelatedContract<'a> { - type Inner = RelatedContract<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RelatedContract<'a> { - pub const VT_INSTANCE_ID: flatbuffers::VOffsetT = 4; - pub const VT_STATE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RelatedContract { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RelatedContractArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RelatedContractBuilder::new(_fbb); - if let Some(x) = args.state { builder.add_state(x); } - if let Some(x) = args.instance_id { builder.add_instance_id(x); } - builder.finish() - } - - - #[inline] - pub fn instance_id(&self) -> super::common::ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(RelatedContract::VT_INSTANCE_ID, None).unwrap()} - } - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RelatedContract::VT_STATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RelatedContract<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("instance_id", Self::VT_INSTANCE_ID, true)? - .visit_field::>>("state", Self::VT_STATE, true)? - .finish(); - Ok(()) - } -} -pub struct RelatedContractArgs<'a> { - pub instance_id: Option>>, - pub state: Option>>, -} -impl<'a> Default for RelatedContractArgs<'a> { - #[inline] - fn default() -> Self { - RelatedContractArgs { - instance_id: None, // required field - state: None, // required field - } - } -} - -pub struct RelatedContractBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RelatedContractBuilder<'a, 'b> { - #[inline] - pub fn add_instance_id(&mut self, instance_id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedContract::VT_INSTANCE_ID, instance_id); - } - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedContract::VT_STATE, state); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RelatedContractBuilder<'a, 'b> { - let start = _fbb.start_table(); - RelatedContractBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RelatedContract::VT_INSTANCE_ID,"instance_id"); - self.fbb_.required(o, RelatedContract::VT_STATE,"state"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RelatedContract<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RelatedContract"); - ds.field("instance_id", &self.instance_id()); - ds.field("state", &self.state()); - ds.finish() - } -} -pub enum RelatedContractsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RelatedContracts<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RelatedContracts<'a> { - type Inner = RelatedContracts<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RelatedContracts<'a> { - pub const VT_CONTRACTS: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RelatedContracts { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RelatedContractsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RelatedContractsBuilder::new(_fbb); - if let Some(x) = args.contracts { builder.add_contracts(x); } - builder.finish() - } - - - #[inline] - pub fn contracts(&self) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(RelatedContracts::VT_CONTRACTS, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RelatedContracts<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("contracts", Self::VT_CONTRACTS, true)? - .finish(); - Ok(()) - } -} -pub struct RelatedContractsArgs<'a> { - pub contracts: Option>>>>, -} -impl<'a> Default for RelatedContractsArgs<'a> { - #[inline] - fn default() -> Self { - RelatedContractsArgs { - contracts: None, // required field - } - } -} - -pub struct RelatedContractsBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RelatedContractsBuilder<'a, 'b> { - #[inline] - pub fn add_contracts(&mut self, contracts: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(RelatedContracts::VT_CONTRACTS, contracts); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RelatedContractsBuilder<'a, 'b> { - let start = _fbb.start_table(); - RelatedContractsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RelatedContracts::VT_CONTRACTS,"contracts"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RelatedContracts<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RelatedContracts"); - ds.field("contracts", &self.contracts()); - ds.finish() - } -} -pub enum PutOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Put<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Put<'a> { - type Inner = Put<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Put<'a> { - pub const VT_CONTAINER: flatbuffers::VOffsetT = 4; - pub const VT_WRAPPED_STATE: flatbuffers::VOffsetT = 6; - pub const VT_RELATED_CONTRACTS: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Put { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args PutArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PutBuilder::new(_fbb); - if let Some(x) = args.related_contracts { builder.add_related_contracts(x); } - if let Some(x) = args.wrapped_state { builder.add_wrapped_state(x); } - if let Some(x) = args.container { builder.add_container(x); } - builder.finish() - } - - - #[inline] - pub fn container(&self) -> super::common::ContractContainer<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Put::VT_CONTAINER, None).unwrap()} - } - #[inline] - pub fn wrapped_state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(Put::VT_WRAPPED_STATE, None).unwrap()} - } - #[inline] - pub fn related_contracts(&self) -> RelatedContracts<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Put::VT_RELATED_CONTRACTS, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for Put<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("container", Self::VT_CONTAINER, true)? - .visit_field::>>("wrapped_state", Self::VT_WRAPPED_STATE, true)? - .visit_field::>("related_contracts", Self::VT_RELATED_CONTRACTS, true)? - .finish(); - Ok(()) - } -} -pub struct PutArgs<'a> { - pub container: Option>>, - pub wrapped_state: Option>>, - pub related_contracts: Option>>, -} -impl<'a> Default for PutArgs<'a> { - #[inline] - fn default() -> Self { - PutArgs { - container: None, // required field - wrapped_state: None, // required field - related_contracts: None, // required field - } - } -} - -pub struct PutBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> PutBuilder<'a, 'b> { - #[inline] - pub fn add_container(&mut self, container: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Put::VT_CONTAINER, container); - } - #[inline] - pub fn add_wrapped_state(&mut self, wrapped_state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Put::VT_WRAPPED_STATE, wrapped_state); - } - #[inline] - pub fn add_related_contracts(&mut self, related_contracts: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Put::VT_RELATED_CONTRACTS, related_contracts); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PutBuilder<'a, 'b> { - let start = _fbb.start_table(); - PutBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Put::VT_CONTAINER,"container"); - self.fbb_.required(o, Put::VT_WRAPPED_STATE,"wrapped_state"); - self.fbb_.required(o, Put::VT_RELATED_CONTRACTS,"related_contracts"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Put<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Put"); - ds.field("container", &self.container()); - ds.field("wrapped_state", &self.wrapped_state()); - ds.field("related_contracts", &self.related_contracts()); - ds.finish() - } -} -pub enum UpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Update<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Update<'a> { - type Inner = Update<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Update<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_DATA: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Update { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = UpdateBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> super::common::ContractKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Update::VT_KEY, None).unwrap()} - } - #[inline] - pub fn data(&self) -> super::common::UpdateData<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Update::VT_DATA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for Update<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("data", Self::VT_DATA, true)? - .finish(); - Ok(()) - } -} -pub struct UpdateArgs<'a> { - pub key: Option>>, - pub data: Option>>, -} -impl<'a> Default for UpdateArgs<'a> { - #[inline] - fn default() -> Self { - UpdateArgs { - key: None, // required field - data: None, // required field - } - } -} - -pub struct UpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UpdateBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Update::VT_KEY, key); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Update::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - UpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Update::VT_KEY,"key"); - self.fbb_.required(o, Update::VT_DATA,"data"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Update<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Update"); - ds.field("key", &self.key()); - ds.field("data", &self.data()); - ds.finish() - } -} -pub enum GetOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Get<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Get<'a> { - type Inner = Get<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Get<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_FETCH_CONTRACT: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Get { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GetArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GetBuilder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - builder.add_fetch_contract(args.fetch_contract); - builder.finish() - } - - - #[inline] - pub fn key(&self) -> super::common::ContractKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Get::VT_KEY, None).unwrap()} - } - #[inline] - pub fn fetch_contract(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Get::VT_FETCH_CONTRACT, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for Get<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::("fetch_contract", Self::VT_FETCH_CONTRACT, false)? - .finish(); - Ok(()) - } -} -pub struct GetArgs<'a> { - pub key: Option>>, - pub fetch_contract: bool, -} -impl<'a> Default for GetArgs<'a> { - #[inline] - fn default() -> Self { - GetArgs { - key: None, // required field - fetch_contract: false, - } - } -} - -pub struct GetBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GetBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Get::VT_KEY, key); - } - #[inline] - pub fn add_fetch_contract(&mut self, fetch_contract: bool) { - self.fbb_.push_slot::(Get::VT_FETCH_CONTRACT, fetch_contract, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetBuilder<'a, 'b> { - let start = _fbb.start_table(); - GetBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Get::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Get<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Get"); - ds.field("key", &self.key()); - ds.field("fetch_contract", &self.fetch_contract()); - ds.finish() - } -} -pub enum SubscribeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Subscribe<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Subscribe<'a> { - type Inner = Subscribe<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Subscribe<'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 { - Subscribe { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args SubscribeArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SubscribeBuilder::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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Subscribe::VT_KEY, None).unwrap()} - } - #[inline] - pub fn summary(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(Subscribe::VT_SUMMARY, None)} - } -} - -impl flatbuffers::Verifiable for Subscribe<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("summary", Self::VT_SUMMARY, false)? - .finish(); - Ok(()) - } -} -pub struct SubscribeArgs<'a> { - pub key: Option>>, - pub summary: Option>>, -} -impl<'a> Default for SubscribeArgs<'a> { - #[inline] - fn default() -> Self { - SubscribeArgs { - key: None, // required field - summary: None, - } - } -} - -pub struct SubscribeBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> SubscribeBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Subscribe::VT_KEY, key); - } - #[inline] - pub fn add_summary(&mut self, summary: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Subscribe::VT_SUMMARY, summary); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SubscribeBuilder<'a, 'b> { - let start = _fbb.start_table(); - SubscribeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Subscribe::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Subscribe<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Subscribe"); - ds.field("key", &self.key()); - ds.field("summary", &self.summary()); - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ClientResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ClientResponseBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ClientResponse::VT_DATA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for ClientResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, true)? - .finish(); - Ok(()) - } -} -pub struct ClientResponseArgs<'a> { - pub data: Option>>, -} -impl<'a> Default for ClientResponseArgs<'a> { - #[inline] - fn default() -> Self { - ClientResponseArgs { - data: None, // required field - } - } -} - -pub struct ClientResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ClientResponseBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ClientResponse::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ClientResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - ClientResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ClientResponse::VT_DATA,"data"); - 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 UserInputResponseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct UserInputResponse<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for UserInputResponse<'a> { - type Inner = UserInputResponse<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> UserInputResponse<'a> { - pub const VT_REQUEST_ID: flatbuffers::VOffsetT = 4; - pub const VT_RESPONSE: flatbuffers::VOffsetT = 6; - pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - UserInputResponse { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UserInputResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = UserInputResponseBuilder::new(_fbb); - if let Some(x) = args.delegate_context { builder.add_delegate_context(x); } - if let Some(x) = args.response { builder.add_response(x); } - builder.add_request_id(args.request_id); - builder.finish() - } - - - #[inline] - pub fn request_id(&self) -> u32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UserInputResponse::VT_REQUEST_ID, Some(0)).unwrap()} - } - #[inline] - pub fn response(&self) -> ClientResponse<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(UserInputResponse::VT_RESPONSE, None).unwrap()} - } - #[inline] - pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(UserInputResponse::VT_DELEGATE_CONTEXT, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for UserInputResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("request_id", Self::VT_REQUEST_ID, false)? - .visit_field::>("response", Self::VT_RESPONSE, true)? - .visit_field::>>("delegate_context", Self::VT_DELEGATE_CONTEXT, true)? - .finish(); - Ok(()) - } -} -pub struct UserInputResponseArgs<'a> { - pub request_id: u32, - pub response: Option>>, - pub delegate_context: Option>>, -} -impl<'a> Default for UserInputResponseArgs<'a> { - #[inline] - fn default() -> Self { - UserInputResponseArgs { - request_id: 0, - response: None, // required field - delegate_context: None, // required field - } - } -} - -pub struct UserInputResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UserInputResponseBuilder<'a, 'b> { - #[inline] - pub fn add_request_id(&mut self, request_id: u32) { - self.fbb_.push_slot::(UserInputResponse::VT_REQUEST_ID, request_id, 0); - } - #[inline] - pub fn add_response(&mut self, response: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UserInputResponse::VT_RESPONSE, response); - } - #[inline] - pub fn add_delegate_context(&mut self, delegate_context: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UserInputResponse::VT_DELEGATE_CONTEXT, delegate_context); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UserInputResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - UserInputResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, UserInputResponse::VT_RESPONSE,"response"); - self.fbb_.required(o, UserInputResponse::VT_DELEGATE_CONTEXT,"delegate_context"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for UserInputResponse<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("UserInputResponse"); - ds.field("request_id", &self.request_id()); - ds.field("response", &self.response()); - ds.field("delegate_context", &self.delegate_context()); - ds.finish() - } -} -pub enum InboundDelegateMsgOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct InboundDelegateMsg<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for InboundDelegateMsg<'a> { - type Inner = InboundDelegateMsg<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> InboundDelegateMsg<'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 { - InboundDelegateMsg { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args InboundDelegateMsgArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = InboundDelegateMsgBuilder::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) -> InboundDelegateMsgType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(InboundDelegateMsg::VT_INBOUND_TYPE, Some(InboundDelegateMsgType::NONE)).unwrap()} - } - #[inline] - pub fn inbound(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(InboundDelegateMsg::VT_INBOUND, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_application_message(&self) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::common_ApplicationMessage { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::ApplicationMessage::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_response(&self) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::common_GetSecretResponse { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_user_input_response(&self) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::UserInputResponse { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { UserInputResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_request(&self) -> Option> { - if self.inbound_type() == InboundDelegateMsgType::common_GetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for InboundDelegateMsg<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| { - match key { - InboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::>("InboundDelegateMsgType::common_ApplicationMessage", pos), - InboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::>("InboundDelegateMsgType::common_GetSecretResponse", pos), - InboundDelegateMsgType::UserInputResponse => v.verify_union_variant::>("InboundDelegateMsgType::UserInputResponse", pos), - InboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::>("InboundDelegateMsgType::common_GetSecretRequest", pos), - _ => Ok(()), + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UnregisterDelegateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = UnregisterDelegateBuilder::new(_fbb); + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() } - })? - .finish(); - Ok(()) - } -} -pub struct InboundDelegateMsgArgs { - pub inbound_type: InboundDelegateMsgType, - pub inbound: Option>, -} -impl<'a> Default for InboundDelegateMsgArgs { - #[inline] - fn default() -> Self { - InboundDelegateMsgArgs { - inbound_type: InboundDelegateMsgType::NONE, - inbound: None, // required field - } - } -} - -pub struct InboundDelegateMsgBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> InboundDelegateMsgBuilder<'a, 'b> { - #[inline] - pub fn add_inbound_type(&mut self, inbound_type: InboundDelegateMsgType) { - self.fbb_.push_slot::(InboundDelegateMsg::VT_INBOUND_TYPE, inbound_type, InboundDelegateMsgType::NONE); - } - #[inline] - pub fn add_inbound(&mut self, inbound: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(InboundDelegateMsg::VT_INBOUND, inbound); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> InboundDelegateMsgBuilder<'a, 'b> { - let start = _fbb.start_table(); - InboundDelegateMsgBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, InboundDelegateMsg::VT_INBOUND,"inbound"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for InboundDelegateMsg<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("InboundDelegateMsg"); - ds.field("inbound_type", &self.inbound_type()); - match self.inbound_type() { - InboundDelegateMsgType::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.") - } - }, - InboundDelegateMsgType::common_GetSecretResponse => { - if let Some(x) = self.inbound_as_common_get_secret_response() { - ds.field("inbound", &x) - } else { - ds.field("inbound", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - InboundDelegateMsgType::UserInputResponse => { - if let Some(x) = self.inbound_as_user_input_response() { - ds.field("inbound", &x) - } else { - ds.field("inbound", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - InboundDelegateMsgType::common_GetSecretRequest => { - if let Some(x) = self.inbound_as_common_get_secret_request() { - 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 ApplicationMessagesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ApplicationMessages<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ApplicationMessages<'a> { - type Inner = ApplicationMessages<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ApplicationMessages<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_PARAMS: flatbuffers::VOffsetT = 6; - pub const VT_INBOUND: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ApplicationMessages { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ApplicationMessagesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ApplicationMessagesBuilder::new(_fbb); - if let Some(x) = args.inbound { builder.add_inbound(x); } - if let Some(x) = args.params { builder.add_params(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> DelegateKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ApplicationMessages::VT_KEY, None).unwrap()} - } - #[inline] - pub fn params(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ApplicationMessages::VT_PARAMS, None).unwrap()} - } - #[inline] - pub fn inbound(&self) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ApplicationMessages::VT_INBOUND, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for ApplicationMessages<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("params", Self::VT_PARAMS, true)? - .visit_field::>>>("inbound", Self::VT_INBOUND, true)? - .finish(); - Ok(()) - } -} -pub struct ApplicationMessagesArgs<'a> { - pub key: Option>>, - pub params: Option>>, - pub inbound: Option>>>>, -} -impl<'a> Default for ApplicationMessagesArgs<'a> { - #[inline] - fn default() -> Self { - ApplicationMessagesArgs { - key: None, // required field - params: None, // required field - inbound: None, // required field - } - } -} - -pub struct ApplicationMessagesBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ApplicationMessagesBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ApplicationMessages::VT_KEY, key); - } - #[inline] - pub fn add_params(&mut self, params: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ApplicationMessages::VT_PARAMS, params); - } - #[inline] - pub fn add_inbound(&mut self, inbound: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ApplicationMessages::VT_INBOUND, inbound); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ApplicationMessagesBuilder<'a, 'b> { - let start = _fbb.start_table(); - ApplicationMessagesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ApplicationMessages::VT_KEY,"key"); - self.fbb_.required(o, ApplicationMessages::VT_PARAMS,"params"); - self.fbb_.required(o, ApplicationMessages::VT_INBOUND,"inbound"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ApplicationMessages<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ApplicationMessages"); - ds.field("key", &self.key()); - ds.field("params", &self.params()); - ds.field("inbound", &self.inbound()); - ds.finish() - } -} -pub enum GetSecretRequestTypeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct GetSecretRequestType<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for GetSecretRequestType<'a> { - type Inner = GetSecretRequestType<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> GetSecretRequestType<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_PARAMS: flatbuffers::VOffsetT = 6; - pub const VT_GET_REQUEST: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - GetSecretRequestType { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GetSecretRequestTypeArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GetSecretRequestTypeBuilder::new(_fbb); - if let Some(x) = args.get_request { builder.add_get_request(x); } - if let Some(x) = args.params { builder.add_params(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> DelegateKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetSecretRequestType::VT_KEY, None).unwrap()} - } - #[inline] - pub fn params(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GetSecretRequestType::VT_PARAMS, None).unwrap()} - } - #[inline] - pub fn get_request(&self) -> super::common::GetSecretRequest<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetSecretRequestType::VT_GET_REQUEST, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for GetSecretRequestType<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("params", Self::VT_PARAMS, true)? - .visit_field::>("get_request", Self::VT_GET_REQUEST, true)? - .finish(); - Ok(()) - } -} -pub struct GetSecretRequestTypeArgs<'a> { - pub key: Option>>, - pub params: Option>>, - pub get_request: Option>>, -} -impl<'a> Default for GetSecretRequestTypeArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretRequestTypeArgs { - key: None, // required field - params: None, // required field - get_request: None, // required field - } - } -} - -pub struct GetSecretRequestTypeBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GetSecretRequestTypeBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretRequestType::VT_KEY, key); - } - #[inline] - pub fn add_params(&mut self, params: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretRequestType::VT_PARAMS, params); - } - #[inline] - pub fn add_get_request(&mut self, get_request: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretRequestType::VT_GET_REQUEST, get_request); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetSecretRequestTypeBuilder<'a, 'b> { - let start = _fbb.start_table(); - GetSecretRequestTypeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretRequestType::VT_KEY,"key"); - self.fbb_.required(o, GetSecretRequestType::VT_PARAMS,"params"); - self.fbb_.required(o, GetSecretRequestType::VT_GET_REQUEST,"get_request"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for GetSecretRequestType<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("GetSecretRequestType"); - ds.field("key", &self.key()); - ds.field("params", &self.params()); - ds.field("get_request", &self.get_request()); - ds.finish() - } -} -pub enum RegisterDelegateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RegisterDelegate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RegisterDelegate<'a> { - type Inner = RegisterDelegate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RegisterDelegate<'a> { - pub const VT_DELEGATE: flatbuffers::VOffsetT = 4; - pub const VT_CIPHER: flatbuffers::VOffsetT = 6; - pub const VT_NONCE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RegisterDelegate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RegisterDelegateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RegisterDelegateBuilder::new(_fbb); - if let Some(x) = args.nonce { builder.add_nonce(x); } - if let Some(x) = args.cipher { builder.add_cipher(x); } - if let Some(x) = args.delegate { builder.add_delegate(x); } - builder.finish() - } - - - #[inline] - pub fn delegate(&self) -> DelegateContainer<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(RegisterDelegate::VT_DELEGATE, None).unwrap()} - } - #[inline] - pub fn cipher(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RegisterDelegate::VT_CIPHER, None).unwrap()} - } - #[inline] - pub fn nonce(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RegisterDelegate::VT_NONCE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RegisterDelegate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("delegate", Self::VT_DELEGATE, true)? - .visit_field::>>("cipher", Self::VT_CIPHER, true)? - .visit_field::>>("nonce", Self::VT_NONCE, true)? - .finish(); - Ok(()) - } -} -pub struct RegisterDelegateArgs<'a> { - pub delegate: Option>>, - pub cipher: Option>>, - pub nonce: Option>>, -} -impl<'a> Default for RegisterDelegateArgs<'a> { - #[inline] - fn default() -> Self { - RegisterDelegateArgs { - delegate: None, // required field - cipher: None, // required field - nonce: None, // required field - } - } -} - -pub struct RegisterDelegateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RegisterDelegateBuilder<'a, 'b> { - #[inline] - pub fn add_delegate(&mut self, delegate: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RegisterDelegate::VT_DELEGATE, delegate); - } - #[inline] - pub fn add_cipher(&mut self, cipher: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RegisterDelegate::VT_CIPHER, cipher); - } - #[inline] - pub fn add_nonce(&mut self, nonce: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RegisterDelegate::VT_NONCE, nonce); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RegisterDelegateBuilder<'a, 'b> { - let start = _fbb.start_table(); - RegisterDelegateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RegisterDelegate::VT_DELEGATE,"delegate"); - self.fbb_.required(o, RegisterDelegate::VT_CIPHER,"cipher"); - self.fbb_.required(o, RegisterDelegate::VT_NONCE,"nonce"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RegisterDelegate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RegisterDelegate"); - ds.field("delegate", &self.delegate()); - ds.field("cipher", &self.cipher()); - ds.field("nonce", &self.nonce()); - ds.finish() - } -} -pub enum UnregisterDelegateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct UnregisterDelegate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for UnregisterDelegate<'a> { - type Inner = UnregisterDelegate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> UnregisterDelegate<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - UnregisterDelegate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UnregisterDelegateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = UnregisterDelegateBuilder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> DelegateKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(UnregisterDelegate::VT_KEY, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for UnregisterDelegate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .finish(); - Ok(()) - } -} -pub struct UnregisterDelegateArgs<'a> { - pub key: Option>>, -} -impl<'a> Default for UnregisterDelegateArgs<'a> { - #[inline] - fn default() -> Self { - UnregisterDelegateArgs { - key: None, // required field - } - } -} - -pub struct UnregisterDelegateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UnregisterDelegateBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UnregisterDelegate::VT_KEY, key); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UnregisterDelegateBuilder<'a, 'b> { - let start = _fbb.start_table(); - UnregisterDelegateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, UnregisterDelegate::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for UnregisterDelegate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("UnregisterDelegate"); - ds.field("key", &self.key()); - ds.finish() - } -} -pub enum ContractRequestOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ContractRequest<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ContractRequest<'a> { - type Inner = ContractRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ContractRequest<'a> { - pub const VT_CONTRACT_REQUEST_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_CONTRACT_REQUEST: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ContractRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractRequestArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = ContractRequestBuilder::new(_fbb); - if let Some(x) = args.contract_request { builder.add_contract_request(x); } - builder.add_contract_request_type(args.contract_request_type); - builder.finish() - } - - - #[inline] - pub fn contract_request_type(&self) -> ContractRequestType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ContractRequest::VT_CONTRACT_REQUEST_TYPE, Some(ContractRequestType::NONE)).unwrap()} - } - #[inline] - pub fn contract_request(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractRequest::VT_CONTRACT_REQUEST, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn contract_request_as_put(&self) -> Option> { - if self.contract_request_type() == ContractRequestType::Put { - let u = self.contract_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Put::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_request_as_update(&self) -> Option> { - if self.contract_request_type() == ContractRequestType::Update { - let u = self.contract_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Update::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_request_as_get(&self) -> Option> { - if self.contract_request_type() == ContractRequestType::Get { - let u = self.contract_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Get::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_request_as_subscribe(&self) -> Option> { - if self.contract_request_type() == ContractRequestType::Subscribe { - let u = self.contract_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Subscribe::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for ContractRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("contract_request_type", Self::VT_CONTRACT_REQUEST_TYPE, "contract_request", Self::VT_CONTRACT_REQUEST, true, |key, v, pos| { - match key { - ContractRequestType::Put => v.verify_union_variant::>("ContractRequestType::Put", pos), - ContractRequestType::Update => v.verify_union_variant::>("ContractRequestType::Update", pos), - ContractRequestType::Get => v.verify_union_variant::>("ContractRequestType::Get", pos), - ContractRequestType::Subscribe => v.verify_union_variant::>("ContractRequestType::Subscribe", pos), - _ => Ok(()), + + #[inline] + pub fn key(&self) -> DelegateKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + UnregisterDelegate::VT_KEY, + None, + ) + .unwrap() + } } - })? - .finish(); - Ok(()) - } -} -pub struct ContractRequestArgs { - pub contract_request_type: ContractRequestType, - pub contract_request: Option>, -} -impl<'a> Default for ContractRequestArgs { - #[inline] - fn default() -> Self { - ContractRequestArgs { - contract_request_type: ContractRequestType::NONE, - contract_request: None, // required field - } - } -} - -pub struct ContractRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractRequestBuilder<'a, 'b> { - #[inline] - pub fn add_contract_request_type(&mut self, contract_request_type: ContractRequestType) { - self.fbb_.push_slot::(ContractRequest::VT_CONTRACT_REQUEST_TYPE, contract_request_type, ContractRequestType::NONE); - } - #[inline] - pub fn add_contract_request(&mut self, contract_request: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(ContractRequest::VT_CONTRACT_REQUEST, contract_request); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ContractRequest::VT_CONTRACT_REQUEST,"contract_request"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ContractRequest<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ContractRequest"); - ds.field("contract_request_type", &self.contract_request_type()); - match self.contract_request_type() { - ContractRequestType::Put => { - if let Some(x) = self.contract_request_as_put() { - ds.field("contract_request", &x) - } else { - ds.field("contract_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ContractRequestType::Update => { - if let Some(x) = self.contract_request_as_update() { - ds.field("contract_request", &x) - } else { - ds.field("contract_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ContractRequestType::Get => { - if let Some(x) = self.contract_request_as_get() { - ds.field("contract_request", &x) - } else { - ds.field("contract_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ContractRequestType::Subscribe => { - if let Some(x) = self.contract_request_as_subscribe() { - ds.field("contract_request", &x) - } else { - ds.field("contract_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("contract_request", &x) - }, - }; - ds.finish() - } -} -pub enum DelegateRequestOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DelegateRequest<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DelegateRequest<'a> { - type Inner = DelegateRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DelegateRequest<'a> { - pub const VT_DELEGATE_REQUEST_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_DELEGATE_REQUEST: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DelegateRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateRequestArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DelegateRequestBuilder::new(_fbb); - if let Some(x) = args.delegate_request { builder.add_delegate_request(x); } - builder.add_delegate_request_type(args.delegate_request_type); - builder.finish() - } - - - #[inline] - pub fn delegate_request_type(&self) -> DelegateRequestType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DelegateRequest::VT_DELEGATE_REQUEST_TYPE, Some(DelegateRequestType::NONE)).unwrap()} - } - #[inline] - pub fn delegate_request(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateRequest::VT_DELEGATE_REQUEST, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn delegate_request_as_application_messages(&self) -> Option> { - if self.delegate_request_type() == DelegateRequestType::ApplicationMessages { - let u = self.delegate_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { ApplicationMessages::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn delegate_request_as_get_secret_request_type(&self) -> Option> { - if self.delegate_request_type() == DelegateRequestType::GetSecretRequestType { - let u = self.delegate_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { GetSecretRequestType::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn delegate_request_as_register_delegate(&self) -> Option> { - if self.delegate_request_type() == DelegateRequestType::RegisterDelegate { - let u = self.delegate_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { RegisterDelegate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn delegate_request_as_unregister_delegate(&self) -> Option> { - if self.delegate_request_type() == DelegateRequestType::UnregisterDelegate { - let u = self.delegate_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { UnregisterDelegate::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for DelegateRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? + } + + impl flatbuffers::Verifiable for UnregisterDelegate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .finish(); + Ok(()) + } + } + pub struct UnregisterDelegateArgs<'a> { + pub key: Option>>, + } + impl<'a> Default for UnregisterDelegateArgs<'a> { + #[inline] + fn default() -> Self { + UnregisterDelegateArgs { + key: None, // required field + } + } + } + + pub struct UnregisterDelegateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UnregisterDelegateBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + UnregisterDelegate::VT_KEY, + key, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> UnregisterDelegateBuilder<'a, 'b> { + let start = _fbb.start_table(); + UnregisterDelegateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, UnregisterDelegate::VT_KEY, "key"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for UnregisterDelegate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("UnregisterDelegate"); + ds.field("key", &self.key()); + ds.finish() + } + } + pub enum ContractRequestOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ContractRequest<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ContractRequest<'a> { + type Inner = ContractRequest<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ContractRequest<'a> { + pub const VT_CONTRACT_REQUEST_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_CONTRACT_REQUEST: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ContractRequest { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractRequestArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = ContractRequestBuilder::new(_fbb); + if let Some(x) = args.contract_request { + builder.add_contract_request(x); + } + builder.add_contract_request_type(args.contract_request_type); + builder.finish() + } + + #[inline] + pub fn contract_request_type(&self) -> ContractRequestType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + ContractRequest::VT_CONTRACT_REQUEST_TYPE, + Some(ContractRequestType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn contract_request(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractRequest::VT_CONTRACT_REQUEST, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn contract_request_as_put(&self) -> Option> { + if self.contract_request_type() == ContractRequestType::Put { + let u = self.contract_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Put::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_request_as_update(&self) -> Option> { + if self.contract_request_type() == ContractRequestType::Update { + let u = self.contract_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Update::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_request_as_get(&self) -> Option> { + if self.contract_request_type() == ContractRequestType::Get { + let u = self.contract_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Get::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_request_as_subscribe(&self) -> Option> { + if self.contract_request_type() == ContractRequestType::Subscribe { + let u = self.contract_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Subscribe::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for ContractRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::( + "contract_request_type", + Self::VT_CONTRACT_REQUEST_TYPE, + "contract_request", + Self::VT_CONTRACT_REQUEST, + true, + |key, v, pos| match key { + ContractRequestType::Put => v + .verify_union_variant::>( + "ContractRequestType::Put", + pos, + ), + ContractRequestType::Update => v + .verify_union_variant::>( + "ContractRequestType::Update", + pos, + ), + ContractRequestType::Get => v + .verify_union_variant::>( + "ContractRequestType::Get", + pos, + ), + ContractRequestType::Subscribe => v + .verify_union_variant::>( + "ContractRequestType::Subscribe", + pos, + ), + _ => Ok(()), + }, + )? + .finish(); + Ok(()) + } + } + pub struct ContractRequestArgs { + pub contract_request_type: ContractRequestType, + pub contract_request: Option>, + } + impl<'a> Default for ContractRequestArgs { + #[inline] + fn default() -> Self { + ContractRequestArgs { + contract_request_type: ContractRequestType::NONE, + contract_request: None, // required field + } + } + } + + pub struct ContractRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractRequestBuilder<'a, 'b> { + #[inline] + pub fn add_contract_request_type(&mut self, contract_request_type: ContractRequestType) { + self.fbb_.push_slot::( + ContractRequest::VT_CONTRACT_REQUEST_TYPE, + contract_request_type, + ContractRequestType::NONE, + ); + } + #[inline] + pub fn add_contract_request( + &mut self, + contract_request: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + ContractRequest::VT_CONTRACT_REQUEST, + contract_request, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContractRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, ContractRequest::VT_CONTRACT_REQUEST, "contract_request"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ContractRequest<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ContractRequest"); + ds.field("contract_request_type", &self.contract_request_type()); + match self.contract_request_type() { + ContractRequestType::Put => { + if let Some(x) = self.contract_request_as_put() { + ds.field("contract_request", &x) + } else { + ds.field( + "contract_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ContractRequestType::Update => { + if let Some(x) = self.contract_request_as_update() { + ds.field("contract_request", &x) + } else { + ds.field( + "contract_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ContractRequestType::Get => { + if let Some(x) = self.contract_request_as_get() { + ds.field("contract_request", &x) + } else { + ds.field( + "contract_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ContractRequestType::Subscribe => { + if let Some(x) = self.contract_request_as_subscribe() { + ds.field("contract_request", &x) + } else { + ds.field( + "contract_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("contract_request", &x) + } + }; + ds.finish() + } + } + pub enum DelegateRequestOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct DelegateRequest<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for DelegateRequest<'a> { + type Inner = DelegateRequest<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> DelegateRequest<'a> { + pub const VT_DELEGATE_REQUEST_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_DELEGATE_REQUEST: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DelegateRequest { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateRequestArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = DelegateRequestBuilder::new(_fbb); + if let Some(x) = args.delegate_request { + builder.add_delegate_request(x); + } + builder.add_delegate_request_type(args.delegate_request_type); + builder.finish() + } + + #[inline] + pub fn delegate_request_type(&self) -> DelegateRequestType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + DelegateRequest::VT_DELEGATE_REQUEST_TYPE, + Some(DelegateRequestType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn delegate_request(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateRequest::VT_DELEGATE_REQUEST, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn delegate_request_as_application_messages(&self) -> Option> { + if self.delegate_request_type() == DelegateRequestType::ApplicationMessages { + let u = self.delegate_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { ApplicationMessages::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn delegate_request_as_get_secret_request_type( + &self, + ) -> Option> { + if self.delegate_request_type() == DelegateRequestType::GetSecretRequestType { + let u = self.delegate_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { GetSecretRequestType::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn delegate_request_as_register_delegate(&self) -> Option> { + if self.delegate_request_type() == DelegateRequestType::RegisterDelegate { + let u = self.delegate_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { RegisterDelegate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn delegate_request_as_unregister_delegate(&self) -> Option> { + if self.delegate_request_type() == DelegateRequestType::UnregisterDelegate { + let u = self.delegate_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { UnregisterDelegate::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for DelegateRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? .visit_union::("delegate_request_type", Self::VT_DELEGATE_REQUEST_TYPE, "delegate_request", Self::VT_DELEGATE_REQUEST, true, |key, v, pos| { match key { DelegateRequestType::ApplicationMessages => v.verify_union_variant::>("DelegateRequestType::ApplicationMessages", pos), @@ -3083,569 +3933,681 @@ impl flatbuffers::Verifiable for DelegateRequest<'_> { } })? .finish(); - Ok(()) - } -} -pub struct DelegateRequestArgs { - pub delegate_request_type: DelegateRequestType, - pub delegate_request: Option>, -} -impl<'a> Default for DelegateRequestArgs { - #[inline] - fn default() -> Self { - DelegateRequestArgs { - delegate_request_type: DelegateRequestType::NONE, - delegate_request: None, // required field - } - } -} - -pub struct DelegateRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateRequestBuilder<'a, 'b> { - #[inline] - pub fn add_delegate_request_type(&mut self, delegate_request_type: DelegateRequestType) { - self.fbb_.push_slot::(DelegateRequest::VT_DELEGATE_REQUEST_TYPE, delegate_request_type, DelegateRequestType::NONE); - } - #[inline] - pub fn add_delegate_request(&mut self, delegate_request: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(DelegateRequest::VT_DELEGATE_REQUEST, delegate_request); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DelegateRequest::VT_DELEGATE_REQUEST,"delegate_request"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DelegateRequest<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DelegateRequest"); - ds.field("delegate_request_type", &self.delegate_request_type()); - match self.delegate_request_type() { - DelegateRequestType::ApplicationMessages => { - if let Some(x) = self.delegate_request_as_application_messages() { - ds.field("delegate_request", &x) - } else { - ds.field("delegate_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - DelegateRequestType::GetSecretRequestType => { - if let Some(x) = self.delegate_request_as_get_secret_request_type() { - ds.field("delegate_request", &x) - } else { - ds.field("delegate_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - DelegateRequestType::RegisterDelegate => { - if let Some(x) = self.delegate_request_as_register_delegate() { - ds.field("delegate_request", &x) - } else { - ds.field("delegate_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - DelegateRequestType::UnregisterDelegate => { - if let Some(x) = self.delegate_request_as_unregister_delegate() { - ds.field("delegate_request", &x) - } else { - ds.field("delegate_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("delegate_request", &x) - }, - }; - ds.finish() - } -} -pub enum DisconnectOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Disconnect<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Disconnect<'a> { - type Inner = Disconnect<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Disconnect<'a> { - pub const VT_CAUSE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Disconnect { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DisconnectArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DisconnectBuilder::new(_fbb); - if let Some(x) = args.cause { builder.add_cause(x); } - builder.finish() - } - - - #[inline] - pub fn cause(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Disconnect::VT_CAUSE, None)} - } -} - -impl flatbuffers::Verifiable for Disconnect<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("cause", Self::VT_CAUSE, false)? - .finish(); - Ok(()) - } -} -pub struct DisconnectArgs<'a> { - pub cause: Option>, -} -impl<'a> Default for DisconnectArgs<'a> { - #[inline] - fn default() -> Self { - DisconnectArgs { - cause: None, - } - } -} - -pub struct DisconnectBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DisconnectBuilder<'a, 'b> { - #[inline] - pub fn add_cause(&mut self, cause: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Disconnect::VT_CAUSE, cause); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DisconnectBuilder<'a, 'b> { - let start = _fbb.start_table(); - DisconnectBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Disconnect<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Disconnect"); - ds.field("cause", &self.cause()); - ds.finish() - } -} -pub enum AuthenticateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Authenticate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Authenticate<'a> { - type Inner = Authenticate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Authenticate<'a> { - pub const VT_TOKEN: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Authenticate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args AuthenticateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = AuthenticateBuilder::new(_fbb); - if let Some(x) = args.token { builder.add_token(x); } - builder.finish() - } - - - #[inline] - pub fn token(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Authenticate::VT_TOKEN, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for Authenticate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("token", Self::VT_TOKEN, true)? - .finish(); - Ok(()) - } -} -pub struct AuthenticateArgs<'a> { - pub token: Option>, -} -impl<'a> Default for AuthenticateArgs<'a> { - #[inline] - fn default() -> Self { - AuthenticateArgs { - token: None, // required field - } - } -} - -pub struct AuthenticateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> AuthenticateBuilder<'a, 'b> { - #[inline] - pub fn add_token(&mut self, token: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Authenticate::VT_TOKEN, token); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> AuthenticateBuilder<'a, 'b> { - let start = _fbb.start_table(); - AuthenticateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Authenticate::VT_TOKEN,"token"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Authenticate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Authenticate"); - ds.field("token", &self.token()); - ds.finish() - } -} -pub enum ClientRequestOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ClientRequest<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ClientRequest<'a> { - type Inner = ClientRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ClientRequest<'a> { - pub const VT_CLIENT_REQUEST_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_CLIENT_REQUEST: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ClientRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ClientRequestArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = ClientRequestBuilder::new(_fbb); - if let Some(x) = args.client_request { builder.add_client_request(x); } - builder.add_client_request_type(args.client_request_type); - builder.finish() - } - - - #[inline] - pub fn client_request_type(&self) -> ClientRequestType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ClientRequest::VT_CLIENT_REQUEST_TYPE, Some(ClientRequestType::NONE)).unwrap()} - } - #[inline] - pub fn client_request(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ClientRequest::VT_CLIENT_REQUEST, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn client_request_as_contract_request(&self) -> Option> { - if self.client_request_type() == ClientRequestType::ContractRequest { - let u = self.client_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { ContractRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn client_request_as_delegate_request(&self) -> Option> { - if self.client_request_type() == ClientRequestType::DelegateRequest { - let u = self.client_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { DelegateRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn client_request_as_disconnect(&self) -> Option> { - if self.client_request_type() == ClientRequestType::Disconnect { - let u = self.client_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Disconnect::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn client_request_as_authenticate(&self) -> Option> { - if self.client_request_type() == ClientRequestType::Authenticate { - let u = self.client_request(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Authenticate::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for ClientRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("client_request_type", Self::VT_CLIENT_REQUEST_TYPE, "client_request", Self::VT_CLIENT_REQUEST, true, |key, v, pos| { - match key { - ClientRequestType::ContractRequest => v.verify_union_variant::>("ClientRequestType::ContractRequest", pos), - ClientRequestType::DelegateRequest => v.verify_union_variant::>("ClientRequestType::DelegateRequest", pos), - ClientRequestType::Disconnect => v.verify_union_variant::>("ClientRequestType::Disconnect", pos), - ClientRequestType::Authenticate => v.verify_union_variant::>("ClientRequestType::Authenticate", pos), - _ => Ok(()), + Ok(()) } - })? - .finish(); - Ok(()) - } -} -pub struct ClientRequestArgs { - pub client_request_type: ClientRequestType, - pub client_request: Option>, -} -impl<'a> Default for ClientRequestArgs { - #[inline] - fn default() -> Self { - ClientRequestArgs { - client_request_type: ClientRequestType::NONE, - client_request: None, // required field - } - } -} - -pub struct ClientRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ClientRequestBuilder<'a, 'b> { - #[inline] - pub fn add_client_request_type(&mut self, client_request_type: ClientRequestType) { - self.fbb_.push_slot::(ClientRequest::VT_CLIENT_REQUEST_TYPE, client_request_type, ClientRequestType::NONE); - } - #[inline] - pub fn add_client_request(&mut self, client_request: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(ClientRequest::VT_CLIENT_REQUEST, client_request); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ClientRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - ClientRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ClientRequest::VT_CLIENT_REQUEST,"client_request"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ClientRequest<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ClientRequest"); - ds.field("client_request_type", &self.client_request_type()); - match self.client_request_type() { - ClientRequestType::ContractRequest => { - if let Some(x) = self.client_request_as_contract_request() { - ds.field("client_request", &x) - } else { - ds.field("client_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ClientRequestType::DelegateRequest => { - if let Some(x) = self.client_request_as_delegate_request() { - ds.field("client_request", &x) - } else { - ds.field("client_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ClientRequestType::Disconnect => { - if let Some(x) = self.client_request_as_disconnect() { - ds.field("client_request", &x) - } else { - ds.field("client_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - ClientRequestType::Authenticate => { - if let Some(x) = self.client_request_as_authenticate() { - ds.field("client_request", &x) - } else { - ds.field("client_request", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("client_request", &x) - }, - }; - ds.finish() - } -} -#[inline] -/// Verifies that a buffer of bytes contains a `ClientRequest` -/// and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_client_request_unchecked`. -pub fn root_as_client_request(buf: &[u8]) -> Result { - flatbuffers::root::(buf) -} -#[inline] -/// Verifies that a buffer of bytes contains a size prefixed -/// `ClientRequest` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `size_prefixed_root_as_client_request_unchecked`. -pub fn size_prefixed_root_as_client_request(buf: &[u8]) -> Result { - flatbuffers::size_prefixed_root::(buf) -} -#[inline] -/// Verifies, with the given options, that a buffer of bytes -/// contains a `ClientRequest` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_client_request_unchecked`. -pub fn root_as_client_request_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) -} -#[inline] -/// Verifies, with the given verifier options, that a buffer of -/// bytes contains a size prefixed `ClientRequest` and returns -/// it. Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_client_request_unchecked`. -pub fn size_prefixed_root_as_client_request_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a ClientRequest and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid `ClientRequest`. -pub unsafe fn root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest { - flatbuffers::root_unchecked::(buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a size prefixed ClientRequest and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid size prefixed `ClientRequest`. -pub unsafe fn size_prefixed_root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest { - flatbuffers::size_prefixed_root_unchecked::(buf) -} -#[inline] -pub fn finish_client_request_buffer<'a, 'b>( - fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); -} - -#[inline] -pub fn finish_size_prefixed_client_request_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); -} -} // pub mod client_request + } + pub struct DelegateRequestArgs { + pub delegate_request_type: DelegateRequestType, + pub delegate_request: Option>, + } + impl<'a> Default for DelegateRequestArgs { + #[inline] + fn default() -> Self { + DelegateRequestArgs { + delegate_request_type: DelegateRequestType::NONE, + delegate_request: None, // required field + } + } + } + + pub struct DelegateRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateRequestBuilder<'a, 'b> { + #[inline] + pub fn add_delegate_request_type(&mut self, delegate_request_type: DelegateRequestType) { + self.fbb_.push_slot::( + DelegateRequest::VT_DELEGATE_REQUEST_TYPE, + delegate_request_type, + DelegateRequestType::NONE, + ); + } + #[inline] + pub fn add_delegate_request( + &mut self, + delegate_request: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + DelegateRequest::VT_DELEGATE_REQUEST, + delegate_request, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> DelegateRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, DelegateRequest::VT_DELEGATE_REQUEST, "delegate_request"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for DelegateRequest<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DelegateRequest"); + ds.field("delegate_request_type", &self.delegate_request_type()); + match self.delegate_request_type() { + DelegateRequestType::ApplicationMessages => { + if let Some(x) = self.delegate_request_as_application_messages() { + ds.field("delegate_request", &x) + } else { + ds.field( + "delegate_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + DelegateRequestType::GetSecretRequestType => { + if let Some(x) = self.delegate_request_as_get_secret_request_type() { + ds.field("delegate_request", &x) + } else { + ds.field( + "delegate_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + DelegateRequestType::RegisterDelegate => { + if let Some(x) = self.delegate_request_as_register_delegate() { + ds.field("delegate_request", &x) + } else { + ds.field( + "delegate_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + DelegateRequestType::UnregisterDelegate => { + if let Some(x) = self.delegate_request_as_unregister_delegate() { + ds.field("delegate_request", &x) + } else { + ds.field( + "delegate_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("delegate_request", &x) + } + }; + ds.finish() + } + } + pub enum DisconnectOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Disconnect<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Disconnect<'a> { + type Inner = Disconnect<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Disconnect<'a> { + pub const VT_CAUSE: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Disconnect { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DisconnectArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = DisconnectBuilder::new(_fbb); + if let Some(x) = args.cause { + builder.add_cause(x); + } + builder.finish() + } + + #[inline] + pub fn cause(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(Disconnect::VT_CAUSE, None) + } + } + } + + impl flatbuffers::Verifiable for Disconnect<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("cause", Self::VT_CAUSE, false)? + .finish(); + Ok(()) + } + } + pub struct DisconnectArgs<'a> { + pub cause: Option>, + } + impl<'a> Default for DisconnectArgs<'a> { + #[inline] + fn default() -> Self { + DisconnectArgs { cause: None } + } + } + + pub struct DisconnectBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DisconnectBuilder<'a, 'b> { + #[inline] + pub fn add_cause(&mut self, cause: flatbuffers::WIPOffset<&'b str>) { + self.fbb_ + .push_slot_always::>(Disconnect::VT_CAUSE, cause); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DisconnectBuilder<'a, 'b> { + let start = _fbb.start_table(); + DisconnectBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Disconnect<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Disconnect"); + ds.field("cause", &self.cause()); + ds.finish() + } + } + pub enum AuthenticateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct Authenticate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for Authenticate<'a> { + type Inner = Authenticate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> Authenticate<'a> { + pub const VT_TOKEN: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Authenticate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args AuthenticateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = AuthenticateBuilder::new(_fbb); + if let Some(x) = args.token { + builder.add_token(x); + } + builder.finish() + } + + #[inline] + pub fn token(&self) -> &'a str { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(Authenticate::VT_TOKEN, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Authenticate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("token", Self::VT_TOKEN, true)? + .finish(); + Ok(()) + } + } + pub struct AuthenticateArgs<'a> { + pub token: Option>, + } + impl<'a> Default for AuthenticateArgs<'a> { + #[inline] + fn default() -> Self { + AuthenticateArgs { + token: None, // required field + } + } + } + + pub struct AuthenticateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> AuthenticateBuilder<'a, 'b> { + #[inline] + pub fn add_token(&mut self, token: flatbuffers::WIPOffset<&'b str>) { + self.fbb_ + .push_slot_always::>(Authenticate::VT_TOKEN, token); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> AuthenticateBuilder<'a, 'b> { + let start = _fbb.start_table(); + AuthenticateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, Authenticate::VT_TOKEN, "token"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for Authenticate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Authenticate"); + ds.field("token", &self.token()); + ds.finish() + } + } + pub enum ClientRequestOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ClientRequest<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ClientRequest<'a> { + type Inner = ClientRequest<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ClientRequest<'a> { + pub const VT_CLIENT_REQUEST_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_CLIENT_REQUEST: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ClientRequest { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ClientRequestArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = ClientRequestBuilder::new(_fbb); + if let Some(x) = args.client_request { + builder.add_client_request(x); + } + builder.add_client_request_type(args.client_request_type); + builder.finish() + } + + #[inline] + pub fn client_request_type(&self) -> ClientRequestType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + ClientRequest::VT_CLIENT_REQUEST_TYPE, + Some(ClientRequestType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn client_request(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ClientRequest::VT_CLIENT_REQUEST, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn client_request_as_contract_request(&self) -> Option> { + if self.client_request_type() == ClientRequestType::ContractRequest { + let u = self.client_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { ContractRequest::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn client_request_as_delegate_request(&self) -> Option> { + if self.client_request_type() == ClientRequestType::DelegateRequest { + let u = self.client_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { DelegateRequest::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn client_request_as_disconnect(&self) -> Option> { + if self.client_request_type() == ClientRequestType::Disconnect { + let u = self.client_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Disconnect::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn client_request_as_authenticate(&self) -> Option> { + if self.client_request_type() == ClientRequestType::Authenticate { + let u = self.client_request(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Authenticate::init_from_table(u) }) + } else { + None + } + } + } + impl flatbuffers::Verifiable for ClientRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::( + "client_request_type", + Self::VT_CLIENT_REQUEST_TYPE, + "client_request", + Self::VT_CLIENT_REQUEST, + true, + |key, v, pos| match key { + ClientRequestType::ContractRequest => v + .verify_union_variant::>( + "ClientRequestType::ContractRequest", + pos, + ), + ClientRequestType::DelegateRequest => v + .verify_union_variant::>( + "ClientRequestType::DelegateRequest", + pos, + ), + ClientRequestType::Disconnect => v + .verify_union_variant::>( + "ClientRequestType::Disconnect", + pos, + ), + ClientRequestType::Authenticate => v + .verify_union_variant::>( + "ClientRequestType::Authenticate", + pos, + ), + _ => Ok(()), + }, + )? + .finish(); + Ok(()) + } + } + pub struct ClientRequestArgs { + pub client_request_type: ClientRequestType, + pub client_request: Option>, + } + impl<'a> Default for ClientRequestArgs { + #[inline] + fn default() -> Self { + ClientRequestArgs { + client_request_type: ClientRequestType::NONE, + client_request: None, // required field + } + } + } + + pub struct ClientRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ClientRequestBuilder<'a, 'b> { + #[inline] + pub fn add_client_request_type(&mut self, client_request_type: ClientRequestType) { + self.fbb_.push_slot::( + ClientRequest::VT_CLIENT_REQUEST_TYPE, + client_request_type, + ClientRequestType::NONE, + ); + } + #[inline] + pub fn add_client_request( + &mut self, + client_request: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + ClientRequest::VT_CLIENT_REQUEST, + client_request, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ClientRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + ClientRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, ClientRequest::VT_CLIENT_REQUEST, "client_request"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ClientRequest<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ClientRequest"); + ds.field("client_request_type", &self.client_request_type()); + match self.client_request_type() { + ClientRequestType::ContractRequest => { + if let Some(x) = self.client_request_as_contract_request() { + ds.field("client_request", &x) + } else { + ds.field( + "client_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ClientRequestType::DelegateRequest => { + if let Some(x) = self.client_request_as_delegate_request() { + ds.field("client_request", &x) + } else { + ds.field( + "client_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ClientRequestType::Disconnect => { + if let Some(x) = self.client_request_as_disconnect() { + ds.field("client_request", &x) + } else { + ds.field( + "client_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + ClientRequestType::Authenticate => { + if let Some(x) = self.client_request_as_authenticate() { + ds.field("client_request", &x) + } else { + ds.field( + "client_request", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("client_request", &x) + } + }; + ds.finish() + } + } + #[inline] + /// Verifies that a buffer of bytes contains a `ClientRequest` + /// and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_client_request_unchecked`. + pub fn root_as_client_request( + buf: &[u8], + ) -> Result { + flatbuffers::root::(buf) + } + #[inline] + /// Verifies that a buffer of bytes contains a size prefixed + /// `ClientRequest` and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `size_prefixed_root_as_client_request_unchecked`. + pub fn size_prefixed_root_as_client_request( + buf: &[u8], + ) -> Result { + flatbuffers::size_prefixed_root::(buf) + } + #[inline] + /// Verifies, with the given options, that a buffer of bytes + /// contains a `ClientRequest` and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_client_request_unchecked`. + pub fn root_as_client_request_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], + ) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::root_with_opts::>(opts, buf) + } + #[inline] + /// Verifies, with the given verifier options, that a buffer of + /// bytes contains a size prefixed `ClientRequest` and returns + /// it. Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_client_request_unchecked`. + pub fn size_prefixed_root_as_client_request_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], + ) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + } + #[inline] + /// Assumes, without verification, that a buffer of bytes contains a ClientRequest and returns it. + /// # Safety + /// Callers must trust the given bytes do indeed contain a valid `ClientRequest`. + pub unsafe fn root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest { + flatbuffers::root_unchecked::(buf) + } + #[inline] + /// Assumes, without verification, that a buffer of bytes contains a size prefixed ClientRequest and returns it. + /// # Safety + /// Callers must trust the given bytes do indeed contain a valid size prefixed `ClientRequest`. + pub unsafe fn size_prefixed_root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest { + flatbuffers::size_prefixed_root_unchecked::(buf) + } + #[inline] + pub fn finish_client_request_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, + ) { + fbb.finish(root, None); + } + + #[inline] + pub fn finish_size_prefixed_client_request_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, + ) { + fbb.finish_size_prefixed(root, None); + } +} // pub mod client_request diff --git a/rust/src/common_generated.rs b/rust/src/common_generated.rs index d0401ab..10fade4 100644 --- a/rust/src/common_generated.rs +++ b/rust/src/common_generated.rs @@ -1,2178 +1,2788 @@ // automatically generated by the FlatBuffers compiler, do not modify +// @generated + +use core::cmp::Ordering; +use core::mem; + +extern crate flatbuffers; +use self::flatbuffers::{EndianScalar, Follow}; + +#[allow(unused_imports, dead_code)] +pub mod common { + + use core::cmp::Ordering; + use core::mem; + + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_CONTRACT_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_TYPE: u8 = 1; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_CONTRACT_TYPE: [ContractType; 2] = + [ContractType::NONE, ContractType::WasmContractV1]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct ContractType(pub u8); + #[allow(non_upper_case_globals)] + impl ContractType { + pub const NONE: Self = Self(0); + pub const WasmContractV1: Self = Self(1); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 1; + pub const ENUM_VALUES: &'static [Self] = &[Self::NONE, Self::WasmContractV1]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::WasmContractV1 => Some("WasmContractV1"), + _ => None, + } + } + } + impl core::fmt::Debug for ContractType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for ContractType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for ContractType { + type Output = ContractType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for ContractType { + 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 ContractType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for ContractType {} + pub struct ContractTypeUnionTableOffset {} + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_UPDATE_DATA_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_UPDATE_DATA_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_UPDATE_DATA_TYPE: [UpdateDataType; 7] = [ + UpdateDataType::NONE, + UpdateDataType::StateUpdate, + UpdateDataType::DeltaUpdate, + UpdateDataType::StateAndDeltaUpdate, + UpdateDataType::RelatedStateUpdate, + UpdateDataType::RelatedDeltaUpdate, + UpdateDataType::RelatedStateAndDeltaUpdate, + ]; + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] + #[repr(transparent)] + pub struct UpdateDataType(pub u8); + #[allow(non_upper_case_globals)] + impl UpdateDataType { + pub const NONE: Self = Self(0); + pub const StateUpdate: Self = Self(1); + pub const DeltaUpdate: Self = Self(2); + pub const StateAndDeltaUpdate: Self = Self(3); + pub const RelatedStateUpdate: Self = Self(4); + pub const RelatedDeltaUpdate: Self = Self(5); + pub const RelatedStateAndDeltaUpdate: Self = Self(6); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 6; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::StateUpdate, + Self::DeltaUpdate, + Self::StateAndDeltaUpdate, + Self::RelatedStateUpdate, + Self::RelatedDeltaUpdate, + Self::RelatedStateAndDeltaUpdate, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::StateUpdate => Some("StateUpdate"), + Self::DeltaUpdate => Some("DeltaUpdate"), + Self::StateAndDeltaUpdate => Some("StateAndDeltaUpdate"), + Self::RelatedStateUpdate => Some("RelatedStateUpdate"), + Self::RelatedDeltaUpdate => Some("RelatedDeltaUpdate"), + Self::RelatedStateAndDeltaUpdate => Some("RelatedStateAndDeltaUpdate"), + _ => None, + } + } + } + impl core::fmt::Debug for UpdateDataType { + 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!("", self.0)) + } + } + } + impl<'a> flatbuffers::Follow<'a> for UpdateDataType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for UpdateDataType { + type Output = UpdateDataType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } + } + + impl flatbuffers::EndianScalar for UpdateDataType { + 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 UpdateDataType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } + } + + impl flatbuffers::SimpleToVerifyInSlice for UpdateDataType {} + pub struct UpdateDataTypeUnionTableOffset {} + + pub enum ContractInstanceIdOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ContractInstanceId<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ContractInstanceId<'a> { + type Inner = ContractInstanceId<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ContractInstanceId<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ContractInstanceId { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractInstanceIdArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ContractInstanceIdBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractInstanceId::VT_DATA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ContractInstanceId<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct ContractInstanceIdArgs<'a> { + pub data: Option>>, + } + impl<'a> Default for ContractInstanceIdArgs<'a> { + #[inline] + fn default() -> Self { + ContractInstanceIdArgs { + data: None, // required field + } + } + } + + pub struct ContractInstanceIdBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractInstanceIdBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(ContractInstanceId::VT_DATA, data); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContractInstanceIdBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractInstanceIdBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ContractInstanceId::VT_DATA, "data"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ContractInstanceId<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ContractInstanceId"); + ds.field("data", &self.data()); + ds.finish() + } + } + pub enum ContractKeyOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ContractKey<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ContractKey<'a> { + type Inner = ContractKey<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ContractKey<'a> { + pub const VT_INSTANCE: flatbuffers::VOffsetT = 4; + pub const VT_CODE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ContractKey { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractKeyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ContractKeyBuilder::new(_fbb); + if let Some(x) = args.code { + builder.add_code(x); + } + if let Some(x) = args.instance { + builder.add_instance(x); + } + builder.finish() + } + + #[inline] + pub fn instance(&self) -> ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + ContractKey::VT_INSTANCE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn code(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractKey::VT_CODE, + None, + ) + } + } + } + + impl flatbuffers::Verifiable for ContractKey<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "instance", + Self::VT_INSTANCE, + true, + )? + .visit_field::>>( + "code", + Self::VT_CODE, + false, + )? + .finish(); + Ok(()) + } + } + pub struct ContractKeyArgs<'a> { + pub instance: Option>>, + pub code: Option>>, + } + impl<'a> Default for ContractKeyArgs<'a> { + #[inline] + fn default() -> Self { + ContractKeyArgs { + instance: None, // required field + code: None, + } + } + } + + pub struct ContractKeyBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractKeyBuilder<'a, 'b> { + #[inline] + pub fn add_instance(&mut self, instance: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + ContractKey::VT_INSTANCE, + instance, + ); + } + #[inline] + pub fn add_code(&mut self, code: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(ContractKey::VT_CODE, code); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractKeyBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractKeyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ContractKey::VT_INSTANCE, "instance"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ContractKey<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ContractKey"); + ds.field("instance", &self.instance()); + ds.field("code", &self.code()); + ds.finish() + } + } + pub enum SecretsIdOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct SecretsId<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for SecretsId<'a> { + type Inner = SecretsId<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> SecretsId<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_HASH: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + SecretsId { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args SecretsIdArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = SecretsIdBuilder::new(_fbb); + if let Some(x) = args.hash { + builder.add_hash(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + SecretsId::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn hash(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + SecretsId::VT_HASH, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for SecretsId<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "hash", + Self::VT_HASH, + true, + )? + .finish(); + Ok(()) + } + } + pub struct SecretsIdArgs<'a> { + pub key: Option>>, + pub hash: Option>>, + } + impl<'a> Default for SecretsIdArgs<'a> { + #[inline] + fn default() -> Self { + SecretsIdArgs { + key: None, // required field + hash: None, // required field + } + } + } + + pub struct SecretsIdBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> SecretsIdBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(SecretsId::VT_KEY, key); + } + #[inline] + pub fn add_hash(&mut self, hash: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(SecretsId::VT_HASH, hash); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SecretsIdBuilder<'a, 'b> { + let start = _fbb.start_table(); + SecretsIdBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, SecretsId::VT_KEY, "key"); + self.fbb_.required(o, SecretsId::VT_HASH, "hash"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for SecretsId<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("SecretsId"); + ds.field("key", &self.key()); + ds.field("hash", &self.hash()); + ds.finish() + } + } + pub enum ContractCodeOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ContractCode<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ContractCode<'a> { + type Inner = ContractCode<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ContractCode<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + pub const VT_CODE_HASH: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ContractCode { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractCodeArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ContractCodeBuilder::new(_fbb); + if let Some(x) = args.code_hash { + builder.add_code_hash(x); + } + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractCode::VT_DATA, + None, + ) + .unwrap() + } + } + #[inline] + pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractCode::VT_CODE_HASH, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ContractCode<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + true, + )? + .visit_field::>>( + "code_hash", + Self::VT_CODE_HASH, + true, + )? + .finish(); + Ok(()) + } + } + pub struct ContractCodeArgs<'a> { + pub data: Option>>, + pub code_hash: Option>>, + } + impl<'a> Default for ContractCodeArgs<'a> { + #[inline] + fn default() -> Self { + ContractCodeArgs { + data: None, // required field + code_hash: None, // required field + } + } + } + + pub struct ContractCodeBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractCodeBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(ContractCode::VT_DATA, data); + } + #[inline] + pub fn add_code_hash( + &mut self, + code_hash: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + ContractCode::VT_CODE_HASH, + code_hash, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContractCodeBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractCodeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ContractCode::VT_DATA, "data"); + self.fbb_ + .required(o, ContractCode::VT_CODE_HASH, "code_hash"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ContractCode<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ContractCode"); + ds.field("data", &self.data()); + ds.field("code_hash", &self.code_hash()); + ds.finish() + } + } + pub enum ApplicationMessageOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ApplicationMessage<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ApplicationMessage<'a> { + type Inner = ApplicationMessage<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> ApplicationMessage<'a> { + pub const VT_APP: flatbuffers::VOffsetT = 4; + pub const VT_PAYLOAD: flatbuffers::VOffsetT = 6; + pub const VT_CONTEXT: flatbuffers::VOffsetT = 8; + pub const VT_PROCESSED: flatbuffers::VOffsetT = 10; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ApplicationMessage { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ApplicationMessageArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ApplicationMessageBuilder::new(_fbb); + if let Some(x) = args.context { + builder.add_context(x); + } + if let Some(x) = args.payload { + builder.add_payload(x); + } + if let Some(x) = args.app { + builder.add_app(x); + } + builder.add_processed(args.processed); + builder.finish() + } + + #[inline] + pub fn app(&self) -> ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + ApplicationMessage::VT_APP, + None, + ) + .unwrap() + } + } + #[inline] + pub fn payload(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ApplicationMessage::VT_PAYLOAD, + None, + ) + .unwrap() + } + } + #[inline] + pub fn context(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ApplicationMessage::VT_CONTEXT, + None, + ) + .unwrap() + } + } + #[inline] + pub fn processed(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(ApplicationMessage::VT_PROCESSED, Some(false)) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ApplicationMessage<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "app", + Self::VT_APP, + true, + )? + .visit_field::>>( + "payload", + Self::VT_PAYLOAD, + true, + )? + .visit_field::>>( + "context", + Self::VT_CONTEXT, + true, + )? + .visit_field::("processed", Self::VT_PROCESSED, false)? + .finish(); + Ok(()) + } + } + pub struct ApplicationMessageArgs<'a> { + pub app: Option>>, + pub payload: Option>>, + pub context: Option>>, + pub processed: bool, + } + impl<'a> Default for ApplicationMessageArgs<'a> { + #[inline] + fn default() -> Self { + ApplicationMessageArgs { + app: None, // required field + payload: None, // required field + context: None, // required field + processed: false, + } + } + } + + pub struct ApplicationMessageBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ApplicationMessageBuilder<'a, 'b> { + #[inline] + pub fn add_app(&mut self, app: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + ApplicationMessage::VT_APP, + app, + ); + } + #[inline] + pub fn add_payload( + &mut self, + payload: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + ApplicationMessage::VT_PAYLOAD, + payload, + ); + } + #[inline] + pub fn add_context( + &mut self, + context: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + ApplicationMessage::VT_CONTEXT, + context, + ); + } + #[inline] + pub fn add_processed(&mut self, processed: bool) { + self.fbb_ + .push_slot::(ApplicationMessage::VT_PROCESSED, processed, false); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ApplicationMessageBuilder<'a, 'b> { + let start = _fbb.start_table(); + ApplicationMessageBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, ApplicationMessage::VT_APP, "app"); + self.fbb_ + .required(o, ApplicationMessage::VT_PAYLOAD, "payload"); + self.fbb_ + .required(o, ApplicationMessage::VT_CONTEXT, "context"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ApplicationMessage<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ApplicationMessage"); + ds.field("app", &self.app()); + ds.field("payload", &self.payload()); + ds.field("context", &self.context()); + ds.field("processed", &self.processed()); + ds.finish() + } + } + pub enum GetSecretRequestOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct GetSecretRequest<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for GetSecretRequest<'a> { + type Inner = GetSecretRequest<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> GetSecretRequest<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 6; + pub const VT_PROCESSED: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + GetSecretRequest { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GetSecretRequestArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = GetSecretRequestBuilder::new(_fbb); + if let Some(x) = args.delegate_context { + builder.add_delegate_context(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.add_processed(args.processed); + builder.finish() + } + + #[inline] + pub fn key(&self) -> SecretsId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(GetSecretRequest::VT_KEY, None) + .unwrap() + } + } + #[inline] + pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GetSecretRequest::VT_DELEGATE_CONTEXT, + None, + ) + .unwrap() + } + } + #[inline] + pub fn processed(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(GetSecretRequest::VT_PROCESSED, Some(false)) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for GetSecretRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("key", Self::VT_KEY, true)? + .visit_field::>>( + "delegate_context", + Self::VT_DELEGATE_CONTEXT, + true, + )? + .visit_field::("processed", Self::VT_PROCESSED, false)? + .finish(); + Ok(()) + } + } + pub struct GetSecretRequestArgs<'a> { + pub key: Option>>, + pub delegate_context: Option>>, + pub processed: bool, + } + impl<'a> Default for GetSecretRequestArgs<'a> { + #[inline] + fn default() -> Self { + GetSecretRequestArgs { + key: None, // required field + delegate_context: None, // required field + processed: false, + } + } + } + + pub struct GetSecretRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GetSecretRequestBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + GetSecretRequest::VT_KEY, + key, + ); + } + #[inline] + pub fn add_delegate_context( + &mut self, + delegate_context: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + GetSecretRequest::VT_DELEGATE_CONTEXT, + delegate_context, + ); + } + #[inline] + pub fn add_processed(&mut self, processed: bool) { + self.fbb_ + .push_slot::(GetSecretRequest::VT_PROCESSED, processed, false); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> GetSecretRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + GetSecretRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, GetSecretRequest::VT_KEY, "key"); + self.fbb_ + .required(o, GetSecretRequest::VT_DELEGATE_CONTEXT, "delegate_context"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for GetSecretRequest<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("GetSecretRequest"); + ds.field("key", &self.key()); + ds.field("delegate_context", &self.delegate_context()); + ds.field("processed", &self.processed()); + ds.finish() + } + } + pub enum GetSecretResponseOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct GetSecretResponse<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for GetSecretResponse<'a> { + type Inner = GetSecretResponse<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> GetSecretResponse<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_VALUE: flatbuffers::VOffsetT = 6; + pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + GetSecretResponse { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GetSecretResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = GetSecretResponseBuilder::new(_fbb); + if let Some(x) = args.delegate_context { + builder.add_delegate_context(x); + } + if let Some(x) = args.value { + builder.add_value(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> SecretsId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(GetSecretResponse::VT_KEY, None) + .unwrap() + } + } + #[inline] + pub fn value(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GetSecretResponse::VT_VALUE, + None, + ) + } + } + #[inline] + pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GetSecretResponse::VT_DELEGATE_CONTEXT, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for GetSecretResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("key", Self::VT_KEY, true)? + .visit_field::>>( + "value", + Self::VT_VALUE, + false, + )? + .visit_field::>>( + "delegate_context", + Self::VT_DELEGATE_CONTEXT, + true, + )? + .finish(); + Ok(()) + } + } + pub struct GetSecretResponseArgs<'a> { + pub key: Option>>, + pub value: Option>>, + pub delegate_context: Option>>, + } + impl<'a> Default for GetSecretResponseArgs<'a> { + #[inline] + fn default() -> Self { + GetSecretResponseArgs { + key: None, // required field + value: None, + delegate_context: None, // required field + } + } + } + + pub struct GetSecretResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GetSecretResponseBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + GetSecretResponse::VT_KEY, + key, + ); + } + #[inline] + pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(GetSecretResponse::VT_VALUE, value); + } + #[inline] + pub fn add_delegate_context( + &mut self, + delegate_context: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + GetSecretResponse::VT_DELEGATE_CONTEXT, + delegate_context, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> GetSecretResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + GetSecretResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, GetSecretResponse::VT_KEY, "key"); + self.fbb_.required( + o, + GetSecretResponse::VT_DELEGATE_CONTEXT, + "delegate_context", + ); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for GetSecretResponse<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("GetSecretResponse"); + ds.field("key", &self.key()); + ds.field("value", &self.value()); + ds.field("delegate_context", &self.delegate_context()); + ds.finish() + } + } + pub enum WasmContractV1Offset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct WasmContractV1<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for WasmContractV1<'a> { + type Inner = WasmContractV1<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> WasmContractV1<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + pub const VT_PARAMETERS: flatbuffers::VOffsetT = 6; + pub const VT_KEY: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + WasmContractV1 { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args WasmContractV1Args<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = WasmContractV1Builder::new(_fbb); + if let Some(x) = args.key { + builder.add_key(x); + } + if let Some(x) = args.parameters { + builder.add_parameters(x); + } + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> ContractCode<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + WasmContractV1::VT_DATA, + None, + ) + .unwrap() + } + } + #[inline] + pub fn parameters(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + WasmContractV1::VT_PARAMETERS, + None, + ) + .unwrap() + } + } + #[inline] + pub fn key(&self) -> ContractKey<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(WasmContractV1::VT_KEY, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for WasmContractV1<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "data", + Self::VT_DATA, + true, + )? + .visit_field::>>( + "parameters", + Self::VT_PARAMETERS, + true, + )? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .finish(); + Ok(()) + } + } + pub struct WasmContractV1Args<'a> { + pub data: Option>>, + pub parameters: Option>>, + pub key: Option>>, + } + impl<'a> Default for WasmContractV1Args<'a> { + #[inline] + fn default() -> Self { + WasmContractV1Args { + data: None, // required field + parameters: None, // required field + key: None, // required field + } + } + } + + pub struct WasmContractV1Builder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> WasmContractV1Builder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + WasmContractV1::VT_DATA, + data, + ); + } + #[inline] + pub fn add_parameters( + &mut self, + parameters: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + WasmContractV1::VT_PARAMETERS, + parameters, + ); + } + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + WasmContractV1::VT_KEY, + key, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> WasmContractV1Builder<'a, 'b> { + let start = _fbb.start_table(); + WasmContractV1Builder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, WasmContractV1::VT_DATA, "data"); + self.fbb_ + .required(o, WasmContractV1::VT_PARAMETERS, "parameters"); + self.fbb_.required(o, WasmContractV1::VT_KEY, "key"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for WasmContractV1<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("WasmContractV1"); + ds.field("data", &self.data()); + ds.field("parameters", &self.parameters()); + ds.field("key", &self.key()); + ds.finish() + } + } + pub enum ContractContainerOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct ContractContainer<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for ContractContainer<'a> { + type Inner = ContractContainer<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } -// @generated + impl<'a> ContractContainer<'a> { + pub const VT_CONTRACT_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_CONTRACT: flatbuffers::VOffsetT = 6; -use core::mem; -use core::cmp::Ordering; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ContractContainer { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractContainerArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = ContractContainerBuilder::new(_fbb); + if let Some(x) = args.contract { + builder.add_contract(x); + } + builder.add_contract_type(args.contract_type); + builder.finish() + } -extern crate flatbuffers; -use self::flatbuffers::{EndianScalar, Follow}; + #[inline] + pub fn contract_type(&self) -> ContractType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + ContractContainer::VT_CONTRACT_TYPE, + Some(ContractType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn contract(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractContainer::VT_CONTRACT, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn contract_as_wasm_contract_v1(&self) -> Option> { + if self.contract_type() == ContractType::WasmContractV1 { + let u = self.contract(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { WasmContractV1::init_from_table(u) }) + } else { + None + } + } + } -#[allow(unused_imports, dead_code)] -pub mod common { + impl flatbuffers::Verifiable for ContractContainer<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::( + "contract_type", + Self::VT_CONTRACT_TYPE, + "contract", + Self::VT_CONTRACT, + true, + |key, v, pos| match key { + ContractType::WasmContractV1 => v + .verify_union_variant::>( + "ContractType::WasmContractV1", + pos, + ), + _ => Ok(()), + }, + )? + .finish(); + Ok(()) + } + } + pub struct ContractContainerArgs { + pub contract_type: ContractType, + pub contract: Option>, + } + impl<'a> Default for ContractContainerArgs { + #[inline] + fn default() -> Self { + ContractContainerArgs { + contract_type: ContractType::NONE, + contract: None, // required field + } + } + } - use core::mem; - use core::cmp::Ordering; - - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_CONTRACT_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_TYPE: u8 = 1; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_CONTRACT_TYPE: [ContractType; 2] = [ - ContractType::NONE, - ContractType::WasmContractV1, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct ContractType(pub u8); -#[allow(non_upper_case_globals)] -impl ContractType { - pub const NONE: Self = Self(0); - pub const WasmContractV1: Self = Self(1); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 1; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::WasmContractV1, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::WasmContractV1 => Some("WasmContractV1"), - _ => None, - } - } -} -impl core::fmt::Debug for ContractType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for ContractType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ContractType { - type Output = ContractType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for ContractType { - 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 ContractType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for ContractType {} -pub struct ContractTypeUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_UPDATE_DATA_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_UPDATE_DATA_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_UPDATE_DATA_TYPE: [UpdateDataType; 7] = [ - UpdateDataType::NONE, - UpdateDataType::StateUpdate, - UpdateDataType::DeltaUpdate, - UpdateDataType::StateAndDeltaUpdate, - UpdateDataType::RelatedStateUpdate, - UpdateDataType::RelatedDeltaUpdate, - UpdateDataType::RelatedStateAndDeltaUpdate, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct UpdateDataType(pub u8); -#[allow(non_upper_case_globals)] -impl UpdateDataType { - pub const NONE: Self = Self(0); - pub const StateUpdate: Self = Self(1); - pub const DeltaUpdate: Self = Self(2); - pub const StateAndDeltaUpdate: Self = Self(3); - pub const RelatedStateUpdate: Self = Self(4); - pub const RelatedDeltaUpdate: Self = Self(5); - pub const RelatedStateAndDeltaUpdate: Self = Self(6); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 6; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::StateUpdate, - Self::DeltaUpdate, - Self::StateAndDeltaUpdate, - Self::RelatedStateUpdate, - Self::RelatedDeltaUpdate, - Self::RelatedStateAndDeltaUpdate, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::StateUpdate => Some("StateUpdate"), - Self::DeltaUpdate => Some("DeltaUpdate"), - Self::StateAndDeltaUpdate => Some("StateAndDeltaUpdate"), - Self::RelatedStateUpdate => Some("RelatedStateUpdate"), - Self::RelatedDeltaUpdate => Some("RelatedDeltaUpdate"), - Self::RelatedStateAndDeltaUpdate => Some("RelatedStateAndDeltaUpdate"), - _ => None, - } - } -} -impl core::fmt::Debug for UpdateDataType { - 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!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for UpdateDataType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for UpdateDataType { - type Output = UpdateDataType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for UpdateDataType { - 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 UpdateDataType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for UpdateDataType {} -pub struct UpdateDataTypeUnionTableOffset {} - -pub enum ContractInstanceIdOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ContractInstanceId<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ContractInstanceId<'a> { - type Inner = ContractInstanceId<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ContractInstanceId<'a> { - pub const VT_DATA: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ContractInstanceId { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractInstanceIdArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ContractInstanceIdBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractInstanceId::VT_DATA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for ContractInstanceId<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, true)? - .finish(); - Ok(()) - } -} -pub struct ContractInstanceIdArgs<'a> { - pub data: Option>>, -} -impl<'a> Default for ContractInstanceIdArgs<'a> { - #[inline] - fn default() -> Self { - ContractInstanceIdArgs { - data: None, // required field - } - } -} - -pub struct ContractInstanceIdBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractInstanceIdBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContractInstanceId::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractInstanceIdBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractInstanceIdBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ContractInstanceId::VT_DATA,"data"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ContractInstanceId<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ContractInstanceId"); - ds.field("data", &self.data()); - ds.finish() - } -} -pub enum ContractKeyOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ContractKey<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ContractKey<'a> { - type Inner = ContractKey<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ContractKey<'a> { - pub const VT_INSTANCE: flatbuffers::VOffsetT = 4; - pub const VT_CODE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ContractKey { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractKeyArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ContractKeyBuilder::new(_fbb); - if let Some(x) = args.code { builder.add_code(x); } - if let Some(x) = args.instance { builder.add_instance(x); } - builder.finish() - } - - - #[inline] - pub fn instance(&self) -> ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ContractKey::VT_INSTANCE, None).unwrap()} - } - #[inline] - pub fn code(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractKey::VT_CODE, None)} - } -} - -impl flatbuffers::Verifiable for ContractKey<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("instance", Self::VT_INSTANCE, true)? - .visit_field::>>("code", Self::VT_CODE, false)? - .finish(); - Ok(()) - } -} -pub struct ContractKeyArgs<'a> { - pub instance: Option>>, - pub code: Option>>, -} -impl<'a> Default for ContractKeyArgs<'a> { - #[inline] - fn default() -> Self { - ContractKeyArgs { - instance: None, // required field - code: None, - } - } -} - -pub struct ContractKeyBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractKeyBuilder<'a, 'b> { - #[inline] - pub fn add_instance(&mut self, instance: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContractKey::VT_INSTANCE, instance); - } - #[inline] - pub fn add_code(&mut self, code: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContractKey::VT_CODE, code); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractKeyBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractKeyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ContractKey::VT_INSTANCE,"instance"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ContractKey<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ContractKey"); - ds.field("instance", &self.instance()); - ds.field("code", &self.code()); - ds.finish() - } -} -pub enum SecretsIdOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SecretsId<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SecretsId<'a> { - type Inner = SecretsId<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SecretsId<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_HASH: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SecretsId { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args SecretsIdArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SecretsIdBuilder::new(_fbb); - if let Some(x) = args.hash { builder.add_hash(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(SecretsId::VT_KEY, None).unwrap()} - } - #[inline] - pub fn hash(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(SecretsId::VT_HASH, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for SecretsId<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("key", Self::VT_KEY, true)? - .visit_field::>>("hash", Self::VT_HASH, true)? - .finish(); - Ok(()) - } -} -pub struct SecretsIdArgs<'a> { - pub key: Option>>, - pub hash: Option>>, -} -impl<'a> Default for SecretsIdArgs<'a> { - #[inline] - fn default() -> Self { - SecretsIdArgs { - key: None, // required field - hash: None, // required field - } - } -} - -pub struct SecretsIdBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> SecretsIdBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SecretsId::VT_KEY, key); - } - #[inline] - pub fn add_hash(&mut self, hash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SecretsId::VT_HASH, hash); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SecretsIdBuilder<'a, 'b> { - let start = _fbb.start_table(); - SecretsIdBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, SecretsId::VT_KEY,"key"); - self.fbb_.required(o, SecretsId::VT_HASH,"hash"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SecretsId<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SecretsId"); - ds.field("key", &self.key()); - ds.field("hash", &self.hash()); - ds.finish() - } -} -pub enum ContractCodeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ContractCode<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ContractCode<'a> { - type Inner = ContractCode<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ContractCode<'a> { - pub const VT_DATA: flatbuffers::VOffsetT = 4; - pub const VT_CODE_HASH: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ContractCode { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractCodeArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ContractCodeBuilder::new(_fbb); - if let Some(x) = args.code_hash { builder.add_code_hash(x); } - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractCode::VT_DATA, None).unwrap()} - } - #[inline] - pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractCode::VT_CODE_HASH, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for ContractCode<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, true)? - .visit_field::>>("code_hash", Self::VT_CODE_HASH, true)? - .finish(); - Ok(()) - } -} -pub struct ContractCodeArgs<'a> { - pub data: Option>>, - pub code_hash: Option>>, -} -impl<'a> Default for ContractCodeArgs<'a> { - #[inline] - fn default() -> Self { - ContractCodeArgs { - data: None, // required field - code_hash: None, // required field - } - } -} - -pub struct ContractCodeBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractCodeBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContractCode::VT_DATA, data); - } - #[inline] - pub fn add_code_hash(&mut self, code_hash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContractCode::VT_CODE_HASH, code_hash); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractCodeBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractCodeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ContractCode::VT_DATA,"data"); - self.fbb_.required(o, ContractCode::VT_CODE_HASH,"code_hash"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ContractCode<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ContractCode"); - ds.field("data", &self.data()); - ds.field("code_hash", &self.code_hash()); - ds.finish() - } -} -pub enum ApplicationMessageOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ApplicationMessage<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ApplicationMessage<'a> { - type Inner = ApplicationMessage<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ApplicationMessage<'a> { - pub const VT_APP: flatbuffers::VOffsetT = 4; - pub const VT_PAYLOAD: flatbuffers::VOffsetT = 6; - pub const VT_CONTEXT: flatbuffers::VOffsetT = 8; - pub const VT_PROCESSED: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ApplicationMessage { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ApplicationMessageArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ApplicationMessageBuilder::new(_fbb); - if let Some(x) = args.context { builder.add_context(x); } - if let Some(x) = args.payload { builder.add_payload(x); } - if let Some(x) = args.app { builder.add_app(x); } - builder.add_processed(args.processed); - builder.finish() - } - - - #[inline] - pub fn app(&self) -> ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ApplicationMessage::VT_APP, None).unwrap()} - } - #[inline] - pub fn payload(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ApplicationMessage::VT_PAYLOAD, None).unwrap()} - } - #[inline] - pub fn context(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ApplicationMessage::VT_CONTEXT, None).unwrap()} - } - #[inline] - pub fn processed(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ApplicationMessage::VT_PROCESSED, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for ApplicationMessage<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("app", Self::VT_APP, true)? - .visit_field::>>("payload", Self::VT_PAYLOAD, true)? - .visit_field::>>("context", Self::VT_CONTEXT, true)? - .visit_field::("processed", Self::VT_PROCESSED, false)? - .finish(); - Ok(()) - } -} -pub struct ApplicationMessageArgs<'a> { - pub app: Option>>, - pub payload: Option>>, - pub context: Option>>, - pub processed: bool, -} -impl<'a> Default for ApplicationMessageArgs<'a> { - #[inline] - fn default() -> Self { - ApplicationMessageArgs { - app: None, // required field - payload: None, // required field - context: None, // required field - processed: false, - } - } -} - -pub struct ApplicationMessageBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ApplicationMessageBuilder<'a, 'b> { - #[inline] - pub fn add_app(&mut self, app: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ApplicationMessage::VT_APP, app); - } - #[inline] - pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ApplicationMessage::VT_PAYLOAD, payload); - } - #[inline] - pub fn add_context(&mut self, context: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ApplicationMessage::VT_CONTEXT, context); - } - #[inline] - pub fn add_processed(&mut self, processed: bool) { - self.fbb_.push_slot::(ApplicationMessage::VT_PROCESSED, processed, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ApplicationMessageBuilder<'a, 'b> { - let start = _fbb.start_table(); - ApplicationMessageBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ApplicationMessage::VT_APP,"app"); - self.fbb_.required(o, ApplicationMessage::VT_PAYLOAD,"payload"); - self.fbb_.required(o, ApplicationMessage::VT_CONTEXT,"context"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ApplicationMessage<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ApplicationMessage"); - ds.field("app", &self.app()); - ds.field("payload", &self.payload()); - ds.field("context", &self.context()); - ds.field("processed", &self.processed()); - ds.finish() - } -} -pub enum GetSecretRequestOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct GetSecretRequest<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for GetSecretRequest<'a> { - type Inner = GetSecretRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> GetSecretRequest<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 6; - pub const VT_PROCESSED: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - GetSecretRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GetSecretRequestArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GetSecretRequestBuilder::new(_fbb); - if let Some(x) = args.delegate_context { builder.add_delegate_context(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.add_processed(args.processed); - builder.finish() - } - - - #[inline] - pub fn key(&self) -> SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetSecretRequest::VT_KEY, None).unwrap()} - } - #[inline] - pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GetSecretRequest::VT_DELEGATE_CONTEXT, None).unwrap()} - } - #[inline] - pub fn processed(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GetSecretRequest::VT_PROCESSED, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for GetSecretRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("delegate_context", Self::VT_DELEGATE_CONTEXT, true)? - .visit_field::("processed", Self::VT_PROCESSED, false)? - .finish(); - Ok(()) - } -} -pub struct GetSecretRequestArgs<'a> { - pub key: Option>>, - pub delegate_context: Option>>, - pub processed: bool, -} -impl<'a> Default for GetSecretRequestArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretRequestArgs { - key: None, // required field - delegate_context: None, // required field - processed: false, - } - } -} - -pub struct GetSecretRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GetSecretRequestBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretRequest::VT_KEY, key); - } - #[inline] - pub fn add_delegate_context(&mut self, delegate_context: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretRequest::VT_DELEGATE_CONTEXT, delegate_context); - } - #[inline] - pub fn add_processed(&mut self, processed: bool) { - self.fbb_.push_slot::(GetSecretRequest::VT_PROCESSED, processed, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetSecretRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - GetSecretRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretRequest::VT_KEY,"key"); - self.fbb_.required(o, GetSecretRequest::VT_DELEGATE_CONTEXT,"delegate_context"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for GetSecretRequest<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("GetSecretRequest"); - ds.field("key", &self.key()); - ds.field("delegate_context", &self.delegate_context()); - ds.field("processed", &self.processed()); - ds.finish() - } -} -pub enum GetSecretResponseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct GetSecretResponse<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for GetSecretResponse<'a> { - type Inner = GetSecretResponse<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> GetSecretResponse<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - pub const VT_DELEGATE_CONTEXT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - GetSecretResponse { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GetSecretResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GetSecretResponseBuilder::new(_fbb); - if let Some(x) = args.delegate_context { builder.add_delegate_context(x); } - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetSecretResponse::VT_KEY, None).unwrap()} - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GetSecretResponse::VT_VALUE, None)} - } - #[inline] - pub fn delegate_context(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GetSecretResponse::VT_DELEGATE_CONTEXT, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for GetSecretResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("value", Self::VT_VALUE, false)? - .visit_field::>>("delegate_context", Self::VT_DELEGATE_CONTEXT, true)? - .finish(); - Ok(()) - } -} -pub struct GetSecretResponseArgs<'a> { - pub key: Option>>, - pub value: Option>>, - pub delegate_context: Option>>, -} -impl<'a> Default for GetSecretResponseArgs<'a> { - #[inline] - fn default() -> Self { - GetSecretResponseArgs { - key: None, // required field - value: None, - delegate_context: None, // required field - } - } -} - -pub struct GetSecretResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GetSecretResponseBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretResponse::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretResponse::VT_VALUE, value); - } - #[inline] - pub fn add_delegate_context(&mut self, delegate_context: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetSecretResponse::VT_DELEGATE_CONTEXT, delegate_context); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetSecretResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - GetSecretResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, GetSecretResponse::VT_KEY,"key"); - self.fbb_.required(o, GetSecretResponse::VT_DELEGATE_CONTEXT,"delegate_context"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for GetSecretResponse<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("GetSecretResponse"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.field("delegate_context", &self.delegate_context()); - ds.finish() - } -} -pub enum WasmContractV1Offset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct WasmContractV1<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for WasmContractV1<'a> { - type Inner = WasmContractV1<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> WasmContractV1<'a> { - pub const VT_DATA: flatbuffers::VOffsetT = 4; - pub const VT_PARAMETERS: flatbuffers::VOffsetT = 6; - pub const VT_KEY: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - WasmContractV1 { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args WasmContractV1Args<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = WasmContractV1Builder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - if let Some(x) = args.parameters { builder.add_parameters(x); } - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> ContractCode<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(WasmContractV1::VT_DATA, None).unwrap()} - } - #[inline] - pub fn parameters(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(WasmContractV1::VT_PARAMETERS, None).unwrap()} - } - #[inline] - pub fn key(&self) -> ContractKey<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(WasmContractV1::VT_KEY, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for WasmContractV1<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("data", Self::VT_DATA, true)? - .visit_field::>>("parameters", Self::VT_PARAMETERS, true)? - .visit_field::>("key", Self::VT_KEY, true)? - .finish(); - Ok(()) - } -} -pub struct WasmContractV1Args<'a> { - pub data: Option>>, - pub parameters: Option>>, - pub key: Option>>, -} -impl<'a> Default for WasmContractV1Args<'a> { - #[inline] - fn default() -> Self { - WasmContractV1Args { - data: None, // required field - parameters: None, // required field - key: None, // required field - } - } -} - -pub struct WasmContractV1Builder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> WasmContractV1Builder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmContractV1::VT_DATA, data); - } - #[inline] - pub fn add_parameters(&mut self, parameters: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmContractV1::VT_PARAMETERS, parameters); - } - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(WasmContractV1::VT_KEY, key); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> WasmContractV1Builder<'a, 'b> { - let start = _fbb.start_table(); - WasmContractV1Builder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, WasmContractV1::VT_DATA,"data"); - self.fbb_.required(o, WasmContractV1::VT_PARAMETERS,"parameters"); - self.fbb_.required(o, WasmContractV1::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for WasmContractV1<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("WasmContractV1"); - ds.field("data", &self.data()); - ds.field("parameters", &self.parameters()); - ds.field("key", &self.key()); - ds.finish() - } -} -pub enum ContractContainerOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ContractContainer<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ContractContainer<'a> { - type Inner = ContractContainer<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ContractContainer<'a> { - pub const VT_CONTRACT_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_CONTRACT: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ContractContainer { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractContainerArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = ContractContainerBuilder::new(_fbb); - if let Some(x) = args.contract { builder.add_contract(x); } - builder.add_contract_type(args.contract_type); - builder.finish() - } - - - #[inline] - pub fn contract_type(&self) -> ContractType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ContractContainer::VT_CONTRACT_TYPE, Some(ContractType::NONE)).unwrap()} - } - #[inline] - pub fn contract(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractContainer::VT_CONTRACT, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn contract_as_wasm_contract_v1(&self) -> Option> { - if self.contract_type() == ContractType::WasmContractV1 { - let u = self.contract(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { WasmContractV1::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for ContractContainer<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("contract_type", Self::VT_CONTRACT_TYPE, "contract", Self::VT_CONTRACT, true, |key, v, pos| { - match key { - ContractType::WasmContractV1 => v.verify_union_variant::>("ContractType::WasmContractV1", pos), - _ => Ok(()), + pub struct ContractContainerBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractContainerBuilder<'a, 'b> { + #[inline] + pub fn add_contract_type(&mut self, contract_type: ContractType) { + self.fbb_.push_slot::( + ContractContainer::VT_CONTRACT_TYPE, + contract_type, + ContractType::NONE, + ); } - })? - .finish(); - Ok(()) - } -} -pub struct ContractContainerArgs { - pub contract_type: ContractType, - pub contract: Option>, -} -impl<'a> Default for ContractContainerArgs { - #[inline] - fn default() -> Self { - ContractContainerArgs { - contract_type: ContractType::NONE, - contract: None, // required field - } - } -} - -pub struct ContractContainerBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractContainerBuilder<'a, 'b> { - #[inline] - pub fn add_contract_type(&mut self, contract_type: ContractType) { - self.fbb_.push_slot::(ContractContainer::VT_CONTRACT_TYPE, contract_type, ContractType::NONE); - } - #[inline] - pub fn add_contract(&mut self, contract: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(ContractContainer::VT_CONTRACT, contract); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractContainerBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractContainerBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, ContractContainer::VT_CONTRACT,"contract"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ContractContainer<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ContractContainer"); - ds.field("contract_type", &self.contract_type()); - match self.contract_type() { - ContractType::WasmContractV1 => { - if let Some(x) = self.contract_as_wasm_contract_v1() { - ds.field("contract", &x) - } else { - ds.field("contract", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("contract", &x) - }, - }; - ds.finish() - } -} -pub enum StateUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StateUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StateUpdate<'a> { - type Inner = StateUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StateUpdate<'a> { - pub const VT_STATE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StateUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args StateUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StateUpdateBuilder::new(_fbb); - if let Some(x) = args.state { builder.add_state(x); } - builder.finish() - } - - - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(StateUpdate::VT_STATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for StateUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("state", Self::VT_STATE, true)? - .finish(); - Ok(()) - } -} -pub struct StateUpdateArgs<'a> { - pub state: Option>>, -} -impl<'a> Default for StateUpdateArgs<'a> { - #[inline] - fn default() -> Self { - StateUpdateArgs { - state: None, // required field - } - } -} - -pub struct StateUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> StateUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StateUpdate::VT_STATE, state); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StateUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - StateUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, StateUpdate::VT_STATE,"state"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StateUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StateUpdate"); - ds.field("state", &self.state()); - ds.finish() - } -} -pub enum DeltaUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DeltaUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DeltaUpdate<'a> { - type Inner = DeltaUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DeltaUpdate<'a> { - pub const VT_DELTA: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DeltaUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DeltaUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DeltaUpdateBuilder::new(_fbb); - if let Some(x) = args.delta { builder.add_delta(x); } - builder.finish() - } - - - #[inline] - pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DeltaUpdate::VT_DELTA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DeltaUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("delta", Self::VT_DELTA, true)? - .finish(); - Ok(()) - } -} -pub struct DeltaUpdateArgs<'a> { - pub delta: Option>>, -} -impl<'a> Default for DeltaUpdateArgs<'a> { - #[inline] - fn default() -> Self { - DeltaUpdateArgs { - delta: None, // required field - } - } -} - -pub struct DeltaUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DeltaUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DeltaUpdate::VT_DELTA, delta); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DeltaUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - DeltaUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DeltaUpdate::VT_DELTA,"delta"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DeltaUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DeltaUpdate"); - ds.field("delta", &self.delta()); - ds.finish() - } -} -pub enum StateAndDeltaUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StateAndDeltaUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StateAndDeltaUpdate<'a> { - type Inner = StateAndDeltaUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StateAndDeltaUpdate<'a> { - pub const VT_STATE: flatbuffers::VOffsetT = 4; - pub const VT_DELTA: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StateAndDeltaUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args StateAndDeltaUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StateAndDeltaUpdateBuilder::new(_fbb); - if let Some(x) = args.delta { builder.add_delta(x); } - if let Some(x) = args.state { builder.add_state(x); } - builder.finish() - } - - - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(StateAndDeltaUpdate::VT_STATE, None).unwrap()} - } - #[inline] - pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(StateAndDeltaUpdate::VT_DELTA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for StateAndDeltaUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("state", Self::VT_STATE, true)? - .visit_field::>>("delta", Self::VT_DELTA, true)? - .finish(); - Ok(()) - } -} -pub struct StateAndDeltaUpdateArgs<'a> { - pub state: Option>>, - pub delta: Option>>, -} -impl<'a> Default for StateAndDeltaUpdateArgs<'a> { - #[inline] - fn default() -> Self { - StateAndDeltaUpdateArgs { - state: None, // required field - delta: None, // required field - } - } -} - -pub struct StateAndDeltaUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> StateAndDeltaUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StateAndDeltaUpdate::VT_STATE, state); - } - #[inline] - pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StateAndDeltaUpdate::VT_DELTA, delta); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StateAndDeltaUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - StateAndDeltaUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, StateAndDeltaUpdate::VT_STATE,"state"); - self.fbb_.required(o, StateAndDeltaUpdate::VT_DELTA,"delta"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StateAndDeltaUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StateAndDeltaUpdate"); - ds.field("state", &self.state()); - ds.field("delta", &self.delta()); - ds.finish() - } -} -pub enum RelatedStateUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RelatedStateUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RelatedStateUpdate<'a> { - type Inner = RelatedStateUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RelatedStateUpdate<'a> { - pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; - pub const VT_STATE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RelatedStateUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RelatedStateUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RelatedStateUpdateBuilder::new(_fbb); - if let Some(x) = args.state { builder.add_state(x); } - if let Some(x) = args.related_to { builder.add_related_to(x); } - builder.finish() - } - - - #[inline] - pub fn related_to(&self) -> ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(RelatedStateUpdate::VT_RELATED_TO, None).unwrap()} - } - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RelatedStateUpdate::VT_STATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RelatedStateUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("related_to", Self::VT_RELATED_TO, true)? - .visit_field::>>("state", Self::VT_STATE, true)? - .finish(); - Ok(()) - } -} -pub struct RelatedStateUpdateArgs<'a> { - pub related_to: Option>>, - pub state: Option>>, -} -impl<'a> Default for RelatedStateUpdateArgs<'a> { - #[inline] - fn default() -> Self { - RelatedStateUpdateArgs { - related_to: None, // required field - state: None, // required field - } - } -} - -pub struct RelatedStateUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RelatedStateUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_related_to(&mut self, related_to: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedStateUpdate::VT_RELATED_TO, related_to); - } - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedStateUpdate::VT_STATE, state); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RelatedStateUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - RelatedStateUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RelatedStateUpdate::VT_RELATED_TO,"related_to"); - self.fbb_.required(o, RelatedStateUpdate::VT_STATE,"state"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RelatedStateUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RelatedStateUpdate"); - ds.field("related_to", &self.related_to()); - ds.field("state", &self.state()); - ds.finish() - } -} -pub enum RelatedDeltaUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RelatedDeltaUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RelatedDeltaUpdate<'a> { - type Inner = RelatedDeltaUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RelatedDeltaUpdate<'a> { - pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; - pub const VT_DELTA: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RelatedDeltaUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RelatedDeltaUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RelatedDeltaUpdateBuilder::new(_fbb); - if let Some(x) = args.delta { builder.add_delta(x); } - if let Some(x) = args.related_to { builder.add_related_to(x); } - builder.finish() - } - - - #[inline] - pub fn related_to(&self) -> ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(RelatedDeltaUpdate::VT_RELATED_TO, None).unwrap()} - } - #[inline] - pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RelatedDeltaUpdate::VT_DELTA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RelatedDeltaUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("related_to", Self::VT_RELATED_TO, true)? - .visit_field::>>("delta", Self::VT_DELTA, true)? - .finish(); - Ok(()) - } -} -pub struct RelatedDeltaUpdateArgs<'a> { - pub related_to: Option>>, - pub delta: Option>>, -} -impl<'a> Default for RelatedDeltaUpdateArgs<'a> { - #[inline] - fn default() -> Self { - RelatedDeltaUpdateArgs { - related_to: None, // required field - delta: None, // required field - } - } -} - -pub struct RelatedDeltaUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RelatedDeltaUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_related_to(&mut self, related_to: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedDeltaUpdate::VT_RELATED_TO, related_to); - } - #[inline] - pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedDeltaUpdate::VT_DELTA, delta); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RelatedDeltaUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - RelatedDeltaUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RelatedDeltaUpdate::VT_RELATED_TO,"related_to"); - self.fbb_.required(o, RelatedDeltaUpdate::VT_DELTA,"delta"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RelatedDeltaUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RelatedDeltaUpdate"); - ds.field("related_to", &self.related_to()); - ds.field("delta", &self.delta()); - ds.finish() - } -} -pub enum RelatedStateAndDeltaUpdateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct RelatedStateAndDeltaUpdate<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for RelatedStateAndDeltaUpdate<'a> { - type Inner = RelatedStateAndDeltaUpdate<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> RelatedStateAndDeltaUpdate<'a> { - pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; - pub const VT_STATE: flatbuffers::VOffsetT = 6; - pub const VT_DELTA: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - RelatedStateAndDeltaUpdate { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RelatedStateAndDeltaUpdateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RelatedStateAndDeltaUpdateBuilder::new(_fbb); - if let Some(x) = args.delta { builder.add_delta(x); } - if let Some(x) = args.state { builder.add_state(x); } - if let Some(x) = args.related_to { builder.add_related_to(x); } - builder.finish() - } - - - #[inline] - pub fn related_to(&self) -> ContractInstanceId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(RelatedStateAndDeltaUpdate::VT_RELATED_TO, None).unwrap()} - } - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RelatedStateAndDeltaUpdate::VT_STATE, None).unwrap()} - } - #[inline] - pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RelatedStateAndDeltaUpdate::VT_DELTA, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RelatedStateAndDeltaUpdate<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("related_to", Self::VT_RELATED_TO, true)? - .visit_field::>>("state", Self::VT_STATE, true)? - .visit_field::>>("delta", Self::VT_DELTA, true)? - .finish(); - Ok(()) - } -} -pub struct RelatedStateAndDeltaUpdateArgs<'a> { - pub related_to: Option>>, - pub state: Option>>, - pub delta: Option>>, -} -impl<'a> Default for RelatedStateAndDeltaUpdateArgs<'a> { - #[inline] - fn default() -> Self { - RelatedStateAndDeltaUpdateArgs { - related_to: None, // required field - state: None, // required field - delta: None, // required field - } - } -} - -pub struct RelatedStateAndDeltaUpdateBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RelatedStateAndDeltaUpdateBuilder<'a, 'b> { - #[inline] - pub fn add_related_to(&mut self, related_to: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedStateAndDeltaUpdate::VT_RELATED_TO, related_to); - } - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedStateAndDeltaUpdate::VT_STATE, state); - } - #[inline] - pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RelatedStateAndDeltaUpdate::VT_DELTA, delta); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RelatedStateAndDeltaUpdateBuilder<'a, 'b> { - let start = _fbb.start_table(); - RelatedStateAndDeltaUpdateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, RelatedStateAndDeltaUpdate::VT_RELATED_TO,"related_to"); - self.fbb_.required(o, RelatedStateAndDeltaUpdate::VT_STATE,"state"); - self.fbb_.required(o, RelatedStateAndDeltaUpdate::VT_DELTA,"delta"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for RelatedStateAndDeltaUpdate<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("RelatedStateAndDeltaUpdate"); - ds.field("related_to", &self.related_to()); - ds.field("state", &self.state()); - ds.field("delta", &self.delta()); - ds.finish() - } -} -pub enum UpdateDataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct UpdateData<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for UpdateData<'a> { - type Inner = UpdateData<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> UpdateData<'a> { - pub const VT_UPDATE_DATA_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_UPDATE_DATA: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - UpdateData { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UpdateDataArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = UpdateDataBuilder::new(_fbb); - if let Some(x) = args.update_data { builder.add_update_data(x); } - builder.add_update_data_type(args.update_data_type); - builder.finish() - } - - - #[inline] - pub fn update_data_type(&self) -> UpdateDataType { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UpdateData::VT_UPDATE_DATA_TYPE, Some(UpdateDataType::NONE)).unwrap()} - } - #[inline] - pub fn update_data(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(UpdateData::VT_UPDATE_DATA, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_state_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::StateUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { StateUpdate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_delta_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::DeltaUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { DeltaUpdate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_state_and_delta_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::StateAndDeltaUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { StateAndDeltaUpdate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_related_state_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::RelatedStateUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { RelatedStateUpdate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_related_delta_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::RelatedDeltaUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { RelatedDeltaUpdate::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn update_data_as_related_state_and_delta_update(&self) -> Option> { - if self.update_data_type() == UpdateDataType::RelatedStateAndDeltaUpdate { - let u = self.update_data(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { RelatedStateAndDeltaUpdate::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for UpdateData<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? + #[inline] + pub fn add_contract( + &mut self, + contract: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + ContractContainer::VT_CONTRACT, + contract, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContractContainerBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractContainerBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, ContractContainer::VT_CONTRACT, "contract"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for ContractContainer<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ContractContainer"); + ds.field("contract_type", &self.contract_type()); + match self.contract_type() { + ContractType::WasmContractV1 => { + if let Some(x) = self.contract_as_wasm_contract_v1() { + ds.field("contract", &x) + } else { + ds.field( + "contract", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("contract", &x) + } + }; + ds.finish() + } + } + pub enum StateUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct StateUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for StateUpdate<'a> { + type Inner = StateUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> StateUpdate<'a> { + pub const VT_STATE: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + StateUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args StateUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = StateUpdateBuilder::new(_fbb); + if let Some(x) = args.state { + builder.add_state(x); + } + builder.finish() + } + + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + StateUpdate::VT_STATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for StateUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct StateUpdateArgs<'a> { + pub state: Option>>, + } + impl<'a> Default for StateUpdateArgs<'a> { + #[inline] + fn default() -> Self { + StateUpdateArgs { + state: None, // required field + } + } + } + + pub struct StateUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> StateUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(StateUpdate::VT_STATE, state); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> StateUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + StateUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, StateUpdate::VT_STATE, "state"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for StateUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("StateUpdate"); + ds.field("state", &self.state()); + ds.finish() + } + } + pub enum DeltaUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct DeltaUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for DeltaUpdate<'a> { + type Inner = DeltaUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> DeltaUpdate<'a> { + pub const VT_DELTA: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DeltaUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DeltaUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = DeltaUpdateBuilder::new(_fbb); + if let Some(x) = args.delta { + builder.add_delta(x); + } + builder.finish() + } + + #[inline] + pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DeltaUpdate::VT_DELTA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DeltaUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "delta", + Self::VT_DELTA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct DeltaUpdateArgs<'a> { + pub delta: Option>>, + } + impl<'a> Default for DeltaUpdateArgs<'a> { + #[inline] + fn default() -> Self { + DeltaUpdateArgs { + delta: None, // required field + } + } + } + + pub struct DeltaUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DeltaUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(DeltaUpdate::VT_DELTA, delta); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DeltaUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + DeltaUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, DeltaUpdate::VT_DELTA, "delta"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for DeltaUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DeltaUpdate"); + ds.field("delta", &self.delta()); + ds.finish() + } + } + pub enum StateAndDeltaUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct StateAndDeltaUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for StateAndDeltaUpdate<'a> { + type Inner = StateAndDeltaUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> StateAndDeltaUpdate<'a> { + pub const VT_STATE: flatbuffers::VOffsetT = 4; + pub const VT_DELTA: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + StateAndDeltaUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args StateAndDeltaUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = StateAndDeltaUpdateBuilder::new(_fbb); + if let Some(x) = args.delta { + builder.add_delta(x); + } + if let Some(x) = args.state { + builder.add_state(x); + } + builder.finish() + } + + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + StateAndDeltaUpdate::VT_STATE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + StateAndDeltaUpdate::VT_DELTA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for StateAndDeltaUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .visit_field::>>( + "delta", + Self::VT_DELTA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct StateAndDeltaUpdateArgs<'a> { + pub state: Option>>, + pub delta: Option>>, + } + impl<'a> Default for StateAndDeltaUpdateArgs<'a> { + #[inline] + fn default() -> Self { + StateAndDeltaUpdateArgs { + state: None, // required field + delta: None, // required field + } + } + } + + pub struct StateAndDeltaUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> StateAndDeltaUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + StateAndDeltaUpdate::VT_STATE, + state, + ); + } + #[inline] + pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + StateAndDeltaUpdate::VT_DELTA, + delta, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> StateAndDeltaUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + StateAndDeltaUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, StateAndDeltaUpdate::VT_STATE, "state"); + self.fbb_ + .required(o, StateAndDeltaUpdate::VT_DELTA, "delta"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for StateAndDeltaUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("StateAndDeltaUpdate"); + ds.field("state", &self.state()); + ds.field("delta", &self.delta()); + ds.finish() + } + } + pub enum RelatedStateUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RelatedStateUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RelatedStateUpdate<'a> { + type Inner = RelatedStateUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RelatedStateUpdate<'a> { + pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; + pub const VT_STATE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RelatedStateUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RelatedStateUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RelatedStateUpdateBuilder::new(_fbb); + if let Some(x) = args.state { + builder.add_state(x); + } + if let Some(x) = args.related_to { + builder.add_related_to(x); + } + builder.finish() + } + + #[inline] + pub fn related_to(&self) -> ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + RelatedStateUpdate::VT_RELATED_TO, + None, + ) + .unwrap() + } + } + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RelatedStateUpdate::VT_STATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RelatedStateUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "related_to", + Self::VT_RELATED_TO, + true, + )? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct RelatedStateUpdateArgs<'a> { + pub related_to: Option>>, + pub state: Option>>, + } + impl<'a> Default for RelatedStateUpdateArgs<'a> { + #[inline] + fn default() -> Self { + RelatedStateUpdateArgs { + related_to: None, // required field + state: None, // required field + } + } + } + + pub struct RelatedStateUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RelatedStateUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_related_to( + &mut self, + related_to: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + RelatedStateUpdate::VT_RELATED_TO, + related_to, + ); + } + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(RelatedStateUpdate::VT_STATE, state); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RelatedStateUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + RelatedStateUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RelatedStateUpdate::VT_RELATED_TO, "related_to"); + self.fbb_.required(o, RelatedStateUpdate::VT_STATE, "state"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for RelatedStateUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RelatedStateUpdate"); + ds.field("related_to", &self.related_to()); + ds.field("state", &self.state()); + ds.finish() + } + } + pub enum RelatedDeltaUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RelatedDeltaUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RelatedDeltaUpdate<'a> { + type Inner = RelatedDeltaUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RelatedDeltaUpdate<'a> { + pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; + pub const VT_DELTA: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RelatedDeltaUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RelatedDeltaUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RelatedDeltaUpdateBuilder::new(_fbb); + if let Some(x) = args.delta { + builder.add_delta(x); + } + if let Some(x) = args.related_to { + builder.add_related_to(x); + } + builder.finish() + } + + #[inline] + pub fn related_to(&self) -> ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + RelatedDeltaUpdate::VT_RELATED_TO, + None, + ) + .unwrap() + } + } + #[inline] + pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RelatedDeltaUpdate::VT_DELTA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RelatedDeltaUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "related_to", + Self::VT_RELATED_TO, + true, + )? + .visit_field::>>( + "delta", + Self::VT_DELTA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct RelatedDeltaUpdateArgs<'a> { + pub related_to: Option>>, + pub delta: Option>>, + } + impl<'a> Default for RelatedDeltaUpdateArgs<'a> { + #[inline] + fn default() -> Self { + RelatedDeltaUpdateArgs { + related_to: None, // required field + delta: None, // required field + } + } + } + + pub struct RelatedDeltaUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RelatedDeltaUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_related_to( + &mut self, + related_to: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + RelatedDeltaUpdate::VT_RELATED_TO, + related_to, + ); + } + #[inline] + pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(RelatedDeltaUpdate::VT_DELTA, delta); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RelatedDeltaUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + RelatedDeltaUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RelatedDeltaUpdate::VT_RELATED_TO, "related_to"); + self.fbb_.required(o, RelatedDeltaUpdate::VT_DELTA, "delta"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for RelatedDeltaUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RelatedDeltaUpdate"); + ds.field("related_to", &self.related_to()); + ds.field("delta", &self.delta()); + ds.finish() + } + } + pub enum RelatedStateAndDeltaUpdateOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct RelatedStateAndDeltaUpdate<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for RelatedStateAndDeltaUpdate<'a> { + type Inner = RelatedStateAndDeltaUpdate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> RelatedStateAndDeltaUpdate<'a> { + pub const VT_RELATED_TO: flatbuffers::VOffsetT = 4; + pub const VT_STATE: flatbuffers::VOffsetT = 6; + pub const VT_DELTA: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RelatedStateAndDeltaUpdate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RelatedStateAndDeltaUpdateArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RelatedStateAndDeltaUpdateBuilder::new(_fbb); + if let Some(x) = args.delta { + builder.add_delta(x); + } + if let Some(x) = args.state { + builder.add_state(x); + } + if let Some(x) = args.related_to { + builder.add_related_to(x); + } + builder.finish() + } + + #[inline] + pub fn related_to(&self) -> ContractInstanceId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + RelatedStateAndDeltaUpdate::VT_RELATED_TO, + None, + ) + .unwrap() + } + } + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RelatedStateAndDeltaUpdate::VT_STATE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn delta(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RelatedStateAndDeltaUpdate::VT_DELTA, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RelatedStateAndDeltaUpdate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "related_to", + Self::VT_RELATED_TO, + true, + )? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .visit_field::>>( + "delta", + Self::VT_DELTA, + true, + )? + .finish(); + Ok(()) + } + } + pub struct RelatedStateAndDeltaUpdateArgs<'a> { + pub related_to: Option>>, + pub state: Option>>, + pub delta: Option>>, + } + impl<'a> Default for RelatedStateAndDeltaUpdateArgs<'a> { + #[inline] + fn default() -> Self { + RelatedStateAndDeltaUpdateArgs { + related_to: None, // required field + state: None, // required field + delta: None, // required field + } + } + } + + pub struct RelatedStateAndDeltaUpdateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RelatedStateAndDeltaUpdateBuilder<'a, 'b> { + #[inline] + pub fn add_related_to( + &mut self, + related_to: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + RelatedStateAndDeltaUpdate::VT_RELATED_TO, + related_to, + ); + } + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + RelatedStateAndDeltaUpdate::VT_STATE, + state, + ); + } + #[inline] + pub fn add_delta(&mut self, delta: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + RelatedStateAndDeltaUpdate::VT_DELTA, + delta, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RelatedStateAndDeltaUpdateBuilder<'a, 'b> { + let start = _fbb.start_table(); + RelatedStateAndDeltaUpdateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, RelatedStateAndDeltaUpdate::VT_RELATED_TO, "related_to"); + self.fbb_ + .required(o, RelatedStateAndDeltaUpdate::VT_STATE, "state"); + self.fbb_ + .required(o, RelatedStateAndDeltaUpdate::VT_DELTA, "delta"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for RelatedStateAndDeltaUpdate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RelatedStateAndDeltaUpdate"); + ds.field("related_to", &self.related_to()); + ds.field("state", &self.state()); + ds.field("delta", &self.delta()); + ds.finish() + } + } + pub enum UpdateDataOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct UpdateData<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for UpdateData<'a> { + type Inner = UpdateData<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> UpdateData<'a> { + pub const VT_UPDATE_DATA_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_UPDATE_DATA: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + UpdateData { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UpdateDataArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = UpdateDataBuilder::new(_fbb); + if let Some(x) = args.update_data { + builder.add_update_data(x); + } + builder.add_update_data_type(args.update_data_type); + builder.finish() + } + + #[inline] + pub fn update_data_type(&self) -> UpdateDataType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + UpdateData::VT_UPDATE_DATA_TYPE, + Some(UpdateDataType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn update_data(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + UpdateData::VT_UPDATE_DATA, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_state_update(&self) -> Option> { + if self.update_data_type() == UpdateDataType::StateUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { StateUpdate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_delta_update(&self) -> Option> { + if self.update_data_type() == UpdateDataType::DeltaUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { DeltaUpdate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_state_and_delta_update(&self) -> Option> { + if self.update_data_type() == UpdateDataType::StateAndDeltaUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { StateAndDeltaUpdate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_related_state_update(&self) -> Option> { + if self.update_data_type() == UpdateDataType::RelatedStateUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { RelatedStateUpdate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_related_delta_update(&self) -> Option> { + if self.update_data_type() == UpdateDataType::RelatedDeltaUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { RelatedDeltaUpdate::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn update_data_as_related_state_and_delta_update( + &self, + ) -> Option> { + if self.update_data_type() == UpdateDataType::RelatedStateAndDeltaUpdate { + let u = self.update_data(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { RelatedStateAndDeltaUpdate::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for UpdateData<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? .visit_union::("update_data_type", Self::VT_UPDATE_DATA_TYPE, "update_data", Self::VT_UPDATE_DATA, true, |key, v, pos| { match key { UpdateDataType::StateUpdate => v.verify_union_variant::>("UpdateDataType::StateUpdate", pos), @@ -2185,106 +2795,134 @@ impl flatbuffers::Verifiable for UpdateData<'_> { } })? .finish(); - Ok(()) - } -} -pub struct UpdateDataArgs { - pub update_data_type: UpdateDataType, - pub update_data: Option>, -} -impl<'a> Default for UpdateDataArgs { - #[inline] - fn default() -> Self { - UpdateDataArgs { - update_data_type: UpdateDataType::NONE, - update_data: None, // required field - } - } -} - -pub struct UpdateDataBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UpdateDataBuilder<'a, 'b> { - #[inline] - pub fn add_update_data_type(&mut self, update_data_type: UpdateDataType) { - self.fbb_.push_slot::(UpdateData::VT_UPDATE_DATA_TYPE, update_data_type, UpdateDataType::NONE); - } - #[inline] - pub fn add_update_data(&mut self, update_data: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(UpdateData::VT_UPDATE_DATA, update_data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateDataBuilder<'a, 'b> { - let start = _fbb.start_table(); - UpdateDataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, UpdateData::VT_UPDATE_DATA,"update_data"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for UpdateData<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("UpdateData"); - ds.field("update_data_type", &self.update_data_type()); - match self.update_data_type() { - UpdateDataType::StateUpdate => { - if let Some(x) = self.update_data_as_state_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - UpdateDataType::DeltaUpdate => { - if let Some(x) = self.update_data_as_delta_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - UpdateDataType::StateAndDeltaUpdate => { - if let Some(x) = self.update_data_as_state_and_delta_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - UpdateDataType::RelatedStateUpdate => { - if let Some(x) = self.update_data_as_related_state_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - UpdateDataType::RelatedDeltaUpdate => { - if let Some(x) = self.update_data_as_related_delta_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - UpdateDataType::RelatedStateAndDeltaUpdate => { - if let Some(x) = self.update_data_as_related_state_and_delta_update() { - ds.field("update_data", &x) - } else { - ds.field("update_data", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("update_data", &x) - }, - }; - ds.finish() - } -} -} // pub mod common + Ok(()) + } + } + pub struct UpdateDataArgs { + pub update_data_type: UpdateDataType, + pub update_data: Option>, + } + impl<'a> Default for UpdateDataArgs { + #[inline] + fn default() -> Self { + UpdateDataArgs { + update_data_type: UpdateDataType::NONE, + update_data: None, // required field + } + } + } + + pub struct UpdateDataBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UpdateDataBuilder<'a, 'b> { + #[inline] + pub fn add_update_data_type(&mut self, update_data_type: UpdateDataType) { + self.fbb_.push_slot::( + UpdateData::VT_UPDATE_DATA_TYPE, + update_data_type, + UpdateDataType::NONE, + ); + } + #[inline] + pub fn add_update_data( + &mut self, + update_data: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + UpdateData::VT_UPDATE_DATA, + update_data, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateDataBuilder<'a, 'b> { + let start = _fbb.start_table(); + UpdateDataBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_ + .required(o, UpdateData::VT_UPDATE_DATA, "update_data"); + flatbuffers::WIPOffset::new(o.value()) + } + } + impl core::fmt::Debug for UpdateData<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("UpdateData"); + ds.field("update_data_type", &self.update_data_type()); + match self.update_data_type() { + UpdateDataType::StateUpdate => { + if let Some(x) = self.update_data_as_state_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + UpdateDataType::DeltaUpdate => { + if let Some(x) = self.update_data_as_delta_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + UpdateDataType::StateAndDeltaUpdate => { + if let Some(x) = self.update_data_as_state_and_delta_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + UpdateDataType::RelatedStateUpdate => { + if let Some(x) = self.update_data_as_related_state_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + UpdateDataType::RelatedDeltaUpdate => { + if let Some(x) = self.update_data_as_related_delta_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + UpdateDataType::RelatedStateAndDeltaUpdate => { + if let Some(x) = self.update_data_as_related_state_and_delta_update() { + ds.field("update_data", &x) + } else { + ds.field( + "update_data", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("update_data", &x) + } + }; + ds.finish() + } + } +} // pub mod common diff --git a/rust/src/host_response_generated.rs b/rust/src/host_response_generated.rs index 8c08707..2ad671a 100644 --- a/rust/src/host_response_generated.rs +++ b/rust/src/host_response_generated.rs @@ -1,11 +1,10 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated use crate::common_generated::*; -use core::mem; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; @@ -13,899 +12,1097 @@ use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod host_response { - use crate::common_generated::*; - use core::mem; - use core::cmp::Ordering; - - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_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 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_CONTRACT_RESPONSE_TYPE: [ContractResponseType; 5] = [ - ContractResponseType::NONE, - ContractResponseType::GetResponse, - ContractResponseType::PutResponse, - ContractResponseType::UpdateNotification, - ContractResponseType::UpdateResponse, -]; - -#[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 ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::GetResponse, - Self::PutResponse, - Self::UpdateNotification, - Self::UpdateResponse, - ]; - /// Returns the variant's name or "" if unknown. - 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"), - _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ContractResponseType { - type Output = ContractResponseType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(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> { - use self::flatbuffers::Verifiable; - 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 = 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_OUTBOUND_DELEGATE_MSG_TYPE: [OutboundDelegateMsgType; 7] = [ - OutboundDelegateMsgType::NONE, - OutboundDelegateMsgType::common_ApplicationMessage, - OutboundDelegateMsgType::RequestUserInput, - OutboundDelegateMsgType::ContextUpdated, - OutboundDelegateMsgType::common_GetSecretRequest, - OutboundDelegateMsgType::SetSecretRequest, - OutboundDelegateMsgType::common_GetSecretResponse, -]; - -#[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 common_GetSecretRequest: Self = Self(4); - pub const SetSecretRequest: Self = Self(5); - pub const common_GetSecretResponse: Self = Self(6); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 6; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::common_ApplicationMessage, - Self::RequestUserInput, - Self::ContextUpdated, - Self::common_GetSecretRequest, - Self::SetSecretRequest, - Self::common_GetSecretResponse, - ]; - /// Returns the variant's name or "" if unknown. - 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"), - Self::common_GetSecretRequest => Some("common_GetSecretRequest"), - Self::SetSecretRequest => Some("SetSecretRequest"), - Self::common_GetSecretResponse => Some("common_GetSecretResponse"), - _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for OutboundDelegateMsgType { - type Output = OutboundDelegateMsgType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(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> { - use self::flatbuffers::Verifiable; - 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 = 5; -#[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; 6] = [ - HostResponseType::NONE, - HostResponseType::ContractResponse, - HostResponseType::DelegateResponse, - HostResponseType::GenerateRandData, - HostResponseType::Ok, - HostResponseType::Error, -]; - -#[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 ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 5; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::ContractResponse, - Self::DelegateResponse, - Self::GenerateRandData, - Self::Ok, - Self::Error, - ]; - /// Returns the variant's name or "" if unknown. - 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"), - _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for HostResponseType { - type Output = HostResponseType; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(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> { - use self::flatbuffers::Verifiable; - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GetResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetResponse::VT_KEY, None).unwrap()} - } - #[inline] - pub fn contract(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GetResponse::VT_CONTRACT, None)} - } - #[inline] - pub fn state(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GetResponse::VT_STATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for GetResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("contract", Self::VT_CONTRACT, false)? - .visit_field::>>("state", Self::VT_STATE, true)? - .finish(); - Ok(()) - } -} -pub struct GetResponseArgs<'a> { - pub key: Option>>, - pub contract: Option>>, - pub state: Option>>, -} -impl<'a> Default for GetResponseArgs<'a> { - #[inline] - fn default() -> Self { - GetResponseArgs { - key: None, // required field - contract: None, - state: None, // required field - } - } -} - -pub struct GetResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GetResponseBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetResponse::VT_KEY, key); - } - #[inline] - pub fn add_contract(&mut self, contract: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetResponse::VT_CONTRACT, contract); - } - #[inline] - pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GetResponse::VT_STATE, state); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - GetResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args PutResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(PutResponse::VT_KEY, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for PutResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .finish(); - Ok(()) - } -} -pub struct PutResponseArgs<'a> { - pub key: Option>>, -} -impl<'a> Default for PutResponseArgs<'a> { - #[inline] - fn default() -> Self { - PutResponseArgs { - key: None, // required field - } - } -} - -pub struct PutResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> PutResponseBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PutResponse::VT_KEY, key); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PutResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - PutResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UpdateNotificationArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(UpdateNotification::VT_KEY, None).unwrap()} - } - #[inline] - pub fn update(&self) -> super::common::UpdateData<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(UpdateNotification::VT_UPDATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for UpdateNotification<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("update", Self::VT_UPDATE, true)? - .finish(); - Ok(()) - } -} -pub struct UpdateNotificationArgs<'a> { - pub key: Option>>, - pub update: Option>>, -} -impl<'a> Default for UpdateNotificationArgs<'a> { - #[inline] - fn default() -> Self { - UpdateNotificationArgs { - key: None, // required field - update: None, // required field - } - } -} - -pub struct UpdateNotificationBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UpdateNotificationBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UpdateNotification::VT_KEY, key); - } - #[inline] - pub fn add_update(&mut self, update: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UpdateNotification::VT_UPDATE, update); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateNotificationBuilder<'a, 'b> { - let start = _fbb.start_table(); - UpdateNotificationBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UpdateResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(UpdateResponse::VT_KEY, None).unwrap()} - } - #[inline] - pub fn summary(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(UpdateResponse::VT_SUMMARY, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for UpdateResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("summary", Self::VT_SUMMARY, true)? - .finish(); - Ok(()) - } -} -pub struct UpdateResponseArgs<'a> { - pub key: Option>>, - pub summary: Option>>, -} -impl<'a> Default for UpdateResponseArgs<'a> { - #[inline] - fn default() -> Self { - UpdateResponseArgs { - key: None, // required field - summary: None, // required field - } - } -} - -pub struct UpdateResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UpdateResponseBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UpdateResponse::VT_KEY, key); - } - #[inline] - pub fn add_summary(&mut self, summary: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UpdateResponse::VT_SUMMARY, summary); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UpdateResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - UpdateResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContractResponseArgs - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ContractResponse::VT_CONTRACT_RESPONSE_TYPE, Some(ContractResponseType::NONE)).unwrap()} - } - #[inline] - pub fn contract_response(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContractResponse::VT_CONTRACT_RESPONSE, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn contract_response_as_get_response(&self) -> Option> { - if self.contract_response_type() == ContractResponseType::GetResponse { - let u = self.contract_response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { GetResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_response_as_put_response(&self) -> Option> { - if self.contract_response_type() == ContractResponseType::PutResponse { - let u = self.contract_response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { PutResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_response_as_update_notification(&self) -> Option> { - if self.contract_response_type() == ContractResponseType::UpdateNotification { - let u = self.contract_response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { UpdateNotification::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn contract_response_as_update_response(&self) -> Option> { - if self.contract_response_type() == ContractResponseType::UpdateResponse { - let u = self.contract_response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { UpdateResponse::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for ContractResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? + use crate::common_generated::*; + use core::cmp::Ordering; + use core::mem; + + extern crate flatbuffers; + use self::flatbuffers::{EndianScalar, Follow}; + + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + pub const ENUM_MIN_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 = 4; + #[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." + )] + #[allow(non_camel_case_types)] + pub const ENUM_VALUES_CONTRACT_RESPONSE_TYPE: [ContractResponseType; 5] = [ + ContractResponseType::NONE, + ContractResponseType::GetResponse, + ContractResponseType::PutResponse, + ContractResponseType::UpdateNotification, + ContractResponseType::UpdateResponse, + ]; + + #[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 ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 4; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::GetResponse, + Self::PutResponse, + Self::UpdateNotification, + Self::UpdateResponse, + ]; + /// Returns the variant's name or "" if unknown. + 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"), + _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for ContractResponseType { + type Output = ContractResponseType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(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> { + use self::flatbuffers::Verifiable; + 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 = 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_OUTBOUND_DELEGATE_MSG_TYPE: [OutboundDelegateMsgType; 7] = [ + OutboundDelegateMsgType::NONE, + OutboundDelegateMsgType::common_ApplicationMessage, + OutboundDelegateMsgType::RequestUserInput, + OutboundDelegateMsgType::ContextUpdated, + OutboundDelegateMsgType::common_GetSecretRequest, + OutboundDelegateMsgType::SetSecretRequest, + OutboundDelegateMsgType::common_GetSecretResponse, + ]; + + #[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 common_GetSecretRequest: Self = Self(4); + pub const SetSecretRequest: Self = Self(5); + pub const common_GetSecretResponse: Self = Self(6); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 6; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::common_ApplicationMessage, + Self::RequestUserInput, + Self::ContextUpdated, + Self::common_GetSecretRequest, + Self::SetSecretRequest, + Self::common_GetSecretResponse, + ]; + /// Returns the variant's name or "" if unknown. + 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"), + Self::common_GetSecretRequest => Some("common_GetSecretRequest"), + Self::SetSecretRequest => Some("SetSecretRequest"), + Self::common_GetSecretResponse => Some("common_GetSecretResponse"), + _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for OutboundDelegateMsgType { + type Output = OutboundDelegateMsgType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(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> { + use self::flatbuffers::Verifiable; + 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 = 5; + #[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; 6] = [ + HostResponseType::NONE, + HostResponseType::ContractResponse, + HostResponseType::DelegateResponse, + HostResponseType::GenerateRandData, + HostResponseType::Ok, + HostResponseType::Error, + ]; + + #[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 ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 5; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::ContractResponse, + Self::DelegateResponse, + Self::GenerateRandData, + Self::Ok, + Self::Error, + ]; + /// Returns the variant's name or "" if unknown. + 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"), + _ => 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!("", 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 = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } + } + + impl flatbuffers::Push for HostResponseType { + type Output = HostResponseType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(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> { + use self::flatbuffers::Verifiable; + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GetResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + GetResponse::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn contract(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + GetResponse::VT_CONTRACT, + None, + ) + } + } + #[inline] + pub fn state(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GetResponse::VT_STATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for GetResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>( + "contract", + Self::VT_CONTRACT, + false, + )? + .visit_field::>>( + "state", + Self::VT_STATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct GetResponseArgs<'a> { + pub key: Option>>, + pub contract: Option>>, + pub state: Option>>, + } + impl<'a> Default for GetResponseArgs<'a> { + #[inline] + fn default() -> Self { + GetResponseArgs { + key: None, // required field + contract: None, + state: None, // required field + } + } + } + + pub struct GetResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GetResponseBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + GetResponse::VT_KEY, + key, + ); + } + #[inline] + pub fn add_contract( + &mut self, + contract: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + GetResponse::VT_CONTRACT, + contract, + ); + } + #[inline] + pub fn add_state(&mut self, state: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(GetResponse::VT_STATE, state); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GetResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + GetResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args PutResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + PutResponse::VT_KEY, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for PutResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .finish(); + Ok(()) + } + } + pub struct PutResponseArgs<'a> { + pub key: Option>>, + } + impl<'a> Default for PutResponseArgs<'a> { + #[inline] + fn default() -> Self { + PutResponseArgs { + key: None, // required field + } + } + } + + pub struct PutResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> PutResponseBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + PutResponse::VT_KEY, + key, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PutResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + PutResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UpdateNotificationArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + UpdateNotification::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn update(&self) -> super::common::UpdateData<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + UpdateNotification::VT_UPDATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for UpdateNotification<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>( + "update", + Self::VT_UPDATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct UpdateNotificationArgs<'a> { + pub key: Option>>, + pub update: Option>>, + } + impl<'a> Default for UpdateNotificationArgs<'a> { + #[inline] + fn default() -> Self { + UpdateNotificationArgs { + key: None, // required field + update: None, // required field + } + } + } + + pub struct UpdateNotificationBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UpdateNotificationBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + UpdateNotification::VT_KEY, + key, + ); + } + #[inline] + pub fn add_update( + &mut self, + update: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>( + UpdateNotification::VT_UPDATE, + update, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> UpdateNotificationBuilder<'a, 'b> { + let start = _fbb.start_table(); + UpdateNotificationBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UpdateResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + UpdateResponse::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn summary(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + UpdateResponse::VT_SUMMARY, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for UpdateResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "summary", + Self::VT_SUMMARY, + true, + )? + .finish(); + Ok(()) + } + } + pub struct UpdateResponseArgs<'a> { + pub key: Option>>, + pub summary: Option>>, + } + impl<'a> Default for UpdateResponseArgs<'a> { + #[inline] + fn default() -> Self { + UpdateResponseArgs { + key: None, // required field + summary: None, // required field + } + } + } + + pub struct UpdateResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UpdateResponseBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + UpdateResponse::VT_KEY, + key, + ); + } + #[inline] + pub fn add_summary( + &mut self, + summary: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>(UpdateResponse::VT_SUMMARY, summary); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> UpdateResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + UpdateResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContractResponseArgs, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + ContractResponse::VT_CONTRACT_RESPONSE_TYPE, + Some(ContractResponseType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn contract_response(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContractResponse::VT_CONTRACT_RESPONSE, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn contract_response_as_get_response(&self) -> Option> { + if self.contract_response_type() == ContractResponseType::GetResponse { + let u = self.contract_response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { GetResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_response_as_put_response(&self) -> Option> { + if self.contract_response_type() == ContractResponseType::PutResponse { + let u = self.contract_response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { PutResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_response_as_update_notification(&self) -> Option> { + if self.contract_response_type() == ContractResponseType::UpdateNotification { + let u = self.contract_response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { UpdateNotification::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn contract_response_as_update_response(&self) -> Option> { + if self.contract_response_type() == ContractResponseType::UpdateResponse { + let u = self.contract_response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { UpdateResponse::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for ContractResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? .visit_union::("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::>("ContractResponseType::GetResponse", pos), @@ -916,1753 +1113,2208 @@ impl flatbuffers::Verifiable for ContractResponse<'_> { } })? .finish(); - Ok(()) - } -} -pub struct ContractResponseArgs { - pub contract_response_type: ContractResponseType, - pub contract_response: Option>, -} -impl<'a> Default for ContractResponseArgs { - #[inline] - fn default() -> Self { - ContractResponseArgs { - contract_response_type: ContractResponseType::NONE, - contract_response: None, // required field - } - } -} - -pub struct ContractResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContractResponseBuilder<'a, 'b> { - #[inline] - pub fn add_contract_response_type(&mut self, contract_response_type: ContractResponseType) { - self.fbb_.push_slot::(ContractResponse::VT_CONTRACT_RESPONSE_TYPE, contract_response_type, ContractResponseType::NONE); - } - #[inline] - pub fn add_contract_response(&mut self, contract_response: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(ContractResponse::VT_CONTRACT_RESPONSE, contract_response); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContractResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContractResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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.") - } - }, - _ => { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateKeyArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateKey::VT_KEY, None).unwrap()} - } - #[inline] - pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DelegateKey::VT_CODE_HASH, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DelegateKey<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("key", Self::VT_KEY, true)? - .visit_field::>>("code_hash", Self::VT_CODE_HASH, true)? - .finish(); - Ok(()) - } -} -pub struct DelegateKeyArgs<'a> { - pub key: Option>>, - pub code_hash: Option>>, -} -impl<'a> Default for DelegateKeyArgs<'a> { - #[inline] - fn default() -> Self { - DelegateKeyArgs { - key: None, // required field - code_hash: None, // required field - } - } -} - -pub struct DelegateKeyBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateKeyBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateKey::VT_KEY, key); - } - #[inline] - pub fn add_code_hash(&mut self, code_hash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateKey::VT_CODE_HASH, code_hash); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateKeyBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateKeyBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args UserInputRequestArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UserInputRequest::VT_REQUEST_ID, Some(0)).unwrap()} - } - #[inline] - pub fn message(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(UserInputRequest::VT_MESSAGE, None).unwrap()} - } - #[inline] - pub fn responses(&self) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(UserInputRequest::VT_RESPONSES, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for UserInputRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("request_id", Self::VT_REQUEST_ID, false)? - .visit_field::>>("message", Self::VT_MESSAGE, true)? - .visit_field::>>>("responses", Self::VT_RESPONSES, true)? - .finish(); - Ok(()) - } -} -pub struct UserInputRequestArgs<'a> { - pub request_id: u32, - pub message: Option>>, - pub responses: Option>>>>, -} -impl<'a> Default for UserInputRequestArgs<'a> { - #[inline] - fn default() -> Self { - UserInputRequestArgs { - request_id: 0, - message: None, // required field - responses: None, // required field - } - } -} - -pub struct UserInputRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> UserInputRequestBuilder<'a, 'b> { - #[inline] - pub fn add_request_id(&mut self, request_id: u32) { - self.fbb_.push_slot::(UserInputRequest::VT_REQUEST_ID, request_id, 0); - } - #[inline] - pub fn add_message(&mut self, message: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(UserInputRequest::VT_MESSAGE, message); - } - #[inline] - pub fn add_responses(&mut self, responses: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(UserInputRequest::VT_RESPONSES, responses); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> UserInputRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - UserInputRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ClientResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ClientResponseBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - builder.finish() - } - - - #[inline] - pub fn data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ClientResponse::VT_DATA, None)} - } -} - -impl flatbuffers::Verifiable for ClientResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("data", Self::VT_DATA, false)? - .finish(); - Ok(()) - } -} -pub struct ClientResponseArgs<'a> { - pub data: Option>>, -} -impl<'a> Default for ClientResponseArgs<'a> { - #[inline] - fn default() -> Self { - ClientResponseArgs { - data: None, - } - } -} - -pub struct ClientResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ClientResponseBuilder<'a, 'b> { - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ClientResponse::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ClientResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - ClientResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RequestUserInputArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(RequestUserInput::VT_REQUEST_ID, Some(0)).unwrap()} - } - #[inline] - pub fn message(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(RequestUserInput::VT_MESSAGE, None)} - } - #[inline] - pub fn responses(&self) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(RequestUserInput::VT_RESPONSES, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for RequestUserInput<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("request_id", Self::VT_REQUEST_ID, false)? - .visit_field::>>("message", Self::VT_MESSAGE, false)? - .visit_field::>>>("responses", Self::VT_RESPONSES, true)? - .finish(); - Ok(()) - } -} -pub struct RequestUserInputArgs<'a> { - pub request_id: u32, - pub message: Option>>, - pub responses: Option>>>>, -} -impl<'a> Default for RequestUserInputArgs<'a> { - #[inline] - fn default() -> Self { - RequestUserInputArgs { - request_id: 0, - message: None, - responses: None, // required field - } - } -} - -pub struct RequestUserInputBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> RequestUserInputBuilder<'a, 'b> { - #[inline] - pub fn add_request_id(&mut self, request_id: u32) { - self.fbb_.push_slot::(RequestUserInput::VT_REQUEST_ID, request_id, 0); - } - #[inline] - pub fn add_message(&mut self, message: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(RequestUserInput::VT_MESSAGE, message); - } - #[inline] - pub fn add_responses(&mut self, responses: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(RequestUserInput::VT_RESPONSES, responses); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RequestUserInputBuilder<'a, 'b> { - let start = _fbb.start_table(); - RequestUserInputBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ContextUpdatedArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ContextUpdated::VT_CONTEXT, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for ContextUpdated<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("context", Self::VT_CONTEXT, true)? - .finish(); - Ok(()) - } -} -pub struct ContextUpdatedArgs<'a> { - pub context: Option>>, -} -impl<'a> Default for ContextUpdatedArgs<'a> { - #[inline] - fn default() -> Self { - ContextUpdatedArgs { - context: None, // required field - } - } -} - -pub struct ContextUpdatedBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ContextUpdatedBuilder<'a, 'b> { - #[inline] - pub fn add_context(&mut self, context: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ContextUpdated::VT_CONTEXT, context); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ContextUpdatedBuilder<'a, 'b> { - let start = _fbb.start_table(); - ContextUpdatedBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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 SetSecretRequestOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SetSecretRequest<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SetSecretRequest<'a> { - type Inner = SetSecretRequest<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SetSecretRequest<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SetSecretRequest { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args SetSecretRequestArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SetSecretRequestBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> super::common::SecretsId<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SetSecretRequest::VT_KEY, None).unwrap()} - } - #[inline] - pub fn value(&self) -> flatbuffers::Vector<'a, u8> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(SetSecretRequest::VT_VALUE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for SetSecretRequest<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>("value", Self::VT_VALUE, true)? - .finish(); - Ok(()) - } -} -pub struct SetSecretRequestArgs<'a> { - pub key: Option>>, - pub value: Option>>, -} -impl<'a> Default for SetSecretRequestArgs<'a> { - #[inline] - fn default() -> Self { - SetSecretRequestArgs { - key: None, // required field - value: None, // required field - } - } -} - -pub struct SetSecretRequestBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> SetSecretRequestBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SetSecretRequest::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SetSecretRequest::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SetSecretRequestBuilder<'a, 'b> { - let start = _fbb.start_table(); - SetSecretRequestBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, SetSecretRequest::VT_KEY,"key"); - self.fbb_.required(o, SetSecretRequest::VT_VALUE,"value"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SetSecretRequest<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SetSecretRequest"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args OutboundDelegateMsgArgs - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(OutboundDelegateMsg::VT_INBOUND_TYPE, Some(OutboundDelegateMsgType::NONE)).unwrap()} - } - #[inline] - pub fn inbound(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(OutboundDelegateMsg::VT_INBOUND, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_application_message(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::common_ApplicationMessage { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - 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> { - if self.inbound_type() == OutboundDelegateMsgType::RequestUserInput { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { RequestUserInput::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_context_updated(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::ContextUpdated { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { ContextUpdated::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_request(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_set_secret_request(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::SetSecretRequest { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { SetSecretRequest::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn inbound_as_common_get_secret_response(&self) -> Option> { - if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretResponse { - let u = self.inbound(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for OutboundDelegateMsg<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| { - match key { - OutboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::>("OutboundDelegateMsgType::common_ApplicationMessage", pos), - OutboundDelegateMsgType::RequestUserInput => v.verify_union_variant::>("OutboundDelegateMsgType::RequestUserInput", pos), - OutboundDelegateMsgType::ContextUpdated => v.verify_union_variant::>("OutboundDelegateMsgType::ContextUpdated", pos), - OutboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::>("OutboundDelegateMsgType::common_GetSecretRequest", pos), - OutboundDelegateMsgType::SetSecretRequest => v.verify_union_variant::>("OutboundDelegateMsgType::SetSecretRequest", pos), - OutboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::>("OutboundDelegateMsgType::common_GetSecretResponse", pos), - _ => Ok(()), + Ok(()) } - })? - .finish(); - Ok(()) - } -} -pub struct OutboundDelegateMsgArgs { - pub inbound_type: OutboundDelegateMsgType, - pub inbound: Option>, -} -impl<'a> Default for OutboundDelegateMsgArgs { - #[inline] - fn default() -> Self { - OutboundDelegateMsgArgs { - inbound_type: OutboundDelegateMsgType::NONE, - inbound: None, // required field - } - } -} - -pub struct OutboundDelegateMsgBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> OutboundDelegateMsgBuilder<'a, 'b> { - #[inline] - pub fn add_inbound_type(&mut self, inbound_type: OutboundDelegateMsgType) { - self.fbb_.push_slot::(OutboundDelegateMsg::VT_INBOUND_TYPE, inbound_type, OutboundDelegateMsgType::NONE); - } - #[inline] - pub fn add_inbound(&mut self, inbound: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(OutboundDelegateMsg::VT_INBOUND, inbound); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> OutboundDelegateMsgBuilder<'a, 'b> { - let start = _fbb.start_table(); - OutboundDelegateMsgBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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.") - } - }, - OutboundDelegateMsgType::common_GetSecretRequest => { - if let Some(x) = self.inbound_as_common_get_secret_request() { - ds.field("inbound", &x) - } else { - ds.field("inbound", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - OutboundDelegateMsgType::SetSecretRequest => { - if let Some(x) = self.inbound_as_set_secret_request() { - ds.field("inbound", &x) - } else { - ds.field("inbound", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - OutboundDelegateMsgType::common_GetSecretResponse => { - if let Some(x) = self.inbound_as_common_get_secret_response() { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args DelegateResponseArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DelegateResponse::VT_KEY, None).unwrap()} - } - #[inline] - pub fn values(&self) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DelegateResponse::VT_VALUES, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for DelegateResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>>>("values", Self::VT_VALUES, true)? - .finish(); - Ok(()) - } -} -pub struct DelegateResponseArgs<'a> { - pub key: Option>>, - pub values: Option>>>>, -} -impl<'a> Default for DelegateResponseArgs<'a> { - #[inline] - fn default() -> Self { - DelegateResponseArgs { - key: None, // required field - values: None, // required field - } - } -} - -pub struct DelegateResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> DelegateResponseBuilder<'a, 'b> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DelegateResponse::VT_KEY, key); - } - #[inline] - pub fn add_values(&mut self, values: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DelegateResponse::VT_VALUES, values); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - DelegateResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args GenerateRandDataArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GenerateRandData::VT_WRAPPED_STATE, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for GenerateRandData<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("wrapped_state", Self::VT_WRAPPED_STATE, true)? - .finish(); - Ok(()) - } -} -pub struct GenerateRandDataArgs<'a> { - pub wrapped_state: Option>>, -} -impl<'a> Default for GenerateRandDataArgs<'a> { - #[inline] - fn default() -> Self { - GenerateRandDataArgs { - wrapped_state: None, // required field - } - } -} - -pub struct GenerateRandDataBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> GenerateRandDataBuilder<'a, 'b> { - #[inline] - pub fn add_wrapped_state(&mut self, wrapped_state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GenerateRandData::VT_WRAPPED_STATE, wrapped_state); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GenerateRandDataBuilder<'a, 'b> { - let start = _fbb.start_table(); - GenerateRandDataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args OkArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Ok::VT_MSG, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for Ok<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("msg", Self::VT_MSG, true)? - .finish(); - Ok(()) - } -} -pub struct OkArgs<'a> { - pub msg: Option>, -} -impl<'a> Default for OkArgs<'a> { - #[inline] - fn default() -> Self { - OkArgs { - msg: None, // required field - } - } -} - -pub struct OkBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> OkBuilder<'a, 'b> { - #[inline] - pub fn add_msg(&mut self, msg: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Ok::VT_MSG, msg); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> OkBuilder<'a, 'b> { - let start = _fbb.start_table(); - OkBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args ErrorArgs<'args> - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Error::VT_MSG, None).unwrap()} - } -} - -impl flatbuffers::Verifiable for Error<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("msg", Self::VT_MSG, true)? - .finish(); - Ok(()) - } -} -pub struct ErrorArgs<'a> { - pub msg: Option>, -} -impl<'a> Default for ErrorArgs<'a> { - #[inline] - fn default() -> Self { - ErrorArgs { - msg: None, // required field - } - } -} - -pub struct ErrorBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> ErrorBuilder<'a, 'b> { - #[inline] - pub fn add_msg(&mut self, msg: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Error::VT_MSG, msg); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ErrorBuilder<'a, 'b> { - let start = _fbb.start_table(); - ErrorBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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: 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>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args HostResponseArgs - ) -> flatbuffers::WIPOffset> { - 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 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(HostResponse::VT_RESPONSE_TYPE, Some(HostResponseType::NONE)).unwrap()} - } - #[inline] - pub fn response(&self) -> flatbuffers::Table<'a> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(HostResponse::VT_RESPONSE, None).unwrap()} - } - #[inline] - #[allow(non_snake_case)] - pub fn response_as_contract_response(&self) -> Option> { - if self.response_type() == HostResponseType::ContractResponse { - let u = self.response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { ContractResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn response_as_delegate_response(&self) -> Option> { - if self.response_type() == HostResponseType::DelegateResponse { - let u = self.response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { DelegateResponse::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn response_as_generate_rand_data(&self) -> Option> { - if self.response_type() == HostResponseType::GenerateRandData { - let u = self.response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { GenerateRandData::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn response_as_ok(&self) -> Option> { - if self.response_type() == HostResponseType::Ok { - let u = self.response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Ok::init_from_table(u) }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn response_as_error(&self) -> Option> { - if self.response_type() == HostResponseType::Error { - let u = self.response(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - Some(unsafe { Error::init_from_table(u) }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for HostResponse<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("response_type", Self::VT_RESPONSE_TYPE, "response", Self::VT_RESPONSE, true, |key, v, pos| { - match key { - HostResponseType::ContractResponse => v.verify_union_variant::>("HostResponseType::ContractResponse", pos), - HostResponseType::DelegateResponse => v.verify_union_variant::>("HostResponseType::DelegateResponse", pos), - HostResponseType::GenerateRandData => v.verify_union_variant::>("HostResponseType::GenerateRandData", pos), - HostResponseType::Ok => v.verify_union_variant::>("HostResponseType::Ok", pos), - HostResponseType::Error => v.verify_union_variant::>("HostResponseType::Error", pos), - _ => Ok(()), + } + pub struct ContractResponseArgs { + pub contract_response_type: ContractResponseType, + pub contract_response: Option>, + } + impl<'a> Default for ContractResponseArgs { + #[inline] + fn default() -> Self { + ContractResponseArgs { + contract_response_type: ContractResponseType::NONE, + contract_response: None, // required field + } } - })? - .finish(); - Ok(()) - } -} -pub struct HostResponseArgs { - pub response_type: HostResponseType, - pub response: Option>, -} -impl<'a> Default for HostResponseArgs { - #[inline] - fn default() -> Self { - HostResponseArgs { - response_type: HostResponseType::NONE, - response: None, // required field - } - } -} - -pub struct HostResponseBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b> HostResponseBuilder<'a, 'b> { - #[inline] - pub fn add_response_type(&mut self, response_type: HostResponseType) { - self.fbb_.push_slot::(HostResponse::VT_RESPONSE_TYPE, response_type, HostResponseType::NONE); - } - #[inline] - pub fn add_response(&mut self, response: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(HostResponse::VT_RESPONSE, response); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> HostResponseBuilder<'a, 'b> { - let start = _fbb.start_table(); - HostResponseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - 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.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("response", &x) - }, - }; - ds.finish() - } -} -#[inline] -/// Verifies that a buffer of bytes contains a `HostResponse` -/// and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_host_response_unchecked`. -pub fn root_as_host_response(buf: &[u8]) -> Result { - flatbuffers::root::(buf) -} -#[inline] -/// Verifies that a buffer of bytes contains a size prefixed -/// `HostResponse` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `size_prefixed_root_as_host_response_unchecked`. -pub fn size_prefixed_root_as_host_response(buf: &[u8]) -> Result { - flatbuffers::size_prefixed_root::(buf) -} -#[inline] -/// Verifies, with the given options, that a buffer of bytes -/// contains a `HostResponse` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_host_response_unchecked`. -pub fn root_as_host_response_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) -} -#[inline] -/// Verifies, with the given verifier options, that a buffer of -/// bytes contains a size prefixed `HostResponse` and returns -/// it. Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_host_response_unchecked`. -pub fn size_prefixed_root_as_host_response_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a HostResponse and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid `HostResponse`. -pub unsafe fn root_as_host_response_unchecked(buf: &[u8]) -> HostResponse { - flatbuffers::root_unchecked::(buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a size prefixed HostResponse and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid size prefixed `HostResponse`. -pub unsafe fn size_prefixed_root_as_host_response_unchecked(buf: &[u8]) -> HostResponse { - flatbuffers::size_prefixed_root_unchecked::(buf) -} -#[inline] -pub fn finish_host_response_buffer<'a, 'b>( - fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); -} - -#[inline] -pub fn finish_size_prefixed_host_response_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); -} -} // pub mod host_response + } + + pub struct ContractResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContractResponseBuilder<'a, 'b> { + #[inline] + pub fn add_contract_response_type(&mut self, contract_response_type: ContractResponseType) { + self.fbb_.push_slot::( + ContractResponse::VT_CONTRACT_RESPONSE_TYPE, + contract_response_type, + ContractResponseType::NONE, + ); + } + #[inline] + pub fn add_contract_response( + &mut self, + contract_response: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + ContractResponse::VT_CONTRACT_RESPONSE, + contract_response, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContractResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContractResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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.", + ) + } + } + _ => { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateKeyArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateKey::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn code_hash(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + DelegateKey::VT_CODE_HASH, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DelegateKey<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "code_hash", + Self::VT_CODE_HASH, + true, + )? + .finish(); + Ok(()) + } + } + pub struct DelegateKeyArgs<'a> { + pub key: Option>>, + pub code_hash: Option>>, + } + impl<'a> Default for DelegateKeyArgs<'a> { + #[inline] + fn default() -> Self { + DelegateKeyArgs { + key: None, // required field + code_hash: None, // required field + } + } + } + pub struct DelegateKeyBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateKeyBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(DelegateKey::VT_KEY, key); + } + #[inline] + pub fn add_code_hash( + &mut self, + code_hash: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + DelegateKey::VT_CODE_HASH, + code_hash, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> DelegateKeyBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateKeyBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args UserInputRequestArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(UserInputRequest::VT_REQUEST_ID, Some(0)) + .unwrap() + } + } + #[inline] + pub fn message(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + UserInputRequest::VT_MESSAGE, + None, + ) + .unwrap() + } + } + #[inline] + pub fn responses( + &self, + ) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>, + >>(UserInputRequest::VT_RESPONSES, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for UserInputRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("request_id", Self::VT_REQUEST_ID, false)? + .visit_field::>>( + "message", + Self::VT_MESSAGE, + true, + )? + .visit_field::>, + >>("responses", Self::VT_RESPONSES, true)? + .finish(); + Ok(()) + } + } + pub struct UserInputRequestArgs<'a> { + pub request_id: u32, + pub message: Option>>, + pub responses: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + } + impl<'a> Default for UserInputRequestArgs<'a> { + #[inline] + fn default() -> Self { + UserInputRequestArgs { + request_id: 0, + message: None, // required field + responses: None, // required field + } + } + } + + pub struct UserInputRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> UserInputRequestBuilder<'a, 'b> { + #[inline] + pub fn add_request_id(&mut self, request_id: u32) { + self.fbb_ + .push_slot::(UserInputRequest::VT_REQUEST_ID, request_id, 0); + } + #[inline] + pub fn add_message( + &mut self, + message: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + UserInputRequest::VT_MESSAGE, + message, + ); + } + #[inline] + pub fn add_responses( + &mut self, + responses: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + UserInputRequest::VT_RESPONSES, + responses, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> UserInputRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + UserInputRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ClientResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = ClientResponseBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + builder.finish() + } + + #[inline] + pub fn data(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ClientResponse::VT_DATA, + None, + ) + } + } + } + + impl flatbuffers::Verifiable for ClientResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "data", + Self::VT_DATA, + false, + )? + .finish(); + Ok(()) + } + } + pub struct ClientResponseArgs<'a> { + pub data: Option>>, + } + impl<'a> Default for ClientResponseArgs<'a> { + #[inline] + fn default() -> Self { + ClientResponseArgs { data: None } + } + } + + pub struct ClientResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ClientResponseBuilder<'a, 'b> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(ClientResponse::VT_DATA, data); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ClientResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + ClientResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RequestUserInputArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(RequestUserInput::VT_REQUEST_ID, Some(0)) + .unwrap() + } + } + #[inline] + pub fn message(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + RequestUserInput::VT_MESSAGE, + None, + ) + } + } + #[inline] + pub fn responses( + &self, + ) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>, + >>(RequestUserInput::VT_RESPONSES, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for RequestUserInput<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("request_id", Self::VT_REQUEST_ID, false)? + .visit_field::>>( + "message", + Self::VT_MESSAGE, + false, + )? + .visit_field::>, + >>("responses", Self::VT_RESPONSES, true)? + .finish(); + Ok(()) + } + } + pub struct RequestUserInputArgs<'a> { + pub request_id: u32, + pub message: Option>>, + pub responses: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + } + impl<'a> Default for RequestUserInputArgs<'a> { + #[inline] + fn default() -> Self { + RequestUserInputArgs { + request_id: 0, + message: None, + responses: None, // required field + } + } + } + + pub struct RequestUserInputBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> RequestUserInputBuilder<'a, 'b> { + #[inline] + pub fn add_request_id(&mut self, request_id: u32) { + self.fbb_ + .push_slot::(RequestUserInput::VT_REQUEST_ID, request_id, 0); + } + #[inline] + pub fn add_message( + &mut self, + message: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + RequestUserInput::VT_MESSAGE, + message, + ); + } + #[inline] + pub fn add_responses( + &mut self, + responses: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + RequestUserInput::VT_RESPONSES, + responses, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> RequestUserInputBuilder<'a, 'b> { + let start = _fbb.start_table(); + RequestUserInputBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ContextUpdatedArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + ContextUpdated::VT_CONTEXT, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for ContextUpdated<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "context", + Self::VT_CONTEXT, + true, + )? + .finish(); + Ok(()) + } + } + pub struct ContextUpdatedArgs<'a> { + pub context: Option>>, + } + impl<'a> Default for ContextUpdatedArgs<'a> { + #[inline] + fn default() -> Self { + ContextUpdatedArgs { + context: None, // required field + } + } + } + + pub struct ContextUpdatedBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ContextUpdatedBuilder<'a, 'b> { + #[inline] + pub fn add_context( + &mut self, + context: flatbuffers::WIPOffset>, + ) { + self.fbb_ + .push_slot_always::>(ContextUpdated::VT_CONTEXT, context); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> ContextUpdatedBuilder<'a, 'b> { + let start = _fbb.start_table(); + ContextUpdatedBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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 SetSecretRequestOffset {} + #[derive(Copy, Clone, PartialEq)] + + pub struct SetSecretRequest<'a> { + pub _tab: flatbuffers::Table<'a>, + } + + impl<'a> flatbuffers::Follow<'a> for SetSecretRequest<'a> { + type Inner = SetSecretRequest<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } + } + + impl<'a> SetSecretRequest<'a> { + pub const VT_KEY: flatbuffers::VOffsetT = 4; + pub const VT_VALUE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + SetSecretRequest { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args SetSecretRequestArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = SetSecretRequestBuilder::new(_fbb); + if let Some(x) = args.value { + builder.add_value(x); + } + if let Some(x) = args.key { + builder.add_key(x); + } + builder.finish() + } + + #[inline] + pub fn key(&self) -> super::common::SecretsId<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + SetSecretRequest::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn value(&self) -> flatbuffers::Vector<'a, u8> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + SetSecretRequest::VT_VALUE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for SetSecretRequest<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>>( + "value", + Self::VT_VALUE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct SetSecretRequestArgs<'a> { + pub key: Option>>, + pub value: Option>>, + } + impl<'a> Default for SetSecretRequestArgs<'a> { + #[inline] + fn default() -> Self { + SetSecretRequestArgs { + key: None, // required field + value: None, // required field + } + } + } + + pub struct SetSecretRequestBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> SetSecretRequestBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + SetSecretRequest::VT_KEY, + key, + ); + } + #[inline] + pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(SetSecretRequest::VT_VALUE, value); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> SetSecretRequestBuilder<'a, 'b> { + let start = _fbb.start_table(); + SetSecretRequestBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + self.fbb_.required(o, SetSecretRequest::VT_KEY, "key"); + self.fbb_.required(o, SetSecretRequest::VT_VALUE, "value"); + flatbuffers::WIPOffset::new(o.value()) + } + } + + impl core::fmt::Debug for SetSecretRequest<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("SetSecretRequest"); + ds.field("key", &self.key()); + ds.field("value", &self.value()); + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args OutboundDelegateMsgArgs, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + OutboundDelegateMsg::VT_INBOUND_TYPE, + Some(OutboundDelegateMsgType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn inbound(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + OutboundDelegateMsg::VT_INBOUND, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_application_message( + &self, + ) -> Option> { + if self.inbound_type() == OutboundDelegateMsgType::common_ApplicationMessage { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + 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> { + if self.inbound_type() == OutboundDelegateMsgType::RequestUserInput { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { RequestUserInput::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_context_updated(&self) -> Option> { + if self.inbound_type() == OutboundDelegateMsgType::ContextUpdated { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { ContextUpdated::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_get_secret_request( + &self, + ) -> Option> { + if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretRequest { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { super::common::GetSecretRequest::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_set_secret_request(&self) -> Option> { + if self.inbound_type() == OutboundDelegateMsgType::SetSecretRequest { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { SetSecretRequest::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn inbound_as_common_get_secret_response( + &self, + ) -> Option> { + if self.inbound_type() == OutboundDelegateMsgType::common_GetSecretResponse { + let u = self.inbound(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { super::common::GetSecretResponse::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for OutboundDelegateMsg<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("inbound_type", Self::VT_INBOUND_TYPE, "inbound", Self::VT_INBOUND, true, |key, v, pos| { + match key { + OutboundDelegateMsgType::common_ApplicationMessage => v.verify_union_variant::>("OutboundDelegateMsgType::common_ApplicationMessage", pos), + OutboundDelegateMsgType::RequestUserInput => v.verify_union_variant::>("OutboundDelegateMsgType::RequestUserInput", pos), + OutboundDelegateMsgType::ContextUpdated => v.verify_union_variant::>("OutboundDelegateMsgType::ContextUpdated", pos), + OutboundDelegateMsgType::common_GetSecretRequest => v.verify_union_variant::>("OutboundDelegateMsgType::common_GetSecretRequest", pos), + OutboundDelegateMsgType::SetSecretRequest => v.verify_union_variant::>("OutboundDelegateMsgType::SetSecretRequest", pos), + OutboundDelegateMsgType::common_GetSecretResponse => v.verify_union_variant::>("OutboundDelegateMsgType::common_GetSecretResponse", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } + } + pub struct OutboundDelegateMsgArgs { + pub inbound_type: OutboundDelegateMsgType, + pub inbound: Option>, + } + impl<'a> Default for OutboundDelegateMsgArgs { + #[inline] + fn default() -> Self { + OutboundDelegateMsgArgs { + inbound_type: OutboundDelegateMsgType::NONE, + inbound: None, // required field + } + } + } + + pub struct OutboundDelegateMsgBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> OutboundDelegateMsgBuilder<'a, 'b> { + #[inline] + pub fn add_inbound_type(&mut self, inbound_type: OutboundDelegateMsgType) { + self.fbb_.push_slot::( + OutboundDelegateMsg::VT_INBOUND_TYPE, + inbound_type, + OutboundDelegateMsgType::NONE, + ); + } + #[inline] + pub fn add_inbound( + &mut self, + inbound: flatbuffers::WIPOffset, + ) { + self.fbb_.push_slot_always::>( + OutboundDelegateMsg::VT_INBOUND, + inbound, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> OutboundDelegateMsgBuilder<'a, 'b> { + let start = _fbb.start_table(); + OutboundDelegateMsgBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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.", + ) + } + } + OutboundDelegateMsgType::common_GetSecretRequest => { + if let Some(x) = self.inbound_as_common_get_secret_request() { + ds.field("inbound", &x) + } else { + ds.field( + "inbound", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + OutboundDelegateMsgType::SetSecretRequest => { + if let Some(x) = self.inbound_as_set_secret_request() { + ds.field("inbound", &x) + } else { + ds.field( + "inbound", + &"InvalidFlatbuffer: Union discriminant does not match value.", + ) + } + } + OutboundDelegateMsgType::common_GetSecretResponse => { + if let Some(x) = self.inbound_as_common_get_secret_response() { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args DelegateResponseArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>( + DelegateResponse::VT_KEY, + None, + ) + .unwrap() + } + } + #[inline] + pub fn values( + &self, + ) -> flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>> + { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>, + >>(DelegateResponse::VT_VALUES, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for DelegateResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>( + "key", + Self::VT_KEY, + true, + )? + .visit_field::>, + >>("values", Self::VT_VALUES, true)? + .finish(); + Ok(()) + } + } + pub struct DelegateResponseArgs<'a> { + pub key: Option>>, + pub values: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + } + impl<'a> Default for DelegateResponseArgs<'a> { + #[inline] + fn default() -> Self { + DelegateResponseArgs { + key: None, // required field + values: None, // required field + } + } + } + + pub struct DelegateResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> DelegateResponseBuilder<'a, 'b> { + #[inline] + pub fn add_key(&mut self, key: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>( + DelegateResponse::VT_KEY, + key, + ); + } + #[inline] + pub fn add_values( + &mut self, + values: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_ + .push_slot_always::>(DelegateResponse::VT_VALUES, values); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> DelegateResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + DelegateResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GenerateRandDataArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + GenerateRandData::VT_WRAPPED_STATE, + None, + ) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for GenerateRandData<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "wrapped_state", + Self::VT_WRAPPED_STATE, + true, + )? + .finish(); + Ok(()) + } + } + pub struct GenerateRandDataArgs<'a> { + pub wrapped_state: Option>>, + } + impl<'a> Default for GenerateRandDataArgs<'a> { + #[inline] + fn default() -> Self { + GenerateRandDataArgs { + wrapped_state: None, // required field + } + } + } + + pub struct GenerateRandDataBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> GenerateRandDataBuilder<'a, 'b> { + #[inline] + pub fn add_wrapped_state( + &mut self, + wrapped_state: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + GenerateRandData::VT_WRAPPED_STATE, + wrapped_state, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> GenerateRandDataBuilder<'a, 'b> { + let start = _fbb.start_table(); + GenerateRandDataBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args OkArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(Ok::VT_MSG, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Ok<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("msg", Self::VT_MSG, true)? + .finish(); + Ok(()) + } + } + pub struct OkArgs<'a> { + pub msg: Option>, + } + impl<'a> Default for OkArgs<'a> { + #[inline] + fn default() -> Self { + OkArgs { + msg: None, // required field + } + } + } + + pub struct OkBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> OkBuilder<'a, 'b> { + #[inline] + pub fn add_msg(&mut self, msg: flatbuffers::WIPOffset<&'b str>) { + self.fbb_ + .push_slot_always::>(Ok::VT_MSG, msg); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> OkBuilder<'a, 'b> { + let start = _fbb.start_table(); + OkBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args ErrorArgs<'args>, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(Error::VT_MSG, None) + .unwrap() + } + } + } + + impl flatbuffers::Verifiable for Error<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("msg", Self::VT_MSG, true)? + .finish(); + Ok(()) + } + } + pub struct ErrorArgs<'a> { + pub msg: Option>, + } + impl<'a> Default for ErrorArgs<'a> { + #[inline] + fn default() -> Self { + ErrorArgs { + msg: None, // required field + } + } + } + + pub struct ErrorBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> ErrorBuilder<'a, 'b> { + #[inline] + pub fn add_msg(&mut self, msg: flatbuffers::WIPOffset<&'b str>) { + self.fbb_ + .push_slot_always::>(Error::VT_MSG, msg); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ErrorBuilder<'a, 'b> { + let start = _fbb.start_table(); + ErrorBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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: 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>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args HostResponseArgs, + ) -> flatbuffers::WIPOffset> { + 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 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::( + HostResponse::VT_RESPONSE_TYPE, + Some(HostResponseType::NONE), + ) + .unwrap() + } + } + #[inline] + pub fn response(&self) -> flatbuffers::Table<'a> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + HostResponse::VT_RESPONSE, + None, + ) + .unwrap() + } + } + #[inline] + #[allow(non_snake_case)] + pub fn response_as_contract_response(&self) -> Option> { + if self.response_type() == HostResponseType::ContractResponse { + let u = self.response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { ContractResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn response_as_delegate_response(&self) -> Option> { + if self.response_type() == HostResponseType::DelegateResponse { + let u = self.response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { DelegateResponse::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn response_as_generate_rand_data(&self) -> Option> { + if self.response_type() == HostResponseType::GenerateRandData { + let u = self.response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { GenerateRandData::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn response_as_ok(&self) -> Option> { + if self.response_type() == HostResponseType::Ok { + let u = self.response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Ok::init_from_table(u) }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn response_as_error(&self) -> Option> { + if self.response_type() == HostResponseType::Error { + let u = self.response(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + Some(unsafe { Error::init_from_table(u) }) + } else { + None + } + } + } + + impl flatbuffers::Verifiable for HostResponse<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::( + "response_type", + Self::VT_RESPONSE_TYPE, + "response", + Self::VT_RESPONSE, + true, + |key, v, pos| match key { + HostResponseType::ContractResponse => v + .verify_union_variant::>( + "HostResponseType::ContractResponse", + pos, + ), + HostResponseType::DelegateResponse => v + .verify_union_variant::>( + "HostResponseType::DelegateResponse", + pos, + ), + HostResponseType::GenerateRandData => v + .verify_union_variant::>( + "HostResponseType::GenerateRandData", + pos, + ), + HostResponseType::Ok => v + .verify_union_variant::>( + "HostResponseType::Ok", + pos, + ), + HostResponseType::Error => v + .verify_union_variant::>( + "HostResponseType::Error", + pos, + ), + _ => Ok(()), + }, + )? + .finish(); + Ok(()) + } + } + pub struct HostResponseArgs { + pub response_type: HostResponseType, + pub response: Option>, + } + impl<'a> Default for HostResponseArgs { + #[inline] + fn default() -> Self { + HostResponseArgs { + response_type: HostResponseType::NONE, + response: None, // required field + } + } + } + + pub struct HostResponseBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, + } + impl<'a: 'b, 'b> HostResponseBuilder<'a, 'b> { + #[inline] + pub fn add_response_type(&mut self, response_type: HostResponseType) { + self.fbb_.push_slot::( + HostResponse::VT_RESPONSE_TYPE, + response_type, + HostResponseType::NONE, + ); + } + #[inline] + pub fn add_response( + &mut self, + response: flatbuffers::WIPOffset, + ) { + self.fbb_ + .push_slot_always::>(HostResponse::VT_RESPONSE, response); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> HostResponseBuilder<'a, 'b> { + let start = _fbb.start_table(); + HostResponseBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + 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.", + ) + } + } + _ => { + let x: Option<()> = None; + ds.field("response", &x) + } + }; + ds.finish() + } + } + #[inline] + /// Verifies that a buffer of bytes contains a `HostResponse` + /// and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_host_response_unchecked`. + pub fn root_as_host_response( + buf: &[u8], + ) -> Result { + flatbuffers::root::(buf) + } + #[inline] + /// Verifies that a buffer of bytes contains a size prefixed + /// `HostResponse` and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `size_prefixed_root_as_host_response_unchecked`. + pub fn size_prefixed_root_as_host_response( + buf: &[u8], + ) -> Result { + flatbuffers::size_prefixed_root::(buf) + } + #[inline] + /// Verifies, with the given options, that a buffer of bytes + /// contains a `HostResponse` and returns it. + /// Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_host_response_unchecked`. + pub fn root_as_host_response_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], + ) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::root_with_opts::>(opts, buf) + } + #[inline] + /// Verifies, with the given verifier options, that a buffer of + /// bytes contains a size prefixed `HostResponse` and returns + /// it. Note that verification is still experimental and may not + /// catch every error, or be maximally performant. For the + /// previous, unchecked, behavior use + /// `root_as_host_response_unchecked`. + pub fn size_prefixed_root_as_host_response_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], + ) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + } + #[inline] + /// Assumes, without verification, that a buffer of bytes contains a HostResponse and returns it. + /// # Safety + /// Callers must trust the given bytes do indeed contain a valid `HostResponse`. + pub unsafe fn root_as_host_response_unchecked(buf: &[u8]) -> HostResponse { + flatbuffers::root_unchecked::(buf) + } + #[inline] + /// Assumes, without verification, that a buffer of bytes contains a size prefixed HostResponse and returns it. + /// # Safety + /// Callers must trust the given bytes do indeed contain a valid size prefixed `HostResponse`. + pub unsafe fn size_prefixed_root_as_host_response_unchecked(buf: &[u8]) -> HostResponse { + flatbuffers::size_prefixed_root_unchecked::(buf) + } + #[inline] + pub fn finish_host_response_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, + ) { + fbb.finish(root, None); + } + + #[inline] + pub fn finish_size_prefixed_host_response_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, + ) { + fbb.finish_size_prefixed(root, None); + } +} // pub mod host_response