Fix broken crates instantly 🏃🏽‍♀️💨

Overview

Patch-Crate

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

# fix a bug in one of your dependencies
vim target/patch/brokencrate

# run patch-crate to create a .patch file
cargo patch-crate some-crate

# commit the patch file to share the fix with your team
git add patches/some-crate+3.14.15.patch
git commit -m "fix broken_file.rs in some-crate"

Checkout our example at here.

Get started

  1. Install command patch-crate

    cargo install patch-crate
  2. Add broken crate in your Cargo.toml

    [package.metadata.patch]
    crates = ["some-crate"]
    
    [patch.crates-io]
    some-crate = { path="./target/patch/some-crate-1.0.110" }
  3. Download the crate's source code into target/patch

    cargo patch-crate
  4. Fix the broken code in target/patch/some-crate directly.

  5. Create a crate-patch

    cargo patch-crate some-crate
  6. Commit the patch file to share the fix with your team

    git add patches/some-crate+1.0.110.patch
    git commit -m "fix broken-code in some-crate"
  7. Instead of running cargo patch-crate its also possible to add a build.rs file like this:

    fn main() {
       println!("cargo:rerun-if-changed=Cargo.toml");
       patch_crate::run().expect("Failed while patching");
    }

    To make it work, add the patch-crate library to the build-dependencies

    patch-crate = "0.1"

Command explanation

  • cargo patch-crate

    Apply patch files in ./patches to ./target/patch/crate-xxx if it not exist.

  • cargo patch-crate --force

    Clean up ./target/patch/ and apply patch files in ./patches to ./target/patch/crate-xxx.

  • crate patch-crate <crate name1> <crate name2> ...

    Create patch file of specific crate from ./target/patch/crate-xxx and save to ./patches

Credits

License

Licensed under either of

at your option.

You might also like...
A list of crates with snippets used by me to learn more about Rust.

my-rust-examples This is a list of crates used by me to learn Rust. How to execute You can use a dependency called cargo-play: cargo install cargo-pla

List public items (public API) of library crates. Enables diffing public API between releases.

cargo-public-items List public items (the public API) of a Rust library crate by analyzing the rustdoc JSON of the crate. Automatically builds the rus

This repo contains crates that are used to create the micro services and keep shared code in a common place.

MyEmma Helper Crates This repo contains crates that can are reused over different services. These crate are used in projects at MyEmma. But these crat

A complete imgui-rs example using dependencies only from crates.io.
A complete imgui-rs example using dependencies only from crates.io.

Dear imgui-rs, hello. This is a fairly basic, but complete and standalone example application for the Rust version of dear imgui (https://github.com/o

Use raw-window-handle 0.5 with crates that depend on 0.4.

OldHasRawWindowHandleWrapper Wrap any type that implements HasRawWindowHandle and HasRawDisplayHandle from raw-window-handle 0.5 in OldHasRawWindowHan

A series of crates that I made to compile images/video into asciinema & play them.

Bad Apple A series of crates that I made to compile images/video into asciinema & play them. The end goal is to make a kernel & legacy bootloader that

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

A TUI for exploring crates.io using Ratatui
A TUI for exploring crates.io using Ratatui

crates-tui crates-tui is a simple terminal user interface explorer for crates.io based on Ratatui. crates-tui.mov It supports features like: copy carg

Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

A cross platform tool which instantly notifies about COVID vaccine availability.
A cross platform tool which instantly notifies about COVID vaccine availability.

💉 CoWIN Notifier 😷 A cross-platform tool written in rust, which instantly notifies users about COVID-19 vaccine availability at their regions. Curre

Autogenerated async RPC bindings that instantly connect a JS frontend to a Rust backend service via WebSockets and WASM.

Turbocharger Autogenerated async RPC bindings that instantly connect a JS frontend to a Rust backend service via WebSockets and WASM. See https://gith

Dreamer is an extensible tool manager and shell for creating small, lightweight, dev environments instantly.

Dreamer 💤 Does what you want, not what you say. Dreamer is a universal tool management system for any language, any build system, and any framework.

An alternative broken buggy Nix implementation in Rust + Java (for evaluation)

An alternative broken buggy Nix implementation in Rust + Java (for evaluation)

Some Steam patches, fixing broken Steam features on Asus Rog Ally

Ally Steam Patches Ally Steam Patches is a tool designed to enhance your Steam experience by applying patches to the Steam client. Installation To ins

Some Steam patches, fixing broken Steam features on Asus Rog Ally
Some Steam patches, fixing broken Steam features on Asus Rog Ally

⚙️ Steam Patch Steam Patch is a tool designed to enhance your Steam experience by applying patches to the Steam client. 📥 Installation To install Ste

A web service that generates images of dependency graphs for crates hosted on crates.io

crate-deps A web service that generates images of dependency graphs for crates hosted on crates.io This project is built entirely in Rust using these

crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).
crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).

