Function unlikely
const fn unlikely(b: bool) -> bool
Hints to the compiler that a branch condition is unlikely to be true. Returns the value passed to it.
It can be used with if or boolean match expressions.
When used outside of a branch condition, it may still influence a nearby branch, but probably will not have any effect.
It can also be applied to parts of expressions, such as likely(a) && unlikely(b), or to
compound expressions, such as unlikely(a && b). When applied to compound expressions, it has
the following effect:
unlikely(!a) => !likely(a)
unlikely(a && b) => a && unlikely(b)
unlikely(a || b) => unlikely(a) || unlikely(b)
See also the function [cold_path()] which may be more appropriate for idiomatic Rust code.
Examples
use unlikely;