Skip to main content

streamer/
data_generated.rs

1// automatically generated by the FlatBuffers compiler, do not modify
2
3
4// @generated
5
6use core::mem;
7use core::cmp::Ordering;
8
9extern crate flatbuffers;
10use self::flatbuffers::{EndianScalar, Follow};
11
12#[allow(unused_imports, dead_code)]
13pub mod sampler {
14
15  use core::mem;
16  use core::cmp::Ordering;
17
18  extern crate flatbuffers;
19  use self::flatbuffers::{EndianScalar, Follow};
20
21pub enum ScanOffset {}
22#[derive(Copy, Clone, PartialEq)]
23
24pub struct Scan<'a> {
25  pub _tab: flatbuffers::Table<'a>,
26}
27
28impl<'a> flatbuffers::Follow<'a> for Scan<'a> {
29  type Inner = Scan<'a>;
30  #[inline]
31  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
32    Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
33  }
34}
35
36impl<'a> Scan<'a> {
37  pub const VT_FIRST_SAMPLE_UNIX_NS: flatbuffers::VOffsetT = 4;
38  pub const VT_SAMPLE_INTERVAL_NS: flatbuffers::VOffsetT = 6;
39  pub const VT_ACTUAL_SCAN_RATE_HZ: flatbuffers::VOffsetT = 8;
40  pub const VT_SEQUENCE: flatbuffers::VOffsetT = 10;
41  pub const VT_VALUES: flatbuffers::VOffsetT = 12;
42
43  #[inline]
44  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
45    Scan { _tab: table }
46  }
47  #[allow(unused_mut)]
48  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
49    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
50    args: &'args ScanArgs<'args>
51  ) -> flatbuffers::WIPOffset<Scan<'bldr>> {
52    let mut builder = ScanBuilder::new(_fbb);
53    builder.add_sequence(args.sequence);
54    builder.add_actual_scan_rate_hz(args.actual_scan_rate_hz);
55    builder.add_sample_interval_ns(args.sample_interval_ns);
56    builder.add_first_sample_unix_ns(args.first_sample_unix_ns);
57    if let Some(x) = args.values { builder.add_values(x); }
58    builder.finish()
59  }
60
61
62  #[inline]
63  pub fn first_sample_unix_ns(&self) -> u64 {
64    // Safety:
65    // Created from valid Table for this object
66    // which contains a valid value in this slot
67    unsafe { self._tab.get::<u64>(Scan::VT_FIRST_SAMPLE_UNIX_NS, Some(0)).unwrap()}
68  }
69  #[inline]
70  pub fn sample_interval_ns(&self) -> u64 {
71    // Safety:
72    // Created from valid Table for this object
73    // which contains a valid value in this slot
74    unsafe { self._tab.get::<u64>(Scan::VT_SAMPLE_INTERVAL_NS, Some(0)).unwrap()}
75  }
76  #[inline]
77  pub fn actual_scan_rate_hz(&self) -> f64 {
78    // Safety:
79    // Created from valid Table for this object
80    // which contains a valid value in this slot
81    unsafe { self._tab.get::<f64>(Scan::VT_ACTUAL_SCAN_RATE_HZ, Some(0.0)).unwrap()}
82  }
83  #[inline]
84  pub fn sequence(&self) -> u64 {
85    // Safety:
86    // Created from valid Table for this object
87    // which contains a valid value in this slot
88    unsafe { self._tab.get::<u64>(Scan::VT_SEQUENCE, Some(0)).unwrap()}
89  }
90  #[inline]
91  pub fn values(&self) -> Option<flatbuffers::Vector<'a, f64>> {
92    // Safety:
93    // Created from valid Table for this object
94    // which contains a valid value in this slot
95    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Scan::VT_VALUES, None)}
96  }
97}
98
99impl flatbuffers::Verifiable for Scan<'_> {
100  #[inline]
101  fn run_verifier(
102    v: &mut flatbuffers::Verifier, pos: usize
103  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
104    use self::flatbuffers::Verifiable;
105    v.visit_table(pos)?
106     .visit_field::<u64>("first_sample_unix_ns", Self::VT_FIRST_SAMPLE_UNIX_NS, false)?
107     .visit_field::<u64>("sample_interval_ns", Self::VT_SAMPLE_INTERVAL_NS, false)?
108     .visit_field::<f64>("actual_scan_rate_hz", Self::VT_ACTUAL_SCAN_RATE_HZ, false)?
109     .visit_field::<u64>("sequence", Self::VT_SEQUENCE, false)?
110     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("values", Self::VT_VALUES, false)?
111     .finish();
112    Ok(())
113  }
114}
115pub struct ScanArgs<'a> {
116    pub first_sample_unix_ns: u64,
117    pub sample_interval_ns: u64,
118    pub actual_scan_rate_hz: f64,
119    pub sequence: u64,
120    pub values: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
121}
122impl<'a> Default for ScanArgs<'a> {
123  #[inline]
124  fn default() -> Self {
125    ScanArgs {
126      first_sample_unix_ns: 0,
127      sample_interval_ns: 0,
128      actual_scan_rate_hz: 0.0,
129      sequence: 0,
130      values: None,
131    }
132  }
133}
134
135pub struct ScanBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
136  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
137  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
138}
139impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ScanBuilder<'a, 'b, A> {
140  #[inline]
141  pub fn add_first_sample_unix_ns(&mut self, first_sample_unix_ns: u64) {
142    self.fbb_.push_slot::<u64>(Scan::VT_FIRST_SAMPLE_UNIX_NS, first_sample_unix_ns, 0);
143  }
144  #[inline]
145  pub fn add_sample_interval_ns(&mut self, sample_interval_ns: u64) {
146    self.fbb_.push_slot::<u64>(Scan::VT_SAMPLE_INTERVAL_NS, sample_interval_ns, 0);
147  }
148  #[inline]
149  pub fn add_actual_scan_rate_hz(&mut self, actual_scan_rate_hz: f64) {
150    self.fbb_.push_slot::<f64>(Scan::VT_ACTUAL_SCAN_RATE_HZ, actual_scan_rate_hz, 0.0);
151  }
152  #[inline]
153  pub fn add_sequence(&mut self, sequence: u64) {
154    self.fbb_.push_slot::<u64>(Scan::VT_SEQUENCE, sequence, 0);
155  }
156  #[inline]
157  pub fn add_values(&mut self, values: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
158    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Scan::VT_VALUES, values);
159  }
160  #[inline]
161  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ScanBuilder<'a, 'b, A> {
162    let start = _fbb.start_table();
163    ScanBuilder {
164      fbb_: _fbb,
165      start_: start,
166    }
167  }
168  #[inline]
169  pub fn finish(self) -> flatbuffers::WIPOffset<Scan<'a>> {
170    let o = self.fbb_.end_table(self.start_);
171    flatbuffers::WIPOffset::new(o.value())
172  }
173}
174
175impl core::fmt::Debug for Scan<'_> {
176  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
177    let mut ds = f.debug_struct("Scan");
178      ds.field("first_sample_unix_ns", &self.first_sample_unix_ns());
179      ds.field("sample_interval_ns", &self.sample_interval_ns());
180      ds.field("actual_scan_rate_hz", &self.actual_scan_rate_hz());
181      ds.field("sequence", &self.sequence());
182      ds.field("values", &self.values());
183      ds.finish()
184  }
185}
186#[inline]
187/// Verifies that a buffer of bytes contains a `Scan`
188/// and returns it.
189/// 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_scan_unchecked`.
193pub fn root_as_scan(buf: &[u8]) -> Result<Scan<'_>, flatbuffers::InvalidFlatbuffer> {
194  flatbuffers::root::<Scan>(buf)
195}
196#[inline]
197/// Verifies that a buffer of bytes contains a size prefixed
198/// `Scan` and returns it.
199/// Note that verification is still experimental and may not
200/// catch every error, or be maximally performant. For the
201/// previous, unchecked, behavior use
202/// `size_prefixed_root_as_scan_unchecked`.
203pub fn size_prefixed_root_as_scan(buf: &[u8]) -> Result<Scan<'_>, flatbuffers::InvalidFlatbuffer> {
204  flatbuffers::size_prefixed_root::<Scan>(buf)
205}
206#[inline]
207/// Verifies, with the given options, that a buffer of bytes
208/// contains a `Scan` and returns it.
209/// Note that verification is still experimental and may not
210/// catch every error, or be maximally performant. For the
211/// previous, unchecked, behavior use
212/// `root_as_scan_unchecked`.
213pub fn root_as_scan_with_opts<'b, 'o>(
214  opts: &'o flatbuffers::VerifierOptions,
215  buf: &'b [u8],
216) -> Result<Scan<'b>, flatbuffers::InvalidFlatbuffer> {
217  flatbuffers::root_with_opts::<Scan<'b>>(opts, buf)
218}
219#[inline]
220/// Verifies, with the given verifier options, that a buffer of
221/// bytes contains a size prefixed `Scan` and returns
222/// it. Note that verification is still experimental and may not
223/// catch every error, or be maximally performant. For the
224/// previous, unchecked, behavior use
225/// `root_as_scan_unchecked`.
226pub fn size_prefixed_root_as_scan_with_opts<'b, 'o>(
227  opts: &'o flatbuffers::VerifierOptions,
228  buf: &'b [u8],
229) -> Result<Scan<'b>, flatbuffers::InvalidFlatbuffer> {
230  flatbuffers::size_prefixed_root_with_opts::<Scan<'b>>(opts, buf)
231}
232#[inline]
233/// Assumes, without verification, that a buffer of bytes contains a Scan and returns it.
234/// # Safety
235/// Callers must trust the given bytes do indeed contain a valid `Scan`.
236pub unsafe fn root_as_scan_unchecked(buf: &[u8]) -> Scan<'_> {
237  unsafe { flatbuffers::root_unchecked::<Scan>(buf) }
238}
239#[inline]
240/// Assumes, without verification, that a buffer of bytes contains a size prefixed Scan and returns it.
241/// # Safety
242/// Callers must trust the given bytes do indeed contain a valid size prefixed `Scan`.
243pub unsafe fn size_prefixed_root_as_scan_unchecked(buf: &[u8]) -> Scan<'_> {
244  unsafe { flatbuffers::size_prefixed_root_unchecked::<Scan>(buf) }
245}
246#[inline]
247pub fn finish_scan_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
248    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
249    root: flatbuffers::WIPOffset<Scan<'a>>) {
250  fbb.finish(root, None);
251}
252
253#[inline]
254pub fn finish_size_prefixed_scan_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<Scan<'a>>) {
255  fbb.finish_size_prefixed(root, None);
256}
257}  // pub mod sampler