Skip to content

Commit

Permalink
add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
austbot committed Sep 27, 2022
1 parent 36ef759 commit c10d181
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions plerkle_serialization/src/common_generated.rs
Original file line number Diff line number Diff line change
@@ -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::<Pubkey>(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::<Self>(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);
}
}

0 comments on commit c10d181

Please sign in to comment.