cargo-warehouse

Crates.iocargo-warehouse
lib.rscargo-warehouse
version2.3.0
created_at2025-04-06 21:40:41.900275+00
updated_at2025-05-22 15:30:44.895687+00
descriptionA simple cargo script for set up a local cache for compiled dependencies
homepage
repositoryhttps://github.com/Nichokas/cargo-warehouse/
max_upload_size
id1623417
size35,111
Nicolás Rodríguez Álvarez (Nichokas)

documentation

README

cargo-warehouse

A Rust utility that significantly reduces disk space usage and speeds up Rust builds by creating a shared cache for build artifacts across multiple projects.

📥 Installation

cargo install cargo-warehouse

🔧 Usage

Shared Cache Mode

cargo warehouse

This will:

  • Create a .cargo-cache directory in your home folder (if it doesn't exist)
  • Set up the necessary directory structure for caching
  • Link your project's build directories to this centralized cache

Single File Mode

cargo warehouse -f path/to/file.rs

This mode allows you to run a single Rust file without setting up a full project structure:

  • Compiles and runs a standalone .rs file
  • Supports defining dependencies within the file itself
  • Perfect for quick scripts and small programs

Example single file format:

---cargo
[dependencies]
comfy-print = "0.3.0"
---

use comfy_print::comfy_println;
fn main() {
comfy_println!("heyy!!!!");
}

💡 How It Works

In shared cache mode, the tool creates symbolic links from your project's target directory subdirectories to a centralized cache in your home directory. This means:

  • Build artifacts are shared between projects
  • Dependencies are compiled once and reused
  • Disk space is saved by eliminating duplicate builds

In single file mode, the tool:

  • Creates a temporary project structure
  • Extracts cargo configuration from the file itself
  • Compiles and runs the file using the standard Cargo toolchain

⚠️ Limitations

On some cases (like using windows) requires admin privileges to create symbolic links; on unix-based systems its not needed unless you dont have rw permissions.

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 37

cargo fmt