MCPcopy Index your code
hub / github.com/Shizcow/hotpatch

github.com/Shizcow/hotpatch @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
62 symbols 89 edges 18 files 20 documented · 32%

Browse by type

Functions 52 Types & classes 10
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

hotpatch

crates.io docs.rs

This crate is primarily used to load new function definitions from shared object files in an exceedingly easy way.

Key features: - Thread safe - Type safe - Works for functions of any signature - Namespace aware

Short Example

The following shows how dead-simple this crate is to use:

// main.rs
use hotpatch::*;

#[patchable]
fn foo() { }

fn main() -> Result<(), Box<dyn std::error::Error>> {
  foo(); // does nothing
  foo.hotpatch_lib("libsomething.so")?;
  foo(); // does something totally different!
  foo.hotpatch_fn(|| println!("Dyamic!"))?;
  foo(); // even more modification!
  Ok(())
}

Warning

Don't hotpatch the function you're currently in, or any of its parents.

Because hotpatch doesn't allow multiple function definitions to be in affect at the same time, this will cause a deadlock.

It is possible to do this with the force functions, however they are unsafe, as in a multithreaded enironment this could cause multiple function definitions to be in effect at once.

Docs

For more information, see the docs.

TODO

This crate is still has a long way to go before being "finished". Below are some items left to do. Submit an issue or PR to this section for feature requests!
- no_std and use features to give the widest possible functionality - probably will need to move back to lazy_static - methods (in progress) - #[patchable] ||() to generate from a closure (is this even possible?) - lower compile times - include only necessary features for sub-dependencies - properly document nightly feature requirements

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 34
Method 18
Class 6
Interface 4

Languages

Rust100%

Modules by API surface

hotpatch/src/lib.rs16 symbols
hotpatch/src/docs.rs6 symbols
hotpatch_macros/src/item_impl.rs4 symbols
examples/unsafe/unsafe_bin/src/main.rs4 symbols
examples/local/src/main.rs4 symbols
hotpatch_macros/src/lib.rs3 symbols
hotpatch_macros/src/item_fn.rs3 symbols
examples/threads/threads_bin/src/main.rs3 symbols
examples/methods/src/main.rs3 symbols
examples/hello_world/hw_bin/src/main.rs3 symbols
hotpatch/src/export.rs2 symbols
examples/threads/threads_obj/src/lib.rs2 symbols

For agents

$ claude mcp add hotpatch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page