Skip to main content

RapReturn

Enum RapReturn 

Source
pub enum RapReturn {
    Fatal,
    Severe {
        returned_events: u64,
    },
}
Expand description

How much of a batch a partner returned (GSMA TD.32).

Variants§

§

Fatal

The whole file was rejected.

None of its events ever entered the recipient’s counts, so the sequence number stays open and a resubmission fills it.

§

Severe

Individual events were rejected; the file itself was accepted.

Fields

§returned_events: u64

How many events came back.

Implementations§

Source§

impl RapReturn

Source

pub const fn rejects_the_file(self) -> bool

true when the whole file must be resent.

Source

pub const fn accepted_events(self, batch_events: u64) -> Option<u64>

How many events the recipient kept, given what the batch held.

None when a severe return claims more events than the batch contained, which means the two sides disagree about the file itself.

Source

pub const fn effect_on( self, batch: BatchReconciliation, ) -> Option<BatchReconciliation>

Apply the return to a reconciliation the batch had produced.

A fatal return means the batch never counted: everything it ingested is undone. Records it carried in from an earlier batch are not — they were held by a predecessor and are still outstanding — so they come back as held, which is what keeps PeriodLedger chaining.

A severe return leaves the batch counted and moves the returned events from billable to rejected. Every other counter is untouched: a duplicate stays a duplicate and a hold stays a hold, because the partner returned events, not opinions about the rest of the file.

None when more events came back than the batch released, or when the batch’s own carry cannot be reconstructed — either is a disagreement with the partner rather than arithmetic to absorb.

use mediation::{BatchReconciliation, Disposition, RapReturn, SuppressReason};

let mut batch = BatchReconciliation::EMPTY;
batch.observe(&Disposition::Billable);
batch.observe(&Disposition::Billable);
batch.observe(&Disposition::Suppressed(SuppressReason::ZeroRated));

let after = RapReturn::Severe { returned_events: 1 }.effect_on(batch).unwrap();
assert_eq!(after.released(), 1);
assert_eq!(after.rejected(), 1);
assert_eq!(after.suppressed(), 1, "the rest of the file is untouched");
assert!(after.balances());

Trait Implementations§

Source§

impl Clone for RapReturn

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RapReturn

Source§

impl Debug for RapReturn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RapReturn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RapReturn

Source§

impl PartialEq for RapReturn

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RapReturn

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.