use libc::c_int; use std::error::Error as StdError; use std::ffi::CStr; use std::os::raw::c_char; use std::{
fmt,
result,
str,
};
use ffi;
/// An LMDB error kind. #[derive(Debug, Eq, PartialEq, Copy, Clone)] pubenum Error { /// key/data pair already exists.
KeyExist, /// key/data pair not found (EOF).
NotFound, /// Requested page not found - this usually indicates corruption.
PageNotFound, /// Located page was wrong type.
Corrupted, /// Update of meta page failed or environment had fatal error.
Panic, /// Environment version mismatch.
VersionMismatch, /// File is not a valid LMDB file.
Invalid, /// Environment mapsize reached.
MapFull, /// Environment maxdbs reached.
DbsFull, /// Environment maxreaders reached.
ReadersFull, /// Too many TLS keys in use - Windows only.
TlsFull, /// Txn has too many dirty pages.
TxnFull, /// Cursor stack too deep - internal error.
CursorFull, /// Page has not enough space - internal error.
PageFull, /// Database contents grew beyond environment mapsize.
MapResized, /// MDB_Incompatible: Operation and DB incompatible, or DB flags changed.
Incompatible, /// Invalid reuse of reader locktable slot.
BadRslot, /// Transaction cannot recover - it must be aborted.
BadTxn, /// Unsupported size of key/DB name/data, or wrong DUP_FIXED size.
BadValSize, /// The specified DBI was changed unexpectedly.
BadDbi, /// Other error.
Other(c_int),
}
impl StdError for Error { fn description(&self) -> &str { unsafe { // This is safe since the error messages returned from mdb_strerror are static. let err: *const c_char = ffi::mdb_strerror(self.to_err_code()) as *const c_char;
str::from_utf8_unchecked(CStr::from_ptr(err).to_bytes())
}
}
}
/// An LMDB result. pubtype Result<T> = result::Result<T, Error>;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.