#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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
pub const fn every_secs(secs: u64) -> Self
Sourcepub fn every(duration: Duration) -> Self
pub fn every(duration: Duration) -> Self
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
pub fn on_file_change(path: impl Into<PathBuf>) -> Self
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TriggerConfig
impl Debug for TriggerConfig
Source§impl<'de> Deserialize<'de> for TriggerConfig
impl<'de> Deserialize<'de> for TriggerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TriggerConfig
Source§impl PartialEq for TriggerConfig
impl PartialEq for TriggerConfig
Source§fn eq(&self, other: &TriggerConfig) -> bool
fn eq(&self, other: &TriggerConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TriggerConfig
impl Serialize for TriggerConfig
impl StructuralPartialEq for TriggerConfig
Auto Trait Implementations§
impl Freeze for TriggerConfig
impl RefUnwindSafe for TriggerConfig
impl Send for TriggerConfig
impl Sync for TriggerConfig
impl Unpin for TriggerConfig
impl UnsafeUnpin for TriggerConfig
impl UnwindSafe for TriggerConfig
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