pub struct Hooks {
pub run_before: Vec<CommandInput>,
pub run_after: Vec<CommandInput>,
pub run_failed: Vec<CommandInput>,
pub run_finally: Vec<CommandInput>,
pub context: String,
pub env: HashMap<String, String>,
}Fields§
§run_before: Vec<CommandInput>Call this command before every rustic operation
run_after: Vec<CommandInput>Call this command after every successful rustic operation
run_failed: Vec<CommandInput>Call this command after every failed rustic operation
run_finally: Vec<CommandInput>Call this command after every rustic operation
context: String§env: HashMap<String, String>Implementations§
Source§impl Hooks
impl Hooks
pub fn with_context(&self, context: &str) -> Self
pub fn with_env(&self, env: &HashMap<String, String>) -> Self
fn run_all( cmds: &[CommandInput], context: &str, what: &str, env: &HashMap<String, String>, ) -> Result<()>
pub fn run_before(&self) -> Result<()>
pub fn run_after(&self) -> Result<()>
pub fn run_failed(&self) -> Result<()>
pub fn run_finally(&self) -> Result<()>
Sourcepub fn use_with<T>(&self, f: impl FnOnce() -> Result<T>) -> Result<T>
pub fn use_with<T>(&self, f: impl FnOnce() -> Result<T>) -> Result<T>
Run the given closure using the specified hooks.
Note: after a failure no error handling is done for the hooks run_failed
and run_finally which must run after. However, they already log a warning
or error depending on the on_failure setting.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hooks
impl<'de> Deserialize<'de> for Hooks
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
Auto Trait Implementations§
impl Freeze for Hooks
impl RefUnwindSafe for Hooks
impl Send for Hooks
impl Sync for Hooks
impl Unpin for Hooks
impl UnwindSafe for Hooks
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C> Config for C
impl<C> Config for C
Source§fn load_toml(toml_string: impl AsRef<str>) -> Result<C, FrameworkError>
fn load_toml(toml_string: impl AsRef<str>) -> Result<C, FrameworkError>
Load the configuration from the given TOML string.
Source§fn load_toml_file(path: impl AsRef<CanonicalPath>) -> Result<C, FrameworkError>
fn load_toml_file(path: impl AsRef<CanonicalPath>) -> Result<C, FrameworkError>
Load the global configuration from the TOML file at the given path.
If an error occurs reading or parsing the file, print it out and exit.
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MergeFrom for Twhere
T: Merge,
impl<T> MergeFrom for Twhere
T: Merge,
Source§fn merge_from(self, other: Self) -> Selfwhere
Self: Sized,
fn merge_from(self, other: Self) -> Selfwhere
Self: Sized,
Merges two instances of a type into a new instance. Read more