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
/*******************************************************************************
*
* Copyright (c) 2026 Haixing Hu.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0.
*
******************************************************************************/
//! Pending decoded value retained by buffered converters.
/// Decoded value retained after source input has been consumed.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub(super) struct PendingValue<Value> {
/// Decoded logical value.
value: Value,
/// Source input index that produced this value.
input_index: usize,
}
impl<Value> PendingValue<Value> {
/// Creates a retained decoded value.
///
/// # Parameters
///
/// - `value`: Decoded logical value.
/// - `input_index`: Source input index that produced the value.
///
/// # Returns
///
/// Returns pending-value state owned by the converter engine.
#[inline(always)]
pub(super) const fn new(value: Value, input_index: usize) -> Self {
Self { value, input_index }
}
/// Returns the source input index that produced this value.
///
/// # Returns
///
/// Returns the absolute source input index used for downstream encode errors.
#[must_use]
#[inline(always)]
pub(super) const fn input_index(&self) -> usize {
self.input_index
}
/// Returns the decoded value.
///
/// # Returns
///
/// Returns the retained decoded value by shared reference.
#[must_use]
#[inline(always)]
pub(super) const fn value(&self) -> &Value {
&self.value
}
}