[−][src]Struct pgx::PgTryResult
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]
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> Send for PgTryResult<T> where
T: Send,
T: Send,
impl<T> !Sync for PgTryResult<T>
impl<T> Unpin for PgTryResult<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for PgTryResult<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,