Skip to main content

Workspace

Struct Workspace 

Source
pub struct Workspace {
    pub proc: Option<Arc<DaggerSessionProc>>,
    pub selection: Selection,
    pub graphql_client: DynGraphQLClient,
}

Fields§

§proc: Option<Arc<DaggerSessionProc>>§selection: Selection§graphql_client: DynGraphQLClient

Implementations§

Source§

impl Workspace

Source

pub async fn id(&self) -> Result<Id, DaggerError>

A unique identifier for this Workspace.

Source

pub fn resolve(&self, value: impl Into<String>) -> Address

Resolve an address in this workspace. A DAG address (dag://) selects exactly one workspace artifact: artifacts.filterUri(value).one(). Its typed loaders use that artifact and never fall back to external resolution. A value without the dag:// scheme keeps its external meaning, such as a container image reference. The Address retains this workspace across module calls and ID reloads.

§Arguments
  • value - A DAG address, or an external reference.
Source

pub fn with_initialized(&self) -> Workspace

Return this workspace with a native configuration, without changing an existing configuration. Fail if legacy configuration needs workspace migration.

Source

pub fn migrate_module(&self) -> WorkspaceMigration

Plan migration of one local module without migrating its dependencies or creating a workspace configuration. Include SDK registration when a workspace configuration exists and remove obsolete generated-file ignore rules.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn migrate_module_opts<'a>( &self, opts: WorkspaceMigrateModuleOpts<'a>, ) -> WorkspaceMigration

Plan migration of one local module without migrating its dependencies or creating a workspace configuration. Include SDK registration when a workspace configuration exists and remove obsolete generated-file ignore rules.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn compare_commits_from( &self, source: impl IntoID<Id>, ) -> Result<Vec<WorkspaceCommitPick>, DaggerError>

Preview which source commits withCommitsFrom would apply, skip, or report as conflicting. Results are ordered oldest first and account for earlier applicable commits in the same preview. The preview does not apply commits or write to the checkout. A local receiver is snapshotted automatically; untracked files require interactive approval. Source uncommitted changes are ignored. Exceeding maxCommits fails rather than returning a partial preview. Divergent merge commits require manual integration.

§Arguments
  • source - Git-backed source workspace. For a local checkout, call snapshot on the source first and pass the returned workspace.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn compare_commits_from_opts<'a>( &self, source: impl IntoID<Id>, opts: WorkspaceCompareCommitsFromOpts<'a>, ) -> Result<Vec<WorkspaceCommitPick>, DaggerError>

Preview which source commits withCommitsFrom would apply, skip, or report as conflicting. Results are ordered oldest first and account for earlier applicable commits in the same preview. The preview does not apply commits or write to the checkout. A local receiver is snapshotted automatically; untracked files require interactive approval. Source uncommitted changes are ignored. Exceeding maxCommits fails rather than returning a partial preview. Divergent merge commits require manual integration.

§Arguments
  • source - Git-backed source workspace. For a local checkout, call snapshot on the source first and pass the returned workspace.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_commits_from(&self, source: impl IntoID<Id>) -> Workspace

Integrate source commits into this workspace and return the result, preserving this workspace’s uncommitted changes and metadata. Fast-forward when the selected commits include all new ancestors of their tip; otherwise cherry-pick them oldest first. Already integrated commits and patches already present are skipped. Any conflict fails the operation. Source uncommitted changes are not transferred; merge them explicitly if needed. Use compareCommitsFrom to preview the integration. A local receiver is snapshotted automatically; untracked files require interactive approval. The checkout is not modified. Export the result with an explicit path to write it to a checkout. Cherry-picks preserve the source author and author date, use the calling client’s Git config for committer identity, and reuse the source committer date for reproducible hashes. Origin trailers track cherry-picked commits. Divergent merge commits require manual integration.

§Arguments
  • source - Git-backed source workspace. For a local checkout, call snapshot on the source first and pass the returned workspace.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_commits_from_opts<'a>( &self, source: impl IntoID<Id>, opts: WorkspaceWithCommitsFromOpts<'a>, ) -> Workspace

