diff --git a/plerkle_messenger/src/redis_messenger.rs b/plerkle_messenger/src/redis_messenger.rs index c01ca173..3891c396 100644 --- a/plerkle_messenger/src/redis_messenger.rs +++ b/plerkle_messenger/src/redis_messenger.rs @@ -127,7 +127,7 @@ impl Messenger for RedisMessenger { //pub async fn new(stream_key: &'static str) -> Result { async fn new(config: MessengerConfig) -> Result { let uri = config - .get(&*REDIS_CON_STR) + .get(REDIS_CON_STR) .and_then(|u| u.clone().into_string()) .ok_or(MessengerError::ConfigurationError { msg: format!("Connection String Missing: {}", REDIS_CON_STR), diff --git a/plerkle_serialization/src/account_info_generated.rs b/plerkle_serialization/src/account_info_generated.rs index fbc20a1a..dbb85f13 100644 --- a/plerkle_serialization/src/account_info_generated.rs +++ b/plerkle_serialization/src/account_info_generated.rs @@ -1,158 +1,199 @@ // 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}; pub enum AccountInfoOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct AccountInfo<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for AccountInfo<'a> { - type Inner = AccountInfo<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = AccountInfo<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> AccountInfo<'a> { - pub const VT_PUBKEY: flatbuffers::VOffsetT = 4; - pub const VT_LAMPORTS: flatbuffers::VOffsetT = 6; - pub const VT_OWNER: flatbuffers::VOffsetT = 8; - pub const VT_EXECUTABLE: flatbuffers::VOffsetT = 10; - pub const VT_RENT_EPOCH: flatbuffers::VOffsetT = 12; - pub const VT_DATA: flatbuffers::VOffsetT = 14; - pub const VT_WRITE_VERSION: flatbuffers::VOffsetT = 16; - pub const VT_SLOT: flatbuffers::VOffsetT = 18; - pub const VT_IS_STARTUP: flatbuffers::VOffsetT = 20; - pub const VT_SEEN_AT: flatbuffers::VOffsetT = 22; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - AccountInfo { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args AccountInfoArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = AccountInfoBuilder::new(_fbb); - builder.add_seen_at(args.seen_at); - builder.add_slot(args.slot); - builder.add_write_version(args.write_version); - builder.add_rent_epoch(args.rent_epoch); - builder.add_lamports(args.lamports); - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.owner { builder.add_owner(x); } - if let Some(x) = args.pubkey { builder.add_pubkey(x); } - builder.add_is_startup(args.is_startup); - builder.add_executable(args.executable); - builder.finish() - } + pub const VT_PUBKEY: flatbuffers::VOffsetT = 4; + pub const VT_LAMPORTS: flatbuffers::VOffsetT = 6; + pub const VT_OWNER: flatbuffers::VOffsetT = 8; + pub const VT_EXECUTABLE: flatbuffers::VOffsetT = 10; + pub const VT_RENT_EPOCH: flatbuffers::VOffsetT = 12; + pub const VT_DATA: flatbuffers::VOffsetT = 14; + pub const VT_WRITE_VERSION: flatbuffers::VOffsetT = 16; + pub const VT_SLOT: flatbuffers::VOffsetT = 18; + pub const VT_IS_STARTUP: flatbuffers::VOffsetT = 20; + pub const VT_SEEN_AT: flatbuffers::VOffsetT = 22; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + AccountInfo { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args AccountInfoArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = AccountInfoBuilder::new(_fbb); + builder.add_seen_at(args.seen_at); + builder.add_slot(args.slot); + builder.add_write_version(args.write_version); + builder.add_rent_epoch(args.rent_epoch); + builder.add_lamports(args.lamports); + if let Some(x) = args.data { + builder.add_data(x); + } + if let Some(x) = args.owner { + builder.add_owner(x); + } + if let Some(x) = args.pubkey { + builder.add_pubkey(x); + } + builder.add_is_startup(args.is_startup); + builder.add_executable(args.executable); + builder.finish() + } - #[inline] - pub fn pubkey(&self) -> Option<&'a Pubkey> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_PUBKEY, None)} - } - #[inline] - pub fn lamports(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_LAMPORTS, Some(0)).unwrap()} - } - #[inline] - pub fn owner(&self) -> Option<&'a Pubkey> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_OWNER, None)} - } - #[inline] - pub fn executable(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_EXECUTABLE, Some(false)).unwrap()} - } - #[inline] - pub fn rent_epoch(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_RENT_EPOCH, Some(0)).unwrap()} - } - #[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::>>(AccountInfo::VT_DATA, None)} - } - #[inline] - pub fn write_version(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_WRITE_VERSION, Some(0)).unwrap()} - } - #[inline] - pub fn slot(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_SLOT, Some(0)).unwrap()} - } - #[inline] - pub fn is_startup(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_IS_STARTUP, Some(false)).unwrap()} - } - #[inline] - pub fn seen_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AccountInfo::VT_SEEN_AT, Some(0)).unwrap()} - } + #[inline] + pub fn pubkey(&self) -> Option<&'a Pubkey> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(AccountInfo::VT_PUBKEY, None) } + } + #[inline] + pub fn lamports(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_LAMPORTS, Some(0)) + .unwrap() + } + } + #[inline] + pub fn owner(&self) -> Option<&'a Pubkey> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(AccountInfo::VT_OWNER, None) } + } + #[inline] + pub fn executable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_EXECUTABLE, Some(false)) + .unwrap() + } + } + #[inline] + pub fn rent_epoch(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_RENT_EPOCH, Some(0)) + .unwrap() + } + } + #[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::>>( + AccountInfo::VT_DATA, + None, + ) + } + } + #[inline] + pub fn write_version(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_WRITE_VERSION, Some(0)) + .unwrap() + } + } + #[inline] + pub fn slot(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(AccountInfo::VT_SLOT, Some(0)).unwrap() } + } + #[inline] + pub fn is_startup(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_IS_STARTUP, Some(false)) + .unwrap() + } + } + #[inline] + pub fn seen_at(&self) -> i64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(AccountInfo::VT_SEEN_AT, Some(0)) + .unwrap() + } + } } impl flatbuffers::Verifiable for AccountInfo<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("pubkey", Self::VT_PUBKEY, false)? - .visit_field::("lamports", Self::VT_LAMPORTS, false)? - .visit_field::("owner", Self::VT_OWNER, false)? - .visit_field::("executable", Self::VT_EXECUTABLE, false)? - .visit_field::("rent_epoch", Self::VT_RENT_EPOCH, false)? - .visit_field::>>("data", Self::VT_DATA, false)? - .visit_field::("write_version", Self::VT_WRITE_VERSION, false)? - .visit_field::("slot", Self::VT_SLOT, false)? - .visit_field::("is_startup", Self::VT_IS_STARTUP, false)? - .visit_field::("seen_at", Self::VT_SEEN_AT, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("pubkey", Self::VT_PUBKEY, false)? + .visit_field::("lamports", Self::VT_LAMPORTS, false)? + .visit_field::("owner", Self::VT_OWNER, false)? + .visit_field::("executable", Self::VT_EXECUTABLE, false)? + .visit_field::("rent_epoch", Self::VT_RENT_EPOCH, false)? + .visit_field::>>( + "data", + Self::VT_DATA, + false, + )? + .visit_field::("write_version", Self::VT_WRITE_VERSION, false)? + .visit_field::("slot", Self::VT_SLOT, false)? + .visit_field::("is_startup", Self::VT_IS_STARTUP, false)? + .visit_field::("seen_at", Self::VT_SEEN_AT, false)? + .finish(); + Ok(()) + } } pub struct AccountInfoArgs<'a> { pub pubkey: Option<&'a Pubkey>, @@ -167,98 +208,107 @@ pub struct AccountInfoArgs<'a> { pub seen_at: i64, } impl<'a> Default for AccountInfoArgs<'a> { - #[inline] - fn default() -> Self { - AccountInfoArgs { - pubkey: None, - lamports: 0, - owner: None, - executable: false, - rent_epoch: 0, - data: None, - write_version: 0, - slot: 0, - is_startup: false, - seen_at: 0, + #[inline] + fn default() -> Self { + AccountInfoArgs { + pubkey: None, + lamports: 0, + owner: None, + executable: false, + rent_epoch: 0, + data: None, + write_version: 0, + slot: 0, + is_startup: false, + seen_at: 0, + } } - } } pub struct AccountInfoBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> AccountInfoBuilder<'a, 'b> { - #[inline] - pub fn add_pubkey(&mut self, pubkey: &Pubkey) { - self.fbb_.push_slot_always::<&Pubkey>(AccountInfo::VT_PUBKEY, pubkey); - } - #[inline] - pub fn add_lamports(&mut self, lamports: u64) { - self.fbb_.push_slot::(AccountInfo::VT_LAMPORTS, lamports, 0); - } - #[inline] - pub fn add_owner(&mut self, owner: &Pubkey) { - self.fbb_.push_slot_always::<&Pubkey>(AccountInfo::VT_OWNER, owner); - } - #[inline] - pub fn add_executable(&mut self, executable: bool) { - self.fbb_.push_slot::(AccountInfo::VT_EXECUTABLE, executable, false); - } - #[inline] - pub fn add_rent_epoch(&mut self, rent_epoch: u64) { - self.fbb_.push_slot::(AccountInfo::VT_RENT_EPOCH, rent_epoch, 0); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(AccountInfo::VT_DATA, data); - } - #[inline] - pub fn add_write_version(&mut self, write_version: u64) { - self.fbb_.push_slot::(AccountInfo::VT_WRITE_VERSION, write_version, 0); - } - #[inline] - pub fn add_slot(&mut self, slot: u64) { - self.fbb_.push_slot::(AccountInfo::VT_SLOT, slot, 0); - } - #[inline] - pub fn add_is_startup(&mut self, is_startup: bool) { - self.fbb_.push_slot::(AccountInfo::VT_IS_STARTUP, is_startup, false); - } - #[inline] - pub fn add_seen_at(&mut self, seen_at: i64) { - self.fbb_.push_slot::(AccountInfo::VT_SEEN_AT, seen_at, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> AccountInfoBuilder<'a, 'b> { - let start = _fbb.start_table(); - AccountInfoBuilder { - fbb_: _fbb, - start_: start, + #[inline] + pub fn add_pubkey(&mut self, pubkey: &Pubkey) { + self.fbb_ + .push_slot_always::<&Pubkey>(AccountInfo::VT_PUBKEY, pubkey); + } + #[inline] + pub fn add_lamports(&mut self, lamports: u64) { + self.fbb_ + .push_slot::(AccountInfo::VT_LAMPORTS, lamports, 0); + } + #[inline] + pub fn add_owner(&mut self, owner: &Pubkey) { + self.fbb_ + .push_slot_always::<&Pubkey>(AccountInfo::VT_OWNER, owner); + } + #[inline] + pub fn add_executable(&mut self, executable: bool) { + self.fbb_ + .push_slot::(AccountInfo::VT_EXECUTABLE, executable, false); + } + #[inline] + pub fn add_rent_epoch(&mut self, rent_epoch: u64) { + self.fbb_ + .push_slot::(AccountInfo::VT_RENT_EPOCH, rent_epoch, 0); + } + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(AccountInfo::VT_DATA, data); + } + #[inline] + pub fn add_write_version(&mut self, write_version: u64) { + self.fbb_ + .push_slot::(AccountInfo::VT_WRITE_VERSION, write_version, 0); + } + #[inline] + pub fn add_slot(&mut self, slot: u64) { + self.fbb_.push_slot::(AccountInfo::VT_SLOT, slot, 0); + } + #[inline] + pub fn add_is_startup(&mut self, is_startup: bool) { + self.fbb_ + .push_slot::(AccountInfo::VT_IS_STARTUP, is_startup, false); + } + #[inline] + pub fn add_seen_at(&mut self, seen_at: i64) { + self.fbb_ + .push_slot::(AccountInfo::VT_SEEN_AT, seen_at, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> AccountInfoBuilder<'a, 'b> { + let start = _fbb.start_table(); + AccountInfoBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) } - } - #[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 AccountInfo<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("AccountInfo"); - ds.field("pubkey", &self.pubkey()); - ds.field("lamports", &self.lamports()); - ds.field("owner", &self.owner()); - ds.field("executable", &self.executable()); - ds.field("rent_epoch", &self.rent_epoch()); - ds.field("data", &self.data()); - ds.field("write_version", &self.write_version()); - ds.field("slot", &self.slot()); - ds.field("is_startup", &self.is_startup()); - ds.field("seen_at", &self.seen_at()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("AccountInfo"); + ds.field("pubkey", &self.pubkey()); + ds.field("lamports", &self.lamports()); + ds.field("owner", &self.owner()); + ds.field("executable", &self.executable()); + ds.field("rent_epoch", &self.rent_epoch()); + ds.field("data", &self.data()); + ds.field("write_version", &self.write_version()); + ds.field("slot", &self.slot()); + ds.field("is_startup", &self.is_startup()); + ds.field("seen_at", &self.seen_at()); + ds.finish() + } } #[inline] /// Verifies that a buffer of bytes contains a `AccountInfo` @@ -268,7 +318,7 @@ impl core::fmt::Debug for AccountInfo<'_> { /// previous, unchecked, behavior use /// `root_as_account_info_unchecked`. pub fn root_as_account_info(buf: &[u8]) -> Result { - flatbuffers::root::(buf) + flatbuffers::root::(buf) } #[inline] /// Verifies that a buffer of bytes contains a size prefixed @@ -277,8 +327,10 @@ pub fn root_as_account_info(buf: &[u8]) -> Result Result { - flatbuffers::size_prefixed_root::(buf) +pub fn size_prefixed_root_as_account_info( + buf: &[u8], +) -> Result { + flatbuffers::size_prefixed_root::(buf) } #[inline] /// Verifies, with the given options, that a buffer of bytes @@ -288,10 +340,10 @@ pub fn size_prefixed_root_as_account_info(buf: &[u8]) -> Result( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) + flatbuffers::root_with_opts::>(opts, buf) } #[inline] /// Verifies, with the given verifier options, that a buffer of @@ -301,33 +353,37 @@ pub fn root_as_account_info_with_opts<'b, 'o>( /// previous, unchecked, behavior use /// `root_as_account_info_unchecked`. pub fn size_prefixed_root_as_account_info_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a AccountInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid `AccountInfo`. pub unsafe fn root_as_account_info_unchecked(buf: &[u8]) -> AccountInfo { - flatbuffers::root_unchecked::(buf) + flatbuffers::root_unchecked::(buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a size prefixed AccountInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid size prefixed `AccountInfo`. pub unsafe fn size_prefixed_root_as_account_info_unchecked(buf: &[u8]) -> AccountInfo { - flatbuffers::size_prefixed_root_unchecked::(buf) + flatbuffers::size_prefixed_root_unchecked::(buf) } #[inline] pub fn finish_account_info_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); + root: flatbuffers::WIPOffset>, +) { + fbb.finish(root, None); } #[inline] -pub fn finish_size_prefixed_account_info_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +pub fn finish_size_prefixed_account_info_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, +) { + fbb.finish_size_prefixed(root, None); } diff --git a/plerkle_serialization/src/block_info_generated.rs b/plerkle_serialization/src/block_info_generated.rs index 4acb8e40..16b54219 100644 --- a/plerkle_serialization/src/block_info_generated.rs +++ b/plerkle_serialization/src/block_info_generated.rs @@ -1,25 +1,33 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; 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.")] +#[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." +)] pub const ENUM_MIN_REWARD_TYPE: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." +)] pub const ENUM_MAX_REWARD_TYPE: u8 = 3; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[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_REWARD_TYPE: [RewardType; 4] = [ - RewardType::Fee, - RewardType::Rent, - RewardType::Staking, - RewardType::Voting, + RewardType::Fee, + RewardType::Rent, + RewardType::Staking, + RewardType::Voting, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -27,46 +35,41 @@ pub const ENUM_VALUES_REWARD_TYPE: [RewardType; 4] = [ pub struct RewardType(pub u8); #[allow(non_upper_case_globals)] impl RewardType { - pub const Fee: Self = Self(0); - pub const Rent: Self = Self(1); - pub const Staking: Self = Self(2); - pub const Voting: Self = Self(3); + pub const Fee: Self = Self(0); + pub const Rent: Self = Self(1); + pub const Staking: Self = Self(2); + pub const Voting: Self = Self(3); - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 3; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::Fee, - Self::Rent, - Self::Staking, - Self::Voting, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::Fee => Some("Fee"), - Self::Rent => Some("Rent"), - Self::Staking => Some("Staking"), - Self::Voting => Some("Voting"), - _ => None, - } - } + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 3; + pub const ENUM_VALUES: &'static [Self] = &[Self::Fee, Self::Rent, Self::Staking, Self::Voting]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::Fee => Some("Fee"), + Self::Rent => Some("Rent"), + Self::Staking => Some("Staking"), + Self::Voting => Some("Voting"), + _ => None, + } + } } impl core::fmt::Debug for RewardType { - 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)) + 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 RewardType { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } + 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 RewardType { @@ -78,123 +81,146 @@ impl flatbuffers::Push for RewardType { } impl flatbuffers::EndianScalar for RewardType { - 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) - } + 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 RewardType { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } + #[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 RewardType {} pub enum RewardOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct Reward<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for Reward<'a> { - type Inner = Reward<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = Reward<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> Reward<'a> { - pub const VT_PUBKEY: flatbuffers::VOffsetT = 4; - pub const VT_LAMPORTS: flatbuffers::VOffsetT = 6; - pub const VT_POST_BALANCE: flatbuffers::VOffsetT = 8; - pub const VT_REWARD_TYPE: flatbuffers::VOffsetT = 10; - pub const VT_COMMISSION: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Reward { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args RewardArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = RewardBuilder::new(_fbb); - builder.add_post_balance(args.post_balance); - builder.add_lamports(args.lamports); - if let Some(x) = args.pubkey { builder.add_pubkey(x); } - if let Some(x) = args.commission { builder.add_commission(x); } - if let Some(x) = args.reward_type { builder.add_reward_type(x); } - builder.finish() - } + pub const VT_PUBKEY: flatbuffers::VOffsetT = 4; + pub const VT_LAMPORTS: flatbuffers::VOffsetT = 6; + pub const VT_POST_BALANCE: flatbuffers::VOffsetT = 8; + pub const VT_REWARD_TYPE: flatbuffers::VOffsetT = 10; + pub const VT_COMMISSION: flatbuffers::VOffsetT = 12; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Reward { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RewardArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = RewardBuilder::new(_fbb); + builder.add_post_balance(args.post_balance); + builder.add_lamports(args.lamports); + if let Some(x) = args.pubkey { + builder.add_pubkey(x); + } + if let Some(x) = args.commission { + builder.add_commission(x); + } + if let Some(x) = args.reward_type { + builder.add_reward_type(x); + } + builder.finish() + } - #[inline] - pub fn pubkey(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(Reward::VT_PUBKEY, None)} - } - #[inline] - pub fn lamports(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Reward::VT_LAMPORTS, Some(0)).unwrap()} - } - #[inline] - pub fn post_balance(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Reward::VT_POST_BALANCE, Some(0)).unwrap()} - } - #[inline] - pub fn reward_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Reward::VT_REWARD_TYPE, None)} - } - #[inline] - pub fn commission(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Reward::VT_COMMISSION, None)} - } + #[inline] + pub fn pubkey(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + Reward::VT_PUBKEY, + None, + ) + } + } + #[inline] + pub fn lamports(&self) -> i64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Reward::VT_LAMPORTS, Some(0)).unwrap() } + } + #[inline] + pub fn post_balance(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(Reward::VT_POST_BALANCE, Some(0)) + .unwrap() + } + } + #[inline] + pub fn reward_type(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Reward::VT_REWARD_TYPE, None) } + } + #[inline] + pub fn commission(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Reward::VT_COMMISSION, None) } + } } impl flatbuffers::Verifiable for Reward<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("pubkey", Self::VT_PUBKEY, false)? - .visit_field::("lamports", Self::VT_LAMPORTS, false)? - .visit_field::("post_balance", Self::VT_POST_BALANCE, false)? - .visit_field::("reward_type", Self::VT_REWARD_TYPE, false)? - .visit_field::("commission", Self::VT_COMMISSION, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>( + "pubkey", + Self::VT_PUBKEY, + false, + )? + .visit_field::("lamports", Self::VT_LAMPORTS, false)? + .visit_field::("post_balance", Self::VT_POST_BALANCE, false)? + .visit_field::("reward_type", Self::VT_REWARD_TYPE, false)? + .visit_field::("commission", Self::VT_COMMISSION, false)? + .finish(); + Ok(()) + } } pub struct RewardArgs<'a> { pub pubkey: Option>>, @@ -204,250 +230,295 @@ pub struct RewardArgs<'a> { pub commission: Option, } impl<'a> Default for RewardArgs<'a> { - #[inline] - fn default() -> Self { - RewardArgs { - pubkey: None, - lamports: 0, - post_balance: 0, - reward_type: None, - commission: None, + #[inline] + fn default() -> Self { + RewardArgs { + pubkey: None, + lamports: 0, + post_balance: 0, + reward_type: None, + commission: None, + } } - } } pub struct RewardBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> RewardBuilder<'a, 'b> { - #[inline] - pub fn add_pubkey(&mut self, pubkey: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Reward::VT_PUBKEY, pubkey); - } - #[inline] - pub fn add_lamports(&mut self, lamports: i64) { - self.fbb_.push_slot::(Reward::VT_LAMPORTS, lamports, 0); - } - #[inline] - pub fn add_post_balance(&mut self, post_balance: u64) { - self.fbb_.push_slot::(Reward::VT_POST_BALANCE, post_balance, 0); - } - #[inline] - pub fn add_reward_type(&mut self, reward_type: RewardType) { - self.fbb_.push_slot_always::(Reward::VT_REWARD_TYPE, reward_type); - } - #[inline] - pub fn add_commission(&mut self, commission: u8) { - self.fbb_.push_slot_always::(Reward::VT_COMMISSION, commission); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RewardBuilder<'a, 'b> { - let start = _fbb.start_table(); - RewardBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } + #[inline] + pub fn add_pubkey(&mut self, pubkey: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(Reward::VT_PUBKEY, pubkey); + } + #[inline] + pub fn add_lamports(&mut self, lamports: i64) { + self.fbb_.push_slot::(Reward::VT_LAMPORTS, lamports, 0); + } + #[inline] + pub fn add_post_balance(&mut self, post_balance: u64) { + self.fbb_ + .push_slot::(Reward::VT_POST_BALANCE, post_balance, 0); + } + #[inline] + pub fn add_reward_type(&mut self, reward_type: RewardType) { + self.fbb_ + .push_slot_always::(Reward::VT_REWARD_TYPE, reward_type); + } + #[inline] + pub fn add_commission(&mut self, commission: u8) { + self.fbb_ + .push_slot_always::(Reward::VT_COMMISSION, commission); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RewardBuilder<'a, 'b> { + let start = _fbb.start_table(); + RewardBuilder { + 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 Reward<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Reward"); - ds.field("pubkey", &self.pubkey()); - ds.field("lamports", &self.lamports()); - ds.field("post_balance", &self.post_balance()); - ds.field("reward_type", &self.reward_type()); - ds.field("commission", &self.commission()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Reward"); + ds.field("pubkey", &self.pubkey()); + ds.field("lamports", &self.lamports()); + ds.field("post_balance", &self.post_balance()); + ds.field("reward_type", &self.reward_type()); + ds.field("commission", &self.commission()); + ds.finish() + } } pub enum BlockInfoOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct BlockInfo<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for BlockInfo<'a> { - type Inner = BlockInfo<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = BlockInfo<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> BlockInfo<'a> { - pub const VT_SLOT: flatbuffers::VOffsetT = 4; - pub const VT_BLOCKHASH: flatbuffers::VOffsetT = 6; - pub const VT_REWARDS: flatbuffers::VOffsetT = 8; - pub const VT_BLOCK_TIME: flatbuffers::VOffsetT = 10; - pub const VT_BLOCK_HEIGHT: flatbuffers::VOffsetT = 12; - pub const VT_SEEN_AT: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - BlockInfo { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args BlockInfoArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = BlockInfoBuilder::new(_fbb); - builder.add_seen_at(args.seen_at); - if let Some(x) = args.block_height { builder.add_block_height(x); } - if let Some(x) = args.block_time { builder.add_block_time(x); } - builder.add_slot(args.slot); - if let Some(x) = args.rewards { builder.add_rewards(x); } - if let Some(x) = args.blockhash { builder.add_blockhash(x); } - builder.finish() - } + pub const VT_SLOT: flatbuffers::VOffsetT = 4; + pub const VT_BLOCKHASH: flatbuffers::VOffsetT = 6; + pub const VT_REWARDS: flatbuffers::VOffsetT = 8; + pub const VT_BLOCK_TIME: flatbuffers::VOffsetT = 10; + pub const VT_BLOCK_HEIGHT: flatbuffers::VOffsetT = 12; + pub const VT_SEEN_AT: flatbuffers::VOffsetT = 14; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + BlockInfo { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args BlockInfoArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = BlockInfoBuilder::new(_fbb); + builder.add_seen_at(args.seen_at); + if let Some(x) = args.block_height { + builder.add_block_height(x); + } + if let Some(x) = args.block_time { + builder.add_block_time(x); + } + builder.add_slot(args.slot); + if let Some(x) = args.rewards { + builder.add_rewards(x); + } + if let Some(x) = args.blockhash { + builder.add_blockhash(x); + } + builder.finish() + } - #[inline] - pub fn slot(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(BlockInfo::VT_SLOT, Some(0)).unwrap()} - } - #[inline] - pub fn blockhash(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(BlockInfo::VT_BLOCKHASH, None)} - } - #[inline] - pub fn rewards(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(BlockInfo::VT_REWARDS, None)} - } - #[inline] - pub fn block_time(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(BlockInfo::VT_BLOCK_TIME, None)} - } - #[inline] - pub fn block_height(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(BlockInfo::VT_BLOCK_HEIGHT, None)} - } - #[inline] - pub fn seen_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(BlockInfo::VT_SEEN_AT, Some(0)).unwrap()} - } + #[inline] + pub fn slot(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(BlockInfo::VT_SLOT, Some(0)).unwrap() } + } + #[inline] + pub fn blockhash(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(BlockInfo::VT_BLOCKHASH, None) + } + } + #[inline] + pub fn rewards( + &self, + ) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab.get::>, + >>(BlockInfo::VT_REWARDS, None) + } + } + #[inline] + pub fn block_time(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(BlockInfo::VT_BLOCK_TIME, None) } + } + #[inline] + pub fn block_height(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(BlockInfo::VT_BLOCK_HEIGHT, None) } + } + #[inline] + pub fn seen_at(&self) -> i64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(BlockInfo::VT_SEEN_AT, Some(0)) + .unwrap() + } + } } impl flatbuffers::Verifiable for BlockInfo<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("slot", Self::VT_SLOT, false)? - .visit_field::>("blockhash", Self::VT_BLOCKHASH, false)? - .visit_field::>>>("rewards", Self::VT_REWARDS, false)? - .visit_field::("block_time", Self::VT_BLOCK_TIME, false)? - .visit_field::("block_height", Self::VT_BLOCK_HEIGHT, false)? - .visit_field::("seen_at", Self::VT_SEEN_AT, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("slot", Self::VT_SLOT, false)? + .visit_field::>( + "blockhash", + Self::VT_BLOCKHASH, + false, + )? + .visit_field::>, + >>("rewards", Self::VT_REWARDS, false)? + .visit_field::("block_time", Self::VT_BLOCK_TIME, false)? + .visit_field::("block_height", Self::VT_BLOCK_HEIGHT, false)? + .visit_field::("seen_at", Self::VT_SEEN_AT, false)? + .finish(); + Ok(()) + } } pub struct BlockInfoArgs<'a> { pub slot: u64, pub blockhash: Option>, - pub rewards: Option>>>>, + pub rewards: Option< + flatbuffers::WIPOffset>>>, + >, pub block_time: Option, pub block_height: Option, pub seen_at: i64, } impl<'a> Default for BlockInfoArgs<'a> { - #[inline] - fn default() -> Self { - BlockInfoArgs { - slot: 0, - blockhash: None, - rewards: None, - block_time: None, - block_height: None, - seen_at: 0, - } - } + #[inline] + fn default() -> Self { + BlockInfoArgs { + slot: 0, + blockhash: None, + rewards: None, + block_time: None, + block_height: None, + seen_at: 0, + } + } } pub struct BlockInfoBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> BlockInfoBuilder<'a, 'b> { - #[inline] - pub fn add_slot(&mut self, slot: u64) { - self.fbb_.push_slot::(BlockInfo::VT_SLOT, slot, 0); - } - #[inline] - pub fn add_blockhash(&mut self, blockhash: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(BlockInfo::VT_BLOCKHASH, blockhash); - } - #[inline] - pub fn add_rewards(&mut self, rewards: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(BlockInfo::VT_REWARDS, rewards); - } - #[inline] - pub fn add_block_time(&mut self, block_time: i64) { - self.fbb_.push_slot_always::(BlockInfo::VT_BLOCK_TIME, block_time); - } - #[inline] - pub fn add_block_height(&mut self, block_height: u64) { - self.fbb_.push_slot_always::(BlockInfo::VT_BLOCK_HEIGHT, block_height); - } - #[inline] - pub fn add_seen_at(&mut self, seen_at: i64) { - self.fbb_.push_slot::(BlockInfo::VT_SEEN_AT, seen_at, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> BlockInfoBuilder<'a, 'b> { - let start = _fbb.start_table(); - BlockInfoBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } + #[inline] + pub fn add_slot(&mut self, slot: u64) { + self.fbb_.push_slot::(BlockInfo::VT_SLOT, slot, 0); + } + #[inline] + pub fn add_blockhash(&mut self, blockhash: flatbuffers::WIPOffset<&'b str>) { + self.fbb_ + .push_slot_always::>(BlockInfo::VT_BLOCKHASH, blockhash); + } + #[inline] + pub fn add_rewards( + &mut self, + rewards: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_ + .push_slot_always::>(BlockInfo::VT_REWARDS, rewards); + } + #[inline] + pub fn add_block_time(&mut self, block_time: i64) { + self.fbb_ + .push_slot_always::(BlockInfo::VT_BLOCK_TIME, block_time); + } + #[inline] + pub fn add_block_height(&mut self, block_height: u64) { + self.fbb_ + .push_slot_always::(BlockInfo::VT_BLOCK_HEIGHT, block_height); + } + #[inline] + pub fn add_seen_at(&mut self, seen_at: i64) { + self.fbb_ + .push_slot::(BlockInfo::VT_SEEN_AT, seen_at, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> BlockInfoBuilder<'a, 'b> { + let start = _fbb.start_table(); + BlockInfoBuilder { + 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 BlockInfo<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("BlockInfo"); - ds.field("slot", &self.slot()); - ds.field("blockhash", &self.blockhash()); - ds.field("rewards", &self.rewards()); - ds.field("block_time", &self.block_time()); - ds.field("block_height", &self.block_height()); - ds.field("seen_at", &self.seen_at()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("BlockInfo"); + ds.field("slot", &self.slot()); + ds.field("blockhash", &self.blockhash()); + ds.field("rewards", &self.rewards()); + ds.field("block_time", &self.block_time()); + ds.field("block_height", &self.block_height()); + ds.field("seen_at", &self.seen_at()); + ds.finish() + } } #[inline] /// Verifies that a buffer of bytes contains a `BlockInfo` @@ -457,7 +528,7 @@ impl core::fmt::Debug for BlockInfo<'_> { /// previous, unchecked, behavior use /// `root_as_block_info_unchecked`. pub fn root_as_block_info(buf: &[u8]) -> Result { - flatbuffers::root::(buf) + flatbuffers::root::(buf) } #[inline] /// Verifies that a buffer of bytes contains a size prefixed @@ -466,8 +537,10 @@ pub fn root_as_block_info(buf: &[u8]) -> Result Result { - flatbuffers::size_prefixed_root::(buf) +pub fn size_prefixed_root_as_block_info( + buf: &[u8], +) -> Result { + flatbuffers::size_prefixed_root::(buf) } #[inline] /// Verifies, with the given options, that a buffer of bytes @@ -477,10 +550,10 @@ pub fn size_prefixed_root_as_block_info(buf: &[u8]) -> Result( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) + flatbuffers::root_with_opts::>(opts, buf) } #[inline] /// Verifies, with the given verifier options, that a buffer of @@ -490,33 +563,37 @@ pub fn root_as_block_info_with_opts<'b, 'o>( /// previous, unchecked, behavior use /// `root_as_block_info_unchecked`. pub fn size_prefixed_root_as_block_info_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a BlockInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid `BlockInfo`. pub unsafe fn root_as_block_info_unchecked(buf: &[u8]) -> BlockInfo { - flatbuffers::root_unchecked::(buf) + flatbuffers::root_unchecked::(buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a size prefixed BlockInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid size prefixed `BlockInfo`. pub unsafe fn size_prefixed_root_as_block_info_unchecked(buf: &[u8]) -> BlockInfo { - flatbuffers::size_prefixed_root_unchecked::(buf) + flatbuffers::size_prefixed_root_unchecked::(buf) } #[inline] pub fn finish_block_info_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); + root: flatbuffers::WIPOffset>, +) { + fbb.finish(root, None); } #[inline] -pub fn finish_size_prefixed_block_info_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +pub fn finish_size_prefixed_block_info_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, +) { + fbb.finish_size_prefixed(root, None); } diff --git a/plerkle_serialization/src/common_generated.rs b/plerkle_serialization/src/common_generated.rs index 00cc2704..e8c8b857 100644 --- a/plerkle_serialization/src/common_generated.rs +++ b/plerkle_serialization/src/common_generated.rs @@ -1,45 +1,42 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; // struct Pubkey, aligned to 1 #[repr(transparent)] -#[derive(Clone, Copy, PartialEq)] +#[derive(Clone, Copy, PartialEq, Eq)] pub struct Pubkey(pub [u8; 32]); -impl Default for Pubkey { - fn default() -> Self { - Self([0; 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("key", &self.key()) - .finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + f.debug_struct("Pubkey").field("key", &self.key()).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 { - <&'a Pubkey>::follow(buf, loc) - } + type Inner = &'a Pubkey; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + <&'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 { - flatbuffers::follow_cast_ref::(buf, loc) - } + type Inner = &'a Pubkey; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + flatbuffers::follow_cast_ref::(buf, loc) + } } impl<'b> flatbuffers::Push for Pubkey { type Output = Pubkey; @@ -51,38 +48,35 @@ impl<'b> flatbuffers::Push for Pubkey { } 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::(pos) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.in_buffer::(pos) + } } impl<'a> Pubkey { - #[allow(clippy::too_many_arguments)] - pub fn new( - key: &[u8; 32], - ) -> Self { - let mut s = Self([0; 32]); - s.set_key(key); - s - } - - pub fn key(&'a self) -> flatbuffers::Array<'a, u8, 32> { - // Safety: - // Created from a valid Table for this object - // Which contains a valid array in this slot - unsafe { flatbuffers::Array::follow(&self.0, 0) } - } + #[allow(clippy::too_many_arguments)] + pub fn new(key: &[u8; 32]) -> Self { + let mut s = Self([0; 32]); + s.set_key(key); + s + } - pub fn set_key(&mut self, items: &[u8; 32]) { - // Safety: - // Created from a valid Table for this object - // Which contains a valid array in this slot - unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) }; - } + pub fn key(&'a self) -> flatbuffers::Array<'a, u8, 32> { + // Safety: + // Created from a valid Table for this object + // Which contains a valid array in this slot + unsafe { flatbuffers::Array::follow(&self.0, 0) } + } + pub fn set_key(&mut self, items: &[u8; 32]) { + // Safety: + // Created from a valid Table for this object + // Which contains a valid array in this slot + unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 0, items) }; + } } - diff --git a/plerkle_serialization/src/compiled_instruction_generated.rs b/plerkle_serialization/src/compiled_instruction_generated.rs index ff29080d..66ffd968 100644 --- a/plerkle_serialization/src/compiled_instruction_generated.rs +++ b/plerkle_serialization/src/compiled_instruction_generated.rs @@ -1,88 +1,117 @@ // 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}; pub enum CompiledInstructionOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct CompiledInstruction<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for CompiledInstruction<'a> { - type Inner = CompiledInstruction<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = CompiledInstruction<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> CompiledInstruction<'a> { - pub const VT_PROGRAM_ID_INDEX: flatbuffers::VOffsetT = 4; - pub const VT_ACCOUNTS: flatbuffers::VOffsetT = 6; - pub const VT_DATA: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - CompiledInstruction { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args CompiledInstructionArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = CompiledInstructionBuilder::new(_fbb); - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.accounts { builder.add_accounts(x); } - builder.add_program_id_index(args.program_id_index); - builder.finish() - } + pub const VT_PROGRAM_ID_INDEX: flatbuffers::VOffsetT = 4; + pub const VT_ACCOUNTS: flatbuffers::VOffsetT = 6; + pub const VT_DATA: flatbuffers::VOffsetT = 8; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + CompiledInstruction { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args CompiledInstructionArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = CompiledInstructionBuilder::new(_fbb); + if let Some(x) = args.data { + builder.add_data(x); + } + if let Some(x) = args.accounts { + builder.add_accounts(x); + } + builder.add_program_id_index(args.program_id_index); + builder.finish() + } - #[inline] - pub fn program_id_index(&self) -> u8 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(CompiledInstruction::VT_PROGRAM_ID_INDEX, Some(0)).unwrap()} - } - #[inline] - pub fn accounts(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(CompiledInstruction::VT_ACCOUNTS, None)} - } - #[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::>>(CompiledInstruction::VT_DATA, None)} - } + #[inline] + pub fn program_id_index(&self) -> u8 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(CompiledInstruction::VT_PROGRAM_ID_INDEX, Some(0)) + .unwrap() + } + } + #[inline] + pub fn accounts(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + CompiledInstruction::VT_ACCOUNTS, + None, + ) + } + } + #[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::>>( + CompiledInstruction::VT_DATA, + None, + ) + } + } } impl flatbuffers::Verifiable for CompiledInstruction<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("program_id_index", Self::VT_PROGRAM_ID_INDEX, false)? - .visit_field::>>("accounts", Self::VT_ACCOUNTS, false)? - .visit_field::>>("data", Self::VT_DATA, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("program_id_index", Self::VT_PROGRAM_ID_INDEX, false)? + .visit_field::>>( + "accounts", + Self::VT_ACCOUNTS, + false, + )? + .visit_field::>>( + "data", + Self::VT_DATA, + false, + )? + .finish(); + Ok(()) + } } pub struct CompiledInstructionArgs<'a> { pub program_id_index: u8, @@ -90,56 +119,66 @@ pub struct CompiledInstructionArgs<'a> { pub data: Option>>, } impl<'a> Default for CompiledInstructionArgs<'a> { - #[inline] - fn default() -> Self { - CompiledInstructionArgs { - program_id_index: 0, - accounts: None, - data: None, + #[inline] + fn default() -> Self { + CompiledInstructionArgs { + program_id_index: 0, + accounts: None, + data: None, + } } - } } pub struct CompiledInstructionBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> CompiledInstructionBuilder<'a, 'b> { - #[inline] - pub fn add_program_id_index(&mut self, program_id_index: u8) { - self.fbb_.push_slot::(CompiledInstruction::VT_PROGRAM_ID_INDEX, program_id_index, 0); - } - #[inline] - pub fn add_accounts(&mut self, accounts: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(CompiledInstruction::VT_ACCOUNTS, accounts); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(CompiledInstruction::VT_DATA, data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> CompiledInstructionBuilder<'a, 'b> { - let start = _fbb.start_table(); - CompiledInstructionBuilder { - fbb_: _fbb, - start_: start, + #[inline] + pub fn add_program_id_index(&mut self, program_id_index: u8) { + self.fbb_.push_slot::( + CompiledInstruction::VT_PROGRAM_ID_INDEX, + program_id_index, + 0, + ); + } + #[inline] + pub fn add_accounts(&mut self, accounts: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>( + CompiledInstruction::VT_ACCOUNTS, + accounts, + ); + } + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { + self.fbb_ + .push_slot_always::>(CompiledInstruction::VT_DATA, data); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> CompiledInstructionBuilder<'a, 'b> { + let start = _fbb.start_table(); + CompiledInstructionBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) } - } - #[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 CompiledInstruction<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("CompiledInstruction"); - ds.field("program_id_index", &self.program_id_index()); - ds.field("accounts", &self.accounts()); - ds.field("data", &self.data()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("CompiledInstruction"); + ds.field("program_id_index", &self.program_id_index()); + ds.field("accounts", &self.accounts()); + ds.field("data", &self.data()); + ds.finish() + } } #[inline] /// Verifies that a buffer of bytes contains a `CompiledInstruction` @@ -148,8 +187,10 @@ impl core::fmt::Debug for CompiledInstruction<'_> { /// catch every error, or be maximally performant. For the /// previous, unchecked, behavior use /// `root_as_compiled_instruction_unchecked`. -pub fn root_as_compiled_instruction(buf: &[u8]) -> Result { - flatbuffers::root::(buf) +pub fn root_as_compiled_instruction( + buf: &[u8], +) -> Result { + flatbuffers::root::(buf) } #[inline] /// Verifies that a buffer of bytes contains a size prefixed @@ -158,8 +199,10 @@ pub fn root_as_compiled_instruction(buf: &[u8]) -> Result Result { - flatbuffers::size_prefixed_root::(buf) +pub fn size_prefixed_root_as_compiled_instruction( + buf: &[u8], +) -> Result { + flatbuffers::size_prefixed_root::(buf) } #[inline] /// Verifies, with the given options, that a buffer of bytes @@ -169,10 +212,10 @@ pub fn size_prefixed_root_as_compiled_instruction(buf: &[u8]) -> Result( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) + flatbuffers::root_with_opts::>(opts, buf) } #[inline] /// Verifies, with the given verifier options, that a buffer of @@ -182,33 +225,39 @@ pub fn root_as_compiled_instruction_with_opts<'b, 'o>( /// previous, unchecked, behavior use /// `root_as_compiled_instruction_unchecked`. pub fn size_prefixed_root_as_compiled_instruction_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a CompiledInstruction and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid `CompiledInstruction`. pub unsafe fn root_as_compiled_instruction_unchecked(buf: &[u8]) -> CompiledInstruction { - flatbuffers::root_unchecked::(buf) + flatbuffers::root_unchecked::(buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a size prefixed CompiledInstruction and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid size prefixed `CompiledInstruction`. -pub unsafe fn size_prefixed_root_as_compiled_instruction_unchecked(buf: &[u8]) -> CompiledInstruction { - flatbuffers::size_prefixed_root_unchecked::(buf) +pub unsafe fn size_prefixed_root_as_compiled_instruction_unchecked( + buf: &[u8], +) -> CompiledInstruction { + flatbuffers::size_prefixed_root_unchecked::(buf) } #[inline] pub fn finish_compiled_instruction_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); + root: flatbuffers::WIPOffset>, +) { + fbb.finish(root, None); } #[inline] -pub fn finish_size_prefixed_compiled_instruction_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +pub fn finish_size_prefixed_compiled_instruction_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, +) { + fbb.finish_size_prefixed(root, None); } diff --git a/plerkle_serialization/src/serializer/serializer_stable.rs b/plerkle_serialization/src/serializer/serializer_stable.rs index dce22354..8ede2626 100644 --- a/plerkle_serialization/src/serializer/serializer_stable.rs +++ b/plerkle_serialization/src/serializer/serializer_stable.rs @@ -182,7 +182,7 @@ pub fn serialize_transaction<'a>( slot, slot_index: None, seen_at: seen_at.timestamp_millis(), - signature: Some(signature_offset) + signature: Some(signature_offset), }, ); diff --git a/plerkle_serialization/src/slot_status_info_generated.rs b/plerkle_serialization/src/slot_status_info_generated.rs index 2f4d2c9f..14444f0f 100644 --- a/plerkle_serialization/src/slot_status_info_generated.rs +++ b/plerkle_serialization/src/slot_status_info_generated.rs @@ -1,68 +1,68 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use core::mem; 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.")] +#[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." +)] pub const ENUM_MIN_STATUS: i8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[deprecated( + since = "2.0.0", + note = "Use associated constants instead. This will no longer be generated in 2021." +)] pub const ENUM_MAX_STATUS: i8 = 2; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[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_STATUS: [Status; 3] = [ - Status::Processed, - Status::Rooted, - Status::Confirmed, -]; +pub const ENUM_VALUES_STATUS: [Status; 3] = [Status::Processed, Status::Rooted, Status::Confirmed]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[repr(transparent)] pub struct Status(pub i8); #[allow(non_upper_case_globals)] impl Status { - pub const Processed: Self = Self(0); - pub const Rooted: Self = Self(1); - pub const Confirmed: Self = Self(2); + pub const Processed: Self = Self(0); + pub const Rooted: Self = Self(1); + pub const Confirmed: Self = Self(2); - pub const ENUM_MIN: i8 = 0; - pub const ENUM_MAX: i8 = 2; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::Processed, - Self::Rooted, - Self::Confirmed, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::Processed => Some("Processed"), - Self::Rooted => Some("Rooted"), - Self::Confirmed => Some("Confirmed"), - _ => None, + pub const ENUM_MIN: i8 = 0; + pub const ENUM_MAX: i8 = 2; + pub const ENUM_VALUES: &'static [Self] = &[Self::Processed, Self::Rooted, Self::Confirmed]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::Processed => Some("Processed"), + Self::Rooted => Some("Rooted"), + Self::Confirmed => Some("Confirmed"), + _ => None, + } } - } } impl core::fmt::Debug for Status { - 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)) + 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 Status { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } + 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 Status { @@ -74,113 +74,130 @@ impl flatbuffers::Push for Status { } impl flatbuffers::EndianScalar for Status { - type Scalar = i8; - #[inline] - fn to_little_endian(self) -> i8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: i8) -> Self { - let b = i8::from_le(v); - Self(b) - } + type Scalar = i8; + #[inline] + fn to_little_endian(self) -> i8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: i8) -> Self { + let b = i8::from_le(v); + Self(b) + } } impl<'a> flatbuffers::Verifiable for Status { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - i8::run_verifier(v, pos) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + i8::run_verifier(v, pos) + } } impl flatbuffers::SimpleToVerifyInSlice for Status {} pub enum SlotStatusInfoOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct SlotStatusInfo<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for SlotStatusInfo<'a> { - type Inner = SlotStatusInfo<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = SlotStatusInfo<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> SlotStatusInfo<'a> { - pub const VT_SLOT: flatbuffers::VOffsetT = 4; - pub const VT_PARENT: flatbuffers::VOffsetT = 6; - pub const VT_STATUS: flatbuffers::VOffsetT = 8; - pub const VT_SEEN_AT: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SlotStatusInfo { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args SlotStatusInfoArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = SlotStatusInfoBuilder::new(_fbb); - builder.add_seen_at(args.seen_at); - if let Some(x) = args.parent { builder.add_parent(x); } - builder.add_slot(args.slot); - builder.add_status(args.status); - builder.finish() - } + pub const VT_SLOT: flatbuffers::VOffsetT = 4; + pub const VT_PARENT: flatbuffers::VOffsetT = 6; + pub const VT_STATUS: flatbuffers::VOffsetT = 8; + pub const VT_SEEN_AT: flatbuffers::VOffsetT = 10; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + SlotStatusInfo { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args SlotStatusInfoArgs, + ) -> flatbuffers::WIPOffset> { + let mut builder = SlotStatusInfoBuilder::new(_fbb); + builder.add_seen_at(args.seen_at); + if let Some(x) = args.parent { + builder.add_parent(x); + } + builder.add_slot(args.slot); + builder.add_status(args.status); + builder.finish() + } - #[inline] - pub fn slot(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SlotStatusInfo::VT_SLOT, Some(0)).unwrap()} - } - #[inline] - pub fn parent(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SlotStatusInfo::VT_PARENT, None)} - } - #[inline] - pub fn status(&self) -> Status { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SlotStatusInfo::VT_STATUS, Some(Status::Processed)).unwrap()} - } - #[inline] - pub fn seen_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SlotStatusInfo::VT_SEEN_AT, Some(0)).unwrap()} - } + #[inline] + pub fn slot(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(SlotStatusInfo::VT_SLOT, Some(0)) + .unwrap() + } + } + #[inline] + pub fn parent(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(SlotStatusInfo::VT_PARENT, None) } + } + #[inline] + pub fn status(&self) -> Status { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(SlotStatusInfo::VT_STATUS, Some(Status::Processed)) + .unwrap() + } + } + #[inline] + pub fn seen_at(&self) -> i64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(SlotStatusInfo::VT_SEEN_AT, Some(0)) + .unwrap() + } + } } impl flatbuffers::Verifiable for SlotStatusInfo<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("slot", Self::VT_SLOT, false)? - .visit_field::("parent", Self::VT_PARENT, false)? - .visit_field::("status", Self::VT_STATUS, false)? - .visit_field::("seen_at", Self::VT_SEEN_AT, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("slot", Self::VT_SLOT, false)? + .visit_field::("parent", Self::VT_PARENT, false)? + .visit_field::("status", Self::VT_STATUS, false)? + .visit_field::("seen_at", Self::VT_SEEN_AT, false)? + .finish(); + Ok(()) + } } pub struct SlotStatusInfoArgs { pub slot: u64, @@ -189,62 +206,65 @@ pub struct SlotStatusInfoArgs { pub seen_at: i64, } impl<'a> Default for SlotStatusInfoArgs { - #[inline] - fn default() -> Self { - SlotStatusInfoArgs { - slot: 0, - parent: None, - status: Status::Processed, - seen_at: 0, + #[inline] + fn default() -> Self { + SlotStatusInfoArgs { + slot: 0, + parent: None, + status: Status::Processed, + seen_at: 0, + } } - } } pub struct SlotStatusInfoBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> SlotStatusInfoBuilder<'a, 'b> { - #[inline] - pub fn add_slot(&mut self, slot: u64) { - self.fbb_.push_slot::(SlotStatusInfo::VT_SLOT, slot, 0); - } - #[inline] - pub fn add_parent(&mut self, parent: u64) { - self.fbb_.push_slot_always::(SlotStatusInfo::VT_PARENT, parent); - } - #[inline] - pub fn add_status(&mut self, status: Status) { - self.fbb_.push_slot::(SlotStatusInfo::VT_STATUS, status, Status::Processed); - } - #[inline] - pub fn add_seen_at(&mut self, seen_at: i64) { - self.fbb_.push_slot::(SlotStatusInfo::VT_SEEN_AT, seen_at, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SlotStatusInfoBuilder<'a, 'b> { - let start = _fbb.start_table(); - SlotStatusInfoBuilder { - fbb_: _fbb, - start_: start, + #[inline] + pub fn add_slot(&mut self, slot: u64) { + self.fbb_.push_slot::(SlotStatusInfo::VT_SLOT, slot, 0); + } + #[inline] + pub fn add_parent(&mut self, parent: u64) { + self.fbb_ + .push_slot_always::(SlotStatusInfo::VT_PARENT, parent); + } + #[inline] + pub fn add_status(&mut self, status: Status) { + self.fbb_ + .push_slot::(SlotStatusInfo::VT_STATUS, status, Status::Processed); + } + #[inline] + pub fn add_seen_at(&mut self, seen_at: i64) { + self.fbb_ + .push_slot::(SlotStatusInfo::VT_SEEN_AT, seen_at, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SlotStatusInfoBuilder<'a, 'b> { + let start = _fbb.start_table(); + SlotStatusInfoBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) } - } - #[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 SlotStatusInfo<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SlotStatusInfo"); - ds.field("slot", &self.slot()); - ds.field("parent", &self.parent()); - ds.field("status", &self.status()); - ds.field("seen_at", &self.seen_at()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("SlotStatusInfo"); + ds.field("slot", &self.slot()); + ds.field("parent", &self.parent()); + ds.field("status", &self.status()); + ds.field("seen_at", &self.seen_at()); + ds.finish() + } } #[inline] /// Verifies that a buffer of bytes contains a `SlotStatusInfo` @@ -253,8 +273,10 @@ impl core::fmt::Debug for SlotStatusInfo<'_> { /// catch every error, or be maximally performant. For the /// previous, unchecked, behavior use /// `root_as_slot_status_info_unchecked`. -pub fn root_as_slot_status_info(buf: &[u8]) -> Result { - flatbuffers::root::(buf) +pub fn root_as_slot_status_info( + buf: &[u8], +) -> Result { + flatbuffers::root::(buf) } #[inline] /// Verifies that a buffer of bytes contains a size prefixed @@ -263,8 +285,10 @@ pub fn root_as_slot_status_info(buf: &[u8]) -> Result Result { - flatbuffers::size_prefixed_root::(buf) +pub fn size_prefixed_root_as_slot_status_info( + buf: &[u8], +) -> Result { + flatbuffers::size_prefixed_root::(buf) } #[inline] /// Verifies, with the given options, that a buffer of bytes @@ -274,10 +298,10 @@ pub fn size_prefixed_root_as_slot_status_info(buf: &[u8]) -> Result( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) + flatbuffers::root_with_opts::>(opts, buf) } #[inline] /// Verifies, with the given verifier options, that a buffer of @@ -287,33 +311,37 @@ pub fn root_as_slot_status_info_with_opts<'b, 'o>( /// previous, unchecked, behavior use /// `root_as_slot_status_info_unchecked`. pub fn size_prefixed_root_as_slot_status_info_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a SlotStatusInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid `SlotStatusInfo`. pub unsafe fn root_as_slot_status_info_unchecked(buf: &[u8]) -> SlotStatusInfo { - flatbuffers::root_unchecked::(buf) + flatbuffers::root_unchecked::(buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a size prefixed SlotStatusInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid size prefixed `SlotStatusInfo`. pub unsafe fn size_prefixed_root_as_slot_status_info_unchecked(buf: &[u8]) -> SlotStatusInfo { - flatbuffers::size_prefixed_root_unchecked::(buf) + flatbuffers::size_prefixed_root_unchecked::(buf) } #[inline] pub fn finish_slot_status_info_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); + root: flatbuffers::WIPOffset>, +) { + fbb.finish(root, None); } #[inline] -pub fn finish_size_prefixed_slot_status_info_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +pub fn finish_size_prefixed_slot_status_info_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, +) { + fbb.finish_size_prefixed(root, None); } diff --git a/plerkle_serialization/src/transaction_info_generated.rs b/plerkle_serialization/src/transaction_info_generated.rs index c8fbfe9e..161aa4bb 100644 --- a/plerkle_serialization/src/transaction_info_generated.rs +++ b/plerkle_serialization/src/transaction_info_generated.rs @@ -1,362 +1,517 @@ // automatically generated by the FlatBuffers compiler, do not modify - // @generated -use crate::compiled_instruction_generated::*; use crate::common_generated::*; -use core::mem; +use crate::compiled_instruction_generated::*; use core::cmp::Ordering; +use core::mem; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; pub enum TransactionInfoOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct TransactionInfo<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for TransactionInfo<'a> { - type Inner = TransactionInfo<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = TransactionInfo<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> TransactionInfo<'a> { - pub const VT_IS_VOTE: flatbuffers::VOffsetT = 4; - pub const VT_ACCOUNT_KEYS: flatbuffers::VOffsetT = 6; - pub const VT_LOG_MESSAGES: flatbuffers::VOffsetT = 8; - pub const VT_INNER_INSTRUCTIONS: flatbuffers::VOffsetT = 10; - pub const VT_OUTER_INSTRUCTIONS: flatbuffers::VOffsetT = 12; - pub const VT_SLOT: flatbuffers::VOffsetT = 14; - pub const VT_SLOT_INDEX: flatbuffers::VOffsetT = 16; - pub const VT_SEEN_AT: flatbuffers::VOffsetT = 18; - pub const VT_SIGNATURE: flatbuffers::VOffsetT = 20; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - TransactionInfo { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args TransactionInfoArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = TransactionInfoBuilder::new(_fbb); - builder.add_seen_at(args.seen_at); - builder.add_slot(args.slot); - if let Some(x) = args.signature { builder.add_signature(x); } - if let Some(x) = args.slot_index { builder.add_slot_index(x); } - if let Some(x) = args.outer_instructions { builder.add_outer_instructions(x); } - if let Some(x) = args.inner_instructions { builder.add_inner_instructions(x); } - if let Some(x) = args.log_messages { builder.add_log_messages(x); } - if let Some(x) = args.account_keys { builder.add_account_keys(x); } - builder.add_is_vote(args.is_vote); - builder.finish() - } + pub const VT_IS_VOTE: flatbuffers::VOffsetT = 4; + pub const VT_ACCOUNT_KEYS: flatbuffers::VOffsetT = 6; + pub const VT_LOG_MESSAGES: flatbuffers::VOffsetT = 8; + pub const VT_INNER_INSTRUCTIONS: flatbuffers::VOffsetT = 10; + pub const VT_OUTER_INSTRUCTIONS: flatbuffers::VOffsetT = 12; + pub const VT_SLOT: flatbuffers::VOffsetT = 14; + pub const VT_SLOT_INDEX: flatbuffers::VOffsetT = 16; + pub const VT_SEEN_AT: flatbuffers::VOffsetT = 18; + pub const VT_SIGNATURE: flatbuffers::VOffsetT = 20; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + TransactionInfo { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args TransactionInfoArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = TransactionInfoBuilder::new(_fbb); + builder.add_seen_at(args.seen_at); + builder.add_slot(args.slot); + if let Some(x) = args.signature { + builder.add_signature(x); + } + if let Some(x) = args.slot_index { + builder.add_slot_index(x); + } + if let Some(x) = args.outer_instructions { + builder.add_outer_instructions(x); + } + if let Some(x) = args.inner_instructions { + builder.add_inner_instructions(x); + } + if let Some(x) = args.log_messages { + builder.add_log_messages(x); + } + if let Some(x) = args.account_keys { + builder.add_account_keys(x); + } + builder.add_is_vote(args.is_vote); + builder.finish() + } - #[inline] - pub fn is_vote(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TransactionInfo::VT_IS_VOTE, Some(false)).unwrap()} - } - #[inline] - pub fn account_keys(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(TransactionInfo::VT_ACCOUNT_KEYS, None)} - } - #[inline] - pub fn log_messages(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(TransactionInfo::VT_LOG_MESSAGES, None)} - } - #[inline] - pub fn inner_instructions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(TransactionInfo::VT_INNER_INSTRUCTIONS, None)} - } - #[inline] - pub fn outer_instructions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(TransactionInfo::VT_OUTER_INSTRUCTIONS, None)} - } - #[inline] - pub fn slot(&self) -> u64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TransactionInfo::VT_SLOT, Some(0)).unwrap()} - } - #[inline] - pub fn slot_index(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(TransactionInfo::VT_SLOT_INDEX, None)} - } - #[inline] - pub fn seen_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TransactionInfo::VT_SEEN_AT, Some(0)).unwrap()} - } - #[inline] - pub fn signature(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(TransactionInfo::VT_SIGNATURE, None)} - } + #[inline] + pub fn is_vote(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(TransactionInfo::VT_IS_VOTE, Some(false)) + .unwrap() + } + } + #[inline] + pub fn account_keys(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>>( + TransactionInfo::VT_ACCOUNT_KEYS, + None, + ) + } + } + #[inline] + pub fn log_messages( + &self, + ) -> Option>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab.get::>, + >>(TransactionInfo::VT_LOG_MESSAGES, None) + } + } + #[inline] + pub fn inner_instructions( + &self, + ) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab.get::>, + >>(TransactionInfo::VT_INNER_INSTRUCTIONS, None) + } + } + #[inline] + pub fn outer_instructions( + &self, + ) -> Option>>> + { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab.get::>, + >>(TransactionInfo::VT_OUTER_INSTRUCTIONS, None) + } + } + #[inline] + pub fn slot(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(TransactionInfo::VT_SLOT, Some(0)) + .unwrap() + } + } + #[inline] + pub fn slot_index(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(TransactionInfo::VT_SLOT_INDEX, None) + } + } + #[inline] + pub fn seen_at(&self) -> i64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(TransactionInfo::VT_SEEN_AT, Some(0)) + .unwrap() + } + } + #[inline] + pub fn signature(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::>(TransactionInfo::VT_SIGNATURE, None) + } + } } impl flatbuffers::Verifiable for TransactionInfo<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("is_vote", Self::VT_IS_VOTE, false)? - .visit_field::>>("account_keys", Self::VT_ACCOUNT_KEYS, false)? - .visit_field::>>>("log_messages", Self::VT_LOG_MESSAGES, false)? - .visit_field::>>>("inner_instructions", Self::VT_INNER_INSTRUCTIONS, false)? - .visit_field::>>>("outer_instructions", Self::VT_OUTER_INSTRUCTIONS, false)? - .visit_field::("slot", Self::VT_SLOT, false)? - .visit_field::>("slot_index", Self::VT_SLOT_INDEX, false)? - .visit_field::("seen_at", Self::VT_SEEN_AT, false)? - .visit_field::>("signature", Self::VT_SIGNATURE, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("is_vote", Self::VT_IS_VOTE, false)? + .visit_field::>>( + "account_keys", + Self::VT_ACCOUNT_KEYS, + false, + )? + .visit_field::>, + >>("log_messages", Self::VT_LOG_MESSAGES, false)? + .visit_field::>, + >>("inner_instructions", Self::VT_INNER_INSTRUCTIONS, false)? + .visit_field::>, + >>("outer_instructions", Self::VT_OUTER_INSTRUCTIONS, false)? + .visit_field::("slot", Self::VT_SLOT, false)? + .visit_field::>( + "slot_index", + Self::VT_SLOT_INDEX, + false, + )? + .visit_field::("seen_at", Self::VT_SEEN_AT, false)? + .visit_field::>( + "signature", + Self::VT_SIGNATURE, + false, + )? + .finish(); + Ok(()) + } } pub struct TransactionInfoArgs<'a> { pub is_vote: bool, pub account_keys: Option>>, - pub log_messages: Option>>>, - pub inner_instructions: Option>>>>, - pub outer_instructions: Option>>>>, + pub log_messages: Option< + flatbuffers::WIPOffset>>, + >, + pub inner_instructions: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, + pub outer_instructions: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, pub slot: u64, pub slot_index: Option>, pub seen_at: i64, pub signature: Option>, } impl<'a> Default for TransactionInfoArgs<'a> { - #[inline] - fn default() -> Self { - TransactionInfoArgs { - is_vote: false, - account_keys: None, - log_messages: None, - inner_instructions: None, - outer_instructions: None, - slot: 0, - slot_index: None, - seen_at: 0, - signature: None, - } - } + #[inline] + fn default() -> Self { + TransactionInfoArgs { + is_vote: false, + account_keys: None, + log_messages: None, + inner_instructions: None, + outer_instructions: None, + slot: 0, + slot_index: None, + seen_at: 0, + signature: None, + } + } } pub struct TransactionInfoBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> TransactionInfoBuilder<'a, 'b> { - #[inline] - pub fn add_is_vote(&mut self, is_vote: bool) { - self.fbb_.push_slot::(TransactionInfo::VT_IS_VOTE, is_vote, false); - } - #[inline] - pub fn add_account_keys(&mut self, account_keys: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_ACCOUNT_KEYS, account_keys); - } - #[inline] - pub fn add_log_messages(&mut self, log_messages: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_LOG_MESSAGES, log_messages); - } - #[inline] - pub fn add_inner_instructions(&mut self, inner_instructions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_INNER_INSTRUCTIONS, inner_instructions); - } - #[inline] - pub fn add_outer_instructions(&mut self, outer_instructions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_OUTER_INSTRUCTIONS, outer_instructions); - } - #[inline] - pub fn add_slot(&mut self, slot: u64) { - self.fbb_.push_slot::(TransactionInfo::VT_SLOT, slot, 0); - } - #[inline] - pub fn add_slot_index(&mut self, slot_index: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_SLOT_INDEX, slot_index); - } - #[inline] - pub fn add_seen_at(&mut self, seen_at: i64) { - self.fbb_.push_slot::(TransactionInfo::VT_SEEN_AT, seen_at, 0); - } - #[inline] - pub fn add_signature(&mut self, signature: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(TransactionInfo::VT_SIGNATURE, signature); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TransactionInfoBuilder<'a, 'b> { - let start = _fbb.start_table(); - TransactionInfoBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } + #[inline] + pub fn add_is_vote(&mut self, is_vote: bool) { + self.fbb_ + .push_slot::(TransactionInfo::VT_IS_VOTE, is_vote, false); + } + #[inline] + pub fn add_account_keys( + &mut self, + account_keys: flatbuffers::WIPOffset>, + ) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_ACCOUNT_KEYS, + account_keys, + ); + } + #[inline] + pub fn add_log_messages( + &mut self, + log_messages: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<&'b str>>, + >, + ) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_LOG_MESSAGES, + log_messages, + ); + } + #[inline] + pub fn add_inner_instructions( + &mut self, + inner_instructions: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_INNER_INSTRUCTIONS, + inner_instructions, + ); + } + #[inline] + pub fn add_outer_instructions( + &mut self, + outer_instructions: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_OUTER_INSTRUCTIONS, + outer_instructions, + ); + } + #[inline] + pub fn add_slot(&mut self, slot: u64) { + self.fbb_ + .push_slot::(TransactionInfo::VT_SLOT, slot, 0); + } + #[inline] + pub fn add_slot_index(&mut self, slot_index: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_SLOT_INDEX, + slot_index, + ); + } + #[inline] + pub fn add_seen_at(&mut self, seen_at: i64) { + self.fbb_ + .push_slot::(TransactionInfo::VT_SEEN_AT, seen_at, 0); + } + #[inline] + pub fn add_signature(&mut self, signature: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>( + TransactionInfo::VT_SIGNATURE, + signature, + ); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> TransactionInfoBuilder<'a, 'b> { + let start = _fbb.start_table(); + TransactionInfoBuilder { + 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 TransactionInfo<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("TransactionInfo"); - ds.field("is_vote", &self.is_vote()); - ds.field("account_keys", &self.account_keys()); - ds.field("log_messages", &self.log_messages()); - ds.field("inner_instructions", &self.inner_instructions()); - ds.field("outer_instructions", &self.outer_instructions()); - ds.field("slot", &self.slot()); - ds.field("slot_index", &self.slot_index()); - ds.field("seen_at", &self.seen_at()); - ds.field("signature", &self.signature()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("TransactionInfo"); + ds.field("is_vote", &self.is_vote()); + ds.field("account_keys", &self.account_keys()); + ds.field("log_messages", &self.log_messages()); + ds.field("inner_instructions", &self.inner_instructions()); + ds.field("outer_instructions", &self.outer_instructions()); + ds.field("slot", &self.slot()); + ds.field("slot_index", &self.slot_index()); + ds.field("seen_at", &self.seen_at()); + ds.field("signature", &self.signature()); + ds.finish() + } } pub enum InnerInstructionsOffset {} -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub struct InnerInstructions<'a> { - pub _tab: flatbuffers::Table<'a>, + pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for InnerInstructions<'a> { - type Inner = InnerInstructions<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } + type Inner = InnerInstructions<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { + _tab: flatbuffers::Table::new(buf, loc), + } + } } impl<'a> InnerInstructions<'a> { - pub const VT_INDEX: flatbuffers::VOffsetT = 4; - pub const VT_INSTRUCTIONS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - InnerInstructions { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, - args: &'args InnerInstructionsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = InnerInstructionsBuilder::new(_fbb); - if let Some(x) = args.instructions { builder.add_instructions(x); } - builder.add_index(args.index); - builder.finish() - } + pub const VT_INDEX: flatbuffers::VOffsetT = 4; + pub const VT_INSTRUCTIONS: flatbuffers::VOffsetT = 6; + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + InnerInstructions { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args InnerInstructionsArgs<'args>, + ) -> flatbuffers::WIPOffset> { + let mut builder = InnerInstructionsBuilder::new(_fbb); + if let Some(x) = args.instructions { + builder.add_instructions(x); + } + builder.add_index(args.index); + builder.finish() + } - #[inline] - pub fn index(&self) -> u8 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(InnerInstructions::VT_INDEX, Some(0)).unwrap()} - } - #[inline] - pub fn instructions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(InnerInstructions::VT_INSTRUCTIONS, None)} - } + #[inline] + pub fn index(&self) -> u8 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab + .get::(InnerInstructions::VT_INDEX, Some(0)) + .unwrap() + } + } + #[inline] + pub fn instructions( + &self, + ) -> Option>>> + { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { + self._tab.get::>, + >>(InnerInstructions::VT_INSTRUCTIONS, None) + } + } } impl flatbuffers::Verifiable for InnerInstructions<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("index", Self::VT_INDEX, false)? - .visit_field::>>>("instructions", Self::VT_INSTRUCTIONS, false)? - .finish(); - Ok(()) - } + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("index", Self::VT_INDEX, false)? + .visit_field::>, + >>("instructions", Self::VT_INSTRUCTIONS, false)? + .finish(); + Ok(()) + } } pub struct InnerInstructionsArgs<'a> { pub index: u8, - pub instructions: Option>>>>, + pub instructions: Option< + flatbuffers::WIPOffset< + flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset>>, + >, + >, } impl<'a> Default for InnerInstructionsArgs<'a> { - #[inline] - fn default() -> Self { - InnerInstructionsArgs { - index: 0, - instructions: None, + #[inline] + fn default() -> Self { + InnerInstructionsArgs { + index: 0, + instructions: None, + } } - } } pub struct InnerInstructionsBuilder<'a: 'b, 'b> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, - start_: flatbuffers::WIPOffset, + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b> InnerInstructionsBuilder<'a, 'b> { - #[inline] - pub fn add_index(&mut self, index: u8) { - self.fbb_.push_slot::(InnerInstructions::VT_INDEX, index, 0); - } - #[inline] - pub fn add_instructions(&mut self, instructions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(InnerInstructions::VT_INSTRUCTIONS, instructions); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> InnerInstructionsBuilder<'a, 'b> { - let start = _fbb.start_table(); - InnerInstructionsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } + #[inline] + pub fn add_index(&mut self, index: u8) { + self.fbb_ + .push_slot::(InnerInstructions::VT_INDEX, index, 0); + } + #[inline] + pub fn add_instructions( + &mut self, + instructions: flatbuffers::WIPOffset< + flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset>>, + >, + ) { + self.fbb_.push_slot_always::>( + InnerInstructions::VT_INSTRUCTIONS, + instructions, + ); + } + #[inline] + pub fn new( + _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + ) -> InnerInstructionsBuilder<'a, 'b> { + let start = _fbb.start_table(); + InnerInstructionsBuilder { + 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 InnerInstructions<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("InnerInstructions"); - ds.field("index", &self.index()); - ds.field("instructions", &self.instructions()); - ds.finish() - } + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("InnerInstructions"); + ds.field("index", &self.index()); + ds.field("instructions", &self.instructions()); + ds.finish() + } } #[inline] /// Verifies that a buffer of bytes contains a `TransactionInfo` @@ -365,8 +520,10 @@ impl core::fmt::Debug for InnerInstructions<'_> { /// catch every error, or be maximally performant. For the /// previous, unchecked, behavior use /// `root_as_transaction_info_unchecked`. -pub fn root_as_transaction_info(buf: &[u8]) -> Result { - flatbuffers::root::(buf) +pub fn root_as_transaction_info( + buf: &[u8], +) -> Result { + flatbuffers::root::(buf) } #[inline] /// Verifies that a buffer of bytes contains a size prefixed @@ -375,8 +532,10 @@ pub fn root_as_transaction_info(buf: &[u8]) -> Result Result { - flatbuffers::size_prefixed_root::(buf) +pub fn size_prefixed_root_as_transaction_info( + buf: &[u8], +) -> Result { + flatbuffers::size_prefixed_root::(buf) } #[inline] /// Verifies, with the given options, that a buffer of bytes @@ -386,10 +545,10 @@ pub fn size_prefixed_root_as_transaction_info(buf: &[u8]) -> Result( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) + flatbuffers::root_with_opts::>(opts, buf) } #[inline] /// Verifies, with the given verifier options, that a buffer of @@ -399,33 +558,37 @@ pub fn root_as_transaction_info_with_opts<'b, 'o>( /// previous, unchecked, behavior use /// `root_as_transaction_info_unchecked`. pub fn size_prefixed_root_as_transaction_info_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], ) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a TransactionInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid `TransactionInfo`. pub unsafe fn root_as_transaction_info_unchecked(buf: &[u8]) -> TransactionInfo { - flatbuffers::root_unchecked::(buf) + flatbuffers::root_unchecked::(buf) } #[inline] /// Assumes, without verification, that a buffer of bytes contains a size prefixed TransactionInfo and returns it. /// # Safety /// Callers must trust the given bytes do indeed contain a valid size prefixed `TransactionInfo`. pub unsafe fn size_prefixed_root_as_transaction_info_unchecked(buf: &[u8]) -> TransactionInfo { - flatbuffers::size_prefixed_root_unchecked::(buf) + flatbuffers::size_prefixed_root_unchecked::(buf) } #[inline] pub fn finish_transaction_info_buffer<'a, 'b>( fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); + root: flatbuffers::WIPOffset>, +) { + fbb.finish(root, None); } #[inline] -pub fn finish_size_prefixed_transaction_info_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +pub fn finish_size_prefixed_transaction_info_buffer<'a, 'b>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, + root: flatbuffers::WIPOffset>, +) { + fbb.finish_size_prefixed(root, None); }