pub struct Compiler { /* private fields */ }Expand description
The compiler-facing integration object. Construction validates the public manifest/catalog contract once and exposes the pinned catalog identity.
Implementations§
Source§impl Compiler
impl Compiler
pub fn new() -> Result<Self, IntegrationError>
pub fn catalog_identity(&self) -> CatalogIdentity
pub fn link_report(&self) -> LinkReport
Sourcepub fn compile_hir(
&self,
hir: &Program,
) -> Result<CompilationArtifact, IntegrationError>
pub fn compile_hir( &self, hir: &Program, ) -> Result<CompilationArtifact, IntegrationError>
Lower a resolved OPY HIR program into canonical WIR, validate it against the canonical catalog, and emit deterministic en-US Workshop.
Sourcepub fn compile_hir_with_locale(
&self,
hir: &Program,
locale: &Locale,
) -> Result<CompilationArtifact, IntegrationError>
pub fn compile_hir_with_locale( &self, hir: &Program, locale: &Locale, ) -> Result<CompilationArtifact, IntegrationError>
Lower and emit using a locale declared by the canonical catalog.
Sourcepub fn compile_source(
&self,
source: &str,
main_path: &str,
root: &Path,
) -> Result<CompileOutput, IntegrationError>
pub fn compile_source( &self, source: &str, main_path: &str, root: &Path, ) -> Result<CompileOutput, IntegrationError>
Compile source using the default en-US catalog locale.
This is the ordinary embedding API. It returns Workshop text and does
not require callers to construct a workshop-rs locale or understand
canonical WIR types.
Sourcepub fn compile_source_with_language(
&self,
source: &str,
main_path: &str,
root: &Path,
language: &str,
) -> Result<CompileOutput, IntegrationError>
pub fn compile_source_with_language( &self, source: &str, main_path: &str, root: &Path, language: &str, ) -> Result<CompileOutput, IntegrationError>
Compile source using a catalog locale name without exposing the
workshop-rs locale type to ordinary embedding callers.
Sourcepub fn compile_source_with_locale(
&self,
source: &str,
main_path: &str,
root: &Path,
locale: &Locale,
) -> Result<CompilationArtifact, IntegrationError>
pub fn compile_source_with_locale( &self, source: &str, main_path: &str, root: &Path, locale: &Locale, ) -> Result<CompilationArtifact, IntegrationError>
Compile source with an explicit canonical Workshop locale.
This is an advanced integration API. Use Self::compile_source or
Self::compile_source_with_language for ordinary embedding.
Sourcepub fn compile_source_artifact(
&self,
source: &str,
main_path: &str,
root: &Path,
) -> Result<CompilationArtifact, IntegrationError>
pub fn compile_source_artifact( &self, source: &str, main_path: &str, root: &Path, ) -> Result<CompilationArtifact, IntegrationError>
Compile source and return the canonical WIR artifact for advanced integrations.
Sourcepub fn compile_source_report(
&self,
source: &str,
main_path: &str,
root: &Path,
) -> CompileReport
pub fn compile_source_report( &self, source: &str, main_path: &str, root: &Path, ) -> CompileReport
Compile source into the versioned machine-readable result contract
using the default en-US catalog locale.
Sourcepub fn compile_source_report_with_language(
&self,
source: &str,
main_path: &str,
root: &Path,
language: &str,
) -> CompileReport
pub fn compile_source_report_with_language( &self, source: &str, main_path: &str, root: &Path, language: &str, ) -> CompileReport
Compile source into the versioned machine-readable result contract using a catalog locale name.
Sourcepub fn compile_source_report_with_locale(
&self,
source: &str,
main_path: &str,
root: &Path,
locale: &Locale,
) -> CompileReport
pub fn compile_source_report_with_locale( &self, source: &str, main_path: &str, root: &Path, locale: &Locale, ) -> CompileReport
Compile source into the report contract with an explicit canonical Workshop locale. This is an advanced integration API.