Integrate source commits into this workspace and return the result, preserving this workspace’s uncommitted changes and metadata. Fast-forward when the selected commits include all new ancestors of their tip; otherwise cherry-pick them oldest first. Already integrated commits and patches already present are skipped. Any conflict fails the operation. Source uncommitted changes are not transferred; merge them explicitly if needed. Use compareCommitsFrom to preview the integration. A local receiver is snapshotted automatically; untracked files require interactive approval. The checkout is not modified. Export the result with an explicit path to write it to a checkout. Cherry-picks preserve the source author and author date, use the calling client’s Git config for committer identity, and reuse the source committer date for reproducible hashes. Origin trailers track cherry-picked commits. Divergent merge commits require manual integration.

§Arguments
  • source - Git-backed source workspace. For a local checkout, call snapshot on the source first and pass the returned workspace.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_commit( &self, changes: impl IntoID<Id>, message: impl Into<String>, date: impl Into<String>, ) -> Workspace

Create a Git commit from a changeset and return a stable workspace with HEAD advanced. The changeset is three-way merged into both HEAD and the frozen working tree. Compatible unselected edits remain uncommitted; incoming changes need not already be in the working tree. Conflicts with either tree fail without modifying the workspace. Empty changesets, or changes already present in HEAD, fail with nothing to commit. A local workspace is snapshotted automatically before committing; untracked files require interactive approval. The host checkout is not modified. Missing author fields are resolved from Git config in the calling client’s working directory at commit time, then recorded explicitly for reproducible commits. Unconfigured fields default to Dagger and dagger@localhost.

§Arguments
  • changes - Changeset to commit, for example git.uncommitted.filter(…). Paths are rooted at the repository; rename sides are determined by the changeset. Git metadata (.git) is ignored; metadata-only changes fail with nothing to commit.
  • message - Commit message.
  • date - RFC3339 author and committer date. Required for reproducible commits.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_commit_opts<'a>( &self, changes: impl IntoID<Id>, message: impl Into<String>, date: impl Into<String>, opts: WorkspaceWithCommitOpts<'a>, ) -> Workspace

Create a Git commit from a changeset and return a stable workspace with HEAD advanced. The changeset is three-way merged into both HEAD and the frozen working tree. Compatible unselected edits remain uncommitted; incoming changes need not already be in the working tree. Conflicts with either tree fail without modifying the workspace. Empty changesets, or changes already present in HEAD, fail with nothing to commit. A local workspace is snapshotted automatically before committing; untracked files require interactive approval. The host checkout is not modified. Missing author fields are resolved from Git config in the calling client’s working directory at commit time, then recorded explicitly for reproducible commits. Unconfigured fields default to Dagger and dagger@localhost.

§Arguments
  • changes - Changeset to commit, for example git.uncommitted.filter(…). Paths are rooted at the repository; rename sides are determined by the changeset. Git metadata (.git) is ignored; metadata-only changes fail with nothing to commit.
  • message - Commit message.
  • date - RFC3339 author and committer date. Required for reproducible commits.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_reset(&self, commit: impl Into<String>) -> Workspace

Move this workspace’s Git HEAD to a commit and return the resulting stable workspace. A local workspace is snapshotted automatically before resetting; untracked files require interactive approval. The host checkout is not modified. By default the difference between the previous working tree and the target commit stays uncommitted, as with git reset –mixed, so history can be reworked and reapplied with withCommit — e.g. to amend the latest commit message, reset to its parent and commit again. With hard, the working tree is reset to the commit and every uncommitted change is discarded. Commits orphaned by the reset are not preserved: the frozen repository keeps reachable history only, so a reset cannot be undone by resetting forward again.

§Arguments
  • commit - Commit to reset HEAD to, resolved against this workspace’s repository like GitRepository.ref: a full commit hash, an unambiguous hex prefix (4-40 characters), or a ref name, optionally followed by revision suffixes such as HEAD~1, main^2 or abc1234~2. Only the commit it resolves to is used: a ref name selects its commit, it does not check out that ref.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_reset_opts( &self, commit: impl Into<String>, opts: WorkspaceWithResetOpts, ) -> Workspace

