Skip to content

Commit

Permalink
feat: allowing for creating a SpawnOnStartup hook without boxing it
Browse files Browse the repository at this point in the history
  • Loading branch information
sminez committed Sep 6, 2024
1 parent c693465 commit 331a081
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/extensions/hooks/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ pub struct SpawnOnStartup {
}

impl SpawnOnStartup {
/// Create a new unboxed startup hook ready for adding to your Config
pub fn new(prog: impl Into<Cow<'static, str>>) -> Self {
Self { prog: prog.into() }
}

/// Create a new startup hook ready for adding to your Config
pub fn boxed<X>(prog: impl Into<Cow<'static, str>>) -> Box<dyn StateHook<X>>
where
X: XConn,
{
Box::new(Self { prog: prog.into() })
Box::new(Self::new(prog))
}
}

Expand Down

0 comments on commit 331a081

Please sign in to comment.