wrap unimplemented ser/de branches with internal macro
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ba1c134689
commit
8742437036
4 changed files with 66 additions and 41 deletions
|
@ -1,6 +1,29 @@
|
|||
use conduit::{err, Result};
|
||||
use rocksdb::{Direction, IteratorMode};
|
||||
|
||||
//#[cfg(debug_assertions)]
|
||||
macro_rules! unhandled {
|
||||
($msg:literal) => {
|
||||
unimplemented!($msg)
|
||||
};
|
||||
}
|
||||
|
||||
// activate when stable; we're not ready for this yet
|
||||
#[cfg(disable)] // #[cfg(not(debug_assertions))]
|
||||
macro_rules! unhandled {
|
||||
($msg:literal) => {
|
||||
// SAFETY: Eliminates branches for serializing and deserializing types never
|
||||
// encountered in the codebase. This can promote optimization and reduce
|
||||
// codegen. The developer must verify for every invoking callsite that the
|
||||
// unhandled type is in no way involved and could not possibly be encountered.
|
||||
unsafe {
|
||||
std::hint::unreachable_unchecked();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use unhandled;
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn _into_direction(mode: &IteratorMode<'_>) -> Direction {
|
||||
use Direction::{Forward, Reverse};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue