rustling 0.8.0

A blazingly fast library for computational linguistics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;


#[allow(unused_imports, dead_code)]
pub mod rustling {

#[allow(unused_imports, dead_code)]
pub mod hmm_fbs {


pub enum VocabEntryOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct VocabEntry<'a> {
  pub _tab: ::flatbuffers::Table<'a>,
}

impl<'a> ::flatbuffers::Follow<'a> for VocabEntry<'a> {
  type Inner = VocabEntry<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
  }
}

impl<'a> VocabEntry<'a> {
  pub const VT_KEY: ::flatbuffers::VOffsetT = 4;
  pub const VT_EMISSION_IDX: ::flatbuffers::VOffsetT = 6;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    VocabEntry { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args VocabEntryArgs<'args>
  ) -> ::flatbuffers::WIPOffset<VocabEntry<'bldr>> {
    let mut builder = VocabEntryBuilder::new(_fbb);
    builder.add_emission_idx(args.emission_idx);
    if let Some(x) = args.key { builder.add_key(x); }
    builder.finish()
  }


  #[inline]
  pub fn key(&self) -> &'a str {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(VocabEntry::VT_KEY, None).unwrap()}
  }
  #[inline]
  pub fn emission_idx(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(VocabEntry::VT_EMISSION_IDX, Some(0)).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for VocabEntry<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("key", Self::VT_KEY, true)?
     .visit_field::<u32>("emission_idx", Self::VT_EMISSION_IDX, false)?
     .finish();
    Ok(())
  }
}
pub struct VocabEntryArgs<'a> {
    pub key: Option<::flatbuffers::WIPOffset<&'a str>>,
    pub emission_idx: u32,
}
impl<'a> Default for VocabEntryArgs<'a> {
  #[inline]
  fn default() -> Self {
    VocabEntryArgs {
      key: None, // required field
      emission_idx: 0,
    }
  }
}

pub struct VocabEntryBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
  fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
  start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> VocabEntryBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_key(&mut self, key: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(VocabEntry::VT_KEY, key);
  }
  #[inline]
  pub fn add_emission_idx(&mut self, emission_idx: u32) {
    self.fbb_.push_slot::<u32>(VocabEntry::VT_EMISSION_IDX, emission_idx, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> VocabEntryBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    VocabEntryBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<VocabEntry<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, VocabEntry::VT_KEY,"key");
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for VocabEntry<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("VocabEntry");
      ds.field("key", &self.key());
      ds.field("emission_idx", &self.emission_idx());
      ds.finish()
  }
}
pub enum FeatureVocabOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct FeatureVocab<'a> {
  pub _tab: ::flatbuffers::Table<'a>,
}

impl<'a> ::flatbuffers::Follow<'a> for FeatureVocab<'a> {
  type Inner = FeatureVocab<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
  }
}

impl<'a> FeatureVocab<'a> {
  pub const VT_ENTRIES: ::flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    FeatureVocab { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args FeatureVocabArgs<'args>
  ) -> ::flatbuffers::WIPOffset<FeatureVocab<'bldr>> {
    let mut builder = FeatureVocabBuilder::new(_fbb);
    if let Some(x) = args.entries { builder.add_entries(x); }
    builder.finish()
  }


  #[inline]
  pub fn entries(&self) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<VocabEntry<'a>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<VocabEntry>>>>(FeatureVocab::VT_ENTRIES, None).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for FeatureVocab<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<VocabEntry>>>>("entries", Self::VT_ENTRIES, true)?
     .finish();
    Ok(())
  }
}
pub struct FeatureVocabArgs<'a> {
    pub entries: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<VocabEntry<'a>>>>>,
}
impl<'a> Default for FeatureVocabArgs<'a> {
  #[inline]
  fn default() -> Self {
    FeatureVocabArgs {
      entries: None, // required field
    }
  }
}

pub struct FeatureVocabBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
  fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
  start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> FeatureVocabBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_entries(&mut self, entries: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<VocabEntry<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(FeatureVocab::VT_ENTRIES, entries);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> FeatureVocabBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    FeatureVocabBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<FeatureVocab<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, FeatureVocab::VT_ENTRIES,"entries");
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for FeatureVocab<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("FeatureVocab");
      ds.field("entries", &self.entries());
      ds.finish()
  }
}
pub enum EmissionMatrixOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct EmissionMatrix<'a> {
  pub _tab: ::flatbuffers::Table<'a>,
}

