How to Specify Exact Dependency Versions in Rust

Lock a Rust dependency to a specific version in Cargo.toml using the equals sign operator.

Specify exact dependency versions in your Cargo.toml file by using the = operator before the version number. This forces Cargo to use only that specific version, ignoring newer patch or minor updates.

[dependencies]
serde = "=1.0.193"

Alternatively, you can use a caret (^) with a full version string to lock to a specific minor version range, but = is the strictest method for an exact match.