Add Client::is_closed

This commit is contained in:
Steven Fackler 2018-12-21 21:08:26 -08:00
parent 633e87aefc
commit b9e8b4868b
3 changed files with 12 additions and 0 deletions

View File

@ -60,6 +60,10 @@ impl Client {
self.batch_execute("BEGIN")?;
Ok(Transaction::new(self))
}
pub fn is_closed(&self) -> bool {
self.0.is_closed()
}
}
impl From<tokio_postgres::Client> for Client {

View File

@ -98,6 +98,10 @@ impl Client {
pub fn batch_execute(&mut self, query: &str) -> BatchExecute {
BatchExecute(self.0.batch_execute(query))
}
pub fn is_closed(&self) -> bool {
self.0.is_closed()
}
}
#[must_use = "futures do nothing unless polled"]

View File

@ -60,6 +60,10 @@ impl Client {
}))
}
pub fn is_closed(&self) -> bool {
self.0.sender.is_closed()
}
pub fn downgrade(&self) -> WeakClient {
WeakClient(Arc::downgrade(&self.0))
}