Skip to content
alordashPublic

About

Library for hotreload in Rust

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Repository files navigation

hotcode

Library for hot-reloading functions in Rust.

Build Status Crates.io Documentation

Overview

This library exposes hotreload attribute, which can be applied to standalone functions or to functions in impl blocks. This attribute makes a function hot-reloadable: its code and behavior can be changed on the fly while the application is still running.

💻 Works on Linux, macOS and Windows.
🪲 Hot-reloaded code can be debugged.

Usage

Add hotcode to your dependencies:

[dependencies]
hotcode = "1.0.2"

Add dylib to your library's crate types:

[lib]
crate-type = ["dylib", "rlib"]

Add hotcode::hotreload attribute to your function:

#[hotcode::hotreload]
fn add(a: i32, b: i32) -> i32 {
    a + b
}

Run your application, change the code of this function and rebuild your library using cargo build --lib. The function's behavior will change without restarting the application.

For more information, refer to crate documentation.

Examples

Examples are located in the examples folder. The simplest example is the single_crate project.

Demo

hotreload_renderust.mp4

Minimum Supported Rust Version (MSRV)

hotcode is supported on Rust 1.89.0 and higher. hotcode's MSRV will not be changed in the future without bumping the major or minor version.

License

hotcode is distributed under the terms of the MIT license. See license.txt for details.

About

Library for hotreload in Rust

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Contributors

Languages