pub struct Verifier<'opts, 'buf> { /* private fields */ }Expand description
Carries the verification state. Should not be reused between tables.
Implementations§
Source§impl<'opts, 'buf> Verifier<'opts, 'buf>
impl<'opts, 'buf> Verifier<'opts, 'buf>
pub fn new(opts: &'opts VerifierOptions, buffer: &'buf [u8]) -> Self
Sourcepub fn is_aligned<T>(&self, pos: usize) -> Result<(), InvalidFlatbuffer>
pub fn is_aligned<T>(&self, pos: usize) -> Result<(), InvalidFlatbuffer>
Checks pos is aligned to T’s alignment. This does not mean buffer[pos] is aligned w.r.t
memory since buffer: &[u8] has alignment 1.
§WARNING
This does not work for flatbuffers-structs as they have alignment 1 according to
core::mem::align_of but are meant to have higher alignment within a Flatbuffer w.r.t.
buffer[0]. TODO(caspern).
Note this does not impact soundness as this crate does not assume alignment of structs
pub fn range_in_buffer( &mut self, pos: usize, size: usize, ) -> Result<(), InvalidFlatbuffer>
Sourcepub fn in_buffer<T>(&mut self, pos: usize) -> Result<(), InvalidFlatbuffer>
pub fn in_buffer<T>(&mut self, pos: usize) -> Result<(), InvalidFlatbuffer>
Check that there really is a T in there.
pub fn get_u8(&mut self, pos: usize) -> Result<u8, InvalidFlatbuffer>
pub fn get_uoffset(&mut self, pos: usize) -> Result<UOffsetT, InvalidFlatbuffer>
pub fn visit_table<'ver>( &'ver mut self, table_pos: usize, ) -> Result<TableVerifier<'ver, 'opts, 'buf>, InvalidFlatbuffer>
Sourcepub fn verify_union_variant<T: Verifiable>(
&mut self,
variant: impl Into<Cow<'static, str>>,
position: usize,
) -> Result<(), InvalidFlatbuffer>
pub fn verify_union_variant<T: Verifiable>( &mut self, variant: impl Into<Cow<'static, str>>, position: usize, ) -> Result<(), InvalidFlatbuffer>
Runs the union variant’s type’s verifier assuming the variant is at the given position, tracing the error.