Crate branch_hints
source ·Expand description
This crate provides likely
and unlikely
functions that work as compiler hints for branching in stable rust.
They are taken directly from the hashbrown
crate, all credit belongs to them.
These functions enable constructions like
if likely(condition) {
// main code
} else {
// error handling code
}
and they should be optimized away by the compiler.
§Notes
This is a very minimal crate. If you want more comprehensive functionality, take a look at the likely_stable
crate.