feat: with as ref as well
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-03-30 23:39:14 +01:00
parent 6ec6844ebb
commit c0fe864923
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -43,22 +43,26 @@ impl CuddleCI {
}
}
pub fn with_pull_request<T>(&mut self, pr: T) -> &mut Self
pub fn with_pull_request<T>(&mut self, pr: impl AsRef<T>) -> &mut Self
where
T: PullRequestAction + ToOwned + Send + Sync + 'static,
T: ToOwned<Owned = T>,
{
let pr = pr.as_ref();
self.pr_action.push(Box::new(pr.to_owned()));
self
}
pub fn with_main<T>(&mut self, main: T) -> &mut Self
pub fn with_main<T>(&mut self, main: impl AsRef<T>) -> &mut Self
where
T: MainAction + Send + Sync + 'static,
T: ToOwned<Owned = T>,
{
self.main_action.push(Box::new(main));
let main = main.as_ref();
self.main_action.push(Box::new(main.to_owned()));
self
}