@@ -1,5 +1,5 @@
|
||||
use conduwuit::Result;
|
||||
use rocksdb::{Direction, ErrorKind, IteratorMode};
|
||||
use tuwunel_core::Result;
|
||||
|
||||
//#[cfg(debug_assertions)]
|
||||
macro_rules! unhandled {
|
||||
@@ -38,19 +38,19 @@ pub(crate) fn _into_direction(mode: &IteratorMode<'_>) -> Direction {
|
||||
#[inline]
|
||||
pub(crate) fn result<T>(
|
||||
r: std::result::Result<T, rocksdb::Error>,
|
||||
) -> Result<T, conduwuit::Error> {
|
||||
) -> Result<T, tuwunel_core::Error> {
|
||||
r.map_or_else(or_else, and_then)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn and_then<T>(t: T) -> Result<T, conduwuit::Error> { Ok(t) }
|
||||
pub(crate) fn and_then<T>(t: T) -> Result<T, tuwunel_core::Error> { Ok(t) }
|
||||
|
||||
pub(crate) fn or_else<T>(e: rocksdb::Error) -> Result<T, conduwuit::Error> { Err(map_err(e)) }
|
||||
pub(crate) fn or_else<T>(e: rocksdb::Error) -> Result<T, tuwunel_core::Error> { Err(map_err(e)) }
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn is_incomplete(e: &rocksdb::Error) -> bool { e.kind() == ErrorKind::Incomplete }
|
||||
|
||||
pub(crate) fn map_err(e: rocksdb::Error) -> conduwuit::Error {
|
||||
pub(crate) fn map_err(e: rocksdb::Error) -> tuwunel_core::Error {
|
||||
let kind = io_error_kind(&e.kind());
|
||||
let string = e.into_string();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user