Crates.io | cargo-kit |
lib.rs | cargo-kit |
version | |
source | src |
created_at | 2024-10-31 09:42:50.545004 |
updated_at | 2024-12-09 17:10:34.593627 |
description | Cargo subcommand to apply performance, compile-time, or size-optimized profiles and configs to your Rust project for enhanced build efficiency. |
homepage | https://trinhminhtriet.com |
repository | https://github.com/trinhminhtriet/cargo-kit |
max_upload_size | |
id | 1429845 |
Cargo.toml error: | TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
_ _ _
___ __ _ _ __ __ _ ___ | | __(_)| |_
/ __| / _` || '__| / _` | / _ \ | |/ /| || __|
| (__ | (_| || | | (_| || (_) | | < | || |_
\___| \__,_||_| \__, | \___/ |_|\_\|_| \__|
|___/
This tool automates that setup process, making configuration simpler and faster.
cargo-kit
can create or modify Cargo profiles in your Cargo.toml
manifest and RUSTFLAGS in
the .cargo/config.toml
file, based on a
set of predefined templates:
fast-compile
- minimizes compilation times
fast-runtime
- maximizes runtime performance
min-size
- minimizes binary size
fast-runtime
, but uses optimization flags designed for small binary size.You can also modify these templates in the interactive mode to build your own custom template.
To install cargo-kit, simply clone the repository and follow the instructions below:
git clone git@github.com:trinhminhtriet/cargo-kit.git
cd cargo-kit
cargo build --release
cp target/release/cargo-kit /usr/local/bin/cargo-kit
Alternatively, you can install the binary directly from the repository:
cargo install --path .
Running the below command will globally install the cargo-kit
binary.
cargo install cargo-kit
Optionally, you can add ~/.cargo/bin
to your PATH if it's not already there
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
$ cargo kit
$ cargo kit apply <template> <profile>
# For example, apply `fast-runtime` template to the `dist` profile
$ cargo kit apply fast-runtime dist
You can enable additional configuration options that require a nightly compiler by running cargo-kit
with a
nightly Cargo (e.g. cargo +nightly kit
) or by using the --nightly
flag.
Note that you should be executing cargo kit
inside a directory that is a part of a Cargo workspace. It will then
apply the configuration options to that workspace.
cargo-kit
mostly serves to improve discoverability of possible Cargo profile and config options, to
help you find the ideal settings for your use-cases.cargo-kit
currently only modifies Cargo.toml
and config.toml
. There are other things that can be configured
to achieve e.g. even smaller binaries, but these are out of scope for this tool, at least at the moment.cargo-kit
currently ignores Cargo settings that are not relevant to performance.config.toml
) changes are applied to the global build.hostflags
setting, because per-profile
RUSTFLAGS are still unstable.Running the below command will globally uninstall the cargo-kit
binary.
cargo uninstall cargo-kit
Remove the project repo
rm -rf /path/to/git/clone/cargo-kit
We welcome contributions!
git checkout -b my-feature
;git commit -m "feat: my new feature"
;git push origin my-feature
.Once your pull request has been merged, you can delete your branch.
This project is licensed under the MIT License - see the LICENSE file for details.