harmos-domain 0.1.6

Harmos domain model: identifiers, contracts, catalogs and storage identities.
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
/* ***
 *
 * Harmos
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * ***
 */

/* === Modules === */

mod timestamp;

/* === Re-Exports === */

pub use timestamp::Time;

/* === Imports === */

// Standard Library Imports
use std::borrow::Cow;
use std::marker::PhantomData;
use std::num::NonZeroU32;
use std::sync::Arc;

// Third Party Imports

// Local Imports
use crate::__private::{PostcardReader, PostcardValue};
use crate::schema::declaration::{self, Field, Kind};
use crate::schema::{Cardinality, Described};
use crate::{Identifier, MemorySize, MessageError};

/* === Constants === */

/* === Macros === */

macro_rules! product {
    ($ty:ty { $($field:ident: $codec:ty => $tag:literal),* $(,)? }) => {
        crate::model::storage::codec::product!($ty { $($field: $codec => $tag),* }, check = |_: &$ty| Ok(()));
    };
    ($ty:ty { $($field:ident: $codec:ty => $tag:literal),* $(,)? }, check = $check:expr) => {
        impl crate::schema::Described for $ty {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($ty));
            const FIELDS: &'static [crate::schema::declaration::Field] = &[$(crate::schema::declaration::Field {
                name: std::borrow::Cow::Borrowed(stringify!($field)),
                tag: $tag,
                kind: <$codec as crate::model::storage::codec::Value>::KIND,
                cardinality: <$codec as crate::model::storage::codec::Value>::CARDINALITY,
            }),*];

            const MARKER: &'static [u8] = &crate::schema::declaration::encode::<{
                crate::schema::declaration::encoded_len(Self::NAME, Self::FIELDS)
            }>(Self::NAME, Self::FIELDS);
}
        #[allow(unused_variables)]
        impl crate::__private::PostcardValue for $ty {
            fn write(&self, bytes: &mut Vec<u8>) {
                $(<$codec as crate::model::storage::codec::Value>::postcard_write(&self.$field, bytes);)*
            }
            fn size(&self) -> usize {
                0usize$(.saturating_add(<$codec as crate::model::storage::codec::Value>::postcard_size(&self.$field)))*
            }
            fn memory(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<usize, crate::MessageError> {
                input.nested(|input| {
                    let memory = std::mem::size_of::<Self>();
                    $(let memory = crate::__private::decoding_add(memory, <$codec as crate::model::storage::codec::Value>::postcard_memory(input)?)?;)*
                    Ok(memory)
                })
            }
            fn read(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<Self, crate::MessageError> {
                let value = input.nested(|input| Ok(Self { $($field: <$codec as crate::model::storage::codec::Value>::postcard_read(input)?),* }))?;
                let check: fn(&Self) -> std::result::Result<(), crate::MessageError> = $check;
                check(&value)?;
                Ok(value)
            }
        }
    };
}

pub(crate) use product;

