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]

pub fn new<F>(files: Vec<String, Global>, load_function: F) -> AutoLoader<T> where
    F: 'static + Fn() -> Result<T, Error>, 
[src]

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<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]