Struct live_reload::Reloadable
[−]
[src]
pub struct Reloadable<Host> { /* fields omitted */ }
A Reloadable
represents a handle to library that can be live reloaded.
Methods
impl<Host> Reloadable<Host>
[src]
fn new<P: AsRef<Path>>(path: P, host: Host) -> Result<Self, Error>
Create a new Reloadable library.
This takes the path to a dynamic library containing a RELOAD_API
symbol that exports the functions needed for live reloading. In order to
define this symbol in your own reloadable libraries, see the
live_reload!
macro. This will load the library and initialize a
filesystem watcher pointing to the file in order to know when the
library has changed.
fn reload(&mut self) -> Result<(), Error>
Reload the library if it has changed, otherwise do nothing.
This will consult with the filesystem watcher, and if the library has
been recreated or updated, it will reload the library. See
reload_now
for details on what happens when a library is reloaded.
fn reload_now(&mut self) -> Result<(), Error>
Immediately reload the library without checking whether it has changed.
This first calls unload
on the currently loaded library, then unloads
the dynamic library. Next, it loads the new dynamic library, and calls
reload
on that. If the new library fails to load, this method will
return an Err
and the Reloadable
will be left with no library
loaded.
fn update(&mut self) -> ShouldQuit
Call the update method on the library.
If no library is currently loaded, this does nothing and returns
ShouldQuit::No
.
fn host(&self) -> &Host
Get a reference to the Host
struct>
fn host_mut(&mut self) -> &mut Host
Get a mutable reference to the Host
struct.