Move this workspace’s Git HEAD to a commit and return the resulting stable workspace. A local workspace is snapshotted automatically before resetting; untracked files require interactive approval. The host checkout is not modified. By default the difference between the previous working tree and the target commit stays uncommitted, as with git reset –mixed, so history can be reworked and reapplied with withCommit — e.g. to amend the latest commit message, reset to its parent and commit again. With hard, the working tree is reset to the commit and every uncommitted change is discarded. Commits orphaned by the reset are not preserved: the frozen repository keeps reachable history only, so a reset cannot be undone by resetting forward again.

§Arguments
  • commit - Commit to reset HEAD to, resolved against this workspace’s repository like GitRepository.ref: a full commit hash, an unambiguous hex prefix (4-40 characters), or a ref name, optionally followed by revision suffixes such as HEAD~1, main^2 or abc1234~2. Only the commit it resolves to is used: a ref name selects its commit, it does not check out that ref.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn snapshot(&self) -> Workspace

Return a snapshot of this workspace as a stable value. Git capture is a progressive enhancement: if the workspace has no Git repository or commits, or the client cannot capture Git, return this workspace unchanged. Approval rejections and capture failures remain errors. Use the returned workspace for subsequent reads, edits, and module loading against the captured baseline. Snapshotting an existing stable value preserves its baseline; snapshot currentWorkspace again to capture later checkout changes. Only the owning client can capture a local checkout. Tracked changes are captured automatically; untracked files require interactive approval. Remote Git refs are pinned to their resolved commits. Capturing leaves the checkout unchanged. The recipe is portable when a remote can serve its base; otherwise it is frozen for this session only.

Source

pub fn with_config_paths( &self, config_file: impl Into<String>, lock_file: impl Into<String>, ) -> Workspace

Select workspace-root-relative config and lockfile paths. Empty paths clear the selection.

§Arguments
  • config_file - Config file path.
  • lock_file - Lockfile path.
Source

pub fn with_config_environment(&self, name: impl Into<String>) -> Workspace

Select the config environment carried by this workspace.

§Arguments
  • name - Environment name, or empty to clear the selection.
Source

pub fn with_user_config(&self) -> Workspace

Return this workspace with the calling client’s user-level config re-read and applied. User-level config (the [workspaces.*] section of the Dagger config file) is read when a session loads its workspace, and snapshots keep that configuration. Call this to pick up edits made since, for example when an agent reloads its modules. The entry is matched by the workspace’s git origin remote. A workspace without one, or without a matching entry, gets no user-level config.

Source

pub async fn config_file(&self) -> Result<String, DaggerError>

Selected native workspace config file relative to the workspace cwd, if any.

Source

pub fn directory(&self, path: impl Into<String>) -> Directory

Returns a Directory from the workspace. Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.

§Arguments
  • path - Location of the directory to retrieve. Relative paths (e.g., “src”) resolve from the workspace cwd; absolute paths (e.g., “/src”) resolve from the workspace root.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn directory_opts<'a>( &self, path: impl Into<String>, opts: WorkspaceDirectoryOpts<'a>, ) -> Directory

Returns a Directory from the workspace. Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.

§Arguments
  • path - Location of the directory to retrieve. Relative paths (e.g., “src”) resolve from the workspace cwd; absolute paths (e.g., “/src”) resolve from the workspace root.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn file(&self, path: impl Into<String>) -> File

Returns a File from the workspace. Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.

§Arguments
  • path - Location of the file to retrieve. Relative paths (e.g., “go.mod”) resolve from the workspace cwd; absolute paths (e.g., “/go.mod”) resolve from the workspace root.
Source

pub async fn glob( &self, pattern: impl Into<String>, ) -> Result<Vec<String>, DaggerError>

Returns a list of files and directories that match the given pattern. Patterns match paths relative to the workspace root.

§Arguments
  • pattern - Pattern to match (e.g., “*.md”).
Source

pub async fn search( &self, pattern: impl Into<String>, ) -> Result<Vec<SearchResult>, DaggerError>

Searches for content matching the given regular expression or literal string. Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. Runs ripgrep on the client host, falling back to grep if unavailable.

§Arguments
  • pattern - The text to match.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn search_opts<'a>( &self, pattern: impl Into<String>, opts: WorkspaceSearchOpts<'a>, ) -> Result<Vec<SearchResult>, DaggerError>

Searches for content matching the given regular expression or literal string. Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. Runs ripgrep on the client host, falling back to grep if unavailable.

