pub struct UsageSplit { /* private fields */ }Expand description
A session divided at tariff boundaries, and how the quantities were arrived at.
Implementations§
Source§impl UsageSplit
impl UsageSplit
Sourcepub const fn basis(&self) -> Apportionment
pub const fn basis(&self) -> Apportionment
How the quantities were arrived at.
Measured when nothing was divided: either
the containers reported each span, or no boundary fell inside the
session at all.
Sourcepub fn total_volume(&self) -> Option<VolumePair>
pub fn total_volume(&self) -> Option<VolumePair>
The slices’ volumes summed back up.
None when any slice carried no volume, and None when the sum
overflows. All or nothing, deliberately: adding up the slices that
happen to have a figure and presenting the result as the session’s total
reports a number short by exactly the slices that did not — which is the
same mistake as summing a partial container set and calling it a total.
Sourcepub fn total_duration(&self) -> Option<Seconds>
pub fn total_duration(&self) -> Option<Seconds>
The slices’ chargeable durations summed back up.
None when any slice carried none, for the reason given on
total_volume, and None on overflow.
Sourcepub fn total_events(&self) -> Option<u32>
pub fn total_events(&self) -> Option<u32>
The slices’ event counts summed back up.
None when any slice carried none, or the sum overflows.
Sourcepub fn conserves(&self, record: &UsageRecord) -> bool
pub fn conserves(&self, record: &UsageRecord) -> bool
Whether the split gave back exactly what the record held.
The conservation law applied to one session: apportionment must not
create or destroy usage. For a split_session result false is a
defect, not a rounding artefact — apportion is exact by
construction, so a mismatch means something else went wrong.
For a split_measured result it means something different and equally
worth knowing: the containers do not add up to the record’s own total,
which is the same disagreement
ContainerSet::agrees_with reports.