impl<'a> ::flatbuffers::Follow<'a> for EmissionMatrix<'a> {
  type Inner = EmissionMatrix<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
  }
}

impl<'a> EmissionMatrix<'a> {
  pub const VT_N_STATES: ::flatbuffers::VOffsetT = 4;
  pub const VT_VOCAB_SIZE: ::flatbuffers::VOffsetT = 6;
  pub const VT_VALUES: ::flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    EmissionMatrix { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args EmissionMatrixArgs<'args>
  ) -> ::flatbuffers::WIPOffset<EmissionMatrix<'bldr>> {
    let mut builder = EmissionMatrixBuilder::new(_fbb);
    if let Some(x) = args.values { builder.add_values(x); }
    builder.add_vocab_size(args.vocab_size);
    builder.add_n_states(args.n_states);
    builder.finish()
  }


  #[inline]
  pub fn n_states(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(EmissionMatrix::VT_N_STATES, Some(0)).unwrap()}
  }
  #[inline]
  pub fn vocab_size(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(EmissionMatrix::VT_VOCAB_SIZE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn values(&self) -> ::flatbuffers::Vector<'a, f32> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(EmissionMatrix::VT_VALUES, None).unwrap()}
  }
}

impl ::flatbuffers::Verifiable for EmissionMatrix<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u32>("n_states", Self::VT_N_STATES, false)?
     .visit_field::<u32>("vocab_size", Self::VT_VOCAB_SIZE, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("values", Self::VT_VALUES, true)?
     .finish();
    Ok(())
  }
}
pub struct EmissionMatrixArgs<'a> {
    pub n_states: u32,
    pub vocab_size: u32,
    pub values: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
}
impl<'a> Default for EmissionMatrixArgs<'a> {
  #[inline]
  fn default() -> Self {
    EmissionMatrixArgs {
      n_states: 0,
      vocab_size: 0,
      values: None, // required field
    }
  }
}

pub struct EmissionMatrixBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
  fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
  start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> EmissionMatrixBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_n_states(&mut self, n_states: u32) {
    self.fbb_.push_slot::<u32>(EmissionMatrix::VT_N_STATES, n_states, 0);
  }
  #[inline]
  pub fn add_vocab_size(&mut self, vocab_size: u32) {
    self.fbb_.push_slot::<u32>(EmissionMatrix::VT_VOCAB_SIZE, vocab_size, 0);
  }
  #[inline]
  pub fn add_values(&mut self, values: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(EmissionMatrix::VT_VALUES, values);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> EmissionMatrixBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    EmissionMatrixBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<EmissionMatrix<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, EmissionMatrix::VT_VALUES,"values");
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for EmissionMatrix<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("EmissionMatrix");
      ds.field("n_states", &self.n_states());
      ds.field("vocab_size", &self.vocab_size());
      ds.field("values", &self.values());
      ds.finish()
  }
}
pub enum HmmModelOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct HmmModel<'a> {
  pub _tab: ::flatbuffers::Table<'a>,
}

impl<'a> ::flatbuffers::Follow<'a> for HmmModel<'a> {
  type Inner = HmmModel<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: unsafe { ::flatbuffers::Table::new(buf, loc) } }
  }
}

impl<'a> HmmModel<'a> {
  pub const VT_N_STATES: ::flatbuffers::VOffsetT = 4;
  pub const VT_STATE_LABELS: ::flatbuffers::VOffsetT = 6;
  pub const VT_LOG_INITIAL: ::flatbuffers::VOffsetT = 8;
  pub const VT_LOG_TRANSITION: ::flatbuffers::VOffsetT = 10;
  pub const VT_FEATURE_VOCABS: ::flatbuffers::VOffsetT = 12;
  pub const VT_FEATURE_EMISSIONS: ::flatbuffers::VOffsetT = 14;
  pub const VT_FEATURES_JSON: ::flatbuffers::VOffsetT = 16;

