cargo.star¶
Bump Rust crate dependencies and rust-version in Cargo.toml files.
Edits are line-based, so comments, features and table layout stay as they
were. Cargo.lock is not touched: follow with a run step such as
cargo update -p <crate> when the lockfile is committed.
| Function | What it does |
|---|---|
manifests |
Lists the repo's Cargo manifests. |
set_dependency |
Sets a crate's version wherever a Cargo.toml already depends on it. |
rust_version |
Reads the rust-version of a Cargo.toml. |
set_rust_version |
Raises rust-version in every Cargo.toml that sets it, never lowering it. |
manifests¶
Lists the repo's Cargo manifests.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The sorted paths of every Cargo.toml outside target directories.
Example
set_dependency¶
Sets a crate's version wherever a Cargo.toml already depends on it.
A newer version already there is kept, so a campaign never lowers one.
Covers [dependencies], [dev-dependencies], [build-dependencies],
[workspace.dependencies] and their [target.'...'.dependencies] forms,
written as name = "1.0" or name = { version = "1.0", ... }.
Dependencies given only by path or git have no version and are left
alone.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
name |
The crate name. |
version |
The new version requirement, such as 1.0.210. |
Returns: The list of paths that changed.
Example
Used in: cargo-dependency-bump
rust_version¶
Reads the rust-version of a Cargo.toml.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
path |
The Cargo.toml to read. |
Returns: The version, such as 1.70, or None.
Example
set_rust_version¶
Raises rust-version in every Cargo.toml that sets it, never lowering it.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
version |
The minimum Rust version, such as 1.75. |
Returns: The list of paths that changed.
Example