Is it possible to apply a patch to external code in Cargo.toml?

喜欢而已 提交于 2020-12-13 02:56:35

问题


I read the Cargo manual about the patch option but it is still unclear to me.

Is it possible to instruct Cargo:

  1. Get the code from this repository.
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!