Struct xtask_wasm::Watch

source ·
#[non_exhaustive]
pub struct Watch { pub watch_paths: Vec<PathBuf>, pub exclude_paths: Vec<PathBuf>, pub workspace_exclude_paths: Vec<PathBuf>, pub debounce: Duration, }
Expand description

Watches over your project’s source code, relaunching a given command when changes are detected.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§watch_paths: Vec<PathBuf>

Watch specific file(s) or folder(s).

The default is the workspace root.

§exclude_paths: Vec<PathBuf>

Paths that will be excluded.

§workspace_exclude_paths: Vec<PathBuf>

Paths, relative to the workspace root, that will be excluded.

§debounce: Duration

Throttle events to prevent the command to be re-executed too early right after an execution already occurred.

The default is 2 seconds.

Implementations§

source§

impl Watch

source

pub fn watch_path(self, path: impl AsRef<Path>) -> Watch

Add a path to watch for changes.

source

pub fn watch_paths( self, paths: impl IntoIterator<Item = impl AsRef<Path>> ) -> Watch

Add multiple paths to watch for changes.

source

pub fn exclude_path(self, path: impl AsRef<Path>) -> Watch

Add a path that will be ignored if changes are detected.

source

pub fn exclude_paths( self, paths: impl IntoIterator<Item = impl AsRef<Path>> ) -> Watch

Add multiple paths that will be ignored if changes are detected.

source

pub fn exclude_workspace_path(self, path: impl AsRef<Path>) -> Watch

Add a path, relative to the workspace, that will be ignored if changes are detected.

source

pub fn exclude_workspace_paths( self, paths: impl IntoIterator<Item = impl AsRef<Path>> ) -> Watch

Add multiple paths, relative to the workspace, that will be ignored if changes are detected.

source

pub fn debounce(self, duration: Duration) -> Watch

Set the debounce duration after relaunching the command.

source

pub fn run(self, commands: impl Into<CommandList>) -> Result<(), Error>

Run the given command, monitor the watched paths and relaunch the command when changes are detected.

Workspace’s target directory and hidden paths are excluded by default.

Trait Implementations§

source§

impl Args for Watch

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self. Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can update self. Read more
source§

impl Clone for Watch

source§

fn clone(&self) -> Watch

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommandFactory for Watch

source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
source§

impl Debug for Watch

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Watch

source§

fn default() -> Watch

Returns the “default value” for a type. Read more
source§

impl FromArgMatches for Watch

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Watch, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Watch, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for Watch

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error.
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl RefUnwindSafe for Watch

§

impl Send for Watch

§

impl Sync for Watch

§

impl Unpin for Watch

§

impl UnwindSafe for Watch

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.