pub struct Workspace { /* private fields */ }Expand description
An isolated, throwaway working copy of an authoring project template.
Created by Workspace::stage; the working copy lives under a temporary
directory that is removed when the Workspace is dropped. The submitted
source is written into, and the build runs entirely within,
Workspace::root — never the template.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn stage(template_root: &Path) -> Result<Self, ToolchainError>
pub fn stage(template_root: &Path) -> Result<Self, ToolchainError>
Stages a fresh, isolated working copy of template_root.
Creates a temporary directory as a sibling of template_root (under its
parent) and recursively copies the template’s contents directly into it,
so the working-copy root sits at the same directory depth as the
template. Same-depth sibling placement preserves the template’s relative
path dependencies (aion_flow and any other source = "local" Gleam
dependency): a path such as ../../gleam/aion_flow resolves identically
from the working copy as from the template root.
The template is read only — it is never written to or built in. The
returned Workspace owns the temporary directory and removes it on
drop.
§Errors
Returns ToolchainError::InvalidProject when template_root has no
parent directory (a filesystem root cannot host a sibling), and
ToolchainError::Io when the sibling temporary directory cannot be
created (for example the template’s parent directory is not writable) or
the recursive copy fails.