macro_rules! postcard_field {
    () => {
        fn postcard_write(value: &Self::Native, bytes: &mut Vec<u8>) {
            crate::__private::PostcardValue::write(value, bytes);
        }
        fn postcard_size(value: &Self::Native) -> usize {
            crate::__private::PostcardValue::size(value)
        }
        fn postcard_memory(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<usize, crate::MessageError> {
            Ok(<Self::Native as crate::__private::PostcardValue>::memory(input)?.saturating_sub(std::mem::size_of::<Self::Native>()))
        }
        fn postcard_read(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<Self::Native, crate::MessageError> {
            <Self::Native as crate::__private::PostcardValue>::read(input)
        }
    };
}
pub(crate) use postcard_field;

macro_rules! variants {
    ($ty:ty { $($index:literal, $tag:literal, $name:literal: $pat:pat => { $($field:ident: $codec:ty => $ftag:literal),* $(,)? } => $build:expr;)+ }) => {
        const _: () = {
        struct Variant<const TAG: u32>;
        $(impl crate::schema::Described for Variant<$tag> {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($ty), "::", $name);
            const FIELDS: &'static [crate::schema::declaration::Field] = &[$(crate::schema::declaration::Field {
                name: std::borrow::Cow::Borrowed(stringify!($field)), tag: $ftag,
                kind: <$codec as crate::model::storage::codec::Value>::KIND,
                cardinality: <$codec as crate::model::storage::codec::Value>::CARDINALITY,
            }),*];
            const MARKER: &'static [u8] = &crate::schema::declaration::encode::<{
                crate::schema::declaration::encoded_len(Self::NAME, Self::FIELDS)
            }>(Self::NAME, Self::FIELDS);
        })+
        impl crate::schema::Described for $ty {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($ty));
            const FIELDS: &'static [crate::schema::declaration::Field] = &[$(crate::schema::declaration::Field {
                name: std::borrow::Cow::Borrowed($name),
                tag: $tag,
                cardinality: crate::schema::Cardinality::Variant,
                kind: crate::schema::declaration::Kind::Message {
                    definition: <Variant<$tag> as crate::schema::Described>::DEFINITION,
                },
            }),+];

            // Every Storage Oneof Requires Its Variant; An Absent One Is Refused.
            const DEFAULT_VARIANT: Option<usize> = None;
            const MARKER: &'static [u8] = &crate::schema::declaration::encode::<{
                crate::schema::declaration::encoded_len(Self::NAME, Self::FIELDS)
            }>(Self::NAME, Self::FIELDS);
}
        impl crate::__private::PostcardValue for $ty {
            #[allow(unused_variables)]
            fn write(&self, bytes: &mut Vec<u8>) {
                match self {
                    $($pat => {
                        crate::__private::PostcardValue::write(&($index as u32), bytes);
                        $(<$codec as crate::model::storage::codec::Value>::postcard_write($field, bytes);)*
                    })+
                }
            }
            #[allow(unused_variables)]
            fn size(&self) -> usize {
                match self {
                    $($pat => crate::__private::PostcardValue::size(&($index as u32))
                        $(.saturating_add(<$codec as crate::model::storage::codec::Value>::postcard_size($field)))*,)+
                }
            }
            fn memory(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<usize, crate::MessageError> {
                input.nested(|input| {
                    let memory = std::mem::size_of::<Self>();
                    match input.value::<u32>()? {
                        $($index => {
                            $(let memory = crate::__private::decoding_add(memory, <$codec as crate::model::storage::codec::Value>::postcard_memory(input)?)?;)*
                            Ok(memory)
                        })+
                        _ => Err(crate::MessageError::borrowed(concat!("unknown ", stringify!($ty), " variant"))),
                    }
                })
            }
            fn read(input: &mut crate::__private::PostcardReader<'_>) -> std::result::Result<Self, crate::MessageError> {
                input.nested(|input| match input.value::<u32>()? {
                    $($index => {
                        $(let $field = <$codec as crate::model::storage::codec::Value>::postcard_read(input)?;)*
                        Ok($build)
                    })+
                    _ => Err(crate::MessageError::borrowed(concat!("unknown ", stringify!($ty), " variant"))),
                })
            }
        }
        };
    };
}
pub(crate) use variants;

macro_rules! coded {
    ($ty:ident { $($variant:ident),+ $(,)? }) => {
        impl crate::model::storage::codec::Coded for $ty {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($ty));
            const VARIANTS: &'static [Self] = &[$(Self::$variant),+];
        }
    };
}
pub(crate) use coded;

/* === Type Aliases === */

type Result<T, E = MessageError> = std::result::Result<T, E>;

/* === Structs === */

pub struct Repeated<T>(PhantomData<fn() -> T>);
pub struct Nested<T>(PhantomData<fn() -> T>);
pub struct Shared<T>(PhantomData<fn() -> T>);
pub struct Optional<T>(PhantomData<fn() -> T>);
pub struct Id;
pub struct Bytes;
pub struct Unsigned;
pub struct Percent;
pub struct Version;
pub struct Flag;
pub struct Signed;
pub struct Float;
pub struct Text;
pub struct Code<E>(PhantomData<fn() -> E>);
pub struct Index;
pub struct Wide;
pub struct WideNonZero;
pub struct WideSigned;
pub struct Wrap<A>(PhantomData<fn() -> A>);
pub struct Many<A>(PhantomData<fn() -> A>);

