From c10d181a8fe6c0a6c952445c05dfea408f380fac Mon Sep 17 00:00:00 2001 From: austbot Date: Tue, 27 Sep 2022 15:15:01 -0500 Subject: [PATCH] add missing file --- Cargo.lock | 6 +- plerkle_serialization/src/common_generated.rs | 89 +++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 plerkle_serialization/src/common_generated.rs diff --git a/Cargo.lock b/Cargo.lock index 9e589d4f..49fb5d60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2222,7 +2222,7 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plerkle" -version = "0.4.0" +version = "0.4.1" dependencies = [ "async-trait", "base64 0.13.0", @@ -2253,7 +2253,7 @@ dependencies = [ [[package]] name = "plerkle_messenger" -version = "0.4.0" +version = "0.4.1" dependencies = [ "async-mutex", "async-trait", @@ -2269,7 +2269,7 @@ dependencies = [ [[package]] name = "plerkle_serialization" -version = "0.4.0" +version = "0.4.1" dependencies = [ "chrono", "flatbuffers", diff --git a/plerkle_serialization/src/common_generated.rs b/plerkle_serialization/src/common_generated.rs new file mode 100644 index 00000000..b3844062 --- /dev/null +++ b/plerkle_serialization/src/common_generated.rs @@ -0,0 +1,89 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +// @generated + + + +extern crate flatbuffers; +use self::flatbuffers::{Follow}; + +// struct Pubkey, aligned to 1 +#[repr(transparent)] +#[derive(Clone, Copy, PartialEq)] +pub struct Pubkey(pub [u8; 32]); +impl Default for Pubkey { + fn default() -> Self { + Self([0; 32]) + } +} +impl core::fmt::Debug for Pubkey { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + f.debug_struct("Pubkey").field("key", &self.key()).finish() + } +} + +impl flatbuffers::SimpleToVerifyInSlice for Pubkey {} +impl flatbuffers::SafeSliceAccess for Pubkey {} +impl<'a> flatbuffers::Follow<'a> for Pubkey { + type Inner = &'a Pubkey; + #[inline] + 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] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + flatbuffers::follow_cast_ref::(buf, loc) + } +} +impl<'b> flatbuffers::Push for Pubkey { + type Output = Pubkey; + #[inline] + fn push(&self, dst: &mut [u8], _rest: &[u8]) { + let src = unsafe { + ::core::slice::from_raw_parts(self as *const Pubkey as *const u8, Self::size()) + }; + dst.copy_from_slice(src); + } +} +impl<'b> flatbuffers::Push for &'b Pubkey { + type Output = Pubkey; + + #[inline] + fn push(&self, dst: &mut [u8], _rest: &[u8]) { + let src = unsafe { + ::core::slice::from_raw_parts(*self as *const Pubkey as *const u8, Self::size()) + }; + dst.copy_from_slice(src); + } +} + +impl<'a> flatbuffers::Verifiable for Pubkey { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, + pos: usize, + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + + 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> { + flatbuffers::Array::follow(&self.0, 0) + } + + pub fn set_key(&mut self, items: &[u8; 32]) { + flatbuffers::emplace_scalar_array(&mut self.0, 0, items); + } +}