Skip to main content

SqliteBudgetStore

Struct SqliteBudgetStore 

Source
pub struct SqliteBudgetStore { /* private fields */ }

Implementations§

Source§

impl SqliteBudgetStore

Source

pub fn cumulative_approval_operation_projection( &self, operation_id: &str, ) -> Result<Option<(BudgetCumulativeApprovalUsage, BudgetMutationRecord)>, BudgetStoreError>

Returns an operation’s latest cumulative usage and durable mutation event.

Source§

impl SqliteBudgetStore

Source

pub fn reap_holds_by_map( &self, realized_by_hold: &HashMap<String, u64>, ) -> Result<ReapSummary, BudgetStoreError>

Reconcile or reverse every hold still open at startup. Holds present in realized_by_hold (arbitrated by the ADR-0013 durable receipt log) are reconciled to their realized spend; holds absent from it (never durably admitted) are reversed. This is fail-closed against double-spend: a naive blanket release is never used.

Called by the BudgetStore trait implementation of reap_orphaned_holds.

Source

pub fn reap_expired_reserved_holds( &self, now_unix_secs: i64, ) -> Result<usize, BudgetStoreError>

Settle every reserved hold that is still open and whose reserved_until deadline is at or before now_unix_secs at its reserved worst-case, forfeiting the reserved amount to realized spend. In the two-phase reserve/reconcile flow the only evidence a spend occurred is the caller’s reconcile; an expired-and-unreconciled hold may correspond to a call that executed and spent, so releasing it (realized 0) would under-count real spend and fail open for a cumulative cap. The abandoning caller instead forfeits the worst-case (must reconcile before expiry to reclaim the difference). Fail-closed: only holds explicitly marked reserved (a non-NULL reserved_until) and past expiry are touched; a not-yet-expired reserved hold and any non-open hold are left alone. Idempotent (a settled hold is no longer open). Returns the number of holds settled.

Source

