Skip to main content

HarnessBuilder

Struct HarnessBuilder 

Source
pub struct HarnessBuilder { /* private fields */ }
Expand description

Builder: .venture(..), .module(..), .runtime(..), .template(..), then .build().

Implementations§

Source§

impl HarnessBuilder

Source

pub fn venture(self, venture: Venture) -> Self

Source

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).

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for HarnessBuilder

Source§

fn default() -> HarnessBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more