Skip to main content

Module cache

Module cache 

Source
Expand description

One cargo target folder for every port and bridge, so dependencies compile once.

The folder is CARGO_TARGET_DIR when set, else rust-anything/target in the user’s cache folder. Cargo names a crate’s library after its package name alone, so two crates with one name would overwrite each other’s artifact there. Each package name therefore belongs to one crate folder (owners.json, written under a file lock); another crate with that name builds into its own target/ as before. Built libraries are copied to the crate’s own target/release, where every loader reads them. Front doors keep their own target/.

Structs§

Cleaned
Target
Where cargo builds this crate: the shared folder, or the crate’s own target/ when another crate with the same package name owns that name there.

Functions§

clean
Removes the shared target folder (or only measures it with dry_run). A folder named by CARGO_TARGET_DIR is removed only with force, since other projects may use it.
human
publish
Copies the crate’s built libraries (lib<name>.so, .dylib, .a, <name>.dll, …) from release into the crate’s own target/release, the path every loader reads. Returns that folder.
shared_dir
The shared target folder in effect.
target_for
target_in