pub struct Compiler {
pub registry: Arc<ParserRegistry>,
pub last_css: String,
pub transformer: Transformer,
pub stats: Option<CompileStats>,
pub thread_pool_config: ThreadPoolConfig,
pub compile_cache: HashMap<CompileCacheKey, CompileCacheValue>,
pub cache_size_limit: usize,
pub hot_cache: Option<(CompileCacheKey, CompileResult)>,
}Expand description
Nargo 编译器
负责协调各个编译阶段,集成 nargo-parser、nargo-transformer 等组件,并提供编译配置和优化选项。
Fields§
§registry: Arc<ParserRegistry>解析器注册表
last_css: String上次生成的 CSS
transformer: Transformer转换器
stats: Option<CompileStats>编译统计信息
thread_pool_config: ThreadPoolConfig线程池配置
compile_cache: HashMap<CompileCacheKey, CompileCacheValue>编译缓存
cache_size_limit: usize缓存大小限制(默认 1000)
hot_cache: Option<(CompileCacheKey, CompileResult)>热编译路径快速缓存
Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn with_cache_size_limit(self, limit: usize) -> Self
pub fn with_cache_size_limit(self, limit: usize) -> Self
Sourcepub fn with_thread_pool_config(self, config: ThreadPoolConfig) -> Self
pub fn with_thread_pool_config(self, config: ThreadPoolConfig) -> Self
Sourcepub fn compile_with_options(
&mut self,
name: &str,
source: &str,
options: CompileOptions,
) -> Result<CompileResult>
pub fn compile_with_options( &mut self, name: &str, source: &str, options: CompileOptions, ) -> Result<CompileResult>
Sourcepub fn compile_to_ir(
&mut self,
name: &str,
source: &str,
options: &mut CompileOptions,
) -> Result<IRModule>
pub fn compile_to_ir( &mut self, name: &str, source: &str, options: &mut CompileOptions, ) -> Result<IRModule>
Sourcepub fn get_stats(&self) -> Option<&CompileStats>
pub fn get_stats(&self) -> Option<&CompileStats>
Sourcepub fn compile_parallel(
&self,
files: &HashMap<String, String>,
options: CompileOptions,
) -> Result<HashMap<String, CompileResult>>
pub fn compile_parallel( &self, files: &HashMap<String, String>, options: CompileOptions, ) -> Result<HashMap<String, CompileResult>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compiler
impl !RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnsafeUnpin for Compiler
impl !UnwindSafe for Compiler
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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