Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Hotcode: easy to use hot-reload

Дата публикации: 09-10-2026 10:50:05


I find hot-reloading a very useful feature that speeds up development and makes debugging easier. I use it extensively in C#, and I wanted to have the same feature in Rust, so I created a crate for it: hotcode.
It provides a single attribute, #[hotreload], that can be applied to any function in a [lib] crate. It makes annotated functions hot-reloadable:
use hotcode::hotreload;
#[hotreload]
fn get() -> i32 { 1 }
impl Struct {
#[hotreload]
fn get(&self) -> i32 { self.value }
}
impl Trait for Struct {
#[hotreload]
fn get(&self) -> i32 { self.value + 1 }
}
Your library crate must also be built as both a cdylib and an rlib:
[lib]
crate-type = ["cdylib", "rlib"]
You can now run your application and make changes to your library without restarting it. hotcode will automatically apply those changes.
Here's a usage example - a rasterization function being hot-reloaded in a software renderer:



https://raw.githubusercontent.com/alordash/hotcode/cc33cf97e0f1d53db0105504b3e1a10a5eee60f2/media/hotreload_renderust.mp4


hotcode works by swapping dynamic libraries from a separate file-watcher thread - the same principle that has been used by other hot-reloading libraries, such as hot-lib-reloader-rs and rust-hot-reloading. This approach was also explained in this blogpost.
Source repository: GitHub - alordash/hotcode: Library for hotreload in Rust · GitHub
Crate documentation: hotcode - Rust
I hope this helps someone speed up their development iterations!
2 posts - 1 participant
Read full topic

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Zaxis 0.0.5: immediate-mode GUI on wgpu, embeddable in a host's wgpu pass, with an real overlay layer for other processes010.211-10-2026
2FerroProve - C-to-Rust lifter emitting #![forbid(unsafe_code)] crates with a differential oracle015.5117-10-2026
3Maplike - Crate with traits for abstract containers and operations on them2706-07-2026
4[Project] sol: A self-contained browser kernel written in Rust09.7618-10-2026
5I made a Vibe-Coded Reusable Application Runtime For Any Digital Domain (Office apps, Digital Painter, Graph nodes based apps..etc)017.8312-10-2026
6Multi_bimap - many-to-many bimap freely made of two arbitrary maps013.116-10-2026
7Cargo-Rail v0.20: one workspace engine instead of dependency, CI, cache, release, and split-repo glue/plugins010.430-07-2026
8My state lib PurrGress012.6213-08-2026
9I wrote my M.Sc. thesis on using the Rust type system in 3D graphics0729-06-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 9. Тональность: 0. Информативность: 9.84. Источник: users.rust-lang.org.