pub enum HookResult {
Success {
output: HookOutput,
},
NotFound,
Failed {
status: i32,
output: HookOutput,
},
}Expand description
Result of running the hooks for one event.
Variants§
Success
Every hook ran and exited 0.
Fields
§
output: HookOutputWhat the hooks wrote; empty under HookStdio::Inherit.
NotFound
No hook is installed for the event (or it is not executable) — treated as success.
Failed
A hook exited non-zero; later hooks for the event did not run.
Fields
§
output: HookOutputWhat the hooks wrote up to and including the failing one; empty under
HookStdio::Inherit.
Implementations§
Source§impl HookResult
impl HookResult
Sourcepub fn was_executed(&self) -> bool
pub fn was_executed(&self) -> bool
Returns true if the hook existed and ran (regardless of exit code).
Sourcepub fn status(&self) -> Option<i32>
pub fn status(&self) -> Option<i32>
Exit code of the hook run: Some(0) on success, None when no hook ran.
Sourcepub fn output(&self) -> Option<&HookOutput>
pub fn output(&self) -> Option<&HookOutput>
Captured output, or None when no hook ran.
Sourcepub fn check(self, hook_name: &str) -> Result<bool, HookError>
pub fn check(self, hook_name: &str) -> Result<bool, HookError>
Turn a failed run into HookError::Failed for hook_name; returns whether a hook ran.
§Errors
HookError::Failed carrying the status and captured output when a hook exited non-zero.
Trait Implementations§
Source§impl Clone for HookResult
impl Clone for HookResult
Source§impl Debug for HookResult
impl Debug for HookResult
impl Eq for HookResult
Source§impl PartialEq for HookResult
impl PartialEq for HookResult
impl StructuralPartialEq for HookResult
Auto Trait Implementations§
impl Freeze for HookResult
impl RefUnwindSafe for HookResult
impl Send for HookResult
impl Sync for HookResult
impl Unpin for HookResult
impl UnsafeUnpin for HookResult
impl UnwindSafe for HookResult
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