  #[inline]
  pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
    HmmModel { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: ::flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args HmmModelArgs<'args>
  ) -> ::flatbuffers::WIPOffset<HmmModel<'bldr>> {
    let mut builder = HmmModelBuilder::new(_fbb);
    if let Some(x) = args.features_json { builder.add_features_json(x); }
    if let Some(x) = args.feature_emissions { builder.add_feature_emissions(x); }
    if let Some(x) = args.feature_vocabs { builder.add_feature_vocabs(x); }
    if let Some(x) = args.log_transition { builder.add_log_transition(x); }
    if let Some(x) = args.log_initial { builder.add_log_initial(x); }
    if let Some(x) = args.state_labels { builder.add_state_labels(x); }
    builder.add_n_states(args.n_states);
    builder.finish()
  }


  #[inline]
  pub fn n_states(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(HmmModel::VT_N_STATES, Some(0)).unwrap()}
  }
  #[inline]
  pub fn state_labels(&self) -> Option<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>(HmmModel::VT_STATE_LABELS, None)}
  }
  #[inline]
  pub fn log_initial(&self) -> ::flatbuffers::Vector<'a, f32> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(HmmModel::VT_LOG_INITIAL, None).unwrap()}
  }
  #[inline]
  pub fn log_transition(&self) -> ::flatbuffers::Vector<'a, f32> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, f32>>>(HmmModel::VT_LOG_TRANSITION, None).unwrap()}
  }
  #[inline]
  pub fn feature_vocabs(&self) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FeatureVocab<'a>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FeatureVocab>>>>(HmmModel::VT_FEATURE_VOCABS, None).unwrap()}
  }
  #[inline]
  pub fn feature_emissions(&self) -> ::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<EmissionMatrix<'a>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<EmissionMatrix>>>>(HmmModel::VT_FEATURE_EMISSIONS, None).unwrap()}
  }
  #[inline]
  pub fn features_json(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<::flatbuffers::ForwardsUOffset<&str>>(HmmModel::VT_FEATURES_JSON, None)}
  }
}

impl ::flatbuffers::Verifiable for HmmModel<'_> {
  #[inline]
  fn run_verifier(
    v: &mut ::flatbuffers::Verifier, pos: usize
  ) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
    v.visit_table(pos)?
     .visit_field::<u32>("n_states", Self::VT_N_STATES, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<&'_ str>>>>("state_labels", Self::VT_STATE_LABELS, false)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("log_initial", Self::VT_LOG_INITIAL, true)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, f32>>>("log_transition", Self::VT_LOG_TRANSITION, true)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<FeatureVocab>>>>("feature_vocabs", Self::VT_FEATURE_VOCABS, true)?
     .visit_field::<::flatbuffers::ForwardsUOffset<::flatbuffers::Vector<'_, ::flatbuffers::ForwardsUOffset<EmissionMatrix>>>>("feature_emissions", Self::VT_FEATURE_EMISSIONS, true)?
     .visit_field::<::flatbuffers::ForwardsUOffset<&str>>("features_json", Self::VT_FEATURES_JSON, false)?
     .finish();
    Ok(())
  }
}
pub struct HmmModelArgs<'a> {
    pub n_states: u32,
    pub state_labels: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<&'a str>>>>,
    pub log_initial: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
    pub log_transition: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, f32>>>,
    pub feature_vocabs: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<FeatureVocab<'a>>>>>,
    pub feature_emissions: Option<::flatbuffers::WIPOffset<::flatbuffers::Vector<'a, ::flatbuffers::ForwardsUOffset<EmissionMatrix<'a>>>>>,
    pub features_json: Option<::flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for HmmModelArgs<'a> {
  #[inline]
  fn default() -> Self {
    HmmModelArgs {
      n_states: 0,
      state_labels: None,
      log_initial: None, // required field
      log_transition: None, // required field
      feature_vocabs: None, // required field
      feature_emissions: None, // required field
      features_json: None,
    }
  }
}

