pub struct DriverDown;
Expand description
error indicate Client
’s Driver
is dropped and can’t be accessed anymore when sending request to driver.
database query related to this error has not been sent to database and it’s safe to retry operation if desired.
§Error source
detailed reason of driver shutdown can be obtained from output of Driver
’s AsyncLendingIterator
or
IntoFuture
trait impl method
§Examples
// start a connection and spawn driver task
let (cli, drv) = Postgres::new("<db_confg>").connect().await?;
// keep the driver task's join handle for later use
let handle = tokio::spawn(drv.into_future());
// when query returns error immediately we check if the driver is gone.
if let Err(e) = "".query(&cli).await {
if e.is_driver_down() {
// driver is gone and we want to know detail reason in this case.
// await on the join handle will return the output of Driver task.
let opt = handle.await.unwrap();
println!("{opt:?}");
}
}
Trait Implementations§
Source§impl Debug for DriverDown
impl Debug for DriverDown
Source§impl Default for DriverDown
impl Default for DriverDown
Source§fn default() -> DriverDown
fn default() -> DriverDown
Returns the “default value” for a type. Read more
Source§impl Display for DriverDown
impl Display for DriverDown
Source§impl Error for DriverDown
impl Error for DriverDown
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<DriverDown> for Error
impl From<DriverDown> for Error
Source§fn from(e: DriverDown) -> Self
fn from(e: DriverDown) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DriverDown
impl RefUnwindSafe for DriverDown
impl Send for DriverDown
impl Sync for DriverDown
impl Unpin for DriverDown
impl UnwindSafe for DriverDown
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