pub trait DropPolicy: Sealed { }Expand description
The drop policy of a transaction guard — what an undecided guard does when dropped.
A closed set of two zero-sized markers, Rollback and Commit, chosen as a type
parameter on Transaction and
StackedTransaction. The trait is sealed: exactly
these two policies exist, and the choice is a compile-time typestate rather than a
runtime flag. Each marker’s documentation says when to reach for it; the constructors
that select one are begin /
begin_with and their stacked counterparts.
§The rollback guarantee is conditional on the emitter’s and cache’s own laws
A rolling-back drop calls foreign code — Emitter::rewind and the
Cache restore-path operations — and it may run mid-unwind, where a
second panic aborts the process. Both surfaces therefore carry an explicit non-panicking law
for exactly this call site. An implementation that breaks it turns a rollback into either an
abort (mid-unwind) or a partially-restored input (an ordinary drop a host catches); the
crate cannot detect either, and the same unspecified-but-bounded posture applies as to any
other contract violation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".