refactor: Eliminate unnecessary empty Vec constructions.
This commit is contained in:
@@ -65,16 +65,15 @@ pub enum HookResponse {
|
||||
}
|
||||
|
||||
/// Handler trait for lifecycle hooks. Implementations
|
||||
/// receive events and optionally return responses.
|
||||
/// Exec hooks return empty vecs. Handler hooks send
|
||||
/// responses back through the action channel asynchronously
|
||||
/// and also return empty vecs.
|
||||
/// receive events and may produce side effects (spawning
|
||||
/// processes, sending to channels). Responses flow through
|
||||
/// the action channel, not the return value.
|
||||
///
|
||||
/// This is deliberately synchronous for dyn-compatibility.
|
||||
/// Implementations that need async work (spawning processes,
|
||||
/// writing to channels) should use `tokio::spawn` internally.
|
||||
pub trait HookHandler: Send + Sync {
|
||||
fn handle(&self, event: HookEvent) -> Result<Vec<HookResponse>, PiklError>;
|
||||
fn handle(&self, event: HookEvent) -> Result<(), PiklError>;
|
||||
}
|
||||
|
||||
/// Parse a single line of JSON as a [`HookResponse`].
|
||||
|
||||
Reference in New Issue
Block a user