pub struct Optimizer {
pub last_css: String,
pub optimization_level: OptimizationLevel,
pub environment_config: EnvironmentOptimizationConfig,
}Expand description
Nargo 优化器
负责对 IR 模块进行各种优化,包括常量折叠、死代码消除、静态提升等。
Fields§
§last_css: String上次生成的 CSS
optimization_level: OptimizationLevel优化级别
environment_config: EnvironmentOptimizationConfig环境优化配置
Implementations§
Source§impl Optimizer
impl Optimizer
Sourcepub fn set_optimization_level(&mut self, level: OptimizationLevel)
pub fn set_optimization_level(&mut self, level: OptimizationLevel)
Sourcepub fn set_environment_config(&mut self, config: EnvironmentOptimizationConfig)
pub fn set_environment_config(&mut self, config: EnvironmentOptimizationConfig)
Sourcepub fn set_target_environment(&mut self, target: TargetEnvironment)
pub fn set_target_environment(&mut self, target: TargetEnvironment)
Sourcepub fn process_styles(&mut self, ir: &IRModule) -> Result<()>
pub fn process_styles(&mut self, ir: &IRModule) -> Result<()>
Sourcepub fn apply_scope_id(&mut self, ir: &mut IRModule, scope_id: &str)
pub fn apply_scope_id(&mut self, ir: &mut IRModule, scope_id: &str)
Sourcepub fn generate_scope_id(&self, name: &str) -> String
pub fn generate_scope_id(&self, name: &str) -> String
Sourcepub fn set_detailed_optimizations(&mut self, enabled: bool)
pub fn set_detailed_optimizations(&mut self, enabled: bool)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Optimizer
impl RefUnwindSafe for Optimizer
impl Send for Optimizer
impl Sync for Optimizer
impl Unpin for Optimizer
impl UnsafeUnpin for Optimizer
impl UnwindSafe for Optimizer
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more