1
// automatically generated by the FlatBuffers compiler, do not modify
2

            
3

            
4
// @generated
5

            
6
use crate::input_type_generated::*;
7
use core::mem;
8
use core::cmp::Ordering;
9

            
10
extern crate flatbuffers;
11
use self::flatbuffers::{EndianScalar, Follow};
12

            
13
pub enum DeployV1Offset {}
14
#[derive(Copy, Clone, PartialEq)]
15

            
16
pub struct DeployV1<'a> {
17
  pub _tab: flatbuffers::Table<'a>,
18
}
19

            
20
impl<'a> flatbuffers::Follow<'a> for DeployV1<'a> {
21
  type Inner = DeployV1<'a>;
22
  #[inline]
23
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
24
    Self { _tab: flatbuffers::Table::new(buf, loc) }
25
  }
26
}
27

            
28
impl<'a> DeployV1<'a> {
29
  pub const VT_OWNER: flatbuffers::VOffsetT = 4;
30
  pub const VT_IMAGE_ID: flatbuffers::VOffsetT = 6;
31
  pub const VT_PROGRAM_NAME: flatbuffers::VOffsetT = 8;
32
  pub const VT_URL: flatbuffers::VOffsetT = 10;
33
  pub const VT_SIZE_: flatbuffers::VOffsetT = 12;
34
  pub const VT_INPUTS: flatbuffers::VOffsetT = 14;
35

            
36
  #[inline]
37
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
38
    DeployV1 { _tab: table }
39
  }
40
  #[allow(unused_mut)]
41
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
42
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
43
    args: &'args DeployV1Args<'args>
44
  ) -> flatbuffers::WIPOffset<DeployV1<'bldr>> {
45
    let mut builder = DeployV1Builder::new(_fbb);
46
    builder.add_size_(args.size_);
47
    if let Some(x) = args.inputs { builder.add_inputs(x); }
48
    if let Some(x) = args.url { builder.add_url(x); }
49
    if let Some(x) = args.program_name { builder.add_program_name(x); }
50
    if let Some(x) = args.image_id { builder.add_image_id(x); }
51
    if let Some(x) = args.owner { builder.add_owner(x); }
52
    builder.finish()
53
  }
54

            
55
  pub fn unpack(&self) -> DeployV1T {
56
    let owner = self.owner().map(|x| {
57
      x.into_iter().collect()
58
    });
59
    let image_id = self.image_id().map(|x| {
60
      x.to_string()
61
    });
62
    let program_name = self.program_name().map(|x| {
63
      x.to_string()
64
    });
65
    let url = self.url().map(|x| {
66
      x.to_string()
67
    });
68
    let size_ = self.size_();
69
    let inputs = self.inputs().map(|x| {
70
      x.into_iter().collect()
71
    });
72
    DeployV1T {
73
      owner,
74
      image_id,
75
      program_name,
76
      url,
77
      size_,
78
      inputs,
79
    }
80
  }
81

            
82
  #[inline]
83
  pub fn owner(&self) -> Option<flatbuffers::Vector<'a, u8>> {
84
    // Safety:
85
    // Created from valid Table for this object
86
    // which contains a valid value in this slot
87
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(DeployV1::VT_OWNER, None)}
88
  }
89
  #[inline]
90
  pub fn image_id(&self) -> Option<&'a str> {
91
    // Safety:
92
    // Created from valid Table for this object
93
    // which contains a valid value in this slot
94
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(DeployV1::VT_IMAGE_ID, None)}
95
  }
96
  #[inline]
97
  pub fn program_name(&self) -> Option<&'a str> {
98
    // Safety:
99
    // Created from valid Table for this object
100
    // which contains a valid value in this slot
101
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(DeployV1::VT_PROGRAM_NAME, None)}
102
  }
103
  #[inline]
104
  pub fn url(&self) -> Option<&'a str> {
105
    // Safety:
106
    // Created from valid Table for this object
107
    // which contains a valid value in this slot
108
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(DeployV1::VT_URL, None)}
109
  }
110
  #[inline]
111
  pub fn size_(&self) -> u64 {
112
    // Safety:
113
    // Created from valid Table for this object
114
    // which contains a valid value in this slot
115
    unsafe { self._tab.get::<u64>(DeployV1::VT_SIZE_, Some(0)).unwrap()}
116
  }
117
  #[inline]
118
  pub fn inputs(&self) -> Option<flatbuffers::Vector<'a, ProgramInputType>> {
119
    // Safety:
120
    // Created from valid Table for this object
121
    // which contains a valid value in this slot
122
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, ProgramInputType>>>(DeployV1::VT_INPUTS, None)}
123
  }
