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>(files: Vec<String, Global>, load_function: F) -> AutoLoader<T> where
F: 'static + Fn() -> Result<T, Error>,
[src]
F: 'static + Fn() -> Result<T, Error>,
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>, Error>
[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, Error>
[src]
Forces the execution of the load function and updates the dates of the files to the current one
Auto Trait Implementations
impl<T> !RefUnwindSafe for AutoLoader<T>
impl<T> !Send for AutoLoader<T>
impl<T> !Sync for AutoLoader<T>
impl<T> Unpin for AutoLoader<T>
impl<T> !UnwindSafe for AutoLoader<T>
Blanket Implementations
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]