§Arguments
  • pattern - The text to match.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn find_up( &self, name: impl Into<String>, ) -> Result<String, DaggerError>

Search for a file or directory by walking up from the start path within the workspace. Returns the absolute workspace path if found, or null if not found. Relative start paths resolve from the workspace cwd. The search stops at the workspace root and will not traverse above it.

§Arguments
  • name - The name of the file or directory to search for.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn find_up_opts<'a>( &self, name: impl Into<String>, opts: WorkspaceFindUpOpts<'a>, ) -> Result<String, DaggerError>

Search for a file or directory by walking up from the start path within the workspace. Returns the absolute workspace path if found, or null if not found. Relative start paths resolve from the workspace cwd. The search stops at the workspace root and will not traverse above it.

§Arguments
  • name - The name of the file or directory to search for.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn find_roots( &self, markers: Vec<impl Into<String>>, ) -> Result<Vec<String>, DaggerError>

Find project roots marked by any of the given filenames, starting from a path relative to the workspace cwd. Returns cwd-relative directory paths for every marked directory at or below start, plus the nearest marked ancestor when start itself is not marked. Each returned path is usable as-is with other workspace APIs, e.g. directory(path).

§Arguments
  • markers - File basenames that mark a project root (e.g. [“go.mod”] or [“deno.json”, “deno.jsonc”]).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn find_roots_opts<'a>( &self, markers: Vec<impl Into<String>>, opts: WorkspaceFindRootsOpts<'a>, ) -> Result<Vec<String>, DaggerError>

Find project roots marked by any of the given filenames, starting from a path relative to the workspace cwd. Returns cwd-relative directory paths for every marked directory at or below start, plus the nearest marked ancestor when start itself is not marked. Each returned path is usable as-is with other workspace APIs, e.g. directory(path).

§Arguments
  • markers - File basenames that mark a project root (e.g. [“go.mod”] or [“deno.json”, “deno.jsonc”]).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn git(&self) -> WorkspaceGit

Git state for this workspace. Errors if the workspace is not in a git repository.

Source

pub fn with_new_file( &self, path: impl Into<String>, contents: impl Into<String>, ) -> Workspace

Return this workspace with a new or replaced file, without mutating the source.

§Arguments
  • path - Path of the new file. Relative paths resolve from the workspace cwd.
  • contents - Contents of the new file.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_file_opts( &self, path: impl Into<String>, contents: impl Into<String>, opts: WorkspaceWithNewFileOpts, ) -> Workspace

Return this workspace with a new or replaced file, without mutating the source.

§Arguments
  • path - Path of the new file. Relative paths resolve from the workspace cwd.
  • contents - Contents of the new file.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file( &self, path: impl Into<String>, source: impl IntoID<Id>, ) -> Workspace

Return this workspace with a file added or replaced, without mutating the source.

§Arguments
  • path - Destination path. Relative paths resolve from the workspace cwd.
  • source - File to add.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file_opts( &self, path: impl Into<String>, source: impl IntoID<Id>, opts: WorkspaceWithFileOpts, ) -> Workspace

Return this workspace with a file added or replaced, without mutating the source.

§Arguments
  • path - Destination path. Relative paths resolve from the workspace cwd.
  • source - File to add.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_directory( &self, path: impl Into<String>, source: impl IntoID<Id>, ) -> Workspace

Return this workspace with the given path replaced by a directory, without mutating the source. The source becomes the entire contents of the path: anything already there that the source does not carry is removed. Use withDirectory to keep it instead.

§Arguments
  • path - Path to replace. Relative paths resolve from the workspace cwd.
  • source - Directory to write there.
Source

pub fn with_directory( &self, path: impl Into<String>, source: impl IntoID<Id>, ) -> Workspace

Return this workspace with a directory merged into the given path, without mutating the source. Anything already at the path stays, and files the source carries win, as with Directory.withDirectory. Use withNewDirectory to replace the path instead.

§Arguments
  • path - Path to merge into. Relative paths resolve from the workspace cwd.
  • source - Directory to merge there.
Source

pub fn without_file(&self, path: impl Into<String>) -> Workspace

Return this workspace with a file removed, without mutating the source.

