watchexec/lib/src/config.rs

44 lines
1.6 KiB
Rust
Raw Normal View History

2021-08-19 11:28:56 +02:00
use derive_builder::Builder;
/// Configuration for [`Watchexec`][crate::Watchexec].
///
/// This is used both for constructing the instance and to reconfigure it at runtime, though note
/// that some fields are only applied at construction time.
///
/// Use [`ConfigBuilder`] to build a new one, or modify an existing one. This struct is marked
2021-08-19 11:28:56 +02:00
/// non-exhaustive such that new options may be added without breaking change.
#[derive(Builder, Clone, Debug)]
#[non_exhaustive]
2021-08-18 15:12:50 +02:00
pub struct Config {
2021-08-19 11:28:56 +02:00
/// Working data for the filesystem event source.
///
/// This notably includes the path set to be watched.
#[builder(default)]
2021-08-18 15:12:50 +02:00
pub fs: crate::fs::WorkingData,
2021-08-19 11:28:56 +02:00
2021-08-20 18:43:55 +02:00
/// Working data for the action processing.
///
/// This is the task responsible for scheduling the actions in response to events, applying the
/// filtering, etc.
#[builder(default)]
pub action: crate::action::WorkingData,
2021-08-19 11:28:56 +02:00
/// Internal: the buffer size of the channel which carries runtime errors.
///
/// The default (64) is usually fine. If you expect a much larger throughput of runtime errors,
/// adjusting this value may help. (Fixing whatever is causing the errors may also help.)
///
/// Only used at construction time, cannot be changed via reconfiguration.
#[builder(default = "64")]
pub error_channel_size: usize,
/// Internal: the buffer size of the channel which carries events.
///
/// The default (1024) is usually fine. If you expect a much larger throughput of events,
/// adjusting this value may help.
///
/// Only used at construction time, cannot be changed via reconfiguration.
#[builder(default = "1024")]
pub event_channel_size: usize,
2021-08-18 15:12:50 +02:00
}