Skip to main content

Crate shared_target_core

Crate shared_target_core 

Source
Expand description

Seeding a Cargo target directory from an existing one.

Cutting a git worktree, or any second checkout, leaves a build that starts from nothing. Copying target/ across is the obvious fix and the wrong one: it is routinely tens of gigabytes. What this crate does instead is build the new directory out of the old one’s storage — a block clone where the filesystem offers it, and a hard link for the large write-once artifacts where it does not — so the second tree is warm without being a second copy.

What belongs here is what Cargo knows: where the target directory is, which of its contents may be shared, which must be a file of their own, and that a half-built tree must never be visible under a name Cargo reads. Deciding where the new tree goes is the caller’s; a git worktree is one answer and not a special one.

Modules§

lock
Taking part in Cargo’s build lock, so that a tree is not read while it is being written.

Structs§

Options
Report

Enums§

Error
Strategy

Constants§

DEFAULT_MIN_SHARED_SIZE
Files this size and above under a deps/ directory keep a shared inode rather than a copy of their own.

Functions§

seed
Builds dest from src, sharing whatever the filesystem under dest lets it share.
supports_reflink
Whether the blocks of files in src can be cloned into at rather than copied.
workspace_target_dir
The target directory Cargo itself would use for the workspace containing cwd.

Type Aliases§

Result