§Arguments
  • path - Path of the file to remove. Relative paths resolve from the workspace cwd.
Source

pub fn without_files(&self, paths: Vec<impl Into<String>>) -> Workspace

Return this workspace with files removed, without mutating the source.

§Arguments
  • paths - Paths of the files to remove. Relative paths resolve from the workspace cwd.
Source

pub fn without_directory(&self, path: impl Into<String>) -> Workspace

Return this workspace with a directory removed, without mutating the source.

§Arguments
  • path - Path of the directory to remove. Relative paths resolve from the workspace cwd.
Source

pub fn with_changes(&self, changes: impl IntoID<Id>) -> Workspace

Return this workspace with a changeset applied, without mutating the source.

§Arguments
  • changes - Changes to apply.
Source

pub fn with_patch_file(&self, patch: impl IntoID<Id>) -> Workspace

Return this workspace with the given Git-compatible patch file applied, without mutating the source. Paths in the patch are relative to the workspace root, whatever its cwd, as git diff writes them. Patching a path at or under a mount is an error.

§Arguments
  • patch - File containing the patch to apply
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_patch_file_opts( &self, patch: impl IntoID<Id>, opts: WorkspaceWithPatchFileOpts, ) -> Workspace

Return this workspace with the given Git-compatible patch file applied, without mutating the source. Paths in the patch are relative to the workspace root, whatever its cwd, as git diff writes them. Patching a path at or under a mount is an error.

§Arguments
  • patch - File containing the patch to apply
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_workdir(&self, path: impl Into<String>) -> Workspace

Return this workspace with its working directory pointed at the given workspace-relative path.

§Arguments
  • path - Workspace-relative path to use as the working directory.
Source

pub fn with_mounted_directory( &self, path: impl Into<String>, source: impl IntoID<Id>, ) -> Workspace

Return this workspace with a directory mounted read-only at the given path, without mutating the source. Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified.

§Arguments
  • path - Location of the mounted directory. Relative paths resolve from the workspace cwd.
  • source - Directory to mount.
Source

pub fn with_mounted_file( &self, path: impl Into<String>, source: impl IntoID<Id>, ) -> Workspace

Return this workspace with a file mounted read-only at the given path, without mutating the source. Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified.

§Arguments
  • path - Location of the mounted file. Relative paths resolve from the workspace cwd.
  • source - File to mount.
Source

pub fn without_mount(&self, path: impl Into<String>) -> Workspace

Return this workspace with the content mounted at the given path unmounted. Removes directory and file mounts at or below the path, revealing the underlying workspace content. Other mounts and pending changes are preserved.

§Arguments
  • path - Location of the mount to remove. Relative paths resolve from the workspace cwd. Use / to remove all mounts.
Source

pub fn with_module(&self, ref: impl Into<String>) -> Workspace

Return this workspace with a module installed in its config. When the session selects an env, the module is recorded in that env’s overlay and the env is created if missing.

§Arguments
  • r#ref - Module reference to install.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_module_opts<'a>( &self, ref: impl Into<String>, opts: WorkspaceWithModuleOpts<'a>, ) -> Workspace

Return this workspace with a module installed in its config. When the session selects an env, the module is recorded in that env’s overlay and the env is created if missing.

§Arguments
  • r#ref - Module reference to install.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_module(&self, name: impl Into<String>) -> Workspace

Return this workspace with a module removed from its config. When the session selects an env, only that env’s overlay entry is removed.

§Arguments
  • name - Installed module name or source to remove. Version selectors are not accepted.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_module_opts( &self, name: impl Into<String>, opts: WorkspaceWithoutModuleOpts, ) -> Workspace

Return this workspace with a module removed from its config. When the session selects an env, only that env’s overlay entry is removed.

§Arguments
  • name - Installed module name or source to remove. Version selectors are not accepted.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_sdk(&self, ref: impl Into<String>) -> Workspace

Return this workspace with an SDK installed in its config.

§Arguments
  • r#ref - SDK module reference to install.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_sdk_opts<'a>( &self, ref: impl Into<String>, opts: WorkspaceWithSdkOpts<'a>, ) -> Workspace

Return this workspace with an SDK installed in its config.

§Arguments
  • r#ref - SDK module reference to install.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_sdk(&self, name: impl Into<String>) -> Workspace

