pub enum AmountType {
None,
OneByteOne,
Standard,
Deferred,
Other(u8),
}Expand description
Classification of the amount-type byte in a line item.
Variants§
None
0x00 — placeholder. The four bytes are not a cents value.
OneByteOne
0x01 — [0x01][u24 LE cents] (provisional encoding).
Standard
0x02 — [0x02][u24 LE cents].
Deferred
0x03 — deferred. Encoding not yet known; only raw is populated.
Other(u8)
Any other byte — likely an anchor false-positive or unrecognised tag.
Implementations§
Source§impl AmountType
impl AmountType
Sourcepub fn decode_cents(self, raw: &[u8; 4]) -> Option<u32>
pub fn decode_cents(self, raw: &[u8; 4]) -> Option<u32>
Decode the 4 amount bytes into UNSIGNED integer cents (the raw u24
LE in raw[1..4]). Preserves the original Phase 5 transaction-volume
baseline. Use AmountType::decode_cents_signed for the signed
(high-bit-of-byte-1) interpretation discovered in C.48.
Sourcepub fn decode_cents_signed(self, raw: &[u8; 4]) -> Option<i32>
pub fn decode_cents_signed(self, raw: &[u8; 4]) -> Option<i32>
Decode the 4 amount bytes into SIGNED integer cents under the
high-bit-of-byte-1-is-sign convention (C.48 Track A). The magnitude
is (raw[1] & 0x7F) | (raw[2] << 8) | (raw[3] << 16) and the sign
is -1 if raw[1] & 0x80 != 0. Returns None for types other than
0x01 and 0x02 (type 0x03 is NOT a signed amount; its bytes
store enumerated reference codes - see C.48).
Trait Implementations§
Source§impl Clone for AmountType
impl Clone for AmountType
Source§fn clone(&self) -> AmountType
fn clone(&self) -> AmountType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AmountType
impl Debug for AmountType
Source§impl Hash for AmountType
impl Hash for AmountType
Source§impl PartialEq for AmountType
impl PartialEq for AmountType
Source§fn eq(&self, other: &AmountType) -> bool
fn eq(&self, other: &AmountType) -> bool
self and other values to be equal, and is used by ==.