1#![allow(dead_code)]
6#![allow(unused_imports)]
7
8use crate::r#gen::Schema::*;
9use flatbuffers::EndianScalar;
10use std::{cmp::Ordering, mem};
11#[repr(transparent)]
17#[derive(Clone, Copy, PartialEq)]
18pub struct Block(pub [u8; 24]);
19impl Default for Block {
20 fn default() -> Self {
21 Self([0; 24])
22 }
23}
24impl core::fmt::Debug for Block {
25 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
26 f.debug_struct("Block")
27 .field("offset", &self.offset())
28 .field("metaDataLength", &self.metaDataLength())
29 .field("bodyLength", &self.bodyLength())
30 .finish()
31 }
32}
33
34impl flatbuffers::SimpleToVerifyInSlice for Block {}
35impl<'a> flatbuffers::Follow<'a> for Block {
36 type Inner = &'a Block;
37 #[inline]
38 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
39 unsafe { <&'a Block>::follow(buf, loc) }
40 }
41}
42impl<'a> flatbuffers::Follow<'a> for &'a Block {
43 type Inner = &'a Block;
44 #[inline]
45 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
46 unsafe { flatbuffers::follow_cast_ref::<Block>(buf, loc) }
47 }
48}
49impl<'b> flatbuffers::Push for Block {
50 type Output = Block;
51 #[inline]
52 unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
53 let src = unsafe {
54 ::core::slice::from_raw_parts(
55 self as *const Block as *const u8,
56 <Self as flatbuffers::Push>::size(),
57 )
58 };
59 dst.copy_from_slice(src);
60 }
61 #[inline]
62 fn alignment() -> flatbuffers::PushAlignment {
63 flatbuffers::PushAlignment::new(8)
64 }
65}
66
67impl<'a> flatbuffers::Verifiable for Block {
68 #[inline]
69 fn run_verifier(
70 v: &mut flatbuffers::Verifier,
71 pos: usize,
72 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
73 use flatbuffers::Verifiable;
74 v.in_buffer::<Self>(pos)
75 }
76}
77
78impl<'a> Block {
79 #[allow(clippy::too_many_arguments)]
80 pub fn new(offset: i64, metaDataLength: i32, bodyLength: i64) -> Self {
81 let mut s = Self([0; 24]);
82 s.set_offset(offset);
83 s.set_metaDataLength(metaDataLength);
84 s.set_bodyLength(bodyLength);
85 s
86 }
87
88 pub fn offset(&self) -> i64 {
90 let mut mem = core::mem::MaybeUninit::<<i64 as EndianScalar>::Scalar>::uninit();
91 EndianScalar::from_little_endian(unsafe {
95 core::ptr::copy_nonoverlapping(
96 self.0[0..].as_ptr(),
97 mem.as_mut_ptr() as *mut u8,
98 core::mem::size_of::<<i64 as EndianScalar>::Scalar>(),
99 );
100 mem.assume_init()
101 })
102 }
103
104 pub fn set_offset(&mut self, x: i64) {
105 let x_le = x.to_little_endian();
106 unsafe {
110 core::ptr::copy_nonoverlapping(
111 &x_le as *const _ as *const u8,
112 self.0[0..].as_mut_ptr(),
113 core::mem::size_of::<<i64 as EndianScalar>::Scalar>(),
114 );
115 }
116 }
117
118 pub fn metaDataLength(&self) -> i32 {
120 let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
121 EndianScalar::from_little_endian(unsafe {
125 core::ptr::copy_nonoverlapping(
126 self.0[8..].as_ptr(),
127 mem.as_mut_ptr() as *mut u8,
128 core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
129 );
130 mem.assume_init()
131 })
132 }
133
134 pub fn set_metaDataLength(&mut self, x: i32) {
135 let x_le = x.to_little_endian();
136 unsafe {
140 core::ptr::copy_nonoverlapping(
141 &x_le as *const _ as *const u8,
142 self.0[8..].as_mut_ptr(),
143 core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
144 );
145 }
146 }
147
148 pub fn bodyLength(&self) -> i64 {
151 let mut mem = core::mem::MaybeUninit::<<i64 as EndianScalar>::Scalar>::uninit();
152 EndianScalar::from_little_endian(unsafe {
156 core::ptr::copy_nonoverlapping(
157 self.0[16..].as_ptr(),
158 mem.as_mut_ptr() as *mut u8,
159 core::mem::size_of::<<i64 as EndianScalar>::Scalar>(),
160 );
161 mem.assume_init()
162 })
163 }
164
165 pub fn set_bodyLength(&mut self, x: i64) {
166 let x_le = x.to_little_endian();
167 unsafe {
171 core::ptr::copy_nonoverlapping(
172 &x_le as *const _ as *const u8,
173 self.0[16..].as_mut_ptr(),
174 core::mem::size_of::<<i64 as EndianScalar>::Scalar>(),
175 );
176 }
177 }
178}
179
180pub enum FooterOffset {}
181#[derive(Copy, Clone, PartialEq)]
182
183pub struct Footer<'a> {
187 pub _tab: flatbuffers::Table<'a>,
188}
189
190impl<'a> flatbuffers::Follow<'a> for Footer<'a> {
191 type Inner = Footer<'a>;
192 #[inline]
193 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
194 Self {
195 _tab: unsafe { flatbuffers::Table::new(buf, loc) },
196 }
197 }
198}
199
200impl<'a> Footer<'a> {
201 pub const VT_VERSION: flatbuffers::VOffsetT = 4;
202 pub const VT_SCHEMA: flatbuffers::VOffsetT = 6;
203 pub const VT_DICTIONARIES: flatbuffers::VOffsetT = 8;
204 pub const VT_RECORDBATCHES: flatbuffers::VOffsetT = 10;
205 pub const VT_CUSTOM_METADATA: flatbuffers::VOffsetT = 12;
206
207 #[inline]
208 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
209 Footer { _tab: table }
210 }
211 #[allow(unused_mut)]
212 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
213 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
214 args: &'args FooterArgs<'args>,
215 ) -> flatbuffers::WIPOffset<Footer<'bldr>> {
216 let mut builder = FooterBuilder::new(_fbb);
217 if let Some(x) = args.custom_metadata {
218 builder.add_custom_metadata(x);
219 }
220 if let Some(x) = args.recordBatches {
221 builder.add_recordBatches(x);
222 }
223 if let Some(x) = args.dictionaries {
224 builder.add_dictionaries(x);
225 }
226 if let Some(x) = args.schema {
227 builder.add_schema(x);
228 }
229 builder.add_version(args.version);
230 builder.finish()
231 }
232
233 #[inline]
234 pub fn version(&self) -> MetadataVersion {
235 unsafe {
239 self._tab
240 .get::<MetadataVersion>(Footer::VT_VERSION, Some(MetadataVersion::V1))
241 .unwrap()
242 }
243 }
244 #[inline]
245 pub fn schema(&self) -> Option<Schema<'a>> {
246 unsafe {
250 self._tab
251 .get::<flatbuffers::ForwardsUOffset<Schema>>(Footer::VT_SCHEMA, None)
252 }
253 }
254 #[inline]
255 pub fn dictionaries(&self) -> Option<flatbuffers::Vector<'a, Block>> {
256 unsafe {
260 self._tab
261 .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Block>>>(
262 Footer::VT_DICTIONARIES,
263 None,
264 )
265 }
266 }
267 #[inline]
268 pub fn recordBatches(&self) -> Option<flatbuffers::Vector<'a, Block>> {
269 unsafe {
273 self._tab
274 .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Block>>>(
275 Footer::VT_RECORDBATCHES,
276 None,
277 )
278 }
279 }
280 #[inline]
282 pub fn custom_metadata(
283 &self,
284 ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
285 unsafe {
289 self._tab.get::<flatbuffers::ForwardsUOffset<
290 flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<KeyValue>>,
291 >>(Footer::VT_CUSTOM_METADATA, None)
292 }
293 }
294}
295
296impl flatbuffers::Verifiable for Footer<'_> {
297 #[inline]
298 fn run_verifier(
299 v: &mut flatbuffers::Verifier,
300 pos: usize,
301 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
302 use flatbuffers::Verifiable;
303 v.visit_table(pos)?
304 .visit_field::<MetadataVersion>("version", Self::VT_VERSION, false)?
305 .visit_field::<flatbuffers::ForwardsUOffset<Schema>>("schema", Self::VT_SCHEMA, false)?
306 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Block>>>(
307 "dictionaries",
308 Self::VT_DICTIONARIES,
309 false,
310 )?
311 .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Block>>>(
312 "recordBatches",
313 Self::VT_RECORDBATCHES,
314 false,
315 )?
316 .visit_field::<flatbuffers::ForwardsUOffset<
317 flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<KeyValue>>,
318 >>("custom_metadata", Self::VT_CUSTOM_METADATA, false)?
319 .finish();
320 Ok(())
321 }
322}
323pub struct FooterArgs<'a> {
324 pub version: MetadataVersion,
325 pub schema: Option<flatbuffers::WIPOffset<Schema<'a>>>,
326 pub dictionaries: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Block>>>,
327 pub recordBatches: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Block>>>,
328 pub custom_metadata: Option<
329 flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<KeyValue<'a>>>>,
330 >,
331}
332impl<'a> Default for FooterArgs<'a> {
333 #[inline]
334 fn default() -> Self {
335 FooterArgs {
336 version: MetadataVersion::V1,
337 schema: None,
338 dictionaries: None,
339 recordBatches: None,
340 custom_metadata: None,
341 }
342 }
343}
344
345pub struct FooterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
346 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
347 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
348}
349impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FooterBuilder<'a, 'b, A> {
350 #[inline]
351 pub fn add_version(&mut self, version: MetadataVersion) {
352 self.fbb_
353 .push_slot::<MetadataVersion>(Footer::VT_VERSION, version, MetadataVersion::V1);
354 }
355 #[inline]
356 pub fn add_schema(&mut self, schema: flatbuffers::WIPOffset<Schema<'b>>) {
357 self.fbb_
358 .push_slot_always::<flatbuffers::WIPOffset<Schema>>(Footer::VT_SCHEMA, schema);
359 }
360 #[inline]
361 pub fn add_dictionaries(
362 &mut self,
363 dictionaries: flatbuffers::WIPOffset<flatbuffers::Vector<'b, Block>>,
364 ) {
365 self.fbb_
366 .push_slot_always::<flatbuffers::WIPOffset<_>>(Footer::VT_DICTIONARIES, dictionaries);
367 }
368 #[inline]
369 pub fn add_recordBatches(
370 &mut self,
371 recordBatches: flatbuffers::WIPOffset<flatbuffers::Vector<'b, Block>>,
372 ) {
373 self.fbb_
374 .push_slot_always::<flatbuffers::WIPOffset<_>>(Footer::VT_RECORDBATCHES, recordBatches);
375 }
376 #[inline]
377 pub fn add_custom_metadata(
378 &mut self,
379 custom_metadata: flatbuffers::WIPOffset<
380 flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<KeyValue<'b>>>,
381 >,
382 ) {
383 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
384 Footer::VT_CUSTOM_METADATA,
385 custom_metadata,
386 );
387 }
388 #[inline]
389 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FooterBuilder<'a, 'b, A> {
390 let start = _fbb.start_table();
391 FooterBuilder {
392 fbb_: _fbb,
393 start_: start,
394 }
395 }
396 #[inline]
397 pub fn finish(self) -> flatbuffers::WIPOffset<Footer<'a>> {
398 let o = self.fbb_.end_table(self.start_);
399 flatbuffers::WIPOffset::new(o.value())
400 }
401}
402
403impl core::fmt::Debug for Footer<'_> {
404 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
405 let mut ds = f.debug_struct("Footer");
406 ds.field("version", &self.version());
407 ds.field("schema", &self.schema());
408 ds.field("dictionaries", &self.dictionaries());
409 ds.field("recordBatches", &self.recordBatches());
410 ds.field("custom_metadata", &self.custom_metadata());
411 ds.finish()
412 }
413}
414#[inline]
415pub fn root_as_footer(buf: &[u8]) -> Result<Footer, flatbuffers::InvalidFlatbuffer> {
422 flatbuffers::root::<Footer>(buf)
423}
424#[inline]
425pub fn size_prefixed_root_as_footer(buf: &[u8]) -> Result<Footer, flatbuffers::InvalidFlatbuffer> {
432 flatbuffers::size_prefixed_root::<Footer>(buf)
433}
434#[inline]
435pub fn root_as_footer_with_opts<'b, 'o>(
442 opts: &'o flatbuffers::VerifierOptions,
443 buf: &'b [u8],
444) -> Result<Footer<'b>, flatbuffers::InvalidFlatbuffer> {
445 flatbuffers::root_with_opts::<Footer<'b>>(opts, buf)
446}
447#[inline]
448pub fn size_prefixed_root_as_footer_with_opts<'b, 'o>(
455 opts: &'o flatbuffers::VerifierOptions,
456 buf: &'b [u8],
457) -> Result<Footer<'b>, flatbuffers::InvalidFlatbuffer> {
458 flatbuffers::size_prefixed_root_with_opts::<Footer<'b>>(opts, buf)
459}
460#[inline]
461pub unsafe fn root_as_footer_unchecked(buf: &[u8]) -> Footer {
465 unsafe { flatbuffers::root_unchecked::<Footer>(buf) }
466}
467#[inline]
468pub unsafe fn size_prefixed_root_as_footer_unchecked(buf: &[u8]) -> Footer {
472 unsafe { flatbuffers::size_prefixed_root_unchecked::<Footer>(buf) }
473}
474#[inline]
475pub fn finish_footer_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
476 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
477 root: flatbuffers::WIPOffset<Footer<'a>>,
478) {
479 fbb.finish(root, None);
480}
481
482#[inline]
483pub fn finish_size_prefixed_footer_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
484 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
485 root: flatbuffers::WIPOffset<Footer<'a>>,
486) {
487 fbb.finish_size_prefixed(root, None);
488}