pub struct HookTemplate {
pub name: String,
pub description: Option<String>,
pub event: String,
pub action: Action,
pub parameters: Vec<TemplateParameter>,
}Expand description
Hook template for creating hooks with parameters
Templates define reusable hook patterns that can be instantiated with specific parameters. This allows users to create hooks without writing full hook configurations.
§Examples
ⓘ
let template = HookTemplate {
name: "Format on Save".to_string(),
description: Some("Format code when file is saved".to_string()),
event: "file_saved".to_string(),
action: Action::Command(CommandAction {
command: "prettier".to_string(),
args: vec!["--write".to_string(), "{{file_path}}".to_string()],
timeout_ms: Some(5000),
capture_output: true,
}),
parameters: vec![],
};Fields§
§name: StringTemplate name
description: Option<String>Template description
event: StringEvent that triggers hooks from this template
action: ActionAction template (may contain parameter placeholders)
parameters: Vec<TemplateParameter>Template parameters
Trait Implementations§
Source§impl Clone for HookTemplate
impl Clone for HookTemplate
Source§fn clone(&self) -> HookTemplate
fn clone(&self) -> HookTemplate
Returns a duplicate of the value. Read more
1.0.0 · 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 HookTemplate
impl Debug for HookTemplate
Source§impl<'de> Deserialize<'de> for HookTemplate
impl<'de> Deserialize<'de> for HookTemplate
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 HookTemplate
impl RefUnwindSafe for HookTemplate
impl Send for HookTemplate
impl Sync for HookTemplate
impl Unpin for HookTemplate
impl UnwindSafe for HookTemplate
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