save

open suspend override fun save(snapshot: BudgetSnapshot): Result<Unit>(source)

Counts the call in saveAttemptCount, waits saveDelay (virtual under a test scheduler), then stores snapshot and records it in saves, or delivers the failure armed by failSaves and stores nothing: returned in the Result, or thrown when it was armed with thrown = true. A save cancelled during the delay stores nothing.

Return

success, or a failure holding the cause armed by failSaves.

Parameters

snapshot

the snapshot to store.

Throws

the cause armed by failSaves, when it was armed with thrown = true.