/* === Enums === */

/* === Traits === */

pub trait Native: PostcardValue + MemorySize + Described {}
impl<T: PostcardValue + MemorySize + Described> Native for T {}

pub trait Coded: Copy + PartialEq + Send + Sync + 'static {
    const NAME: &'static str;
    const VARIANTS: &'static [Self];
    fn code(&self) -> u32 {
        Self::VARIANTS
            .iter()
            .position(|variant| variant == self)
            .and_then(|index| u32::try_from(index).ok())
            .expect("a coded variant is listed")
    }

    fn from_code(code: u64) -> Result<Self> {
        usize::try_from(code)
            .ok()
            .and_then(|index| Self::VARIANTS.get(index).copied())
            .ok_or_else(|| MessageError::borrowed("unknown storage enum code"))
    }
}

pub trait Value: 'static {
    const NAME: &'static str;
    type Native;
    const KIND: Kind;
    const CARDINALITY: Cardinality = Cardinality::Required;
    fn postcard_write(value: &Self::Native, bytes: &mut Vec<u8>);
    fn postcard_size(value: &Self::Native) -> usize;
    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize>;
    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<Self::Native>;
}

/* === Implementations === */

impl<T: Native> Value for Repeated<T> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Repeated)), &[T::NAME]).as_str();
    postcard_field!();
    type Native = Vec<T>;
    const KIND: Kind = Nested::<T>::KIND;
    const CARDINALITY: Cardinality = Cardinality::Repeated;
}

impl<T: Native> Value for Nested<T> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Nested)), &[T::NAME]).as_str();
    postcard_field!();
    type Native = T;
    const KIND: Kind = Kind::Message { definition: T::DEFINITION };
}

impl<T: Native> Value for Shared<T> {
    const NAME: &'static str = Nested::<T>::NAME;
    type Native = Arc<T>;
    const KIND: Kind = Nested::<T>::KIND;

    fn postcard_write(value: &Self::Native, bytes: &mut Vec<u8>) {
        T::write(value, bytes);
    }

    fn postcard_size(value: &Self::Native) -> usize {
        T::size(value)
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        crate::__private::decoding_add(T::memory(input)?, 2 * std::mem::size_of::<usize>())
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<Self::Native> {
        T::read(input).map(Arc::new)
    }
}

impl<T: Value> Value for Optional<T> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Optional)), &[T::NAME]).as_str();
    fn postcard_write(value: &Self::Native, bytes: &mut Vec<u8>) {
        PostcardValue::write(&value.is_some(), bytes);
        if let Some(value) = value {
            T::postcard_write(value, bytes);
        }
    }

    fn postcard_size(value: &Self::Native) -> usize {
        1usize.saturating_add(value.as_ref().map_or(0, T::postcard_size))
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        input.nested(|input| if input.value::<bool>()? { T::postcard_memory(input) } else { Ok(0) })
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<Self::Native> {
        input.nested(|input| if input.value::<bool>()? { T::postcard_read(input).map(Some) } else { Ok(None) })
    }

    type Native = Option<T::Native>;
    const KIND: Kind = T::KIND;
    const CARDINALITY: Cardinality = Cardinality::Optional;
}

impl Value for Id {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Id));
    postcard_field!();
    type Native = Identifier;
    const KIND: Kind = Kind::String;
}

impl Value for Bytes {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Bytes));
    postcard_field!();
    type Native = Vec<u8>;
    const KIND: Kind = Kind::Bytes;
}

impl Value for Unsigned {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Unsigned));
    postcard_field!();
    type Native = u64;
    const KIND: Kind = Kind::U64;
}

// A whole percentage rank, carried as a protobuf `uint32`; the rank's range is
// a plan rule, so any byte decodes and the plan check refuses above 100.
impl Value for Percent {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Percent));
    postcard_field!();
    type Native = u8;
    const KIND: Kind = Kind::U32;
}

