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 all_on() -> OptimizationConfig
pub fn all_on() -> OptimizationConfig
Every default-on optimization enabled (the speed baseline).
Sourcepub const fn all_off() -> OptimizationConfig
pub const fn all_off() -> OptimizationConfig
No optimizations enabled — the “boring Rust” config.
Sourcepub fn disable(self, opt: Opt) -> OptimizationConfig
pub fn disable(self, opt: Opt) -> OptimizationConfig
Turn an optimization off (builder style).
Sourcepub fn enable(self, opt: Opt) -> OptimizationConfig
pub fn enable(self, opt: Opt) -> OptimizationConfig
Turn an optimization on (builder style).
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) -> u64
pub const fn bits(&self) -> u64
The raw enabled bitmask (bit layout = Opt::bit). Lets callers relate
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() -> OptimizationConfig
pub fn from_env() -> OptimizationConfig
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>,
) -> OptimizationConfig
pub fn from_spec( master_off: bool, profile: Option<&str>, off_list: Option<&str>, ) -> OptimizationConfig
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.
Sourcepub fn from_toggles(
toggles: &BTreeMap<String, bool>,
) -> (OptimizationConfig, Vec<Opt>)
pub fn from_toggles( toggles: &BTreeMap<String, bool>, ) -> (OptimizationConfig, Vec<Opt>)
Build a config from a keyword→enabled map (e.g. UI toggles), returning the normalized config and the optimizations normalization forced off.
Trait Implementations§
Source§impl Clone for OptimizationConfig
impl Clone for OptimizationConfig
Source§fn clone(&self) -> OptimizationConfig
fn clone(&self) -> OptimizationConfig
1.0.0 (const: unstable) · 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§fn default() -> OptimizationConfig
fn default() -> OptimizationConfig
Source§impl<'de> Deserialize<'de> for OptimizationConfig
impl<'de> Deserialize<'de> for OptimizationConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OptimizationConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OptimizationConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for OptimizationConfig
impl Hash for OptimizationConfig
Source§impl PartialEq for OptimizationConfig
impl PartialEq for OptimizationConfig
Source§fn eq(&self, other: &OptimizationConfig) -> bool
fn eq(&self, other: &OptimizationConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for OptimizationConfig
impl Serialize for OptimizationConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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.