Return this workspace with an SDK removed from its config.

§Arguments
  • name - Name of the installed SDK entry to remove.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_sdk_opts( &self, name: impl Into<String>, opts: WorkspaceWithoutSdkOpts, ) -> Workspace

Return this workspace with an SDK removed from its config.

§Arguments
  • name - Name of the installed SDK entry to remove.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_main(&self, name: impl Into<String>) -> Workspace

Return this workspace with an installed module selected as its main. Every other main selection is cleared. The main module lives in the base workspace config.

§Arguments
  • name - Exact installed module name.
Source

pub fn with_entrypoint(&self, name: impl Into<String>) -> Workspace

Compatibility alias for withMain.

§Arguments
  • name - Exact installed module name.
Source

pub fn without_main(&self) -> Workspace

Return this workspace with no module selected as its main.

Source

pub fn without_entrypoint(&self) -> Workspace

Compatibility alias for withoutMain.

Source

pub fn with_init_module(&self, sdk: impl Into<String>) -> Workspace

Return this workspace with a location initialized as a module scope. The selected SDK module records the scope and generates the module source.

§Arguments
  • sdk - Workspace SDK name or module entry name to use. Required.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_init_module_opts<'a>( &self, sdk: impl Into<String>, opts: WorkspaceWithInitModuleOpts<'a>, ) -> Workspace

Return this workspace with a location initialized as a module scope. The selected SDK module records the scope and generates the module source.

§Arguments
  • sdk - Workspace SDK name or module entry name to use. Required.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn detect_scope( &self, sdk: impl Into<String>, ) -> Result<String, DaggerError>

Return the selected SDK module’s current scope at this workspace location.

§Arguments
  • sdk - SDK name to probe. Required.
Source

pub fn with_client(&self, module: impl Into<String>) -> Workspace

Return this workspace with a generated module client added to one SDK scope. Select the deepest detected or registered scope. Fail if several SDKs have that deepest scope.

§Arguments
  • module - Explicit local path or module address to generate a client for. Installed module names are not supported.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_client_opts<'a>( &self, module: impl Into<String>, opts: WorkspaceWithClientOpts<'a>, ) -> Workspace

Return this workspace with a generated module client added to one SDK scope. Select the deepest detected or registered scope. Fail if several SDKs have that deepest scope.

§Arguments
  • module - Explicit local path or module address to generate a client for. Installed module names are not supported.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_client(&self, module: impl Into<String>) -> Workspace

Return this workspace with a module client removed from the deepest matching recorded scope. Fail if several SDKs have that deepest scope. The selected SDK module regenerates the complete scope. If invalid client targets remain, save the removal and skip generation until those targets are corrected or removed.

§Arguments
  • module - The recorded target to remove.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_client_opts<'a>( &self, module: impl Into<String>, opts: WorkspaceWithoutClientOpts<'a>, ) -> Workspace

Return this workspace with a module client removed from the deepest matching recorded scope. Fail if several SDKs have that deepest scope. The selected SDK module regenerates the complete scope. If invalid client targets remain, save the removal and skip generation until those targets are corrected or removed.

§Arguments
  • module - The recorded target to remove.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_clients(&self) -> Workspace

Return this workspace with the selected module clients updated. The engine re-reads the source of each selected client target and writes the lock entries that those targets reach. The selected SDK module then regenerates every scope that owns one of the targets.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_clients_opts<'a>( &self, opts: WorkspaceWithUpdatedClientsOpts<'a>, ) -> Workspace

Return this workspace with the selected module clients updated. The engine re-reads the source of each selected client target and writes the lock entries that those targets reach. The selected SDK module then regenerates every scope that owns one of the targets.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_config_value( &self, key: impl Into<String>, value: impl Into<String>, ) -> Workspace

Return this workspace with a configuration value written. When the session selects an env, the key is scoped to that env’s overlay and the env is created if missing.

§Arguments
  • key - Dotted key path.
  • value - Value to set. Bools, integers, and comma-separated arrays are auto-detected.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_config_value_opts<'a>( &self, key: impl Into<String>, value: impl Into<String>, opts: WorkspaceWithConfigValueOpts<'a>, ) -> Workspace