crates Hello Rust & VSCode lovers, This is crates, an extension for crates.io dependencies. Aims helping developers to manage dependencies while using

https://crates.io/crates/transistor

Transistor A Rust Crux Client crate/lib. For now, this crate intends to support 2 ways to interact with Crux: Via Docker with a crux-standalone versio

"Crates for Cheese" is a Rust collection library of those crates I consider a useful "extended standard".

cfc The purpose of this library is to provide a minimal list of currated crates which enhance the std library. In addition, most or all crates in this

Owner
YiiSh
YiiSh
Some Steam patches, fixing broken Steam features on Asus Rog Ally

Ally Steam Patches Ally Steam Patches is a tool designed to enhance your Steam experience by applying patches to the Steam client. Installation To ins

MIkhail Kozlov 2 Jul 10, 2023
Some Steam patches, fixing broken Steam features on Asus Rog Ally

⚙️ Steam Patch Steam Patch is a tool designed to enhance your Steam experience by applying patches to the Steam client. ?? Installation To install Ste

MIkhail Kozlov 3 Jul 18, 2023
A gui tool written in Dioxus to make it easy to release a workspace of crates to crates.io

Easy-Release: a visual tool for releasing workspaces of libraries A work-in-progress GUI for releasing a large workspace of crates manually, but easil

Jon Kelley 13 Jan 18, 2023
fixred is a command line utility to fix outdated links in files with redirect URLs.

fixred fixred is a command line utility to fix outdated links in files with redirect URLs. Installation fixred is installed via cargo package manager.

Linda_pp 35 Aug 6, 2022
Eslint - Find and fix problems in your JavaScript code.

ESLint Website | Configuring | Rules | Contributing | Reporting Bugs | Code of Conduct | Twitter | Mailing List | Chat Room ESLint is a tool for ident

ESLint 22k Jan 9, 2023
Fix the simple rust script as shown in README.md

Rust Fix Me Steps Create a Github account. (If you already have one no issues) Star this repository. Fork this repository to your Github account. Clon

Ganesh Chandrasekaran 48 Dec 9, 2022
🔣 nerdfix helps you to find/fix obsolete Nerd Font icons in your project.

?? nerdfix nerdfix helps you to find/fix obsolete Nerd Font icons in your project. ?? Why Nerd Fonts is used in many projects for a beautiful UI. It p

Loi Chyan 80 Apr 8, 2023
SA-MP client server list fix but written in Rust

Server List Fix This is a samp client server list fix, which reroutes the client's request to list.sa-mp.com to sam.markski.ar. The idea is originally

__SyS__ 4 Feb 4, 2024
Incredible.dev is an AI Coding Co-worker which can code, fix, document, deploy, test your APIs. One agent to rule everything API.

Incredible.dev Early Github preview, documentation and instruction to run coming soon in a week! Here are some highlights: AI agents that can code, fi

Incredible 27 Jun 27, 2024
1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel

massh 1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel. The binary crates are CLI and GUI "frontends" for the li

null 2 Oct 16, 2022