impl Value for Version {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Version));
    postcard_field!();
    type Native = NonZeroU32;
    const KIND: Kind = Kind::U32;
}

macro_rules! varint {
    ($adapter:ty, $native:ty, $kind:ident, $encoding:ident, $from:expr) => {
        impl Value for $adapter {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($adapter));
            postcard_field!();
            type Native = $native;
            const KIND: Kind = Kind::$kind;
        }
    };
}

varint!(Flag, bool, Bool, bool, |value: u64| match value {
    0 => Ok(false),
    1 => Ok(true),
    _ => Err(MessageError::borrowed("invalid storage boolean")),
});
varint!(Signed, i64, I64, int64, |value: u64| Ok(value as i64));

impl Value for Float {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Float));
    postcard_field!();
    type Native = f64;
    const KIND: Kind = Kind::F64;
}

impl Value for Text {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Text));
    postcard_field!();
    type Native = String;
    const KIND: Kind = Kind::String;
}

impl<E: Coded> Value for Code<E> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Code)), &[E::NAME]).as_str();
    type Native = E;
    const KIND: Kind = Kind::U32;
    fn postcard_write(value: &E, bytes: &mut Vec<u8>) {
        PostcardValue::write(&value.code(), bytes);
    }

    fn postcard_size(value: &E) -> usize {
        PostcardValue::size(&value.code())
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        E::from_code(u64::from(input.value::<u32>()?))?;
        Ok(0)
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<E> {
        E::from_code(u64::from(input.value::<u32>()?))
    }
}

// Host Indices And Counts Travel As uint64; Decoding Never Truncates.
fn host_width(value: u64) -> Result<usize> {
    usize::try_from(value).map_err(|_| MessageError::borrowed("index exceeds host width"))
}

impl Value for Index {
    const NAME: &'static str = concat!(module_path!(), "::", stringify!(Index));
    type Native = usize;
    const KIND: Kind = Kind::U64;
    fn postcard_write(value: &usize, bytes: &mut Vec<u8>) {
        PostcardValue::write(&(*value as u64), bytes);
    }

    fn postcard_size(value: &usize) -> usize {
        PostcardValue::size(&(*value as u64))
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        Self::postcard_read(input)?;
        Ok(0)
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<usize> {
        host_width(input.value::<u64>()?)
    }
}

// 128-Bit Values Travel As A Message Of Lossless High And Low Halves.
macro_rules! wide {
    ($adapter:ty, $native:ty, $high:ty, $high_codec:ty, $split:expr, $join:expr) => {
        impl Described for $adapter {
            const NAME: &'static str = <Self as Value>::NAME;
            const FIELDS: &'static [Field] = &[
                crate::schema::declaration::Field {
                    name: Cow::Borrowed("high"),
                    tag: 1,
                    kind: <$high_codec as Value>::KIND,
                    cardinality: Cardinality::Required,
                },
                crate::schema::declaration::Field {
                    name: Cow::Borrowed("low"),
                    tag: 2,
                    kind: Kind::U64,
                    cardinality: Cardinality::Required,
                },
            ];
            const MARKER: &'static [u8] = &declaration::encode::<{ declaration::encoded_len(<Self as Described>::NAME, Self::FIELDS) }>(
                <Self as Described>::NAME,
                Self::FIELDS,
            );
        }
        impl Value for $adapter {
            const NAME: &'static str = concat!(module_path!(), "::", stringify!($adapter));
            type Native = $native;
            const KIND: Kind = Kind::Message { definition: <Self as Described>::DEFINITION };
            fn postcard_write(value: &$native, bytes: &mut Vec<u8>) {
                let (high, low): ($high, u64) = ($split)(*value);
                PostcardValue::write(&high, bytes);
                PostcardValue::write(&low, bytes);
            }
            fn postcard_size(value: &$native) -> usize {
                let (high, low): ($high, u64) = ($split)(*value);
                PostcardValue::size(&high).saturating_add(PostcardValue::size(&low))
            }
            fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
                Self::postcard_read(input)?;
                Ok(0)
            }
            fn postcard_read(input: &mut PostcardReader<'_>) -> Result<$native> {
                let high = input.value::<$high>()?;
                let low = input.value::<u64>()?;
                ($join)(high, low)
            }
        }
    };
}