Return this workspace with a configuration value written. When the session selects an env, the key is scoped to that env’s overlay and the env is created if missing.

§Arguments
  • key - Dotted key path.
  • value - Value to set. Bools, integers, and comma-separated arrays are auto-detected.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_config_value(&self, key: impl Into<String>) -> Workspace

Return this workspace with a configuration value removed. Errors when the key is not currently set. When the session selects an env, the key is scoped to that env’s overlay.

§Arguments
  • key - Dotted key path (e.g. modules.greeter.settings.greeting).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_config_value_opts( &self, key: impl Into<String>, opts: WorkspaceWithoutConfigValueOpts, ) -> Workspace

Return this workspace with a configuration value removed. Errors when the key is not currently set. When the session selects an env, the key is scoped to that env’s overlay.

§Arguments
  • key - Dotted key path (e.g. modules.greeter.settings.greeting).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_config_env(&self, name: impl Into<String>) -> Workspace

Return this workspace with a named config environment created.

§Arguments
  • name - Environment name.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_config_env_opts( &self, name: impl Into<String>, opts: WorkspaceWithConfigEnvOpts, ) -> Workspace

Return this workspace with a named config environment created.

§Arguments
  • name - Environment name.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_config_env(&self, name: impl Into<String>) -> Workspace

Return this workspace with a named config environment removed.

§Arguments
  • name - Environment name.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_config_env_opts( &self, name: impl Into<String>, opts: WorkspaceWithoutConfigEnvOpts, ) -> Workspace

Return this workspace with a named config environment removed.

§Arguments
  • name - Environment name.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_lock(&self) -> Workspace

Return this workspace with refreshed lockfile state. SDK client scopes are regenerated unless noGenerate is true.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_lock_opts( &self, opts: WorkspaceWithUpdatedLockOpts, ) -> Workspace

Return this workspace with refreshed lockfile state. SDK client scopes are regenerated unless noGenerate is true.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_modules(&self) -> Workspace

Return this workspace with updated module sources, versions and lockfile state. An SDK client scope is regenerated when it targets an updated module.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_updated_modules_opts<'a>( &self, opts: WorkspaceWithUpdatedModulesOpts<'a>, ) -> Workspace

Return this workspace with updated module sources, versions and lockfile state. An SDK client scope is regenerated when it targets an updated module.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn sdks(&self) -> Result<Vec<WorkspaceSdk>, DaggerError>

Installed SDKs.

Source

pub fn sdk(&self, name: impl Into<String>) -> WorkspaceSdk

An installed SDK, by name.

§Arguments
  • name - SDK name to look up.
Source

pub fn changes(&self) -> Changeset

Return this workspace’s changes, with paths relative to its working directory. Pass from to compare against an earlier workspace state. Omitting it preserves the cumulative behavior used by clients from before this argument was added.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn changes_opts(&self, opts: WorkspaceChangesOpts) -> Changeset

Return this workspace’s changes, with paths relative to its working directory. Pass from to compare against an earlier workspace state. Omitting it preserves the cumulative behavior used by clients from before this argument was added.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export(&self) -> Result<Void, DaggerError>

Write this workspace’s commits and pending changes to a checkout on the calling client. Path selects the destination; omitting it uses the calling client’s current local workspace root, including when exporting a snapshot or committed workspace. Exported file paths are relative to the workspace root regardless of its working directory. This writes only to the client making the call, never the source’s client. A live workspace exported to its own checkout applies only its overlay edits, without capturing the whole checkout. This also applies with an explicit path. Pass from with the same live base to apply only changes since that overlay state. Other exports integrate divergent commits by cherry-picking, preserve unrelated checkout edits, and refuse conflicts. Live inputs are snapshotted automatically; capturing untracked source files requires interactive approval. Stable inputs retain their baseline. Pass from to save only work since an earlier source value, including previously saved pending edits that are now committed.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export_opts<'a>( &self, opts: WorkspaceExportOpts<'a>, ) -> Result<Void, DaggerError>

