5 unstable releases
0.4.0 | Feb 20, 2024 |
---|---|
0.3.1 | Oct 22, 2023 |
0.2.1 | Feb 3, 2023 |
0.2.0 | Dec 23, 2022 |
0.1.2 |
|
#113 in No standard library
28 downloads per month
5KB
branch_hints
This crate provides the functions likely
and unlikely
that work as compiler hints for branching.
These functions enable constructions like
if likely(condition) {
// main code
} else {
// error handling code
}
and they should be optimized away by the compiler.
Credit
The functions are taken directly from the hashbrown crate and this crate simply exposes them, all credit belongs to the hashbrown authors.
Note
This is a very minimal crate. If you want more comprehensive functionality, take a look at the likely_stable crate.
lib.rs
:
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.