Skip to content

Commit 7be5bf3

Browse files
committed
Make Ubi struct implement Send and Sync again
I did this for backwards compatibility.
1 parent 3dd0d22 commit 7be5bf3

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

ubi/src/builder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ impl<'a> UbiBuilder<'a> {
193193
))
194194
}
195195

196-
fn new_forge(&self, project_name: String, forge_type: &ForgeType) -> Result<Box<dyn Forge>> {
196+
fn new_forge(
197+
&self,
198+
project_name: String,
199+
forge_type: &ForgeType,
200+
) -> Result<Box<dyn Forge + Send + Sync>> {
197201
let api_base = self.api_base_url.map(Url::parse).transpose()?;
198202
Ok(match forge_type {
199203
ForgeType::GitHub => Box::new(GitHub::new(

ubi/src/github.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ pub(crate) struct GitHub {
2121
token: Option<String>,
2222
}
2323

24+
unsafe impl Send for GitHub {}
25+
unsafe impl Sync for GitHub {}
26+
2427
#[derive(Debug, Deserialize, Serialize)]
2528
pub(crate) struct Release {
2629
pub(crate) assets: Vec<Asset>,

ubi/src/gitlab.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ pub(crate) struct GitLab {
1818
token: Option<String>,
1919
}
2020

21+
unsafe impl Send for GitLab {}
22+
unsafe impl Sync for GitLab {}
23+
2124
#[derive(Debug, Deserialize, Serialize)]
2225
struct Release {
2326
assets: GitLabAssets,

ubi/src/ubi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use url::Url;
1414
/// [`UbiBuilder`](crate::UbiBuilder) struct to create a new `Ubi` instance.
1515
#[derive(Debug)]
1616
pub struct Ubi<'a> {
17-
forge: Box<dyn Forge>,
17+
forge: Box<dyn Forge + Send + Sync>,
1818
asset_url: Option<Url>,
1919
asset_picker: AssetPicker<'a>,
2020
installer: Installer,
@@ -38,7 +38,7 @@ pub(crate) struct Download {
3838
impl<'a> Ubi<'a> {
3939
/// Create a new Ubi instance.
4040
pub(crate) fn new(
41-
forge: Box<dyn Forge>,
41+
forge: Box<dyn Forge + Send + Sync>,
4242
asset_url: Option<Url>,
4343
asset_picker: AssetPicker<'a>,
4444
installer: Installer,

0 commit comments

Comments
 (0)