pub enum OptLevel {
O0,
O1,
O2,
O3,
Os,
Oz,
}Expand description
An optimisation level.
spec/16-performance.md section 16.4 gives each level a throughput budget and a code
quality budget, and the levels exist to make that tradeoff explicit rather than to be a
dial. There is no -O4, because a level nobody can state the contract for is a level
nobody can test.
Variants§
O0
-O0. Compile as fast as possible and keep every variable inspectable.
O1
-O1. The cheap wins, at roughly the cost of -O0.
O2
-O2. The full pipeline. This is the level the code quality claim is about.
O3
-O3. -O2 plus the transformations that trade size for speed.
Os
-Os. Optimise for size, at roughly -O2 compile time.
Oz
-Oz. Optimise for size, aggressively.
Implementations§
Trait Implementations§
impl Copy for OptLevel
impl Eq for OptLevel
Source§impl Ord for OptLevel
impl Ord for OptLevel
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for OptLevel
impl PartialOrd for OptLevel
impl StructuralPartialEq for OptLevel
Auto Trait Implementations§
impl Freeze for OptLevel
impl RefUnwindSafe for OptLevel
impl Send for OptLevel
impl Sync for OptLevel
impl Unpin for OptLevel
impl UnsafeUnpin for OptLevel
impl UnwindSafe for OptLevel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more