pub enum SettlementMode {
Sequential,
Concurrent,
Background,
}server only.Expand description
Controls when on-chain settlement executes relative to the inner service.
§Variants
-
Sequential (default): verify → execute → settle. Settlement only runs after the handler returns a successful response. This is the safest option — no settlement occurs on handler errors.
-
Concurrent: verify → (settle ∥ execute) → await settle. Settlement is spawned immediately after verification and runs in parallel with the handler, reducing total request latency by one facilitator RTT. On handler error the settlement task is detached (fire-and-forget).
-
Background: verify → spawn settle (fire-and-forget) → execute → return. Settlement runs entirely in the background — the response is returned to the client immediately after the handler completes, without waiting for settlement. Ideal for streaming responses (e.g. SSE / LLM token streams) where the client should start receiving data as soon as possible. Trade-off: the
Payment-Responseheader is not attached since settlement may still be in progress when the response is sent.
Variants§
Sequential
Settlement runs after the handler completes.
Concurrent
Settlement runs concurrently with the handler; response waits for settlement.
Background
Settlement is fire-and-forget; response is returned immediately.
Trait Implementations§
Source§impl Clone for SettlementMode
impl Clone for SettlementMode
Source§fn clone(&self) -> SettlementMode
fn clone(&self) -> SettlementMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SettlementMode
impl Debug for SettlementMode
Source§impl Default for SettlementMode
impl Default for SettlementMode
Source§fn default() -> SettlementMode
fn default() -> SettlementMode
Source§impl Hash for SettlementMode
impl Hash for SettlementMode
Source§impl PartialEq for SettlementMode
impl PartialEq for SettlementMode
impl Copy for SettlementMode
impl Eq for SettlementMode
impl StructuralPartialEq for SettlementMode
Auto Trait Implementations§
impl Freeze for SettlementMode
impl RefUnwindSafe for SettlementMode
impl Send for SettlementMode
impl Sync for SettlementMode
impl Unpin for SettlementMode
impl UnsafeUnpin for SettlementMode
impl UnwindSafe for SettlementMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.