Struct pgx::PgTryResult [−][src]
#[must_use = "this `PgTryResult` may be be holding a Postgres ERROR. It must be consumed or rethrown"]pub struct PgTryResult<T>(_);
A std::result::Result
-type value returned from pg_try()
that allows for performing cleanup
work after a closure raised an error and before it is possibly rethrown
Implementations
impl<T> PgTryResult<T>
[src]
impl<T> PgTryResult<T>
[src]pub fn unwrap(self) -> T
[src]
Retrieve the returned value or panic if the try block raised an error
pub unsafe fn unwrap_or(self, value: T) -> T
[src]
Safety
This function is unsafe because you might be ignoring a caught Postgres ERROR (or Rust panic) and you better know what you’re doing when you do that.
Doing so can potentially leave Postgres in an undefined state and ultimately cause it to crash.
pub unsafe fn unwrap_or_else<F>(self, cleanup: F) -> T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
Perform some operation cleanup operation after the try block if an error was thrown.
Safety
This function does not rethrow a caught ERROR. You better know what you’re doing when you call this function.
Ignoring a caught error can leave Postgres in an undefined state and ultimately cause it to crash.
pub fn unwrap_or_rethrow<F>(self, cleanup: F) -> T where
F: FnOnce(),
[src]
F: FnOnce(),
Perform some operation cleanup operation after the try block if an error was thrown.
In the event an error was caught, it is rethrown.
pub fn finally_or_rethrow<F>(self, finally_block: F) -> T where
F: FnOnce(),
[src]
F: FnOnce(),
Perform some operation after the try block completes, regardless of if an error was thrown.
In the event an error was caught, it is rethrown. Otherwise, the return value from the try block is returned
Auto Trait Implementations
impl<T> !RefUnwindSafe for PgTryResult<T>
impl<T> !RefUnwindSafe for PgTryResult<T>
impl<T> Send for PgTryResult<T> where
T: Send,
impl<T> Send for PgTryResult<T> where
T: Send,
impl<T> !Sync for PgTryResult<T>
impl<T> !Sync for PgTryResult<T>
impl<T> Unpin for PgTryResult<T> where
T: Unpin,
impl<T> Unpin for PgTryResult<T> where
T: Unpin,
impl<T> !UnwindSafe for PgTryResult<T>
impl<T> !UnwindSafe for PgTryResult<T>