Trait lmdb_zero::error::LmdbResultExt
[−]
[src]
pub trait LmdbResultExt { type Inner; fn to_opt(self) -> Result<Option<Self::Inner>>; fn ignore_exists(self, inner: Self::Inner) -> Self; }
Extension methods for LMDB results
Associated Types
type Inner
Required Methods
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.
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.