Write this workspace’s commits and pending changes to a checkout on the calling client. Path selects the destination; omitting it uses the calling client’s current local workspace root, including when exporting a snapshot or committed workspace. Exported file paths are relative to the workspace root regardless of its working directory. This writes only to the client making the call, never the source’s client. A live workspace exported to its own checkout applies only its overlay edits, without capturing the whole checkout. This also applies with an explicit path. Pass from with the same live base to apply only changes since that overlay state. Other exports integrate divergent commits by cherry-picking, preserve unrelated checkout edits, and refuse conflicts. Live inputs are snapshotted automatically; capturing untracked source files requires interactive approval. Stable inputs retain their baseline. Pass from to save only work since an earlier source value, including previously saved pending edits that are now committed.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn config_read(&self) -> Result<String, DaggerError>

Read a configuration value from dagger.toml. If key is empty, returns the full config. If key points to a scalar, returns the value. If key points to a table, returns flattened dotted-key output.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn config_read_opts<'a>( &self, opts: WorkspaceConfigReadOpts<'a>, ) -> Result<String, DaggerError>

Read a configuration value from dagger.toml. If key is empty, returns the full config. If key points to a scalar, returns the value. If key points to a table, returns flattened dotted-key output.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn main(&self) -> Result<String, DaggerError>

Installed name of the module selected as the workspace main, or an empty string when none is selected. Reflects the selected env’s effective view. Fails if several modules are selected.

Source

pub async fn entrypoint(&self) -> Result<String, DaggerError>

Compatibility alias for main.

Source

pub async fn env_list(&self) -> Result<Vec<String>, DaggerError>

List named environments defined in the workspace configuration.

Source

pub async fn modules(&self) -> Result<Vec<WorkspaceModule>, DaggerError>

List modules defined in the workspace configuration. Reflects the selected env’s effective view.

Source

pub fn module(&self, name: impl Into<String>) -> WorkspaceModule

Return a module defined in the workspace configuration. Reflects the selected env’s effective view.

§Arguments
  • name - Module name to inspect.
Source

pub fn module_source(&self, path: impl Into<String>) -> ModuleSource

Load a module source from a path within the workspace. Relative paths (e.g., “foo”) resolve from the workspace cwd; absolute paths (e.g., “/foo”) resolve from the workspace root. Fails if the path does not point to an initialized module.

§Arguments
  • path - Location of the module source to load, relative to the workspace cwd or absolute from the workspace root.
Source

pub async fn cwd(&self) -> Result<String, DaggerError>

Current location within the workspace root. The workspace root is returned as “/”. Relative paths in workspace APIs resolve from here.

Source

pub fn artifacts(&self) -> Artifacts

Discover static object artifacts from workspace modules without evaluating their values. Omits the paths that the workspace’s check.skip, generate.skip, and up.skip settings skip.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn artifacts_opts<'a>(&self, opts: WorkspaceArtifactsOpts<'a>) -> Artifacts

Discover static object artifacts from workspace modules without evaluating their values. Omits the paths that the workspace’s check.skip, generate.skip, and up.skip settings skip.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn migrate(&self) -> WorkspaceMigration

Plan the explicit migration needed for the current workspace. Include installed local modules and their local dependencies. Other module candidates remain unchanged unless selected. The returned plan has an empty changeset and no steps when no migration is needed.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn migrate_opts<'a>( &self, opts: WorkspaceMigrateOpts<'a>, ) -> WorkspaceMigration

Plan the explicit migration needed for the current workspace. Include installed local modules and their local dependencies. Other module candidates remain unchanged unless selected. The returned plan has an empty changeset and no steps when no migration is needed.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn address(&self) -> Result<String, DaggerError>

Canonical Dagger address of the workspace location, or an opaque identity for synthetic workspaces.

Trait Implementations§

Source§

impl Clone for Workspace

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl IntoID<Id> for Workspace

Source§

fn into_id( self, ) -> Pin<Box<dyn Future<Output = Result<Id, DaggerError>> + Send>>

Source§

impl Loadable for Workspace

Source§

fn graphql_type() -> &'static str

The GraphQL type name (e.g. "Container").
Source§

fn from_query( proc: Option<Arc<DaggerSessionProc>>, selection: Selection, graphql_client: DynGraphQLClient, ) -> Self

Construct this type from a query selection.
Source§

impl Node for Workspace

Source§

fn id(&self) -> impl Future<Output = Result<Id, DaggerError>> + Send

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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