pub struct HarnessBuilder { /* private fields */ }Expand description
Builder: .venture(..), .module(..), .runtime(..), .template(..),
then .build().
Implementations§
Source§impl HarnessBuilder
impl HarnessBuilder
pub fn venture(self, venture: Venture) -> Self
Sourcepub fn module(self, module: impl Module) -> Self
pub fn module(self, module: impl Module) -> Self
Adds a module. Composition is compile-time: the wasm binary contains exactly the modules listed here (ADR 0003).
Sourcepub fn module_arc(self, module: Arc<dyn Module>) -> Self
pub fn module_arc(self, module: Arc<dyn Module>) -> Self
Adds an already-shared module (cratefield-testing keeps handles to
apply migrations and run conformance).
Sourcepub fn runtime(self, runtime: impl Runtime) -> Self
pub fn runtime(self, runtime: impl Runtime) -> Self
Declares the runtime: its provides() set drives build-time
checking of every module’s requires(). The runtime is kept on the
built harness for tooling (fz doctor, scheduled fan-out).
Sourcepub fn templates(
self,
templates: impl IntoIterator<Item = (String, Box<dyn Template>)>,
) -> Self
pub fn templates( self, templates: impl IntoIterator<Item = (String, Box<dyn Template>)>, ) -> Self
Registers module default templates (<module>/<template> ids).
Call before overrides; see template.rs for the convention.
Sourcepub fn ui(self, ui: impl UiMount) -> Self
pub fn ui(self, ui: impl UiMount) -> Self
Mounts a UI renderer at /ui (ADR 0010): cratefield_ui::Ui. Off
unless called, so a venture without a UI serves nothing there.
Sourcepub fn template(
self,
id: impl Into<String>,
template: Box<dyn Template>,
) -> Self
pub fn template( self, id: impl Into<String>, template: Box<dyn Template>, ) -> Self
Venture template override. Wins over any module default with the same id; the id’s module part must name a registered module.
Sourcepub fn build(self) -> Result<Harness, ConfigError>
pub fn build(self) -> Result<Harness, ConfigError>
Validates everything, collecting all problems before failing (issue #2).
§Errors
Err whose Display lists every problem: invalid venture, unknown
or duplicated port declarations, duplicate module names, tables or
/.well-known routers, harness_api mismatches, invalid UI
surfaces, unprovided required ports, and template ids naming
unregistered modules.