pub fn mark_hold_reserved_until( &self, hold_id: &str, reserved_until_unix_secs: i64, currency: &str, payment_reference: Option<&str>, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

Stamp an open hold with a TTL reaper deadline, the grant currency, and the rail transaction id of a prepaid MustPrepay reservation (None when the reserve carried no prepayment). Errors fail-closed when the hold is missing or is no longer open.

Source

pub fn reserve_invocation_hold( &self, hold_id: &str, capability_id: &str, grant_index: usize, reserved_until_unix_secs: i64, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

Adopt an already-debited invocation into a durable zero-exposure reserved hold, stamped with the TTL deadline and no currency. The invocation was already counted by try_increment, so this only records the open hold (never touching the invocation count); reversing it by hold id returns the invocation, while reconciling or reaping it keeps the invocation consumed. Fails closed when a hold already exists under the id.

Source

pub fn budget_hold_snapshot( &self, hold_id: &str, ) -> Result<Option<BudgetHoldSnapshot>, BudgetStoreError>

Project a single hold by id, including its reserved-until deadline.

Source§

impl SqliteBudgetStore

Source

pub fn max_mutation_event_seq(&self) -> Result<u64, BudgetStoreError>

Highest budget mutation event_seq, or 0 when empty. Mirrors the private max_budget_mutation_event_seq helper but is a public head read for the status path.

Source

pub fn max_mutation_event_seq_for_authority( &self, authority_id: &str, ) -> Result<u64, BudgetStoreError>

Highest mutation event_seq written under one origin authority, or 0 when none. The cluster budget-write handler reads this immediately after a local (leader) write to build the write’s quorum-witness token: it is always >= the just-written event’s own seq (a concurrent same-origin write can only raise it), so the per-origin contiguous witness can only under-count witnesses, never over-count one (fail-closed).

Source

pub fn mutation_event_seq_for_event_id( &self, event_id: &str, ) -> Result<Option<u64>, BudgetStoreError>

The exact event_seq of the mutation event written under event_id, or None if no such event exists (or it predates seq assignment). The cluster budget-write handler waits on THIS write’s own event_seq, looked up by the write’s event_id, instead of MAX(event_seq) for the authority: a concurrent same-authority commit (or an idempotent retry while later same-origin events already exist) can raise that MAX above this write’s seq, making the quorum wait target the wrong (higher) seq and roll back a write that itself reached quorum. Looked up by the unique event_id, this is race-free and, for an idempotent retry, returns the ORIGINAL event’s seq.

Source

pub fn mutation_event_for_event_id( &self, event_id: &str, ) -> Result<Option<BudgetMutationRecord>, BudgetStoreError>

Source

pub fn usage_projection_for_event_id( &self, event_id: &str, ) -> Result<Option<BudgetUsageRecord>, BudgetStoreError>

Source

pub fn mutation_event_witness_for_event_id( &self, event_id: &str, ) -> Result<Option<(u64, Option<String>, Option<u64>)>, BudgetStoreError>

The quorum-witness identity of the mutation event stored under event_id: (event_seq, authority_id, lease_epoch), or None when no such event exists or it predates seq assignment. The witness must target the event’s STORED origin authority, not the current lease: an idempotent retry after leadership moved re-reads the already-written event, and peers advertise it under its ORIGINAL authority, so keying the wait on the current leader would look under the wrong origin and time out a write that already committed. A null-seq (legacy) row returns None so the caller falls back to the authority MAX rather than witnessing on seq 0.

Source

pub fn record_abandoned_event_seqs( &self, seqs: &[u64], ) -> Result<(), BudgetStoreError>

Record snapshot-carried abandoned event sequences.

Source

pub fn record_abandoned_event_seq_ranges( &self, ranges: &[(u64, u64)], ) -> Result<(), BudgetStoreError>

Record snapshot-carried abandoned event sequences as inclusive ranges.

Source§

impl SqliteBudgetStore

Source§

impl SqliteBudgetStore

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, BudgetStoreError>

Source

pub fn budget_ack_heads(&self) -> Result<Vec<(String, u64)>, BudgetStoreError>

Per-origin contiguous ack head, anchored on the peer’s GLOBAL contiguous import head.

event_seq is a single store-wide dense sequence, so each origin’s events are a sparse subsequence of one global stream; a per-origin gaps-and- islands run (partitioned by authority) mis-models this: an origin whose block starts mid-sequence after a leadership change looks like a gap and is wrongly dropped, stalling its writes.

Instead this first computes the GLOBAL contiguous head H (the largest seq such that every global event_seq in 1..=H is present with no hole) as a single gaps-and-islands run over the whole stream (NOT partitioned), anchored at genesis (island 0). A hole caps H below it. Legacy NULL-authority events still occupy their global slot, so they count for contiguity (a present slot is not a gap) but are never reported as an ack. It then reports, per origin, MAX(event_seq) among that origin’s events with event_seq <= H.

Sound because global-contiguity enforcement on the puller means holding H implies holding EVERY event (all origins) at seq <= H, so head[origin] >= write.event_seq iff the peer durably holds that write and all its predecessors. Fail-closed: a global hole caps H, so no origin is ever reported past a missing global predecessor, and a missing prefix (nothing at seq 1) yields H = 0 and no acks.

NOTE: genesis anchoring assumes budget mutation events are never bulk-compacted below seq 1 (they are not today); if such compaction is added, anchor at a durable global floor instead.

NOTE: a rollback-retry that abandons a seq (existing_event_allowed) leaves a permanent interior hole that caps this GLOBAL head, stalling quorum budget-writes above the hole for EVERY origin cluster-wide (not per-origin) until operator intervention - it does not self-heal, since a snapshot from the holed leader carries the hole. Fail-closed (a hole withholds quorum and never over-counts). PERF: this runs on every cluster status request (once per sync round, an interval clamped as low as 50ms), so it must not rescan the whole ledger. The GLOBAL contiguous head is maintained incrementally against a durable watermark W (budget_ack_head_watermark): each call only advances W over the rows ABOVE it (a window scan bounded to event_seq > W), so steady state cost is O(new rows), not O(history). Soundness holds because W only advances while the run stays gap-free, and any DELETE of a mutation event resets W to 0 (reset_budget_ack_head_watermark, backstopped structurally by the budget_mutation_events_reset_ack_head_watermark AFTER DELETE trigger so a future or out-of-band delete site cannot skip the reset), forcing the next call to re-verify from genesis so a hole punched below W can never leave a stale-high head that over-counts.

Source

pub fn list_abandoned_event_seqs(&self) -> Result<Vec<u64>, BudgetStoreError>

The abandoned/tombstoned event_seqs (rolled-back-then-re-appended writes’ original seqs) that budget_ack_heads treats as filled slots. Replicated in the cluster snapshot so a FRESH follower - which never held the original event and so never fired the delete-trigger that records it locally - still learns the slot is abandoned and does not stall its contiguous head at the hole.

Source

pub fn list_abandoned_event_seq_ranges( &self, ) -> Result<Vec<(u64, u64)>, BudgetStoreError>

The abandoned event_seqs RANGE-ENCODED as inclusive (start, end) runs of consecutive seqs (ascending, non-overlapping).

The cluster snapshot carries the abandoned set this way instead of one entry per seq. A rollback storm abandons a long CONTIGUOUS run of seqs; enumerated, that is millions of integers that push the snapshot body past MAX_PEER_RESPONSE_BYTES, so the force-snapshot recovery path fails to decode cluster_snapshot() and the peer stalls in force_snapshot forever (unlike the delta path, the snapshot backstop has no further fallback). Range-encoded, each contiguous run collapses to one small pair, and the run count is bounded by the number of live mutation events (a run is separated from the next by a filled non-abandoned slot), which the snapshot already carries and which dominate the byte budget - so if the events fit under the cap the ranges do too. The encoding is LOSSLESS: a follower expands the runs to the identical seq set, so the filled-or-abandoned head-advance semantics are preserved bit-for-bit. Computed in SQL (gaps-and-islands) so the full seq set is never materialized here either.

Source

pub fn list_abandoned_event_seqs_after( &self, after_seq: u64, ) -> Result<Vec<u64>, BudgetStoreError>

Abandoned event_seqs strictly above after_seq (ascending). The budget delta endpoint returns these alongside the pulled events so the puller can treat the abandoned slots as filled and not reject the leader’s legitimately gappy stream.

Source

pub fn list_abandoned_event_seqs_in_range( &self, after_seq: u64, up_to_seq: u64, limit: usize, ) -> Result<Vec<u64>, BudgetStoreError>

Abandoned event_seqs in (after_seq, up_to_seq] (ascending), at most limit entries.

The budget delta endpoint uses this to BOUND the abandoned list it serves. A rollback storm can pack an arbitrarily large abandoned window between the follower cursor and the next live event; serializing all of it (the old unbounded list_abandoned_event_seqs_after + in-memory <= page_max filter) could exceed the peer-response byte cap, so the client rejects the body while decoding and never gets to classify the oversized window as snapshot-recovery, pinning the cursor forever. Both the upper bound and the row cap are pushed into SQL so a huge window is never materialized here.

Source

pub fn hold_authority( &self, hold_id: &str, ) -> Result<Option<BudgetEventAuthority>, BudgetStoreError>

Source

pub fn import_mutation_record( &self, record: &BudgetMutationRecord, ) -> Result<(), BudgetStoreError>

Source

pub fn list_usages_after( &self, limit: usize, after_seq: Option<u64>, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>

Source

pub fn list_all_usages( &self, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>

Source

pub fn list_mutation_events_after_seq( &self, limit: usize, after_event_seq: u64, ) -> Result<Vec<BudgetMutationRecord>, BudgetStoreError>

Source

pub fn try_increment_with_event_id( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, event_id: Option<&str>, ) -> Result<bool, BudgetStoreError>

Trait Implementations§

Source§

impl BudgetStore for SqliteBudgetStore

Source§

fn try_increment( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, ) -> Result<bool, BudgetStoreError>

Source§

fn authorize_budget_hold( &self, request: BudgetAuthorizeHoldRequest, ) -> Result<BudgetAuthorizeHoldDecision, BudgetStoreError>

Source§

fn capture_invocation_reservations( &self, request: BudgetCaptureInvocationRequest, ) -> Result<BudgetInvocationCaptureDecision, BudgetStoreError>

Source§

fn authorize_cumulative_approval( &self, request: BudgetAuthorizeCumulativeApprovalRequest, ) -> Result<BudgetCumulativeApprovalAuthorizationDecision, BudgetStoreError>

Source§

fn cancel_captured_before_dispatch( &self, request: BudgetCancelCapturedBeforeDispatchRequest, ) -> Result<BudgetCapturedBeforeDispatchCancellationDecision, BudgetStoreError>

Source§

fn release_budget_hold( &self, request: BudgetReleaseHoldRequest, ) -> Result<BudgetReleaseHoldDecision, BudgetStoreError>

Source§

fn reverse_budget_hold( &self, request: BudgetReverseHoldRequest, ) -> Result<BudgetReverseHoldDecision, BudgetStoreError>

Source§

fn reconcile_budget_hold( &self, request: BudgetReconcileHoldRequest, ) -> Result<BudgetReconcileHoldDecision, BudgetStoreError>

Source§

fn capture_budget_hold( &self, request: BudgetCaptureHoldRequest, ) -> Result<BudgetCaptureHoldDecision, BudgetStoreError>

Source§

fn try_charge_cost( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, ) -> Result<bool, BudgetStoreError>

Atomically check monetary budget limits and record provisional exposure if within bounds. Read more
Source§

fn try_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<bool, BudgetStoreError>

Source§

fn try_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<bool, BudgetStoreError>

Apply a charge under the caller’s durable hold/event identity and authority fence. Implementations must preserve all three values or return an explicit unsupported error. This method is required so a backend upgrade cannot compile successfully and fail only on live calls.
Source§

fn reverse_charge_cost( &self, capability_id: &str, grant_index: usize, cost_units: u64, ) -> Result<(), BudgetStoreError>

Reverse a previously applied provisional exposure for a pre-execution denial path.
Source§

fn reverse_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

Source§

fn reverse_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Reverse a charge under the exact durable identity and authority fence.
Source§

fn reduce_charge_cost( &self, capability_id: &str, grant_index: usize, cost_units: u64, ) -> Result<(), BudgetStoreError>

Release a previously exposed monetary amount without changing invocation count. Read more
Source§

fn reduce_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

Source§

fn reduce_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Release exposure under the exact durable identity and authority fence.
Source§

fn settle_charge_cost( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, ) -> Result<(), BudgetStoreError>

Atomically release provisional exposure and record realized spend. Read more
Source§

fn settle_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

Source§

fn settle_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Reconcile exposure and spend under the exact durable identity and authority fence.
Source§

fn list_usages( &self, limit: usize, capability_id: Option<&str>, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>

Source§

fn get_usage( &self, capability_id: &str, grant_index: usize, ) -> Result<Option<BudgetUsageRecord>, BudgetStoreError>

Source§

fn get_invocation_quota_usage( &self, key: &BudgetQuotaKey, ) -> Result<Option<BudgetInvocationQuotaUsage>, BudgetStoreError>

Source§

fn get_cumulative_approval_account_usage( &self, key: &BudgetCumulativeApprovalAccountKey, ) -> Result<Option<BudgetCumulativeApprovalAccountUsage>, BudgetStoreError>

Source§

fn get_cumulative_approval_operation_usage( &self, operation_id: &str, ) -> Result<Option<BudgetCumulativeApprovalUsage>, BudgetStoreError>

Source§

fn list_mutation_events( &self, limit: usize, capability_id: Option<&str>, grant_index: Option<usize>, ) -> Result<Vec<BudgetMutationRecord>, BudgetStoreError>

Source§

fn reap_orphaned_holds( &self, realized_by_hold: &HashMap<String, u64>, ) -> Result<(usize, usize), BudgetStoreError>

Source§

fn count_open_holds(&self) -> Result<usize, BudgetStoreError>

Source§

fn list_open_delegated_reserved_hold_ids( &self, ) -> Result<Option<Vec<String>>, BudgetStoreError>

Source§

fn request_id_has_reserved_hold( &self, request_id: &str, ) -> Result<Option<bool>, BudgetStoreError>

Source§

fn get_budget_hold( &self, hold_id: &str, ) -> Result<Option<BudgetHoldSnapshot>, BudgetStoreError>

Source§

fn mark_hold_reserved( &self, hold_id: &str, reserved_until_unix_secs: i64, currency: &str, payment_reference: Option<&str>, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

Source§

fn reserve_invocation_hold( &self, hold_id: &str, capability_id: &str, grant_index: usize, reserved_until_unix_secs: i64, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

Source§

fn reap_expired_reserved_holds( &self, now_unix_secs: i64, ) -> Result<usize, BudgetStoreError>

Source§

fn budget_guarantee_level(&self) -> BudgetGuaranteeLevel

Source§

fn budget_authority_profile(&self) -> BudgetAuthorityProfile

Source§

fn budget_metering_profile(&self) -> BudgetMeteringProfile

Source§

impl Clone for SqliteBudgetStore

Source§

fn clone(&self) -> SqliteBudgetStore

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

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more