问题
I read the Cargo manual about the patch option but it is still unclear to me.
Is it possible to instruct Cargo:
- Get the code from this repository.
- Apply this patch file (my_cool_change.patch) to that code.
Is making my own fork of the project the only way to do it?
回答1:
It is not possible to instruct Cargo to do something like "take version 1.2.3 of crate foo-bar from crates.io and apply these arbitrary changes to the source code before compiling it".
The Cargo documentation is not lying to you: you will need to fork the project you wish to change, make the changes however you need, then replace the dependency with your forked version.
来源:https://stackoverflow.com/questions/58065296/is-it-possible-to-apply-a-patch-to-external-code-in-cargo-toml