Generate better formatted Rust code (#8919)

* Cleans up Rust formatting

* Regenerates generated schemas
This commit is contained in:
Cameron Mulhern
2026-03-04 21:49:46 -05:00
committed by GitHub
parent 9c383559e0
commit 08b6372a36
95 changed files with 2783 additions and 1062 deletions

View File

@@ -2,15 +2,18 @@
// @generated
extern crate alloc;
use super::*;
// struct Test, aligned to 2
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq)]
pub struct Test(pub [u8; 4]);
impl Default for Test {
fn default() -> Self {
Self([0; 4])
}
}
impl ::core::fmt::Debug for Test {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
f.debug_struct("Test")
@@ -21,27 +24,34 @@ impl ::core::fmt::Debug for Test {
}
impl ::flatbuffers::SimpleToVerifyInSlice for Test {}
impl<'a> ::flatbuffers::Follow<'a> for Test {
type Inner = &'a Test;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { <&'a Test>::follow(buf, loc) }
}
}
impl<'a> ::flatbuffers::Follow<'a> for &'a Test {
type Inner = &'a Test;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
unsafe { ::flatbuffers::follow_cast_ref::<Test>(buf, loc) }
}
}
impl<'b> ::flatbuffers::Push for Test {
type Output = Test;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
let src = unsafe { ::core::slice::from_raw_parts(self as *const Test as *const u8, <Self as ::flatbuffers::Push>::size()) };
dst.copy_from_slice(src);
}
#[inline]
fn alignment() -> ::flatbuffers::PushAlignment {
::flatbuffers::PushAlignment::new(2)
@@ -144,6 +154,7 @@ pub struct TestT {
pub a: i16,
pub b: i8,
}
impl TestT {
pub fn pack(&self) -> Test {
Test::new(
@@ -152,4 +163,3 @@ impl TestT {
)
}
}