-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |