hyperlight-common 0.14.0

Hyperlight's components common to host and guest.
Documentation
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
extern crate flatbuffers;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::cmp::Ordering;
use core::mem;

use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum HostFunctionDetailsOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct HostFunctionDetails<'a> {
    pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for HostFunctionDetails<'a> {
    type Inner = HostFunctionDetails<'a>;
    #[inline]
    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
        Self {
            _tab: unsafe { flatbuffers::Table::new(buf, loc) },
        }
    }
}

impl<'a> HostFunctionDetails<'a> {
    pub const VT_FUNCTIONS: flatbuffers::VOffsetT = 4;

    #[inline]
    pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
        HostFunctionDetails { _tab: table }
    }
    #[allow(unused_mut)]
    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
        args: &'args HostFunctionDetailsArgs<'args>,
    ) -> flatbuffers::WIPOffset<HostFunctionDetails<'bldr>> {
        let mut builder = HostFunctionDetailsBuilder::new(_fbb);
        if let Some(x) = args.functions {
            builder.add_functions(x);
        }
        builder.finish()
    }

    #[inline]
    pub fn functions(
        &self,
    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<HostFunctionDefinition<'a>>>>
    {
        // Safety:
        // Created from valid Table for this object
        // which contains a valid value in this slot
        unsafe {
            self._tab.get::<flatbuffers::ForwardsUOffset<
                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<HostFunctionDefinition>>,
            >>(HostFunctionDetails::VT_FUNCTIONS, None)
        }
    }
}

impl flatbuffers::Verifiable for HostFunctionDetails<'_> {
    #[inline]
    fn run_verifier(
        v: &mut flatbuffers::Verifier,
        pos: usize,
    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
        use self::flatbuffers::Verifiable;
        v.visit_table(pos)?
            .visit_field::<flatbuffers::ForwardsUOffset<
                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<HostFunctionDefinition>>,
            >>("functions", Self::VT_FUNCTIONS, false)?
            .finish();
        Ok(())
    }
}
pub struct HostFunctionDetailsArgs<'a> {
    pub functions: Option<
        flatbuffers::WIPOffset<
            flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<HostFunctionDefinition<'a>>>,
        >,
    >,
}
impl<'a> Default for HostFunctionDetailsArgs<'a> {
    #[inline]
    fn default() -> Self {
        HostFunctionDetailsArgs { functions: None }
    }
}

pub struct HostFunctionDetailsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
    fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
    start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> HostFunctionDetailsBuilder<'a, 'b, A> {
    #[inline]
    pub fn add_functions(
        &mut self,
        functions: flatbuffers::WIPOffset<
            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<HostFunctionDefinition<'b>>>,
        >,
    ) {
        self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
            HostFunctionDetails::VT_FUNCTIONS,
            functions,
        );
    }
    #[inline]
    pub fn new(
        _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
    ) -> HostFunctionDetailsBuilder<'a, 'b, A> {
        let start = _fbb.start_table();
        HostFunctionDetailsBuilder {
            fbb_: _fbb,
            start_: start,
        }
    }
    #[inline]
    pub fn finish(self) -> flatbuffers::WIPOffset<HostFunctionDetails<'a>> {
        let o = self.fbb_.end_table(self.start_);
        flatbuffers::WIPOffset::new(o.value())
    }
}

impl core::fmt::Debug for HostFunctionDetails<'_> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        let mut ds = f.debug_struct("HostFunctionDetails");
        ds.field("functions", &self.functions());
        ds.finish()
    }
}