124
}
125

            
126
impl flatbuffers::Verifiable for DeployV1<'_> {
127
  #[inline]
128
  fn run_verifier(
129
    v: &mut flatbuffers::Verifier, pos: usize
130
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
131
    use self::flatbuffers::Verifiable;
132
    v.visit_table(pos)?
133
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("owner", Self::VT_OWNER, false)?
134
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("image_id", Self::VT_IMAGE_ID, false)?
135
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("program_name", Self::VT_PROGRAM_NAME, false)?
136
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("url", Self::VT_URL, false)?
137
     .visit_field::<u64>("size_", Self::VT_SIZE_, false)?
138
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, ProgramInputType>>>("inputs", Self::VT_INPUTS, false)?
139
     .finish();
140
    Ok(())
141
  }
142
}
143
pub struct DeployV1Args<'a> {
144
    pub owner: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
145
    pub image_id: Option<flatbuffers::WIPOffset<&'a str>>,
146
    pub program_name: Option<flatbuffers::WIPOffset<&'a str>>,
147
    pub url: Option<flatbuffers::WIPOffset<&'a str>>,
148
    pub size_: u64,
149
    pub inputs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, ProgramInputType>>>,
150
}
151
impl<'a> Default for DeployV1Args<'a> {
152
  #[inline]
153
  fn default() -> Self {
154
    DeployV1Args {
155
      owner: None,
156
      image_id: None,
157
      program_name: None,
158
      url: None,
159
      size_: 0,
160
      inputs: None,
161
    }
162
  }
163
}
164

            
165
pub struct DeployV1Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
166
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
167
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
168
}
169
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DeployV1Builder<'a, 'b, A> {
170
  #[inline]
171
  pub fn add_owner(&mut self, owner: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
172
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DeployV1::VT_OWNER, owner);
173
  }
174
  #[inline]
175
  pub fn add_image_id(&mut self, image_id: flatbuffers::WIPOffset<&'b  str>) {
176
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DeployV1::VT_IMAGE_ID, image_id);
177
  }
178
  #[inline]
179
  pub fn add_program_name(&mut self, program_name: flatbuffers::WIPOffset<&'b  str>) {
180
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DeployV1::VT_PROGRAM_NAME, program_name);
181
  }
182
  #[inline]
183
  pub fn add_url(&mut self, url: flatbuffers::WIPOffset<&'b  str>) {
184
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DeployV1::VT_URL, url);
185
  }
186
  #[inline]
187
  pub fn add_size_(&mut self, size_: u64) {
188
    self.fbb_.push_slot::<u64>(DeployV1::VT_SIZE_, size_, 0);
189
  }
190
  #[inline]
191
  pub fn add_inputs(&mut self, inputs: flatbuffers::WIPOffset<flatbuffers::Vector<'b , ProgramInputType>>) {
192
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(DeployV1::VT_INPUTS, inputs);
193
  }
194
  #[inline]
195
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DeployV1Builder<'a, 'b, A> {
196
    let start = _fbb.start_table();
197
    DeployV1Builder {
198
      fbb_: _fbb,
199
      start_: start,
200
    }
201
  }
202
  #[inline]
203
  pub fn finish(self) -> flatbuffers::WIPOffset<DeployV1<'a>> {
204
    let o = self.fbb_.end_table(self.start_);
205
    flatbuffers::WIPOffset::new(o.value())
206
  }
207
}
208

            
209
impl core::fmt::Debug for DeployV1<'_> {
210
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
211
    let mut ds = f.debug_struct("DeployV1");
212
      ds.field("owner", &self.owner());
213
      ds.field("image_id", &self.image_id());
214
      ds.field("program_name", &self.program_name());
215
      ds.field("url", &self.url());
216
      ds.field("size_", &self.size_());
217
      ds.field("inputs", &self.inputs());
218
      ds.finish()
219
  }
220
}
221
#[non_exhaustive]
222
#[derive(Debug, Clone, PartialEq)]
223
pub struct DeployV1T {
224
  pub owner: Option<Vec<u8>>,
225
  pub image_id: Option<String>,
226
  pub program_name: Option<String>,
227
  pub url: Option<String>,
228
  pub size_: u64,
229
  pub inputs: Option<Vec<ProgramInputType>>,
230
}
231
impl Default for DeployV1T {
232
  fn default() -> Self {
233
    Self {
234
      owner: None,
235
      image_id: None,
236
      program_name: None,
237
      url: None,
238
      size_: 0,
239
      inputs: None,
240
    }
241
  }
242
}
243
impl DeployV1T {
244
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
245
    &self,
246
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
247
  ) -> flatbuffers::WIPOffset<DeployV1<'b>> {
