// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
use super::*;

// struct LargeArrayStruct, aligned to 8
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct LargeArrayStruct(pub [u8; 2496]);

impl Default for LargeArrayStruct {
    fn default() -> Self {
        Self([0; 2496])
    }
}

impl ::core::fmt::Debug for LargeArrayStruct {
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        f.debug_struct("LargeArrayStruct")
            .field("d", &self.d())
            .field("e", &self.e())
            .field("f", &self.f())
            .field("g", &self.g())
            .field("h", &self.h())
            .finish()
    }
}

impl ::flatbuffers::SimpleToVerifyInSlice for LargeArrayStruct {}

impl<'a> ::flatbuffers::Follow<'a> for LargeArrayStruct {
    type Inner = &'a LargeArrayStruct;

    #[inline]
    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
        unsafe { <&'a LargeArrayStruct>::follow(buf, loc) }
    }
}

impl<'a> ::flatbuffers::Follow<'a> for &'a LargeArrayStruct {
    type Inner = &'a LargeArrayStruct;

    #[inline]
    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
        unsafe { ::flatbuffers::follow_cast_ref::<LargeArrayStruct>(buf, loc) }
    }
}

impl<'b> ::flatbuffers::Push for LargeArrayStruct {
    type Output = LargeArrayStruct;

    #[inline]
    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
        let src = unsafe { ::core::slice::from_raw_parts(self as *const LargeArrayStruct as *const u8, <Self as ::flatbuffers::Push>::size()) };
        dst.copy_from_slice(src);
    }

    #[inline]
    fn alignment() -> ::flatbuffers::PushAlignment {
        ::flatbuffers::PushAlignment::new(8)
    }
}

impl<'a> ::flatbuffers::Verifiable for LargeArrayStruct {
    #[inline]
    fn run_verifier(
        v: &mut ::flatbuffers::Verifier, pos: usize
    ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
        v.in_buffer::<Self>(pos)
    }
}

impl<'a> LargeArrayStruct {
    #[allow(clippy::too_many_arguments)]
    pub fn new(
        d: &[u8; 64],
        e: &[f32; 64],
        f: &[bool; 64],
        g: &[NestedStruct; 64],
        h: &[TestEnum; 64],
    ) -> Self {
        let mut s = Self([0; 2496]);
        s.set_d(d);
        s.set_e(e);
        s.set_f(f);
        s.set_g(g);
        s.set_h(h);
        s
    }

    pub const fn get_fully_qualified_name() -> &'static str {
        "MyGame.Example.LargeArrayStruct"
    }

    pub fn d(&'a self) -> ::flatbuffers::Array<'a, u8, 64> {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        use ::flatbuffers::Follow;
        unsafe { ::flatbuffers::Array::follow(&self.0, 0) }
    }

    pub fn set_d(&mut self, items: &[u8; 64]) {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 0, items) };
    }

    pub fn e(&'a self) -> ::flatbuffers::Array<'a, f32, 64> {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        use ::flatbuffers::Follow;
        unsafe { ::flatbuffers::Array::follow(&self.0, 64) }
    }

    pub fn set_e(&mut self, items: &[f32; 64]) {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 64, items) };
    }

    pub fn f(&'a self) -> ::flatbuffers::Array<'a, bool, 64> {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        use ::flatbuffers::Follow;
        unsafe { ::flatbuffers::Array::follow(&self.0, 320) }
    }

    pub fn set_f(&mut self, items: &[bool; 64]) {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        unsafe { ::flatbuffers::emplace_scalar_array(&mut self.0, 320, items) };
    }

    pub fn g(&'a self) -> ::flatbuffers::Array<'a, NestedStruct, 64> {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        use ::flatbuffers::Follow;
        unsafe { ::flatbuffers::Array::follow(&self.0, 384) }
    }

    pub fn set_g(&mut self, x: &[NestedStruct; 64]) {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        unsafe {
            ::core::ptr::copy(
                x.as_ptr() as *const u8,
                self.0.as_mut_ptr().add(384),
                2048,
            );
        }
    }

    pub fn h(&'a self) -> ::flatbuffers::Array<'a, TestEnum, 64> {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        use ::flatbuffers::Follow;
        unsafe { ::flatbuffers::Array::follow(&self.0, 2432) }
    }

    pub fn set_h(&mut self, x: &[TestEnum; 64]) {
        // Safety:
        // Created from a valid Table for this object
        // Which contains a valid array in this slot
        unsafe {
            ::core::ptr::copy(
                x.as_ptr() as *const u8,
                self.0.as_mut_ptr().add(2432),
                64,
            );
        }
    }

    pub fn unpack(&self) -> LargeArrayStructT {
        LargeArrayStructT {
            d: self.d().into(),
            e: self.e().into(),
            f: self.f().into(),
        g: { let g = self.g(); ::flatbuffers::array_init(|i| g.get(i).unpack()) },
            h: self.h().into(),
        }
    }
}

#[derive(Debug, Clone, PartialEq)]
pub struct LargeArrayStructT {
    pub d: [u8; 64],
    pub e: [f32; 64],
    pub f: [bool; 64],
    pub g: [NestedStructT; 64],
    pub h: [TestEnum; 64],
}
impl Default for LargeArrayStructT {
    fn default() -> Self {
        Self {
            d: [0; 64],
            e: [0.0; 64],
            f: [false; 64],
            g: ::flatbuffers::array_init(|_| Default::default()),
            h: ::flatbuffers::array_init(|_| Default::default()),
        }
    }
}

impl LargeArrayStructT {
    pub fn pack(&self) -> LargeArrayStruct {
        LargeArrayStruct::new(
            &self.d,
            &self.e,
            &self.f,
            &::flatbuffers::array_init(|i| self.g[i].pack()),
            &self.h,
        )
    }
}
