pub struct WasmBuildSession<'guard> { /* private fields */ }Expand description
Explicit cross-call input snapshot scoped to a caller-held source lease.
The session contains no global state. It may reuse successful Cargo/rustc identity, metadata, input-discovery, and content-digest work while the caller keeps the supplied write-exclusion guard alive and unchanged.
Implementations§
Source§impl<'guard> WasmBuildSession<'guard>
impl<'guard> WasmBuildSession<'guard>
Sourcepub fn assume_sources_immutable<Guard: ?Sized>(
_source_write_guard: &'guard Guard,
) -> Self
pub fn assume_sources_immutable<Guard: ?Sized>( _source_write_guard: &'guard Guard, ) -> Self
Assert source immutability and bind reuse to the supplied guard’s lifetime.
The guard must prevent mutation of every Cargo/rustc executable, manifest, configuration file, discovered source, declared additional input, and relevant environment value used by every specification sent through this session. The guard must remain held until the session is dropped. This method cannot verify the guard’s provenance; supplying an unrelated value can permit stale cache reuse.
Sourcepub fn build_batch(
&mut self,
specs: &[LabeledWasmBuildSpec],
config: WasmBuildBatchConfig,
progress: Option<(WasmBuildProgressConfig, &mut dyn FnMut(WasmBuildBatchProgressEvent))>,
spawn: impl FnMut(&mut Command) -> Result<OwnedChild>,
) -> Result<WasmBuildBatchReport, WasmBuildBatchContractError>
pub fn build_batch( &mut self, specs: &[LabeledWasmBuildSpec], config: WasmBuildBatchConfig, progress: Option<(WasmBuildProgressConfig, &mut dyn FnMut(WasmBuildBatchProgressEvent))>, spawn: impl FnMut(&mut Command) -> Result<OwnedChild>, ) -> Result<WasmBuildBatchReport, WasmBuildBatchContractError>
Build a collect-all batch with explicit orchestration and optional progress.
Source lease, feature isolation and retention match independent batches.
spawn selects Cargo child/group custody and cleanup, independently of progress.
Prepared snapshots reject specifications absent during preparation.
§Errors
Returns invalid labels, an invalidated lease or an unprepared specification error before work. Individual build failures remain in the report.
Sourcepub const fn metrics(&self) -> WasmBuildSessionMetrics
pub const fn metrics(&self) -> WasmBuildSessionMetrics
Current retained snapshot, reuse, and invalidation counters.