Skip to main content

nautilus_binance/spot/sbe/generated/
new_order_full_response_codec.rs

1pub use decoder::NewOrderFullResponseDecoder;
2pub use encoder::NewOrderFullResponseEncoder;
3
4use super::*;
5pub use super::{SBE_SCHEMA_ID, SBE_SCHEMA_VERSION, SBE_SEMANTIC_VERSION};
6
7pub const SBE_BLOCK_LENGTH: u16 = 154;
8pub const SBE_TEMPLATE_ID: u16 = 302;
9
10pub mod encoder {
11    use message_header_codec::*;
12
13    use super::*;
14
15    #[derive(Debug, Default)]
16    pub struct NewOrderFullResponseEncoder<'a> {
17        buf: WriteBuf<'a>,
18        initial_offset: usize,
19        offset: usize,
20        limit: usize,
21    }
22
23    impl<'a> Writer<'a> for NewOrderFullResponseEncoder<'a> {
24        #[inline]
25        fn get_buf_mut(&mut self) -> &mut WriteBuf<'a> {
26            &mut self.buf
27        }
28    }
29
30    impl<'a> Encoder<'a> for NewOrderFullResponseEncoder<'a> {
31        #[inline]
32        fn get_limit(&self) -> usize {
33            self.limit
34        }
35
36        #[inline]
37        fn set_limit(&mut self, limit: usize) {
38            self.limit = limit;
39        }
40    }
41
42    impl<'a> NewOrderFullResponseEncoder<'a> {
43        pub fn wrap(mut self, buf: WriteBuf<'a>, offset: usize) -> Self {
44            let limit = offset + SBE_BLOCK_LENGTH as usize;
45            self.buf = buf;
46            self.initial_offset = offset;
47            self.offset = offset;
48            self.limit = limit;
49            self
50        }
51
52        #[inline]
53        pub fn encoded_length(&self) -> usize {
54            self.limit - self.offset
55        }
56
57        pub fn header(self, offset: usize) -> MessageHeaderEncoder<Self> {
58            let mut header = MessageHeaderEncoder::default().wrap(self, offset);
59            header.block_length(SBE_BLOCK_LENGTH);
60            header.template_id(SBE_TEMPLATE_ID);
61            header.schema_id(SBE_SCHEMA_ID);
62            header.version(SBE_SCHEMA_VERSION);
63            header
64        }
65
66        /// primitive field 'priceExponent'
67        /// - min value: -127
68        /// - max value: 127
69        /// - null value: -128_i8
70        /// - characterEncoding: null
71        /// - semanticType: null
72        /// - encodedOffset: 0
73        /// - encodedLength: 1
74        /// - version: 0
75        #[inline]
76        pub fn price_exponent(&mut self, value: i8) {
77            let offset = self.offset;
78            self.get_buf_mut().put_i8_at(offset, value);
79        }
80
81        /// primitive field 'qtyExponent'
82        /// - min value: -127
83        /// - max value: 127
84        /// - null value: -128_i8
85        /// - characterEncoding: null
86        /// - semanticType: null
87        /// - encodedOffset: 1
88        /// - encodedLength: 1
89        /// - version: 0
90        #[inline]
91        pub fn qty_exponent(&mut self, value: i8) {
92            let offset = self.offset + 1;
93            self.get_buf_mut().put_i8_at(offset, value);
94        }
95
96        /// primitive field 'orderId'
97        /// - min value: -9223372036854775807
98        /// - max value: 9223372036854775807
99        /// - null value: -9223372036854775808_i64
100        /// - characterEncoding: null
101        /// - semanticType: null
102        /// - encodedOffset: 2
103        /// - encodedLength: 8
104        /// - version: 0
105        #[inline]
106        pub fn order_id(&mut self, value: i64) {
107            let offset = self.offset + 2;
108            self.get_buf_mut().put_i64_at(offset, value);
109        }
110
111        /// primitive field 'orderListId'
112        /// - min value: -9223372036854775807
113        /// - max value: 9223372036854775807
114        /// - null value: -9223372036854775808_i64
115        /// - characterEncoding: null
116        /// - semanticType: null
117        /// - encodedOffset: 10
118        /// - encodedLength: 8
119        /// - version: 0
120        #[inline]
121        pub fn order_list_id(&mut self, value: i64) {
122            let offset = self.offset + 10;
123            self.get_buf_mut().put_i64_at(offset, value);
124        }
125
126        /// primitive field 'transactTime'
127        /// - min value: -9223372036854775807
128        /// - max value: 9223372036854775807
129        /// - null value: -9223372036854775808_i64
130        /// - characterEncoding: null
131        /// - semanticType: null
132        /// - encodedOffset: 18
133        /// - encodedLength: 8
134        /// - version: 0
135        #[inline]
136        pub fn transact_time(&mut self, value: i64) {
137            let offset = self.offset + 18;
138            self.get_buf_mut().put_i64_at(offset, value);
139        }
140
141        /// primitive field 'price'
142        /// - min value: -9223372036854775807
143        /// - max value: 9223372036854775807
144        /// - null value: -9223372036854775808_i64
145        /// - characterEncoding: null
146        /// - semanticType: null
147        /// - encodedOffset: 26
148        /// - encodedLength: 8
149        /// - version: 0
150        #[inline]
151        pub fn price(&mut self, value: i64) {
152            let offset = self.offset + 26;
153            self.get_buf_mut().put_i64_at(offset, value);
154        }
155
156        /// primitive field 'origQty'
157        /// - min value: -9223372036854775807
158        /// - max value: 9223372036854775807
159        /// - null value: -9223372036854775808_i64
160        /// - characterEncoding: null
161        /// - semanticType: null
162        /// - encodedOffset: 34
163        /// - encodedLength: 8
164        /// - version: 0
165        #[inline]
166        pub fn orig_qty(&mut self, value: i64) {
167            let offset = self.offset + 34;
168            self.get_buf_mut().put_i64_at(offset, value);
169        }
170
171        /// primitive field 'executedQty'
172        /// - min value: -9223372036854775807
173        /// - max value: 9223372036854775807
174        /// - null value: -9223372036854775808_i64
175        /// - characterEncoding: null
176        /// - semanticType: null
177        /// - encodedOffset: 42
178        /// - encodedLength: 8
179        /// - version: 0
180        #[inline]
181        pub fn executed_qty(&mut self, value: i64) {
182            let offset = self.offset + 42;
183            self.get_buf_mut().put_i64_at(offset, value);
184        }
185
186        /// primitive field 'cummulativeQuoteQty'
187        /// - min value: -9223372036854775807
188        /// - max value: 9223372036854775807
189        /// - null value: -9223372036854775808_i64
190        /// - characterEncoding: null
191        /// - semanticType: null
192        /// - encodedOffset: 50
193        /// - encodedLength: 8
194        /// - version: 0
195        #[inline]
196        pub fn cummulative_quote_qty(&mut self, value: i64) {
197            let offset = self.offset + 50;
198            self.get_buf_mut().put_i64_at(offset, value);
199        }
200
201        /// REQUIRED enum
202        #[inline]
203        pub fn status(&mut self, value: order_status::OrderStatus) {
204            let offset = self.offset + 58;
205            self.get_buf_mut().put_u8_at(offset, value as u8)
206        }
207
208        /// REQUIRED enum
209        #[inline]
210        pub fn time_in_force(&mut self, value: time_in_force::TimeInForce) {
211            let offset = self.offset + 59;
212            self.get_buf_mut().put_u8_at(offset, value as u8)
213        }
214
215        /// REQUIRED enum
216        #[inline]
217        pub fn order_type(&mut self, value: order_type::OrderType) {
218            let offset = self.offset + 60;
219            self.get_buf_mut().put_u8_at(offset, value as u8)
220        }
221
222        /// REQUIRED enum
223        #[inline]
224        pub fn side(&mut self, value: order_side::OrderSide) {
225            let offset = self.offset + 61;
226            self.get_buf_mut().put_u8_at(offset, value as u8)
227        }
228
229        /// primitive field 'stopPrice'
230        /// - min value: -9223372036854775807
231        /// - max value: 9223372036854775807
232        /// - null value: -9223372036854775808_i64
233        /// - characterEncoding: null
234        /// - semanticType: null
235        /// - encodedOffset: 62
236        /// - encodedLength: 8
237        /// - version: 0
238        #[inline]
239        pub fn stop_price(&mut self, value: i64) {
240            let offset = self.offset + 62;
241            self.get_buf_mut().put_i64_at(offset, value);
242        }
243
244        /// primitive field 'trailingDelta'
245        /// - min value: -9223372036854775807
246        /// - max value: 9223372036854775807
247        /// - null value: -9223372036854775808_i64
248        /// - characterEncoding: null
249        /// - semanticType: null
250        /// - encodedOffset: 70
251        /// - encodedLength: 8
252        /// - version: 0
253        #[inline]
254        pub fn trailing_delta(&mut self, value: i64) {
255            let offset = self.offset + 70;
256            self.get_buf_mut().put_i64_at(offset, value);
257        }
258
259        /// primitive field 'trailingTime'
260        /// - min value: -9223372036854775807
261        /// - max value: 9223372036854775807
262        /// - null value: -9223372036854775808_i64
263        /// - characterEncoding: null
264        /// - semanticType: null
265        /// - encodedOffset: 78
266        /// - encodedLength: 8
267        /// - version: 0
268        #[inline]
269        pub fn trailing_time(&mut self, value: i64) {
270            let offset = self.offset + 78;
271            self.get_buf_mut().put_i64_at(offset, value);
272        }
273
274        /// primitive field 'workingTime'
275        /// - min value: -9223372036854775807
276        /// - max value: 9223372036854775807
277        /// - null value: -9223372036854775808_i64
278        /// - characterEncoding: null
279        /// - semanticType: null
280        /// - encodedOffset: 86
281        /// - encodedLength: 8
282        /// - version: 0
283        #[inline]
284        pub fn working_time(&mut self, value: i64) {
285            let offset = self.offset + 86;
286            self.get_buf_mut().put_i64_at(offset, value);
287        }
288
289        /// primitive field 'icebergQty'
290        /// - min value: -9223372036854775807
291        /// - max value: 9223372036854775807
292        /// - null value: -9223372036854775808_i64
293        /// - characterEncoding: null
294        /// - semanticType: null
295        /// - encodedOffset: 94
296        /// - encodedLength: 8
297        /// - version: 0
298        #[inline]
299        pub fn iceberg_qty(&mut self, value: i64) {
300            let offset = self.offset + 94;
301            self.get_buf_mut().put_i64_at(offset, value);
302        }
303
304        /// primitive field 'strategyId'
305        /// - min value: -9223372036854775807
306        /// - max value: 9223372036854775807
307        /// - null value: -9223372036854775808_i64
308        /// - characterEncoding: null
309        /// - semanticType: null
310        /// - encodedOffset: 102
311        /// - encodedLength: 8
312        /// - version: 0
313        #[inline]
314        pub fn strategy_id(&mut self, value: i64) {
315            let offset = self.offset + 102;
316            self.get_buf_mut().put_i64_at(offset, value);
317        }
318
319        /// primitive field 'strategyType'
320        /// - min value: -2147483647
321        /// - max value: 2147483647
322        /// - null value: -2147483648_i32
323        /// - characterEncoding: null
324        /// - semanticType: null
325        /// - encodedOffset: 110
326        /// - encodedLength: 4
327        /// - version: 0
328        #[inline]
329        pub fn strategy_type(&mut self, value: i32) {
330            let offset = self.offset + 110;
331            self.get_buf_mut().put_i32_at(offset, value);
332        }
333
334        /// REQUIRED enum
335        #[inline]
336        pub fn order_capacity(&mut self, value: order_capacity::OrderCapacity) {
337            let offset = self.offset + 114;
338            self.get_buf_mut().put_u8_at(offset, value as u8)
339        }
340
341        /// REQUIRED enum
342        #[inline]
343        pub fn working_floor(&mut self, value: floor::Floor) {
344            let offset = self.offset + 115;
345            self.get_buf_mut().put_u8_at(offset, value as u8)
346        }
347
348        /// REQUIRED enum
349        #[inline]
350        pub fn self_trade_prevention_mode(
351            &mut self,
352            value: self_trade_prevention_mode::SelfTradePreventionMode,
353        ) {
354            let offset = self.offset + 116;
355            self.get_buf_mut().put_u8_at(offset, value as u8)
356        }
357
358        /// primitive field 'tradeGroupId'
359        /// - min value: -9223372036854775807
360        /// - max value: 9223372036854775807
361        /// - null value: -9223372036854775808_i64
362        /// - characterEncoding: null
363        /// - semanticType: null
364        /// - encodedOffset: 117
365        /// - encodedLength: 8
366        /// - version: 0
367        #[inline]
368        pub fn trade_group_id(&mut self, value: i64) {
369            let offset = self.offset + 117;
370            self.get_buf_mut().put_i64_at(offset, value);
371        }
372
373        /// primitive field 'preventedQuantity'
374        /// - min value: -9223372036854775807
375        /// - max value: 9223372036854775807
376        /// - null value: -9223372036854775808_i64
377        /// - characterEncoding: null
378        /// - semanticType: null
379        /// - encodedOffset: 125
380        /// - encodedLength: 8
381        /// - version: 0
382        #[inline]
383        pub fn prevented_quantity(&mut self, value: i64) {
384            let offset = self.offset + 125;
385            self.get_buf_mut().put_i64_at(offset, value);
386        }
387
388        /// REQUIRED enum
389        #[inline]
390        pub fn used_sor(&mut self, value: bool_enum::BoolEnum) {
391            let offset = self.offset + 133;
392            self.get_buf_mut().put_u8_at(offset, value as u8)
393        }
394
395        /// primitive field 'origQuoteOrderQty'
396        /// - min value: -9223372036854775807
397        /// - max value: 9223372036854775807
398        /// - null value: -9223372036854775808_i64
399        /// - characterEncoding: null
400        /// - semanticType: null
401        /// - encodedOffset: 134
402        /// - encodedLength: 8
403        /// - version: 0
404        #[inline]
405        pub fn orig_quote_order_qty(&mut self, value: i64) {
406            let offset = self.offset + 134;
407            self.get_buf_mut().put_i64_at(offset, value);
408        }
409
410        /// REQUIRED enum
411        #[inline]
412        pub fn peg_price_type(&mut self, value: peg_price_type::PegPriceType) {
413            let offset = self.offset + 142;
414            self.get_buf_mut().put_u8_at(offset, value as u8)
415        }
416
417        /// REQUIRED enum
418        #[inline]
419        pub fn peg_offset_type(&mut self, value: peg_offset_type::PegOffsetType) {
420            let offset = self.offset + 143;
421            self.get_buf_mut().put_u8_at(offset, value as u8)
422        }
423
424        /// primitive field 'pegOffsetValue'
425        /// - min value: 0
426        /// - max value: 254
427        /// - null value: 0xff_u8
428        /// - characterEncoding: null
429        /// - semanticType: null
430        /// - encodedOffset: 144
431        /// - encodedLength: 1
432        /// - version: 1
433        #[inline]
434        pub fn peg_offset_value(&mut self, value: u8) {
435            let offset = self.offset + 144;
436            self.get_buf_mut().put_u8_at(offset, value);
437        }
438
439        /// primitive field 'peggedPrice'
440        /// - min value: -9223372036854775807
441        /// - max value: 9223372036854775807
442        /// - null value: -9223372036854775808_i64
443        /// - characterEncoding: null
444        /// - semanticType: null
445        /// - encodedOffset: 145
446        /// - encodedLength: 8
447        /// - version: 1
448        #[inline]
449        pub fn pegged_price(&mut self, value: i64) {
450            let offset = self.offset + 145;
451            self.get_buf_mut().put_i64_at(offset, value);
452        }
453
454        /// REQUIRED enum
455        #[inline]
456        pub fn expiry_reason(&mut self, value: expiry_reason::ExpiryReason) {
457            let offset = self.offset + 153;
458            self.get_buf_mut().put_u8_at(offset, value as u8)
459        }
460
461        /// GROUP ENCODER (id=100)
462        #[inline]
463        pub fn fills_encoder(
464            self,
465            count: u32,
466            fills_encoder: FillsEncoder<Self>,
467        ) -> FillsEncoder<Self> {
468            fills_encoder.wrap(self, count)
469        }
470
471        /// GROUP ENCODER (id=101)
472        #[inline]
473        pub fn prevented_matches_encoder(
474            self,
475            count: u32,
476            prevented_matches_encoder: PreventedMatchesEncoder<Self>,
477        ) -> PreventedMatchesEncoder<Self> {
478            prevented_matches_encoder.wrap(self, count)
479        }
480
481        /// VAR_DATA ENCODER - character encoding: 'UTF-8'
482        #[inline]
483        pub fn symbol(&mut self, value: &str) {
484            let limit = self.get_limit();
485            let data_length = value.len();
486            self.set_limit(limit + 1 + data_length);
487            self.get_buf_mut().put_u8_at(limit, data_length as u8);
488            self.get_buf_mut().put_slice_at(limit + 1, value.as_bytes());
489        }
490
491        /// VAR_DATA ENCODER - character encoding: 'UTF-8'
492        #[inline]
493        pub fn client_order_id(&mut self, value: &str) {
494            let limit = self.get_limit();
495            let data_length = value.len();
496            self.set_limit(limit + 1 + data_length);
497            self.get_buf_mut().put_u8_at(limit, data_length as u8);
498            self.get_buf_mut().put_slice_at(limit + 1, value.as_bytes());
499        }
500    }
501
502    #[derive(Debug, Default)]
503    pub struct FillsEncoder<P> {
504        parent: Option<P>,
505        count: u32,
506        index: usize,
507        offset: usize,
508        initial_limit: usize,
509    }
510
511    impl<'a, P> Writer<'a> for FillsEncoder<P>
512    where
513        P: Writer<'a> + Default,
514    {
515        #[inline]
516        fn get_buf_mut(&mut self) -> &mut WriteBuf<'a> {
517            if let Some(parent) = self.parent.as_mut() {
518                parent.get_buf_mut()
519            } else {
520                panic!("parent was None")
521            }
522        }
523    }
524
525    impl<'a, P> Encoder<'a> for FillsEncoder<P>
526    where
527        P: Encoder<'a> + Default,
528    {
529        #[inline]
530        fn get_limit(&self) -> usize {
531            self.parent.as_ref().expect("parent missing").get_limit()
532        }
533
534        #[inline]
535        fn set_limit(&mut self, limit: usize) {
536            self.parent
537                .as_mut()
538                .expect("parent missing")
539                .set_limit(limit);
540        }
541    }
542
543    impl<'a, P> FillsEncoder<P>
544    where
545        P: Encoder<'a> + Default,
546    {
547        #[inline]
548        pub fn wrap(mut self, mut parent: P, count: u32) -> Self {
549            let initial_limit = parent.get_limit();
550            parent.set_limit(initial_limit + 6);
551            parent
552                .get_buf_mut()
553                .put_u16_at(initial_limit, Self::block_length());
554            parent.get_buf_mut().put_u32_at(initial_limit + 2, count);
555            self.parent = Some(parent);
556            self.count = count;
557            self.index = usize::MAX;
558            self.offset = usize::MAX;
559            self.initial_limit = initial_limit;
560            self
561        }
562
563        #[inline]
564        pub fn block_length() -> u16 {
565            42
566        }
567
568        #[inline]
569        pub fn parent(&mut self) -> SbeResult<P> {
570            self.parent.take().ok_or(SbeErr::ParentNotSet)
571        }
572
573        /// will return Some(current index) when successful otherwise None
574        #[inline]
575        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
576            let index = self.index.wrapping_add(1);
577            if index >= self.count as usize {
578                return Ok(None);
579            }
580
581            if let Some(parent) = self.parent.as_mut() {
582                self.offset = parent.get_limit();
583                parent.set_limit(self.offset + Self::block_length() as usize);
584                self.index = index;
585                Ok(Some(index))
586            } else {
587                Err(SbeErr::ParentNotSet)
588            }
589        }
590
591        /// primitive field 'commissionExponent'
592        /// - min value: -127
593        /// - max value: 127
594        /// - null value: -128_i8
595        /// - characterEncoding: null
596        /// - semanticType: null
597        /// - encodedOffset: 0
598        /// - encodedLength: 1
599        /// - version: 0
600        #[inline]
601        pub fn commission_exponent(&mut self, value: i8) {
602            let offset = self.offset;
603            self.get_buf_mut().put_i8_at(offset, value);
604        }
605
606        /// REQUIRED enum
607        #[inline]
608        pub fn match_type(&mut self, value: match_type::MatchType) {
609            let offset = self.offset + 1;
610            self.get_buf_mut().put_u8_at(offset, value as u8)
611        }
612
613        /// primitive field 'price'
614        /// - min value: -9223372036854775807
615        /// - max value: 9223372036854775807
616        /// - null value: -9223372036854775808_i64
617        /// - characterEncoding: null
618        /// - semanticType: null
619        /// - encodedOffset: 2
620        /// - encodedLength: 8
621        /// - version: 0
622        #[inline]
623        pub fn price(&mut self, value: i64) {
624            let offset = self.offset + 2;
625            self.get_buf_mut().put_i64_at(offset, value);
626        }
627
628        /// primitive field 'qty'
629        /// - min value: -9223372036854775807
630        /// - max value: 9223372036854775807
631        /// - null value: -9223372036854775808_i64
632        /// - characterEncoding: null
633        /// - semanticType: null
634        /// - encodedOffset: 10
635        /// - encodedLength: 8
636        /// - version: 0
637        #[inline]
638        pub fn qty(&mut self, value: i64) {
639            let offset = self.offset + 10;
640            self.get_buf_mut().put_i64_at(offset, value);
641        }
642
643        /// primitive field 'commission'
644        /// - min value: -9223372036854775807
645        /// - max value: 9223372036854775807
646        /// - null value: -9223372036854775808_i64
647        /// - characterEncoding: null
648        /// - semanticType: null
649        /// - encodedOffset: 18
650        /// - encodedLength: 8
651        /// - version: 0
652        #[inline]
653        pub fn commission(&mut self, value: i64) {
654            let offset = self.offset + 18;
655            self.get_buf_mut().put_i64_at(offset, value);
656        }
657
658        /// primitive field 'tradeId'
659        /// - min value: -9223372036854775807
660        /// - max value: 9223372036854775807
661        /// - null value: -9223372036854775808_i64
662        /// - characterEncoding: null
663        /// - semanticType: null
664        /// - encodedOffset: 26
665        /// - encodedLength: 8
666        /// - version: 0
667        #[inline]
668        pub fn trade_id(&mut self, value: i64) {
669            let offset = self.offset + 26;
670            self.get_buf_mut().put_i64_at(offset, value);
671        }
672
673        /// primitive field 'allocId'
674        /// - min value: -9223372036854775807
675        /// - max value: 9223372036854775807
676        /// - null value: -9223372036854775808_i64
677        /// - characterEncoding: null
678        /// - semanticType: null
679        /// - encodedOffset: 34
680        /// - encodedLength: 8
681        /// - version: 0
682        #[inline]
683        pub fn alloc_id(&mut self, value: i64) {
684            let offset = self.offset + 34;
685            self.get_buf_mut().put_i64_at(offset, value);
686        }
687
688        /// VAR_DATA ENCODER - character encoding: 'UTF-8'
689        #[inline]
690        pub fn commission_asset(&mut self, value: &str) {
691            let limit = self.get_limit();
692            let data_length = value.len();
693            self.set_limit(limit + 1 + data_length);
694            self.get_buf_mut().put_u8_at(limit, data_length as u8);
695            self.get_buf_mut().put_slice_at(limit + 1, value.as_bytes());
696        }
697    }
698
699    #[derive(Debug, Default)]
700    pub struct PreventedMatchesEncoder<P> {
701        parent: Option<P>,
702        count: u32,
703        index: usize,
704        offset: usize,
705        initial_limit: usize,
706    }
707
708    impl<'a, P> Writer<'a> for PreventedMatchesEncoder<P>
709    where
710        P: Writer<'a> + Default,
711    {
712        #[inline]
713        fn get_buf_mut(&mut self) -> &mut WriteBuf<'a> {
714            if let Some(parent) = self.parent.as_mut() {
715                parent.get_buf_mut()
716            } else {
717                panic!("parent was None")
718            }
719        }
720    }
721
722    impl<'a, P> Encoder<'a> for PreventedMatchesEncoder<P>
723    where
724        P: Encoder<'a> + Default,
725    {
726        #[inline]
727        fn get_limit(&self) -> usize {
728            self.parent.as_ref().expect("parent missing").get_limit()
729        }
730
731        #[inline]
732        fn set_limit(&mut self, limit: usize) {
733            self.parent
734                .as_mut()
735                .expect("parent missing")
736                .set_limit(limit);
737        }
738    }
739
740    impl<'a, P> PreventedMatchesEncoder<P>
741    where
742        P: Encoder<'a> + Default,
743    {
744        #[inline]
745        pub fn wrap(mut self, mut parent: P, count: u32) -> Self {
746            let initial_limit = parent.get_limit();
747            parent.set_limit(initial_limit + 6);
748            parent
749                .get_buf_mut()
750                .put_u16_at(initial_limit, Self::block_length());
751            parent.get_buf_mut().put_u32_at(initial_limit + 2, count);
752            self.parent = Some(parent);
753            self.count = count;
754            self.index = usize::MAX;
755            self.offset = usize::MAX;
756            self.initial_limit = initial_limit;
757            self
758        }
759
760        #[inline]
761        pub fn block_length() -> u16 {
762            40
763        }
764
765        #[inline]
766        pub fn parent(&mut self) -> SbeResult<P> {
767            self.parent.take().ok_or(SbeErr::ParentNotSet)
768        }
769
770        /// will return Some(current index) when successful otherwise None
771        #[inline]
772        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
773            let index = self.index.wrapping_add(1);
774            if index >= self.count as usize {
775                return Ok(None);
776            }
777
778            if let Some(parent) = self.parent.as_mut() {
779                self.offset = parent.get_limit();
780                parent.set_limit(self.offset + Self::block_length() as usize);
781                self.index = index;
782                Ok(Some(index))
783            } else {
784                Err(SbeErr::ParentNotSet)
785            }
786        }
787
788        /// primitive field 'preventedMatchId'
789        /// - min value: -9223372036854775807
790        /// - max value: 9223372036854775807
791        /// - null value: -9223372036854775808_i64
792        /// - characterEncoding: null
793        /// - semanticType: null
794        /// - encodedOffset: 0
795        /// - encodedLength: 8
796        /// - version: 0
797        #[inline]
798        pub fn prevented_match_id(&mut self, value: i64) {
799            let offset = self.offset;
800            self.get_buf_mut().put_i64_at(offset, value);
801        }
802
803        /// primitive field 'makerOrderId'
804        /// - min value: -9223372036854775807
805        /// - max value: 9223372036854775807
806        /// - null value: -9223372036854775808_i64
807        /// - characterEncoding: null
808        /// - semanticType: null
809        /// - encodedOffset: 8
810        /// - encodedLength: 8
811        /// - version: 0
812        #[inline]
813        pub fn maker_order_id(&mut self, value: i64) {
814            let offset = self.offset + 8;
815            self.get_buf_mut().put_i64_at(offset, value);
816        }
817
818        /// primitive field 'price'
819        /// - min value: -9223372036854775807
820        /// - max value: 9223372036854775807
821        /// - null value: -9223372036854775808_i64
822        /// - characterEncoding: null
823        /// - semanticType: null
824        /// - encodedOffset: 16
825        /// - encodedLength: 8
826        /// - version: 0
827        #[inline]
828        pub fn price(&mut self, value: i64) {
829            let offset = self.offset + 16;
830            self.get_buf_mut().put_i64_at(offset, value);
831        }
832
833        /// primitive field 'takerPreventedQuantity'
834        /// - min value: -9223372036854775807
835        /// - max value: 9223372036854775807
836        /// - null value: -9223372036854775808_i64
837        /// - characterEncoding: null
838        /// - semanticType: null
839        /// - encodedOffset: 24
840        /// - encodedLength: 8
841        /// - version: 0
842        #[inline]
843        pub fn taker_prevented_quantity(&mut self, value: i64) {
844            let offset = self.offset + 24;
845            self.get_buf_mut().put_i64_at(offset, value);
846        }
847
848        /// primitive field 'makerPreventedQuantity'
849        /// - min value: -9223372036854775807
850        /// - max value: 9223372036854775807
851        /// - null value: -9223372036854775808_i64
852        /// - characterEncoding: null
853        /// - semanticType: null
854        /// - encodedOffset: 32
855        /// - encodedLength: 8
856        /// - version: 0
857        #[inline]
858        pub fn maker_prevented_quantity(&mut self, value: i64) {
859            let offset = self.offset + 32;
860            self.get_buf_mut().put_i64_at(offset, value);
861        }
862
863        /// VAR_DATA ENCODER - character encoding: 'UTF-8'
864        #[inline]
865        pub fn maker_symbol(&mut self, value: &str) {
866            let limit = self.get_limit();
867            let data_length = value.len();
868            self.set_limit(limit + 1 + data_length);
869            self.get_buf_mut().put_u8_at(limit, data_length as u8);
870            self.get_buf_mut().put_slice_at(limit + 1, value.as_bytes());
871        }
872    }
873} // end encoder
874
875pub mod decoder {
876    use message_header_codec::*;
877
878    use super::*;
879
880    #[derive(Clone, Copy, Debug, Default)]
881    pub struct NewOrderFullResponseDecoder<'a> {
882        buf: ReadBuf<'a>,
883        initial_offset: usize,
884        offset: usize,
885        limit: usize,
886        pub acting_block_length: u16,
887        pub acting_version: u16,
888    }
889
890    impl ActingVersion for NewOrderFullResponseDecoder<'_> {
891        #[inline]
892        fn acting_version(&self) -> u16 {
893            self.acting_version
894        }
895    }
896
897    impl<'a> Reader<'a> for NewOrderFullResponseDecoder<'a> {
898        #[inline]
899        fn get_buf(&self) -> &ReadBuf<'a> {
900            &self.buf
901        }
902    }
903
904    impl<'a> Decoder<'a> for NewOrderFullResponseDecoder<'a> {
905        #[inline]
906        fn get_limit(&self) -> usize {
907            self.limit
908        }
909
910        #[inline]
911        fn set_limit(&mut self, limit: usize) {
912            self.limit = limit;
913        }
914    }
915
916    impl<'a> NewOrderFullResponseDecoder<'a> {
917        pub fn wrap(
918            mut self,
919            buf: ReadBuf<'a>,
920            offset: usize,
921            acting_block_length: u16,
922            acting_version: u16,
923        ) -> Self {
924            let limit = offset + acting_block_length as usize;
925            self.buf = buf;
926            self.initial_offset = offset;
927            self.offset = offset;
928            self.limit = limit;
929            self.acting_block_length = acting_block_length;
930            self.acting_version = acting_version;
931            self
932        }
933
934        #[inline]
935        pub fn encoded_length(&self) -> usize {
936            self.limit - self.offset
937        }
938
939        pub fn header(self, mut header: MessageHeaderDecoder<ReadBuf<'a>>, offset: usize) -> Self {
940            debug_assert_eq!(SBE_TEMPLATE_ID, header.template_id());
941            let acting_block_length = header.block_length();
942            let acting_version = header.version();
943
944            self.wrap(
945                header.parent().unwrap(),
946                offset + message_header_codec::ENCODED_LENGTH,
947                acting_block_length,
948                acting_version,
949            )
950        }
951
952        /// primitive field - 'REQUIRED'
953        #[inline]
954        pub fn price_exponent(&self) -> i8 {
955            self.get_buf().get_i8_at(self.offset)
956        }
957
958        /// primitive field - 'REQUIRED'
959        #[inline]
960        pub fn qty_exponent(&self) -> i8 {
961            self.get_buf().get_i8_at(self.offset + 1)
962        }
963
964        /// primitive field - 'REQUIRED'
965        #[inline]
966        pub fn order_id(&self) -> i64 {
967            self.get_buf().get_i64_at(self.offset + 2)
968        }
969
970        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
971        #[inline]
972        pub fn order_list_id(&self) -> Option<i64> {
973            let value = self.get_buf().get_i64_at(self.offset + 10);
974            if value == -9223372036854775808_i64 {
975                None
976            } else {
977                Some(value)
978            }
979        }
980
981        /// primitive field - 'REQUIRED'
982        #[inline]
983        pub fn transact_time(&self) -> i64 {
984            self.get_buf().get_i64_at(self.offset + 18)
985        }
986
987        /// primitive field - 'REQUIRED'
988        #[inline]
989        pub fn price(&self) -> i64 {
990            self.get_buf().get_i64_at(self.offset + 26)
991        }
992
993        /// primitive field - 'REQUIRED'
994        #[inline]
995        pub fn orig_qty(&self) -> i64 {
996            self.get_buf().get_i64_at(self.offset + 34)
997        }
998
999        /// primitive field - 'REQUIRED'
1000        #[inline]
1001        pub fn executed_qty(&self) -> i64 {
1002            self.get_buf().get_i64_at(self.offset + 42)
1003        }
1004
1005        /// primitive field - 'REQUIRED'
1006        #[inline]
1007        pub fn cummulative_quote_qty(&self) -> i64 {
1008            self.get_buf().get_i64_at(self.offset + 50)
1009        }
1010
1011        /// REQUIRED enum
1012        #[inline]
1013        pub fn status(&self) -> order_status::OrderStatus {
1014            self.get_buf().get_u8_at(self.offset + 58).into()
1015        }
1016
1017        /// REQUIRED enum
1018        #[inline]
1019        pub fn time_in_force(&self) -> time_in_force::TimeInForce {
1020            self.get_buf().get_u8_at(self.offset + 59).into()
1021        }
1022
1023        /// REQUIRED enum
1024        #[inline]
1025        pub fn order_type(&self) -> order_type::OrderType {
1026            self.get_buf().get_u8_at(self.offset + 60).into()
1027        }
1028
1029        /// REQUIRED enum
1030        #[inline]
1031        pub fn side(&self) -> order_side::OrderSide {
1032            self.get_buf().get_u8_at(self.offset + 61).into()
1033        }
1034
1035        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1036        #[inline]
1037        pub fn stop_price(&self) -> Option<i64> {
1038            let value = self.get_buf().get_i64_at(self.offset + 62);
1039            if value == -9223372036854775808_i64 {
1040                None
1041            } else {
1042                Some(value)
1043            }
1044        }
1045
1046        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1047        #[inline]
1048        pub fn trailing_delta(&self) -> Option<i64> {
1049            let value = self.get_buf().get_i64_at(self.offset + 70);
1050            if value == -9223372036854775808_i64 {
1051                None
1052            } else {
1053                Some(value)
1054            }
1055        }
1056
1057        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1058        #[inline]
1059        pub fn trailing_time(&self) -> Option<i64> {
1060            let value = self.get_buf().get_i64_at(self.offset + 78);
1061            if value == -9223372036854775808_i64 {
1062                None
1063            } else {
1064                Some(value)
1065            }
1066        }
1067
1068        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1069        #[inline]
1070        pub fn working_time(&self) -> Option<i64> {
1071            let value = self.get_buf().get_i64_at(self.offset + 86);
1072            if value == -9223372036854775808_i64 {
1073                None
1074            } else {
1075                Some(value)
1076            }
1077        }
1078
1079        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1080        #[inline]
1081        pub fn iceberg_qty(&self) -> Option<i64> {
1082            let value = self.get_buf().get_i64_at(self.offset + 94);
1083            if value == -9223372036854775808_i64 {
1084                None
1085            } else {
1086                Some(value)
1087            }
1088        }
1089
1090        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1091        #[inline]
1092        pub fn strategy_id(&self) -> Option<i64> {
1093            let value = self.get_buf().get_i64_at(self.offset + 102);
1094            if value == -9223372036854775808_i64 {
1095                None
1096            } else {
1097                Some(value)
1098            }
1099        }
1100
1101        /// primitive field - 'OPTIONAL' { null_value: '-2147483648_i32' }
1102        #[inline]
1103        pub fn strategy_type(&self) -> Option<i32> {
1104            let value = self.get_buf().get_i32_at(self.offset + 110);
1105            if value == -2147483648_i32 {
1106                None
1107            } else {
1108                Some(value)
1109            }
1110        }
1111
1112        /// REQUIRED enum
1113        #[inline]
1114        pub fn order_capacity(&self) -> order_capacity::OrderCapacity {
1115            self.get_buf().get_u8_at(self.offset + 114).into()
1116        }
1117
1118        /// REQUIRED enum
1119        #[inline]
1120        pub fn working_floor(&self) -> floor::Floor {
1121            self.get_buf().get_u8_at(self.offset + 115).into()
1122        }
1123
1124        /// REQUIRED enum
1125        #[inline]
1126        pub fn self_trade_prevention_mode(
1127            &self,
1128        ) -> self_trade_prevention_mode::SelfTradePreventionMode {
1129            self.get_buf().get_u8_at(self.offset + 116).into()
1130        }
1131
1132        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1133        #[inline]
1134        pub fn trade_group_id(&self) -> Option<i64> {
1135            let value = self.get_buf().get_i64_at(self.offset + 117);
1136            if value == -9223372036854775808_i64 {
1137                None
1138            } else {
1139                Some(value)
1140            }
1141        }
1142
1143        /// primitive field - 'REQUIRED'
1144        #[inline]
1145        pub fn prevented_quantity(&self) -> i64 {
1146            self.get_buf().get_i64_at(self.offset + 125)
1147        }
1148
1149        /// REQUIRED enum
1150        #[inline]
1151        pub fn used_sor(&self) -> bool_enum::BoolEnum {
1152            self.get_buf().get_u8_at(self.offset + 133).into()
1153        }
1154
1155        /// primitive field - 'REQUIRED'
1156        #[inline]
1157        pub fn orig_quote_order_qty(&self) -> i64 {
1158            self.get_buf().get_i64_at(self.offset + 134)
1159        }
1160
1161        /// REQUIRED enum
1162        #[inline]
1163        pub fn peg_price_type(&self) -> peg_price_type::PegPriceType {
1164            if self.acting_version() < 1 {
1165                return peg_price_type::PegPriceType::default();
1166            }
1167
1168            self.get_buf().get_u8_at(self.offset + 142).into()
1169        }
1170
1171        /// REQUIRED enum
1172        #[inline]
1173        pub fn peg_offset_type(&self) -> peg_offset_type::PegOffsetType {
1174            if self.acting_version() < 1 {
1175                return peg_offset_type::PegOffsetType::default();
1176            }
1177
1178            self.get_buf().get_u8_at(self.offset + 143).into()
1179        }
1180
1181        /// primitive field - 'OPTIONAL' { null_value: '0xff_u8' }
1182        #[inline]
1183        pub fn peg_offset_value(&self) -> Option<u8> {
1184            if self.acting_version() < 1 {
1185                return None;
1186            }
1187
1188            let value = self.get_buf().get_u8_at(self.offset + 144);
1189            if value == 0xff_u8 { None } else { Some(value) }
1190        }
1191
1192        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1193        #[inline]
1194        pub fn pegged_price(&self) -> Option<i64> {
1195            if self.acting_version() < 1 {
1196                return None;
1197            }
1198
1199            let value = self.get_buf().get_i64_at(self.offset + 145);
1200            if value == -9223372036854775808_i64 {
1201                None
1202            } else {
1203                Some(value)
1204            }
1205        }
1206
1207        /// REQUIRED enum
1208        #[inline]
1209        pub fn expiry_reason(&self) -> expiry_reason::ExpiryReason {
1210            if self.acting_version() < 3 {
1211                return expiry_reason::ExpiryReason::default();
1212            }
1213
1214            self.get_buf().get_u8_at(self.offset + 153).into()
1215        }
1216
1217        /// GROUP DECODER (id=100)
1218        #[inline]
1219        pub fn fills_decoder(self) -> FillsDecoder<Self> {
1220            FillsDecoder::default().wrap(self)
1221        }
1222
1223        /// GROUP DECODER (id=101)
1224        #[inline]
1225        pub fn prevented_matches_decoder(self) -> PreventedMatchesDecoder<Self> {
1226            PreventedMatchesDecoder::default().wrap(self)
1227        }
1228
1229        /// VAR_DATA DECODER - character encoding: 'UTF-8'
1230        #[inline]
1231        pub fn symbol_decoder(&mut self) -> (usize, usize) {
1232            let offset = self.get_limit();
1233            let data_length = self.get_buf().get_u8_at(offset) as usize;
1234            self.set_limit(offset + 1 + data_length);
1235            (offset + 1, data_length)
1236        }
1237
1238        #[inline]
1239        pub fn symbol_slice(&'a self, coordinates: (usize, usize)) -> &'a [u8] {
1240            debug_assert!(self.get_limit() >= coordinates.0 + coordinates.1);
1241            self.get_buf().get_slice_at(coordinates.0, coordinates.1)
1242        }
1243
1244        /// VAR_DATA DECODER - character encoding: 'UTF-8'
1245        #[inline]
1246        pub fn client_order_id_decoder(&mut self) -> (usize, usize) {
1247            let offset = self.get_limit();
1248            let data_length = self.get_buf().get_u8_at(offset) as usize;
1249            self.set_limit(offset + 1 + data_length);
1250            (offset + 1, data_length)
1251        }
1252
1253        #[inline]
1254        pub fn client_order_id_slice(&'a self, coordinates: (usize, usize)) -> &'a [u8] {
1255            debug_assert!(self.get_limit() >= coordinates.0 + coordinates.1);
1256            self.get_buf().get_slice_at(coordinates.0, coordinates.1)
1257        }
1258    }
1259
1260    #[derive(Debug, Default)]
1261    pub struct FillsDecoder<P> {
1262        parent: Option<P>,
1263        block_length: u16,
1264        count: u32,
1265        index: usize,
1266        offset: usize,
1267    }
1268
1269    impl<'a, P> ActingVersion for FillsDecoder<P>
1270    where
1271        P: Reader<'a> + ActingVersion + Default,
1272    {
1273        #[inline]
1274        fn acting_version(&self) -> u16 {
1275            self.parent.as_ref().unwrap().acting_version()
1276        }
1277    }
1278
1279    impl<'a, P> Reader<'a> for FillsDecoder<P>
1280    where
1281        P: Reader<'a> + Default,
1282    {
1283        #[inline]
1284        fn get_buf(&self) -> &ReadBuf<'a> {
1285            self.parent.as_ref().expect("parent missing").get_buf()
1286        }
1287    }
1288
1289    impl<'a, P> Decoder<'a> for FillsDecoder<P>
1290    where
1291        P: Decoder<'a> + ActingVersion + Default,
1292    {
1293        #[inline]
1294        fn get_limit(&self) -> usize {
1295            self.parent.as_ref().expect("parent missing").get_limit()
1296        }
1297
1298        #[inline]
1299        fn set_limit(&mut self, limit: usize) {
1300            self.parent
1301                .as_mut()
1302                .expect("parent missing")
1303                .set_limit(limit);
1304        }
1305    }
1306
1307    impl<'a, P> FillsDecoder<P>
1308    where
1309        P: Decoder<'a> + ActingVersion + Default,
1310    {
1311        pub fn wrap(mut self, mut parent: P) -> Self {
1312            let initial_offset = parent.get_limit();
1313            let block_length = parent.get_buf().get_u16_at(initial_offset);
1314            let count = parent.get_buf().get_u32_at(initial_offset + 2);
1315            parent.set_limit(initial_offset + 6);
1316            self.parent = Some(parent);
1317            self.block_length = block_length;
1318            self.count = count;
1319            self.index = usize::MAX;
1320            self.offset = 0;
1321            self
1322        }
1323
1324        /// group token - Token{signal=BEGIN_GROUP, name='fills', referencedName='null', description='null', packageName='null', id=100, version=0, deprecated=0, encodedLength=42, offset=154, componentTokenCount=37, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}}
1325        #[inline]
1326        pub fn parent(&mut self) -> SbeResult<P> {
1327            self.parent.take().ok_or(SbeErr::ParentNotSet)
1328        }
1329
1330        #[inline]
1331        pub fn acting_version(&mut self) -> u16 {
1332            self.parent.as_ref().unwrap().acting_version()
1333        }
1334
1335        #[inline]
1336        pub fn count(&self) -> u32 {
1337            self.count
1338        }
1339
1340        /// will return Some(current index) when successful otherwise None
1341        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
1342            let index = self.index.wrapping_add(1);
1343            if index >= self.count as usize {
1344                return Ok(None);
1345            }
1346
1347            if let Some(parent) = self.parent.as_mut() {
1348                self.offset = parent.get_limit();
1349                parent.set_limit(self.offset + self.block_length as usize);
1350                self.index = index;
1351                Ok(Some(index))
1352            } else {
1353                Err(SbeErr::ParentNotSet)
1354            }
1355        }
1356
1357        /// primitive field - 'REQUIRED'
1358        #[inline]
1359        pub fn commission_exponent(&self) -> i8 {
1360            self.get_buf().get_i8_at(self.offset)
1361        }
1362
1363        /// REQUIRED enum
1364        #[inline]
1365        pub fn match_type(&self) -> match_type::MatchType {
1366            self.get_buf().get_u8_at(self.offset + 1).into()
1367        }
1368
1369        /// primitive field - 'REQUIRED'
1370        #[inline]
1371        pub fn price(&self) -> i64 {
1372            self.get_buf().get_i64_at(self.offset + 2)
1373        }
1374
1375        /// primitive field - 'REQUIRED'
1376        #[inline]
1377        pub fn qty(&self) -> i64 {
1378            self.get_buf().get_i64_at(self.offset + 10)
1379        }
1380
1381        /// primitive field - 'REQUIRED'
1382        #[inline]
1383        pub fn commission(&self) -> i64 {
1384            self.get_buf().get_i64_at(self.offset + 18)
1385        }
1386
1387        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1388        #[inline]
1389        pub fn trade_id(&self) -> Option<i64> {
1390            let value = self.get_buf().get_i64_at(self.offset + 26);
1391            if value == -9223372036854775808_i64 {
1392                None
1393            } else {
1394                Some(value)
1395            }
1396        }
1397
1398        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1399        #[inline]
1400        pub fn alloc_id(&self) -> Option<i64> {
1401            let value = self.get_buf().get_i64_at(self.offset + 34);
1402            if value == -9223372036854775808_i64 {
1403                None
1404            } else {
1405                Some(value)
1406            }
1407        }
1408
1409        /// VAR_DATA DECODER - character encoding: 'UTF-8'
1410        #[inline]
1411        pub fn commission_asset_decoder(&mut self) -> (usize, usize) {
1412            let offset = self.parent.as_ref().expect("parent missing").get_limit();
1413            let data_length = self.get_buf().get_u8_at(offset) as usize;
1414            self.parent
1415                .as_mut()
1416                .unwrap()
1417                .set_limit(offset + 1 + data_length);
1418            (offset + 1, data_length)
1419        }
1420
1421        #[inline]
1422        pub fn commission_asset_slice(&'a self, coordinates: (usize, usize)) -> &'a [u8] {
1423            debug_assert!(self.get_limit() >= coordinates.0 + coordinates.1);
1424            self.get_buf().get_slice_at(coordinates.0, coordinates.1)
1425        }
1426    }
1427
1428    #[derive(Debug, Default)]
1429    pub struct PreventedMatchesDecoder<P> {
1430        parent: Option<P>,
1431        block_length: u16,
1432        count: u32,
1433        index: usize,
1434        offset: usize,
1435    }
1436
1437    impl<'a, P> ActingVersion for PreventedMatchesDecoder<P>
1438    where
1439        P: Reader<'a> + ActingVersion + Default,
1440    {
1441        #[inline]
1442        fn acting_version(&self) -> u16 {
1443            self.parent.as_ref().unwrap().acting_version()
1444        }
1445    }
1446
1447    impl<'a, P> Reader<'a> for PreventedMatchesDecoder<P>
1448    where
1449        P: Reader<'a> + Default,
1450    {
1451        #[inline]
1452        fn get_buf(&self) -> &ReadBuf<'a> {
1453            self.parent.as_ref().expect("parent missing").get_buf()
1454        }
1455    }
1456
1457    impl<'a, P> Decoder<'a> for PreventedMatchesDecoder<P>
1458    where
1459        P: Decoder<'a> + ActingVersion + Default,
1460    {
1461        #[inline]
1462        fn get_limit(&self) -> usize {
1463            self.parent.as_ref().expect("parent missing").get_limit()
1464        }
1465
1466        #[inline]
1467        fn set_limit(&mut self, limit: usize) {
1468            self.parent
1469                .as_mut()
1470                .expect("parent missing")
1471                .set_limit(limit);
1472        }
1473    }
1474
1475    impl<'a, P> PreventedMatchesDecoder<P>
1476    where
1477        P: Decoder<'a> + ActingVersion + Default,
1478    {
1479        pub fn wrap(mut self, mut parent: P) -> Self {
1480            let initial_offset = parent.get_limit();
1481            let block_length = parent.get_buf().get_u16_at(initial_offset);
1482            let count = parent.get_buf().get_u32_at(initial_offset + 2);
1483            parent.set_limit(initial_offset + 6);
1484            self.parent = Some(parent);
1485            self.block_length = block_length;
1486            self.count = count;
1487            self.index = usize::MAX;
1488            self.offset = 0;
1489            self
1490        }
1491
1492        /// group token - Token{signal=BEGIN_GROUP, name='preventedMatches', referencedName='null', description='null', packageName='null', id=101, version=0, deprecated=0, encodedLength=40, offset=-1, componentTokenCount=27, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}}
1493        #[inline]
1494        pub fn parent(&mut self) -> SbeResult<P> {
1495            self.parent.take().ok_or(SbeErr::ParentNotSet)
1496        }
1497
1498        #[inline]
1499        pub fn acting_version(&mut self) -> u16 {
1500            self.parent.as_ref().unwrap().acting_version()
1501        }
1502
1503        #[inline]
1504        pub fn count(&self) -> u32 {
1505            self.count
1506        }
1507
1508        /// will return Some(current index) when successful otherwise None
1509        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
1510            let index = self.index.wrapping_add(1);
1511            if index >= self.count as usize {
1512                return Ok(None);
1513            }
1514
1515            if let Some(parent) = self.parent.as_mut() {
1516                self.offset = parent.get_limit();
1517                parent.set_limit(self.offset + self.block_length as usize);
1518                self.index = index;
1519                Ok(Some(index))
1520            } else {
1521                Err(SbeErr::ParentNotSet)
1522            }
1523        }
1524
1525        /// primitive field - 'REQUIRED'
1526        #[inline]
1527        pub fn prevented_match_id(&self) -> i64 {
1528            self.get_buf().get_i64_at(self.offset)
1529        }
1530
1531        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1532        #[inline]
1533        pub fn maker_order_id(&self) -> Option<i64> {
1534            let value = self.get_buf().get_i64_at(self.offset + 8);
1535            if value == -9223372036854775808_i64 {
1536                None
1537            } else {
1538                Some(value)
1539            }
1540        }
1541
1542        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1543        #[inline]
1544        pub fn price(&self) -> Option<i64> {
1545            let value = self.get_buf().get_i64_at(self.offset + 16);
1546            if value == -9223372036854775808_i64 {
1547                None
1548            } else {
1549                Some(value)
1550            }
1551        }
1552
1553        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1554        #[inline]
1555        pub fn taker_prevented_quantity(&self) -> Option<i64> {
1556            let value = self.get_buf().get_i64_at(self.offset + 24);
1557            if value == -9223372036854775808_i64 {
1558                None
1559            } else {
1560                Some(value)
1561            }
1562        }
1563
1564        /// primitive field - 'OPTIONAL' { null_value: '-9223372036854775808_i64' }
1565        #[inline]
1566        pub fn maker_prevented_quantity(&self) -> Option<i64> {
1567            let value = self.get_buf().get_i64_at(self.offset + 32);
1568            if value == -9223372036854775808_i64 {
1569                None
1570            } else {
1571                Some(value)
1572            }
1573        }
1574
1575        /// VAR_DATA DECODER - character encoding: 'UTF-8'
1576        #[inline]
1577        pub fn maker_symbol_decoder(&mut self) -> (usize, usize) {
1578            let offset = self.parent.as_ref().expect("parent missing").get_limit();
1579            let data_length = self.get_buf().get_u8_at(offset) as usize;
1580            self.parent
1581                .as_mut()
1582                .unwrap()
1583                .set_limit(offset + 1 + data_length);
1584            (offset + 1, data_length)
1585        }
1586
1587        #[inline]
1588        pub fn maker_symbol_slice(&'a self, coordinates: (usize, usize)) -> &'a [u8] {
1589            debug_assert!(self.get_limit() >= coordinates.0 + coordinates.1);
1590            self.get_buf().get_slice_at(coordinates.0, coordinates.1)
1591        }
1592    }
1593} // end decoder