pub struct HmmModelBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
  fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
  start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> HmmModelBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_n_states(&mut self, n_states: u32) {
    self.fbb_.push_slot::<u32>(HmmModel::VT_N_STATES, n_states, 0);
  }
  #[inline]
  pub fn add_state_labels(&mut self, state_labels: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<&'b  str>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_STATE_LABELS, state_labels);
  }
  #[inline]
  pub fn add_log_initial(&mut self, log_initial: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_LOG_INITIAL, log_initial);
  }
  #[inline]
  pub fn add_log_transition(&mut self, log_transition: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , f32>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_LOG_TRANSITION, log_transition);
  }
  #[inline]
  pub fn add_feature_vocabs(&mut self, feature_vocabs: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<FeatureVocab<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_FEATURE_VOCABS, feature_vocabs);
  }
  #[inline]
  pub fn add_feature_emissions(&mut self, feature_emissions: ::flatbuffers::WIPOffset<::flatbuffers::Vector<'b , ::flatbuffers::ForwardsUOffset<EmissionMatrix<'b >>>>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_FEATURE_EMISSIONS, feature_emissions);
  }
  #[inline]
  pub fn add_features_json(&mut self, features_json: ::flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<::flatbuffers::WIPOffset<_>>(HmmModel::VT_FEATURES_JSON, features_json);
  }
  #[inline]
  pub fn new(_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>) -> HmmModelBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    HmmModelBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> ::flatbuffers::WIPOffset<HmmModel<'a>> {
    let o = self.fbb_.end_table(self.start_);
    self.fbb_.required(o, HmmModel::VT_LOG_INITIAL,"log_initial");
    self.fbb_.required(o, HmmModel::VT_LOG_TRANSITION,"log_transition");
    self.fbb_.required(o, HmmModel::VT_FEATURE_VOCABS,"feature_vocabs");
    self.fbb_.required(o, HmmModel::VT_FEATURE_EMISSIONS,"feature_emissions");
    ::flatbuffers::WIPOffset::new(o.value())
  }
}

impl ::core::fmt::Debug for HmmModel<'_> {
  fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
    let mut ds = f.debug_struct("HmmModel");
      ds.field("n_states", &self.n_states());
      ds.field("state_labels", &self.state_labels());
      ds.field("log_initial", &self.log_initial());
      ds.field("log_transition", &self.log_transition());
      ds.field("feature_vocabs", &self.feature_vocabs());
      ds.field("feature_emissions", &self.feature_emissions());
      ds.field("features_json", &self.features_json());
      ds.finish()
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `HmmModel`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_hmm_model_unchecked`.
pub fn root_as_hmm_model(buf: &[u8]) -> Result<HmmModel<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root::<HmmModel>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `HmmModel` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_hmm_model_unchecked`.
pub fn size_prefixed_root_as_hmm_model(buf: &[u8]) -> Result<HmmModel<'_>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root::<HmmModel>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `HmmModel` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_hmm_model_unchecked`.
pub fn root_as_hmm_model_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<HmmModel<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::root_with_opts::<HmmModel<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `HmmModel` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_hmm_model_unchecked`.
pub fn size_prefixed_root_as_hmm_model_with_opts<'b, 'o>(
  opts: &'o ::flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<HmmModel<'b>, ::flatbuffers::InvalidFlatbuffer> {
  ::flatbuffers::size_prefixed_root_with_opts::<HmmModel<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a HmmModel and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `HmmModel`.
pub unsafe fn root_as_hmm_model_unchecked(buf: &[u8]) -> HmmModel<'_> {
  unsafe { ::flatbuffers::root_unchecked::<HmmModel>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed HmmModel and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `HmmModel`.
pub unsafe fn size_prefixed_root_as_hmm_model_unchecked(buf: &[u8]) -> HmmModel<'_> {
  unsafe { ::flatbuffers::size_prefixed_root_unchecked::<HmmModel>(buf) }
}
#[inline]
pub fn finish_hmm_model_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
    fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
    root: ::flatbuffers::WIPOffset<HmmModel<'a>>) {
  fbb.finish(root, None);
}

#[inline]
pub fn finish_size_prefixed_hmm_model_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>, root: ::flatbuffers::WIPOffset<HmmModel<'a>>) {
  fbb.finish_size_prefixed(root, None);
}
}  // pub mod hmm_fbs
}  // pub mod rustling