Crate patch_crate

source ·
Expand description

patch-crate lets rust app developer instantly make and keep fixes to crate dependencies. It’s a vital band-aid for those of us living on the bleeding edge.

§Installation

Simply run:

cargo install patch-crate

§Usage

To patch dependency one has to add the following to Cargo.toml

[package.metadata.patch]
crates = ["serde"]

It specifies which dependency to patch (in this case serde). Running:

cargo patch-crate

will download the sede package specified in the dpendency section to the target/patch folder.

Then override the dependency using replace like this

[patch.crates-io]
serde = { path = './target/patch/serde-1.0.110' }

fix a bug in ‘./target/patch/serde-1.0.110’ directly.

run following to create a patches/serde+1.0.110.patch file

cargo patch-crate serde

commit the patch file to share the fix with your team

git add patches/serde+1.0.110.patch
git commit -m "fix broken-serde in serde"

Functions§