#[non_exhaustive]pub enum TriggerConfig {
Every {
interval: Duration,
},
OnFileChange {
path: PathBuf,
},
}Expand description
Configuration for a trigger that the SDK will run.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Every
Periodic trigger: fires every interval.
OnFileChange
File-change trigger: fires when files change under path.
Implementations§
Source§impl TriggerConfig
impl TriggerConfig
Sourcepub const fn every_secs(secs: u64) -> Self
👎Deprecated since 0.2.0: Use try_every(Duration::from_secs(secs)) instead, which returns Result
pub const fn every_secs(secs: u64) -> Self
Use try_every(Duration::from_secs(secs)) instead, which returns Result
Sourcepub fn every(duration: Duration) -> Self
👎Deprecated since 0.2.0: Use try_every() instead, which returns Result
pub fn every(duration: Duration) -> Self
Use try_every() instead, which returns Result
Create an Every trigger with a specific Duration.
§Panics
Panics if the duration is less than 1 second.
Sourcepub fn on_file_change(path: impl Into<PathBuf>) -> Self
👎Deprecated since 0.2.0: Use try_on_file_change() instead, which returns Result
pub fn on_file_change(path: impl Into<PathBuf>) -> Self
Use try_on_file_change() instead, which returns Result
Create an OnFileChange trigger watching the given directory.
§Panics
Panics if path is empty, relative, or contains ...
Sourcepub fn try_on_file_change(path: impl Into<PathBuf>) -> Result<Self, Error>
pub fn try_on_file_change(path: impl Into<PathBuf>) -> Result<Self, Error>
Fallible version of on_file_change.
§Errors
Returns Error::InvalidConfig if path is empty, relative,
or contains ...
Sourcepub fn try_every(duration: Duration) -> Result<Self, Error>
pub fn try_every(duration: Duration) -> Result<Self, Error>
Fallible version of every.
§Errors
Returns Error::InvalidConfig if the duration is less than 1 second.
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Human-readable description for logging.
Trait Implementations§
Source§impl Clone for TriggerConfig
impl Clone for TriggerConfig
Source§fn clone(&self) -> TriggerConfig
fn clone(&self) -> TriggerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more