Skip to main content

nexus_core/generated/
v1_generated.rs

1// automatically generated by the FlatBuffers compiler, do not modify
2// @generated
3extern crate alloc;
4
5
6pub enum RecordV1Offset {}
7#[derive(Copy, Clone, PartialEq)]
8
9pub struct RecordV1<'a> {
10  pub _tab: ::flatbuffers::Table<'a>,
11}
12
13impl<'a> ::flatbuffers::Follow<'a> for RecordV1<'a> {
14  type Inner = RecordV1<'a>;
15  #[inline]
16  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
17    Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
18  }
19}
20
21impl<'a> RecordV1<'a> {
22  pub const VT_OBJECT_ID: ::flatbuffers::VOffsetT = 4;
23  pub const VT_BUCKET_NAME: ::flatbuffers::VOffsetT = 6;
24  pub const VT_OFFSET: ::flatbuffers::VOffsetT = 8;
25
26  #[inline]
27  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
28    RecordV1 { _tab: table }
29  }
30  #[allow(unused_mut)]
31  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
32    _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
33    args: &'args RecordV1Args<'args>
34  ) -> ::flatbuffers::WIPOffset<RecordV1<'bldr>> {
35    let mut builder = RecordV1Builder::new(_fbb);
36    builder.add_offset(args.offset);
37    builder.add_object_id(args.object_id);
38    if let Some(x) = args.bucket_name { builder.add_bucket_name(x); }
39    builder.finish()
40  }
41
42
43  #[inline]
44  pub fn object_id(&self) -> u64 {
45    // Safety:
46    // Created from valid Table for this object
47    // which contains a valid value in this slot
48    unsafe { self._tab.get::<u64>(RecordV1::VT_OBJECT_ID, Some(0)).unwrap()}
49  }
50  #[inline]
51  pub fn bucket_name(&self) -> Option<&'a str> {
52    // Safety:
53    // Created from valid Table for this object
54    // which contains a valid value in this slot
55    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(RecordV1::VT_BUCKET_NAME, None)}
56  }
57  #[inline]
58  pub fn offset(&self) -> u64 {
59    // Safety:
60    // Created from valid Table for this object
61    // which contains a valid value in this slot
62    unsafe { self._tab.get::<u64>(RecordV1::VT_OFFSET, Some(0)).unwrap()}
63  }
64}
65
66impl ::flatbuffers::Verifiable for RecordV1<'_> {
67  #[inline]
68  fn run_verifier(
69    v: &mut ::flatbuffers::Verifier, pos: usize
70  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
71    v.visit_table(pos)?
72     .visit_field::<u64>("object_id", Self::VT_OBJECT_ID, false)?
73     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("bucket_name", Self::VT_BUCKET_NAME, false)?
74     .visit_field::<u64>("offset", Self::VT_OFFSET, false)?
75     .finish();
76    Ok(())
77  }
78}
79pub struct RecordV1Args<'a> {
80    pub object_id: u64,
81    pub bucket_name: Option<::flatbuffers::WIPOffset<&'a str>>,
82    pub offset: u64,
83}
84impl<'a> Default for RecordV1Args<'a> {
85  #[inline]
86  fn default() -> Self {
87    RecordV1Args {
88      object_id: 0,
89      bucket_name: None,
90      offset: 0,
91    }
92  }
93}
94
95pub struct RecordV1Builder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
96  fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
97  start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
98}
99impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> RecordV1Builder<'a, 'b, A> {
100  #[inline]
101  pub fn add_object_id(&mut self, object_id: u64) {
102    self.fbb_.push_slot::<u64>(RecordV1::VT_OBJECT_ID, object_id, 0);
103  }
104  #[inline]
105  pub fn add_bucket_name(&mut self, bucket_name: ::flatbuffers::WIPOffset<&'b  str>) {
106    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(RecordV1::VT_BUCKET_NAME, bucket_name);
107  }
108  #[inline]
109  pub fn add_offset(&mut self, offset: u64) {
110    self.fbb_.push_slot::<u64>(RecordV1::VT_OFFSET, offset, 0);
111  }
112  #[inline]
113  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> RecordV1Builder<'a, 'b, A> {
114    let start = _fbb.start_table();
115    RecordV1Builder {
116      fbb_: _fbb,
117      start_: start,
118    }
119  }
120  #[inline]
121  pub fn finish(self) -> ::flatbuffers::WIPOffset<RecordV1<'a>> {
122    let o = self.fbb_.end_table(self.start_);
123    ::flatbuffers::WIPOffset::new(o.value())
124  }
125}
126
127impl ::core::fmt::Debug for RecordV1<'_> {
128  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
129    let mut ds = f.debug_struct("RecordV1");
130      ds.field("object_id", &self.object_id());
131      ds.field("bucket_name", &self.bucket_name());
132      ds.field("offset", &self.offset());
133      ds.finish()
134  }
135}
136#[inline]
137/// Verifies that a buffer of bytes contains a `RecordV1`
138/// and returns it.
139/// Note that verification is still experimental and may not
140/// catch every error, or be maximally performant. For the
141/// previous, unchecked, behavior use
142/// `root_as_record_v1_unchecked`.
143pub fn root_as_record_v1(buf: &[u8]) -> Result<RecordV1<'_>, ::flatbuffers::InvalidFlatbuffer> {
144  ::flatbuffers::root::<RecordV1>(buf)
145}
146#[inline]
147/// Verifies that a buffer of bytes contains a size prefixed
148/// `RecordV1` and returns it.
149/// Note that verification is still experimental and may not
150/// catch every error, or be maximally performant. For the
151/// previous, unchecked, behavior use
152/// `size_prefixed_root_as_record_v1_unchecked`.
153pub fn size_prefixed_root_as_record_v1(buf: &[u8]) -> Result<RecordV1<'_>, ::flatbuffers::InvalidFlatbuffer> {
154  ::flatbuffers::size_prefixed_root::<RecordV1>(buf)
155}
156#[inline]
157/// Verifies, with the given options, that a buffer of bytes
158/// contains a `RecordV1` and returns it.
159/// Note that verification is still experimental and may not
160/// catch every error, or be maximally performant. For the
161/// previous, unchecked, behavior use
162/// `root_as_record_v1_unchecked`.
163pub fn root_as_record_v1_with_opts<'b, 'o>(
164  opts: &'o ::flatbuffers::VerifierOptions,
165  buf: &'b [u8],
166) -> Result<RecordV1<'b>, ::flatbuffers::InvalidFlatbuffer> {
167  ::flatbuffers::root_with_opts::<RecordV1<'b>>(opts, buf)
168}
169#[inline]
170/// Verifies, with the given verifier options, that a buffer of
171/// bytes contains a size prefixed `RecordV1` and returns
172/// it. Note that verification is still experimental and may not
173/// catch every error, or be maximally performant. For the
174/// previous, unchecked, behavior use
175/// `root_as_record_v1_unchecked`.
176pub fn size_prefixed_root_as_record_v1_with_opts<'b, 'o>(
177  opts: &'o ::flatbuffers::VerifierOptions,
178  buf: &'b [u8],
179) -> Result<RecordV1<'b>, ::flatbuffers::InvalidFlatbuffer> {
180  ::flatbuffers::size_prefixed_root_with_opts::<RecordV1<'b>>(opts, buf)
181}
182#[inline]
183/// Assumes, without verification, that a buffer of bytes contains a RecordV1 and returns it.
184/// # Safety
185/// Callers must trust the given bytes do indeed contain a valid `RecordV1`.
186pub unsafe fn root_as_record_v1_unchecked(buf: &[u8]) -> RecordV1<'_> {
187  unsafe { ::flatbuffers::root_unchecked::<RecordV1>(buf) }
188}
189#[inline]
190/// Assumes, without verification, that a buffer of bytes contains a size prefixed RecordV1 and returns it.
191/// # Safety
192/// Callers must trust the given bytes do indeed contain a valid size prefixed `RecordV1`.
193pub unsafe fn size_prefixed_root_as_record_v1_unchecked(buf: &[u8]) -> RecordV1<'_> {
194  unsafe { ::flatbuffers::size_prefixed_root_unchecked::<RecordV1>(buf) }
195}
196#[inline]
197pub fn finish_record_v1_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
198    fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
199    root: ::flatbuffers::WIPOffset<RecordV1<'a>>) {
200  fbb.finish(root, None);
201}
202
203#[inline]
204pub fn finish_size_prefixed_record_v1_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<RecordV1<'a>>) {
205  fbb.finish_size_prefixed(root, None);
206}