#[repr(C)]pub struct ReloadApi<Host> {
pub size: fn() -> usize,
pub init: fn(&mut Host, *mut ()),
pub reload: fn(&mut Host, *mut ()),
pub update: fn(&mut Host, *mut ()) -> ShouldQuit,
pub unload: fn(&mut Host, *mut ()),
pub deinit: fn(&mut Host, *mut ()),
}Expand description
Contains function pointers for all the parts of the reloadable object lifecycle.
Fields§
§size: fn() -> usizeReturns the size of the State struct so that the host can allocate space for it.
init: fn(&mut Host, *mut ())Initializes the State struct when the program is first started.
reload: fn(&mut Host, *mut ())Makes any necessary updates when the program is reloaded.
This will probably be normally empty. If you changed the State
struct since the last compile, then it won’t necessarily be
correctly initialized. For safety, you should make your State struct
#[repr(C)] and only add members at the end.
update: fn(&mut Host, *mut ()) -> ShouldQuitUpdate the
unload: fn(&mut Host, *mut ())Prepare for the library to be unloaded before a new version loads.
This will probably normally be empty except for short periods in development when you’re making lots of live changes and need to do some kind of migration.
deinit: fn(&mut Host, *mut ())Do final shutdowns before the program completely quits.