Skip to main content

nexus_core/generated/
v2_generated.rs

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