pub trait LmdbResultExt {
type Inner;
// Required methods
fn to_opt(self) -> Result<Option<Self::Inner>>;
fn ignore_exists(self, inner: Self::Inner) -> Self;
}
Expand description
Extension methods for LMDB results
Required Associated Types§
Required Methods§
Sourcefn to_opt(self) -> Result<Option<Self::Inner>>
fn to_opt(self) -> Result<Option<Self::Inner>>
Lift “not found” errors to None
.
If Ok(val)
, return Ok(Some(val))
. If Err
but the error is
Error::Code(NOTFOUND)
, return Ok(None)
. Otherwise, return self.
Sourcefn ignore_exists(self, inner: Self::Inner) -> Self
fn ignore_exists(self, inner: Self::Inner) -> Self
Suppress KEYEXIST
errors.
If this is Err
and the error is Error::Code(KEYEXIST)
, switch to
Ok
with the given inner value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.