Skip to main content

Scaffolder

Trait Scaffolder 

Source
pub trait Scaffolder {
    // Required methods
    fn target_id(&self) -> &'static str;
    fn scaffold(
        &self,
        ctx: &ScaffoldContext<'_>,
    ) -> Result<Vec<OutputFile>, ScaffoldError>;
}
Expand description

Produces project-mode scaffolding files for one target.

A Scaffolder adds files alongside the emitted source tree — manifests, README, formatter/linter configs, transpiled tests. It runs only in project mode (never --source-only); the build driver enforces that.

Returned OutputFiles use paths relative to the target build root (build/<target>/), the same convention as crate::CodeGenerator::generate_project. A scaffolder must not emit a file at a path the codegen tree already occupies (e.g. the run-affordance Cargo.toml/go.mod/package.json); run_scaffolder drops any such collisions defensively, but scaffolders should avoid them.

Required Methods§

Source

fn target_id(&self) -> &'static str

The target id this scaffolder serves.

Source

fn scaffold( &self, ctx: &ScaffoldContext<'_>, ) -> Result<Vec<OutputFile>, ScaffoldError>

Produce the additional scaffolding files for ctx.

§Errors

Returns ScaffoldError if scaffolding cannot be produced (e.g. an internally inconsistent config). S5 stubs do not error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§