248
    let owner = self.owner.as_ref().map(|x|{
249
      _fbb.create_vector(x)
250
    });
251
    let image_id = self.image_id.as_ref().map(|x|{
252
      _fbb.create_string(x)
253
    });
254
    let program_name = self.program_name.as_ref().map(|x|{
255
      _fbb.create_string(x)
256
    });
257
    let url = self.url.as_ref().map(|x|{
258
      _fbb.create_string(x)
259
    });
260
    let size_ = self.size_;
261
    let inputs = self.inputs.as_ref().map(|x|{
262
      _fbb.create_vector(x)
263
    });
264
    DeployV1::create(_fbb, &DeployV1Args{
265
      owner,
266
      image_id,
267
      program_name,
268
      url,
269
      size_,
270
      inputs,
271
    })
272
  }
273
}
274
#[inline]
275
/// Verifies that a buffer of bytes contains a `DeployV1`
276
/// and returns it.
277
/// Note that verification is still experimental and may not
278
/// catch every error, or be maximally performant. For the
279
/// previous, unchecked, behavior use
280
/// `root_as_deploy_v1_unchecked`.
281
pub fn root_as_deploy_v1(buf: &[u8]) -> Result<DeployV1, flatbuffers::InvalidFlatbuffer> {
282
  flatbuffers::root::<DeployV1>(buf)
283
}
284
#[inline]
285
/// Verifies that a buffer of bytes contains a size prefixed
286
/// `DeployV1` and returns it.
287
/// Note that verification is still experimental and may not
288
/// catch every error, or be maximally performant. For the
289
/// previous, unchecked, behavior use
290
/// `size_prefixed_root_as_deploy_v1_unchecked`.
291
pub fn size_prefixed_root_as_deploy_v1(buf: &[u8]) -> Result<DeployV1, flatbuffers::InvalidFlatbuffer> {
292
  flatbuffers::size_prefixed_root::<DeployV1>(buf)
293
}
294
#[inline]
295
/// Verifies, with the given options, that a buffer of bytes
296
/// contains a `DeployV1` and returns it.
297
/// Note that verification is still experimental and may not
298
/// catch every error, or be maximally performant. For the
299
/// previous, unchecked, behavior use
300
/// `root_as_deploy_v1_unchecked`.
301
pub fn root_as_deploy_v1_with_opts<'b, 'o>(
302
  opts: &'o flatbuffers::VerifierOptions,
303
  buf: &'b [u8],
304
) -> Result<DeployV1<'b>, flatbuffers::InvalidFlatbuffer> {
305
  flatbuffers::root_with_opts::<DeployV1<'b>>(opts, buf)
306
}
307
#[inline]
308
/// Verifies, with the given verifier options, that a buffer of
309
/// bytes contains a size prefixed `DeployV1` and returns
310
/// it. Note that verification is still experimental and may not
311
/// catch every error, or be maximally performant. For the
312
/// previous, unchecked, behavior use
313
/// `root_as_deploy_v1_unchecked`.
314
pub fn size_prefixed_root_as_deploy_v1_with_opts<'b, 'o>(
315
  opts: &'o flatbuffers::VerifierOptions,
316
  buf: &'b [u8],
317
) -> Result<DeployV1<'b>, flatbuffers::InvalidFlatbuffer> {
318
  flatbuffers::size_prefixed_root_with_opts::<DeployV1<'b>>(opts, buf)
319
}
320
#[inline]
321
/// Assumes, without verification, that a buffer of bytes contains a DeployV1 and returns it.
322
/// # Safety
323
/// Callers must trust the given bytes do indeed contain a valid `DeployV1`.
324
pub unsafe fn root_as_deploy_v1_unchecked(buf: &[u8]) -> DeployV1 {
325
  flatbuffers::root_unchecked::<DeployV1>(buf)
326
}
327
#[inline]
328
/// Assumes, without verification, that a buffer of bytes contains a size prefixed DeployV1 and returns it.
329
/// # Safety
330
/// Callers must trust the given bytes do indeed contain a valid size prefixed `DeployV1`.
331
pub unsafe fn size_prefixed_root_as_deploy_v1_unchecked(buf: &[u8]) -> DeployV1 {
332
  flatbuffers::size_prefixed_root_unchecked::<DeployV1>(buf)
333
}
334
#[inline]
335
pub fn finish_deploy_v1_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
336
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
337
    root: flatbuffers::WIPOffset<DeployV1<'a>>) {
338
  fbb.finish(root, None);
339
}
340

            
341
#[inline]
342
pub fn finish_size_prefixed_deploy_v1_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<DeployV1<'a>>) {
343
  fbb.finish_size_prefixed(root, None);
344
}