use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod org {
use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod solana {
use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod sealevel {
use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[allow(unused_imports, dead_code)]
pub mod v_2 {
use core::mem;
use core::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Pubkey(pub [u8; 32]);
impl Default for Pubkey {
fn default() -> Self {
Self([0; 32])
}
}
impl core::fmt::Debug for Pubkey {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Pubkey")
.field("address", &self.address())
.finish()
}
}
impl flatbuffers::SimpleToVerifyInSlice for Pubkey {}
impl<'a> flatbuffers::Follow<'a> for Pubkey {
type Inner = &'a Pubkey;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Pubkey>::follow(buf, loc) }
}
}
impl<'a> flatbuffers::Follow<'a> for &'a Pubkey {
type Inner = &'a Pubkey;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Pubkey>(buf, loc) }
}
}
impl<'b> flatbuffers::Push for Pubkey {
type Output = Pubkey;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Pubkey as *const u8, <Self as flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(1)
}
}
impl<'a> flatbuffers::Verifiable for Pubkey {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos)
}
}
impl<'a> Pubkey {
#[allow(clippy::too_many_arguments)]
pub fn new(
address: &[u8; 32],
) -> Self {
let mut s = Self([0; 32]);
s.set_address(address);
s
}
pub fn address(&'a self) -> flatbuffers::Array<'a, u8, 32> {
unsafe { flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_address(&mut self, items: &[u8; 32]) {
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn unpack(&self) -> PubkeyT {
PubkeyT {
address: self.address().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct PubkeyT {
pub address: [u8; 32],
}
impl std::default::Default for PubkeyT {
fn default() -> Self {
Self {
address: core::array::from_fn(|_| Default::default()),
}
}
}
impl PubkeyT {
pub fn pack(&self) -> Pubkey {
Pubkey::new(
&self.address,
)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Signature(pub [u8; 64]);
impl Default for Signature {
fn default() -> Self {
Self([0; 64])
}
}
impl core::fmt::Debug for Signature {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Signature")
.field("signature", &self.signature())
.finish()
}
}
impl flatbuffers::SimpleToVerifyInSlice for Signature {}
impl<'a> flatbuffers::Follow<'a> for Signature {
type Inner = &'a Signature;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Signature>::follow(buf, loc) }
}
}
impl<'a> flatbuffers::Follow<'a> for &'a Signature {
type Inner = &'a Signature;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Signature>(buf, loc) }
}
}
impl<'b> flatbuffers::Push for Signature {
type Output = Signature;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Signature as *const u8, <Self as flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(1)
}
}
impl<'a> flatbuffers::Verifiable for Signature {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos)
}
}
impl<'a> Signature {
#[allow(clippy::too_many_arguments)]
pub fn new(
signature: &[u8; 64],
) -> Self {
let mut s = Self([0; 64]);
s.set_signature(signature);
s
}
pub fn signature(&'a self) -> flatbuffers::Array<'a, u8, 64> {
unsafe { flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_signature(&mut self, items: &[u8; 64]) {
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn unpack(&self) -> SignatureT {
SignatureT {
signature: self.signature().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SignatureT {
pub signature: [u8; 64],
}
impl std::default::Default for SignatureT {
fn default() -> Self {
Self {
signature: core::array::from_fn(|_| Default::default()),
}
}
}
impl SignatureT {
pub fn pack(&self) -> Signature {
Signature::new(
&self.signature,
)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct XXHash(pub [u8; 8]);
impl Default for XXHash {
fn default() -> Self {
Self([0; 8])
}
}
impl core::fmt::Debug for XXHash {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("XXHash")
.field("hash", &self.hash())
.finish()
}
}
impl flatbuffers::SimpleToVerifyInSlice for XXHash {}
impl<'a> flatbuffers::Follow<'a> for XXHash {
type Inner = &'a XXHash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a XXHash>::follow(buf, loc) }
}
}
impl<'a> flatbuffers::Follow<'a> for &'a XXHash {
type Inner = &'a XXHash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<XXHash>(buf, loc) }
}
}
impl<'b> flatbuffers::Push for XXHash {
type Output = XXHash;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const XXHash as *const u8, <Self as flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(1)
}
}
impl<'a> flatbuffers::Verifiable for XXHash {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos)
}
}
impl<'a> XXHash {
#[allow(clippy::too_many_arguments)]
pub fn new(
hash: &[u8; 8],
) -> Self {
let mut s = Self([0; 8]);
s.set_hash(hash);
s
}
pub fn hash(&'a self) -> flatbuffers::Array<'a, u8, 8> {
unsafe { flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_hash(&mut self, items: &[u8; 8]) {
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn unpack(&self) -> XXHashT {
XXHashT {
hash: self.hash().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct XXHashT {
pub hash: [u8; 8],
}
impl std::default::Default for XXHashT {
fn default() -> Self {
Self {
hash: core::array::from_fn(|_| Default::default()),
}
}
}
impl XXHashT {
pub fn pack(&self) -> XXHash {
XXHash::new(
&self.hash,
)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Hash(pub [u8; 32]);
impl Default for Hash {
fn default() -> Self {
Self([0; 32])
}
}
impl core::fmt::Debug for Hash {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Hash")
.field("hash", &self.hash())
.finish()
}
}
impl flatbuffers::SimpleToVerifyInSlice for Hash {}
impl<'a> flatbuffers::Follow<'a> for Hash {
type Inner = &'a Hash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Hash>::follow(buf, loc) }
}
}
impl<'a> flatbuffers::Follow<'a> for &'a Hash {
type Inner = &'a Hash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<Hash>(buf, loc) }
}
}
impl<'b> flatbuffers::Push for Hash {
type Output = Hash;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Hash as *const u8, <Self as flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(1)
}
}
impl<'a> flatbuffers::Verifiable for Hash {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos)
}
}
impl<'a> Hash {
#[allow(clippy::too_many_arguments)]
pub fn new(
hash: &[u8; 32],
) -> Self {
let mut s = Self([0; 32]);
s.set_hash(hash);
s
}
pub fn hash(&'a self) -> flatbuffers::Array<'a, u8, 32> {
unsafe { flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_hash(&mut self, items: &[u8; 32]) {
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn unpack(&self) -> HashT {
HashT {
hash: self.hash().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct HashT {
pub hash: [u8; 32],
}
impl std::default::Default for HashT {
fn default() -> Self {
Self {
hash: core::array::from_fn(|_| Default::default()),
}
}
}
impl HashT {
pub fn pack(&self) -> Hash {
Hash::new(
&self.hash,
)
}
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct LtHash(pub [u8; 2048]);
impl Default for LtHash {
fn default() -> Self {
Self([0; 2048])
}
}
impl core::fmt::Debug for LtHash {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LtHash")
.field("hash", &self.hash())
.finish()
}
}
impl flatbuffers::SimpleToVerifyInSlice for LtHash {}
impl<'a> flatbuffers::Follow<'a> for LtHash {
type Inner = &'a LtHash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a LtHash>::follow(buf, loc) }
}
}
impl<'a> flatbuffers::Follow<'a> for &'a LtHash {
type Inner = &'a LtHash;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { flatbuffers::follow_cast_ref::<LtHash>(buf, loc) }
}
}
impl<'b> flatbuffers::Push for LtHash {
type Output = LtHash;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const LtHash as *const u8, <Self as flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> flatbuffers::PushAlignment {
flatbuffers::PushAlignment::new(2)
}
}
impl<'a> flatbuffers::Verifiable for LtHash {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.in_buffer::<Self>(pos)
}
}
impl<'a> LtHash {
#[allow(clippy::too_many_arguments)]
pub fn new(
hash: &[u16; 1024],
) -> Self {
let mut s = Self([0; 2048]);
s.set_hash(hash);
s
}
pub fn hash(&'a self) -> flatbuffers::Array<'a, u16, 1024> {
unsafe { flatbuffers::Array::follow(&self.0, 0) }
}
pub fn set_hash(&mut self, items: &[u16; 1024]) {
unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
}
pub fn unpack(&self) -> LtHashT {
LtHashT {
hash: self.hash().into(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct LtHashT {
pub hash: [u16; 1024],
}
impl std::default::Default for LtHashT {
fn default() -> Self {
Self {
hash: core::array::from_fn(|_| Default::default()),
}
}
}
impl LtHashT {
pub fn pack(&self) -> LtHash {
LtHash::new(
&self.hash,
)
}
}
pub enum FeatureSetOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct FeatureSet<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for FeatureSet<'a> {
type Inner = FeatureSet<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> FeatureSet<'a> {
pub const VT_FEATURES: flatbuffers::VOffsetT = 4;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
FeatureSet { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args FeatureSetArgs<'args>
) -> flatbuffers::WIPOffset<FeatureSet<'bldr>> {
let mut builder = FeatureSetBuilder::new(_fbb);
if let Some(x) = args.features { builder.add_features(x); }
builder.finish()
}
pub fn unpack(&self) -> FeatureSetT {
let features = self.features().map(|x| {
x.into_iter().collect()
});
FeatureSetT {
features,
}
}
#[inline]
pub fn features(&self) -> Option<flatbuffers::Vector<'a, u64>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(FeatureSet::VT_FEATURES, None)}
}
}
impl flatbuffers::Verifiable for FeatureSet<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("features", Self::VT_FEATURES, false)?
.finish();
Ok(())
}
}
pub struct FeatureSetArgs<'a> {
pub features: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
}
impl<'a> Default for FeatureSetArgs<'a> {
#[inline]
fn default() -> Self {
FeatureSetArgs {
features: None,
}
}
}
pub struct FeatureSetBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FeatureSetBuilder<'a, 'b, A> {
#[inline]
pub fn add_features(&mut self, features: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(FeatureSet::VT_FEATURES, features);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FeatureSetBuilder<'a, 'b, A> {
let start = _fbb.start_table();
FeatureSetBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<FeatureSet<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for FeatureSet<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("FeatureSet");
ds.field("features", &self.features());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct FeatureSetT {
pub features: Option<Vec<u64>>,
}
impl Default for FeatureSetT {
fn default() -> Self {
Self {
features: None,
}
}
}
impl FeatureSetT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<FeatureSet<'b>> {
let features = self.features.as_ref().map(|x|{
_fbb.create_vector(x)
});
FeatureSet::create(_fbb, &FeatureSetArgs{
features,
})
}
}
pub enum AccountOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Account<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Account<'a> {
type Inner = Account<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> Account<'a> {
pub const VT_ADDRESS: flatbuffers::VOffsetT = 4;
pub const VT_LAMPORTS: flatbuffers::VOffsetT = 6;
pub const VT_DATA: flatbuffers::VOffsetT = 8;
pub const VT_EXECUTABLE: flatbuffers::VOffsetT = 10;
pub const VT_OWNER: flatbuffers::VOffsetT = 12;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Account { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args AccountArgs<'args>
) -> flatbuffers::WIPOffset<Account<'bldr>> {
let mut builder = AccountBuilder::new(_fbb);
builder.add_lamports(args.lamports);
if let Some(x) = args.owner { builder.add_owner(x); }
if let Some(x) = args.data { builder.add_data(x); }
if let Some(x) = args.address { builder.add_address(x); }
builder.add_executable(args.executable);
builder.finish()
}
pub fn unpack(&self) -> AccountT {
let address = {
let x = self.address();
x.unpack()
};
let lamports = self.lamports();
let data = {
let x = self.data();
x.into_iter().collect()
};
let executable = self.executable();
let owner = {
let x = self.owner();
x.unpack()
};
AccountT {
address,
lamports,
data,
executable,
owner,
}
}
#[inline]
pub fn address(&self) -> &'a Pubkey {
unsafe { self._tab.get::<Pubkey>(Account::VT_ADDRESS, None).unwrap()}
}
#[inline]
pub fn lamports(&self) -> u64 {
unsafe { self._tab.get::<u64>(Account::VT_LAMPORTS, Some(0)).unwrap()}
}
#[inline]
pub fn data(&self) -> flatbuffers::Vector<'a, u8> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Account::VT_DATA, None).unwrap()}
}
#[inline]
pub fn executable(&self) -> bool {
unsafe { self._tab.get::<bool>(Account::VT_EXECUTABLE, Some(false)).unwrap()}
}
#[inline]
pub fn owner(&self) -> &'a Pubkey {
unsafe { self._tab.get::<Pubkey>(Account::VT_OWNER, None).unwrap()}
}
}
impl flatbuffers::Verifiable for Account<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<Pubkey>("address", Self::VT_ADDRESS, true)?
.visit_field::<u64>("lamports", Self::VT_LAMPORTS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("data", Self::VT_DATA, true)?
.visit_field::<bool>("executable", Self::VT_EXECUTABLE, false)?
.visit_field::<Pubkey>("owner", Self::VT_OWNER, true)?
.finish();
Ok(())
}
}
pub struct AccountArgs<'a> {
pub address: Option<&'a Pubkey>,
pub lamports: u64,
pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
pub executable: bool,
pub owner: Option<&'a Pubkey>,
}
impl<'a> Default for AccountArgs<'a> {
#[inline]
fn default() -> Self {
AccountArgs {
address: None, lamports: 0,
data: None, executable: false,
owner: None, }
}
}
pub struct AccountBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AccountBuilder<'a, 'b, A> {
#[inline]
pub fn add_address(&mut self, address: &Pubkey) {
self.fbb_.push_slot_always::<&Pubkey>(Account::VT_ADDRESS, address);
}
#[inline]
pub fn add_lamports(&mut self, lamports: u64) {
self.fbb_.push_slot::<u64>(Account::VT_LAMPORTS, lamports, 0);
}
#[inline]
pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Account::VT_DATA, data);
}
#[inline]
pub fn add_executable(&mut self, executable: bool) {
self.fbb_.push_slot::<bool>(Account::VT_EXECUTABLE, executable, false);
}
#[inline]
pub fn add_owner(&mut self, owner: &Pubkey) {
self.fbb_.push_slot_always::<&Pubkey>(Account::VT_OWNER, owner);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AccountBuilder<'a, 'b, A> {
let start = _fbb.start_table();
AccountBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Account<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Account::VT_ADDRESS,"address");
self.fbb_.required(o, Account::VT_DATA,"data");
self.fbb_.required(o, Account::VT_OWNER,"owner");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Account<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Account");
ds.field("address", &self.address());
ds.field("lamports", &self.lamports());
ds.field("data", &self.data());
ds.field("executable", &self.executable());
ds.field("owner", &self.owner());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct AccountT {
pub address: PubkeyT,
pub lamports: u64,
pub data: Vec<u8>,
pub executable: bool,
pub owner: PubkeyT,
}
impl Default for AccountT {
fn default() -> Self {
Self {
address: Default::default(),
lamports: 0,
data: Default::default(),
executable: false,
owner: Default::default(),
}
}
}
impl AccountT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<Account<'b>> {
let address_tmp = Some(self.address.pack());
let address = address_tmp.as_ref();
let lamports = self.lamports;
let data = Some({
let x = &self.data;
_fbb.create_vector(x)
});
let executable = self.executable;
let owner_tmp = Some(self.owner.pack());
let owner = owner_tmp.as_ref();
Account::create(_fbb, &AccountArgs{
address,
lamports,
data,
executable,
owner,
})
}
}
pub enum VoteAccountOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct VoteAccount<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for VoteAccount<'a> {
type Inner = VoteAccount<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
}
}
impl<'a> VoteAccount<'a> {
pub const VT_VOTE_ACCOUNT: flatbuffers::VOffsetT = 4;
pub const VT_STAKE: flatbuffers::VOffsetT = 6;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
VoteAccount { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args VoteAccountArgs<'args>
) -> flatbuffers::WIPOffset<VoteAccount<'bldr>> {
let mut builder = VoteAccountBuilder::new(_fbb);
builder.add_stake(args.stake);
if let Some(x) = args.vote_account { builder.add_vote_account(x); }
builder.finish()
}
pub fn unpack(&self) -> VoteAccountT {
let vote_account = {
let x = self.vote_account();
Box::new(x.unpack())
};
let stake = self.stake();
VoteAccountT {
vote_account,
stake,
}
}
#[inline]
pub fn vote_account(&self) -> Account<'a> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<Account>>(VoteAccount::VT_VOTE_ACCOUNT, None).unwrap()}
}
#[inline]
pub fn stake(&self) -> u64 {
unsafe { self._tab.get::<u64>(VoteAccount::VT_STAKE, Some(0)).unwrap()}
}
}
impl flatbuffers::Verifiable for VoteAccount<'_> {
#[inline]
fn run_verifier(
v: &mut flatbuffers::Verifier, pos: usize
) -> Result<(), flatbuffers::InvalidFlatbuffer> {
use self::flatbuffers::Verifiable;
v.visit_table(pos)?
.visit_field::<flatbuffers::ForwardsUOffset<Account>>("vote_account", Self::VT_VOTE_ACCOUNT, true)?
.visit_field::<u64>("stake", Self::VT_STAKE, false)?
.finish();
Ok(())
}
}
pub struct VoteAccountArgs<'a> {
pub vote_account: Option<flatbuffers::WIPOffset<Account<'a>>>,
pub stake: u64,
}
impl<'a> Default for VoteAccountArgs<'a> {
#[inline]
fn default() -> Self {
VoteAccountArgs {
vote_account: None, stake: 0,
}
}
}
pub struct VoteAccountBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VoteAccountBuilder<'a, 'b, A> {
#[inline]
pub fn add_vote_account(&mut self, vote_account: flatbuffers::WIPOffset<Account<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Account>>(VoteAccount::VT_VOTE_ACCOUNT, vote_account);
}
#[inline]
pub fn add_stake(&mut self, stake: u64) {
self.fbb_.push_slot::<u64>(VoteAccount::VT_STAKE, stake, 0);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VoteAccountBuilder<'a, 'b, A> {
let start = _fbb.start_table();
VoteAccountBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<VoteAccount<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, VoteAccount::VT_VOTE_ACCOUNT,"vote_account");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for VoteAccount<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("VoteAccount");
ds.field("vote_account", &self.vote_account());
ds.field("stake", &self.stake());
ds.finish()
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct VoteAccountT {
pub vote_account: Box<AccountT>,
pub stake: u64,
}
impl Default for VoteAccountT {
fn default() -> Self {
Self {
vote_account: Default::default(),
stake: 0,
}
}
}
impl VoteAccountT {
pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
&self,
_fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
) -> flatbuffers::WIPOffset<VoteAccount<'b>> {
let vote_account = Some({
let x = &self.vote_account;
x.pack(_fbb)
});
let stake = self.stake;
VoteAccount::create(_fbb, &VoteAccountArgs{
vote_account,
stake,
})
}
}
} } } }