pub struct ProcessGuard {
pub stdout_reader: Option<Lines<BufReader<ChildStdout>>>,
pub stderr_reader: Option<Lines<BufReader<ChildStderr>>>,
pub port: u32,
pub db_name: String,
pub user_name: String,
/* private fields */
}Expand description
ProcessGuard represents a postgresql process that is running in the background.
once the guard is dropped the process will be killed.
Fields§
§stdout_reader: Option<Lines<BufReader<ChildStdout>>>Allows users to read stdout by line for debugging.
stderr_reader: Option<Lines<BufReader<ChildStderr>>>Allows users to read stderr by line for debugging.
port: u32Parameters for connecting to the temporary postgresql instance.
A user shouldn’t need to use these and should call connection_string instead.
Port number that Postgresql is serving on
db_name: StringDatabase name to connect to.
user_name: StringUsername to connect as.
Implementations§
Source§impl ProcessGuard
impl ProcessGuard
Sourcepub fn connection_string(&self) -> String
pub fn connection_string(&self) -> String
Get a Postgresql format connection String for the process guard.
§Panics
Panics if a string file path cannot be obtained from the socket directory.
Sourcepub fn connection_string_for_db(&self, db_name: &str) -> String
pub fn connection_string_for_db(&self, db_name: &str) -> String
Get a Postgresql format connection string for a database on this running instance.
§Panics
Panics if a string file path cannot be obtained from the socket directory.
Sourcepub fn clone_database(&self, db_name: &str) -> TmpPostgrustResult<String>
pub fn clone_database(&self, db_name: &str) -> TmpPostgrustResult<String>
Clone the current database in this running instance.
The returned connection string points at the newly-created database.
§Errors
Returns an error if createdb fails to clone the current database.
Trait Implementations§
Source§impl Drop for ProcessGuard
Signal that the process needs to end.
impl Drop for ProcessGuard
Signal that the process needs to end.
Auto Trait Implementations§
impl Freeze for ProcessGuard
impl RefUnwindSafe for ProcessGuard
impl Send for ProcessGuard
impl Sync for ProcessGuard
impl Unpin for ProcessGuard
impl UnsafeUnpin for ProcessGuard
impl UnwindSafe for ProcessGuard
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> 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>
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>
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