Struct rin_util::AutoLoader [−][src]
pub struct AutoLoader<T> { /* fields omitted */ }
AutoLoader will watch the filesystem for changes in the passed files and will try to load them again using a load function
The only thing that AutoLoader checks is the date of the files so files that are just touched but not really changed will be considered changed nontheless
The watch will happen whenever the update function is called
Implementations
impl<T> AutoLoader<T>
[src]
impl<T> AutoLoader<T>
[src]pub fn new<F: 'static + Fn() -> Result<T>>(
files: Vec<String>,
load_function: F
) -> AutoLoader<T>
[src]
files: Vec<String>,
load_function: F
) -> AutoLoader<T>
Creates a new AutoLoader that will watch the passed paths for changes and execute the load_function if any of them has changed
pub fn update(&mut self) -> Result<Option<T>>
[src]
Checks the paths for changes and reloads using the load_function if needed
If any file changed and the load function returns succesfully, update returns Ok with the new value
If any file changed and the load function fails, update will return the error
If no file changed update will return Ok(None)
pub fn load(&mut self) -> Result<T>
[src]
Forces the execution of the load function and updates the dates of the files to the current one