wide!(Wide, u128, u64, Unsigned, |value: u128| ((value >> 64) as u64, value as u64), |high: u64, low: u64| Ok::<_, MessageError>(
    (u128::from(high) << 64) | u128::from(low)
));
wide!(
    WideNonZero,
    std::num::NonZeroU128,
    u64,
    Unsigned,
    |value: std::num::NonZeroU128| ((value.get() >> 64) as u64, value.get() as u64),
    |high: u64, low: u64| std::num::NonZeroU128::new((u128::from(high) << 64) | u128::from(low))
        .ok_or_else(|| MessageError::borrowed("wide value must be nonzero"))
);
wide!(WideSigned, i128, i64, Signed, |value: i128| ((value >> 64) as i64, value as u64), |high: i64, low: u64| Ok::<_, MessageError>(
    (i128::from(high) << 64) | i128::from(low)
));

// One Message Holding A Single Field At Tag 1; Absence Reads As Empty.
impl<A: Value> Described for Wrap<A> {
    const NAME: &'static str = <Self as Value>::NAME;
    const FIELDS: &'static [Field] =
        &[crate::schema::declaration::Field { name: Cow::Borrowed("value"), tag: 1, kind: A::KIND, cardinality: A::CARDINALITY }];
    const MARKER: &'static [u8] = declaration::encode_buffer::<2048>(<Self as Described>::NAME, Self::FIELDS)
        .split_at(declaration::encoded_len(<Self as Described>::NAME, Self::FIELDS))
        .0;
}
impl<A: Value> Value for Wrap<A> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Wrap)), &[A::NAME]).as_str();
    type Native = A::Native;
    const KIND: Kind = Kind::Message { definition: <Self as Described>::DEFINITION };
    fn postcard_write(value: &A::Native, bytes: &mut Vec<u8>) {
        A::postcard_write(value, bytes);
    }

    fn postcard_size(value: &A::Native) -> usize {
        A::postcard_size(value)
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        A::postcard_memory(input)
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<A::Native> {
        A::postcard_read(input)
    }
}

// Repeated Messages, Each Holding One Element At Tag 1.
impl<A: Value> Value for Many<A> {
    const NAME: &'static str = declaration::Name::new(concat!(module_path!(), "::", stringify!(Many)), &[A::NAME]).as_str();
    type Native = Vec<A::Native>;
    const KIND: Kind = Wrap::<A>::KIND;
    const CARDINALITY: Cardinality = Cardinality::Repeated;
    fn postcard_write(values: &Vec<A::Native>, bytes: &mut Vec<u8>) {
        PostcardValue::write(&(values.len() as u64), bytes);
        for value in values {
            A::postcard_write(value, bytes);
        }
    }

    fn postcard_size(values: &Vec<A::Native>) -> usize {
        values.iter().fold(PostcardValue::size(&(values.len() as u64)), |size, value| size.saturating_add(A::postcard_size(value)))
    }

    fn postcard_memory(input: &mut PostcardReader<'_>) -> Result<usize> {
        let count = host_width(input.value::<u64>()?)?;
        input.claim(count)?;
        let mut memory = crate::__private::decoding_multiply(count, std::mem::size_of::<A::Native>())?;
        for _ in 0..count {
            memory = crate::__private::decoding_add(memory, A::postcard_memory(input)?)?;
        }
        Ok(memory)
    }

    fn postcard_read(input: &mut PostcardReader<'_>) -> Result<Vec<A::Native>> {
        let count = host_width(input.value::<u64>()?)?;
        input.claim(count)?;
        let mut values = crate::__private::decoding_vector(count)?;
        for _ in 0..count {
            values.push(A::postcard_read(input)?);
        }
        Ok(values)
    }
}

// One Message Holding A Pair At Tags 1 And 2.
/* === Public Functions === */

/* === Private Functions === */

/* === Tests === */