pub struct FileWatcherNode<Context, Action>{ /* private fields */ }Expand description
A node that watches a file for changes
Implementations§
Source§impl<Context, Action> FileWatcherNode<Context, Action>
impl<Context, Action> FileWatcherNode<Context, Action>
Sourcepub fn with_id<P: Into<String>>(file_path: P) -> Self
pub fn with_id<P: Into<String>>(file_path: P) -> Self
Create a new file watcher node with a specified ID
Sourcepub fn with_poll_interval(self, interval: Duration) -> Self
pub fn with_poll_interval(self, interval: Duration) -> Self
Set the poll interval for the file watcher
Sourcepub fn with_change_handler<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(FileChange, &mut Context) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Action, FloxideError>> + Send + 'static,
pub fn with_change_handler<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(FileChange, &mut Context) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Action, FloxideError>> + Send + 'static,
Set the change handler for the file watcher node
Trait Implementations§
Source§impl<Context, Action> ReactiveNode<FileChange, Context, Action> for FileWatcherNode<Context, Action>
impl<Context, Action> ReactiveNode<FileChange, Context, Action> for FileWatcherNode<Context, Action>
Source§fn react_to_change<'life0, 'life1, 'async_trait>(
&'life0 self,
change: FileChange,
context: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn react_to_change<'life0, 'life1, 'async_trait>(
&'life0 self,
change: FileChange,
context: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reacts to a file change and produces an action
Auto Trait Implementations§
impl<Context, Action> Freeze for FileWatcherNode<Context, Action>
impl<Context, Action> !RefUnwindSafe for FileWatcherNode<Context, Action>
impl<Context, Action> Send for FileWatcherNode<Context, Action>
impl<Context, Action> Sync for FileWatcherNode<Context, Action>
impl<Context, Action> Unpin for FileWatcherNode<Context, Action>
impl<Context, Action> UnsafeUnpin for FileWatcherNode<Context, Action>
impl<Context, Action> !UnwindSafe for FileWatcherNode<Context, Action>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more