Trait postgresfixture::runtime::strategy::RuntimeStrategy
source · pub trait RuntimeStrategy: RefUnwindSafe + 'static {
// Required method
fn runtimes(&self) -> Runtimes<'_>;
// Provided methods
fn select(&self, version: &PartialVersion) -> Option<Runtime> { ... }
fn fallback(&self) -> Option<Runtime> { ... }
}
Expand description
A strategy for finding PostgreSQL runtimes.
There are a few questions we want to answer:
- What runtimes are available?
- Which of those runtimes is best suited to running a given cluster?
- When there are no version constraints, what runtime should we use?
This trait models those questions, and provides default implementations for #2 and #3.
Required Methods§
Provided Methods§
sourcefn select(&self, version: &PartialVersion) -> Option<Runtime>
fn select(&self, version: &PartialVersion) -> Option<Runtime>
Determine the most appropriate runtime known to this strategy for the given version constraint.
The default implementation narrows the list of runtimes to those that
match the given version constraint, then chooses the one with the
highest version number. It might return None
.
Implementors§
impl RuntimeStrategy for RuntimesOnPath
impl RuntimeStrategy for Runtime
Use a single runtime as a strategy.