Struct watchexec::action::WorkingData
source · [−]#[non_exhaustive]pub struct WorkingData {
pub throttle: Duration,
pub action_handler: HandlerLock<Action>,
pub pre_spawn_handler: HandlerLock<PreSpawn>,
pub post_spawn_handler: HandlerLock<PostSpawn>,
pub commands: Vec<Command>,
pub grouped: bool,
pub filterer: Arc<dyn Filterer>,
}
Expand description
The configuration of the action worker.
This is marked non-exhaustive so new configuration can be added without breaking.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.throttle: Duration
How long to wait for events to build up before executing an action.
This is sometimes called “debouncing.” We debounce on the trailing edge: an action is triggered only after that amount of time has passed since the first event in the cycle. The action is called with all the collected events in the cycle.
action_handler: HandlerLock<Action>
The main handler to define: what to do when an action is triggered.
This handler is called with the Action
environment, which has a certain way of returning
the desired outcome, check out the Action::outcome()
method. The handler checks for the
outcome as soon as the handler returns, which means that if the handler returns before the
outcome is set, you’ll get unexpected results. For this reason, it’s a bad idea to use ex. a
channel as the handler.
If this handler is not provided, it defaults to a no-op, which does absolutely nothing, not even quit. Hence, you really need to provide a handler.
It is possible to change the handler or any other configuration inside the previous handler. It’s useful to know that the handlers are updated from this working data before any of them run in any given cycle, so changing the pre-spawn and post-spawn handlers from this handler will not affect the running action.
pre_spawn_handler: HandlerLock<PreSpawn>
A handler triggered before a command is spawned.
This handler is called with the PreSpawn
environment, which provides mutable access to
the Command
which is about to be run. See the notes on the
PreSpawn::command()
method for important information on what you can do with it.
Returning an error from the handler will stop the action from processing further, and issue
a RuntimeError
to the error channel.
post_spawn_handler: HandlerLock<PostSpawn>
A handler triggered immediately after a command is spawned.
This handler is called with the PostSpawn
environment, which provides details on the
spawned command, including its PID.
Returning an error from the handler will drop the Child
, which
will terminate the command without triggering any of the normal Watchexec behaviour, and
issue a RuntimeError
to the error channel.
commands: Vec<Command>
Commands to execute.
These will be run in order, and an error will stop early.
grouped: bool
Whether to use process groups (on Unix) or job control (on Windows) to run the command.
This makes use of command_group under the hood.
If you want to known whether a spawned command was run in a process group, you should use
the value in PostSpawn
instead of reading this one, as it may have changed in the
meantime.
filterer: Arc<dyn Filterer>
The filterer implementation to use when filtering events.
The default is a no-op, which will always pass every event.
Trait Implementations
sourceimpl Clone for WorkingData
impl Clone for WorkingData
sourcefn clone(&self) -> WorkingData
fn clone(&self) -> WorkingData
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for WorkingData
impl Debug for WorkingData
Auto Trait Implementations
impl !RefUnwindSafe for WorkingData
impl Send for WorkingData
impl Sync for WorkingData
impl Unpin for WorkingData
impl !UnwindSafe for WorkingData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more