pub struct OptimizationConfig { /* private fields */ }Expand description
A live choice of which optimizations are enabled — one bit per Opt.
The default is every optimization on (the speed-tuned baseline). Clearing all bits yields plain, boring Rust.
Implementations§
Source§impl OptimizationConfig
impl OptimizationConfig
Sourcepub fn enable_with_requires(&mut self, opt: Opt)
pub fn enable_with_requires(&mut self, opt: Opt)
Turn opt on together with the transitive closure of what it requires.
The complement of normalize’s dependency-closure
(which turns dependents off when a requirement goes off): enabling a
leaf must pull its whole requires-chain on, or normalize would just turn
the leaf back off. This is the on-direction of the UI’s toggle-linking.
Sourcepub const fn is_all_off(&self) -> bool
pub const fn is_all_off(&self) -> bool
Whether every optimization is off.
Sourcepub const fn bits(&self) -> OptBits
pub const fn bits(&self) -> OptBits
The enabled set. Relates an OptimizationConfig to a FiredOptimizations set bit for bit.
Sourcepub const fn merged(&self, func: &OptimizationConfig) -> OptimizationConfig
pub const fn merged(&self, func: &OptimizationConfig) -> OptimizationConfig
Combine a program-level config with a function’s per-function overrides: an optimization is on for the function only if it is on in both.
Sourcepub fn disabled_keywords(&self) -> impl Iterator<Item = &'static str> + '_
pub fn disabled_keywords(&self) -> impl Iterator<Item = &'static str> + '_
The keywords of every optimization currently off (registry order).
Sourcepub fn normalize(&mut self) -> NormalizeReport
pub fn normalize(&mut self) -> NormalizeReport
Resolve conflicts and dependencies, returning what was auto-disabled.
Conflicts: when two mutually exclusive optimizations are both on, the
one declared earlier in REGISTRY wins and the later is disabled.
Dependencies: any optimization whose requires set is not fully on is
disabled (transitively, to a fixed point).
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build a config from the environment, the single external entry point.
LOGOS_OPT=off(orLOGOS_NO_OPTIMIZE=1) disables everything.LOGOS_OPT_PROFILE=speed|memory|safetyselects a base profile.LOGOS_OPT_OFF="scalarize,unroll,…"disables the listed keywords.
The result is normalized.
Sourcepub fn from_spec(
master_off: bool,
profile: Option<&str>,
off_list: Option<&str>,
) -> Self
pub fn from_spec( master_off: bool, profile: Option<&str>, off_list: Option<&str>, ) -> Self
The pure, testable core of from_env. master_off disables everything;
profile picks the base preset (speed by default); off_list is a
comma/space/;-separated list of keywords to disable. The result is
normalized.
Trait Implementations§
Source§impl Clone for OptimizationConfig
impl Clone for OptimizationConfig
Source§fn clone(&self) -> OptimizationConfig
fn clone(&self) -> OptimizationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OptimizationConfig
impl Debug for OptimizationConfig
Source§impl Default for OptimizationConfig
impl Default for OptimizationConfig
Source§impl<'de> Deserialize<'de> for OptimizationConfig
impl<'de> Deserialize<'de> for OptimizationConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for OptimizationConfig
impl Hash for OptimizationConfig
Source§impl PartialEq for OptimizationConfig
impl PartialEq for OptimizationConfig
Source§impl Serialize for OptimizationConfig
impl Serialize for OptimizationConfig
impl Copy for OptimizationConfig
impl Eq for OptimizationConfig
impl StructuralPartialEq for OptimizationConfig
Auto Trait Implementations§
impl Freeze for OptimizationConfig
impl RefUnwindSafe for OptimizationConfig
impl Send for OptimizationConfig
impl Sync for OptimizationConfig
impl Unpin for OptimizationConfig
impl UnsafeUnpin for OptimizationConfig
impl UnwindSafe for OptimizationConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.