macro_rules! live_reload {
(host: $Host:ty;
state: $State:ty;
init: $init:ident;
reload: $reload:ident;
update: $update:ident;
unload: $unload:ident;
deinit: $deinit:ident;) => { ... };
}Expand description
Declare the API functions for a live-reloadable library.
This generates wrappers around higher-level lifecycle functions, and then exports them in a struct that the reloader can find.
You need to to specify the host API type, define a struct that represents
the state of your program, and then define methods for init, reload,
update, unload, and deinit. init and deinit are called at the very
beginning and end of the program, and reload and unload are called
immediately after and before the library is loaded/reloaded. update is
called by the wrapping application as needed.
ยงExample
live_reload! {
host: host_api::Host;
state: State;
init: my_init;
reload: my_reload;
update: my_update;
unload: my_unload;
deinit: my_deinit;
}