Struct hot_lib_reloader::LibReloader
source · [−]pub struct LibReloader { /* private fields */ }Implementations
sourceimpl LibReloader
impl LibReloader
pub fn new(
lib_dir: impl AsRef<Path>,
lib_name: impl AsRef<str>
) -> Result<Self, Box<dyn Error>>
sourcepub fn update(&mut self) -> Result<bool, Box<dyn Error>>
pub fn update(&mut self) -> Result<bool, Box<dyn Error>>
Checks if the watched library has changed. If it has, reload it and return true. Otherwise return false.
sourcepub unsafe fn get_symbol<T>(
&self,
name: &[u8]
) -> Result<Symbol<'_, T>, Box<dyn Error>>
pub unsafe fn get_symbol<T>(
&self,
name: &[u8]
) -> Result<Symbol<'_, T>, Box<dyn Error>>
Get a pointer to a function or static variable by symbol name. Just a wrapper around libloading::Library::get.
The symbol may not contain any null bytes, with the exception of the
last byte. Providing a null-terminated symbol may help to avoid an
allocation. The symbol is interpreted as is, no mangling.
Safety
Users of this API must specify the correct type of the function or variable loaded.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LibReloader
impl Send for LibReloader
impl Sync for LibReloader
impl Unpin for LibReloader
impl UnwindSafe for LibReloader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more