pub struct Runtime {
pub bindir: PathBuf,
pub version: Version,
}
Fields§
§bindir: PathBuf
Path to the directory containing the pg_ctl
executable and other
PostgreSQL binaries.
version: Version
Version of this runtime.
Implementations§
Source§impl Runtime
impl Runtime
pub fn new<P: AsRef<Path>>(bindir: P) -> Result<Self, RuntimeError>
Sourcepub fn execute<T: AsRef<OsStr>>(&self, program: T) -> Command
pub fn execute<T: AsRef<OsStr>>(&self, program: T) -> Command
Return a Command
prepped to run the given program
in this
PostgreSQL runtime.
let version = runtime.execute("pg_ctl").arg("--version").output()?;
§Panics
Panics if it’s not possible to calculate PATH
; see
env::join_paths
.
Sourcepub fn command<T: AsRef<OsStr>>(&self, program: T) -> Command
pub fn command<T: AsRef<OsStr>>(&self, program: T) -> Command
Return a Command
prepped to run the given program
with this
PostgreSQL runtime at the front of PATH
. This is very similar to
Self::execute
except it does not qualify the given program name with
Self::bindir
.
let hello = runtime.command("bash").arg("-c").arg("echo hello").output()?;
§Panics
Panics if it’s not possible to calculate PATH
; see
env::join_paths
.
Trait Implementations§
Source§impl From<Runtime> for Strategy
impl From<Runtime> for Strategy
Source§fn from(runtime: Runtime) -> Self
fn from(runtime: Runtime) -> Self
Converts the given runtime into a Strategy::Single
.
impl Eq for Runtime
impl StructuralPartialEq for Runtime
Auto Trait Implementations§
impl Freeze for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnwindSafe for Runtime
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
Mutably borrows from an owned value. Read more
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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