pub struct Record<'a> {
pub dib: Dib,
pub vib: Vib<'a>,
pub value: Value<'a>,
pub from_ciphertext: bool,
pub header: Option<&'a [u8]>,
}Expand description
One data record.
Fields§
§dib: DibData information.
vib: Vib<'a>Value information.
value: Value<'a>The value.
from_ciphertext: boolWhether every byte of this record came out of decryption. false for plaintext
telegrams and for the unencrypted tail after a partially encrypted mode-5/7
payload, which nothing protects. Decryption is confidentiality, not integrity:
see Authenticity::Encrypted.
header: Option<&'a [u8]>The DIF … VIFE bytes as transmitted (None with a plain-text unit).
Implementations§
Source§impl Record<'_>
impl Record<'_>
Sourcepub fn description(&self) -> Description
pub fn description(&self) -> Description
What the value is: kind, unit and exponent (see Vib::description).
Sourcepub fn profile(&self) -> Option<Profile<'_>>
pub fn profile(&self) -> Option<Profile<'_>>
The compact profile this record carries (VIFE 1F, 13 or 1E and an LVAR
payload), if it is one. Its base value is the record with the same storage,
tariff, subunit and VIF without the profile VIFE.
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
A short English name for what the record measures, e.g. "volume flow".
Sourcepub fn quantity(&self) -> Option<Quantity>
pub fn quantity(&self) -> Option<Quantity>
The value as an exact Quantity, with every multiplicative correction VIFE
applied.
None when the value is not an integer or valid BCD, when the description has
no unit (identifiers, counters, dates), when a combinable VIFE changes the unit
or meaning in a way this crate does not model (“per hour”, “date of”, “number
of exceeds”, additive offset, error, manufacturer-specific, reserved; see
Modifier::keeps_quantity), or when the corrected exponent overflows. Never a
value off by a correction factor (001-describe-every-record/SR-001).
Trait Implementations§
impl<'a> Copy for Record<'a>
Source§impl Display for Record<'_>
impl Display for Record<'_>
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
One line: name · modifiers · function · storage · tariff · subunit — value.
Defaults (instantaneous, storage 0, tariff 0, subunit 0) are left out.
let r = Records::new(&[0xDA, 0x02, 0x3B, 0x13, 0x01]).next().unwrap().unwrap();
assert_eq!(r.to_string(), "volume flow · maximum · storage 5 — 0.113 m³/h");