mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
reformat
This commit is contained in:
@@ -102,15 +102,26 @@ pub struct RemoteRelease {
|
|||||||
|
|
||||||
impl RemoteRelease {
|
impl RemoteRelease {
|
||||||
/// The release's download URL for the given target.
|
/// The release's download URL for the given target.
|
||||||
pub fn download_url(&self, fallback_target: &str, installer: Option<Installer>) -> Result<&Url> {
|
pub fn download_url(
|
||||||
let target = installer.map(|installer| format!("{fallback_target}-{}", installer.suffix())).unwrap_or("".to_string());
|
&self,
|
||||||
|
fallback_target: &str,
|
||||||
|
installer: Option<Installer>,
|
||||||
|
) -> Result<&Url> {
|
||||||
|
let target = installer
|
||||||
|
.map(|installer| format!("{fallback_target}-{}", installer.suffix()))
|
||||||
|
.unwrap_or("".to_string());
|
||||||
match self.data {
|
match self.data {
|
||||||
RemoteReleaseInner::Dynamic(ref platform) => Ok(&platform.url),
|
RemoteReleaseInner::Dynamic(ref platform) => Ok(&platform.url),
|
||||||
RemoteReleaseInner::Static { ref platforms } => platforms.get(&target).map_or_else(
|
RemoteReleaseInner::Static { ref platforms } => platforms.get(&target).map_or_else(
|
||||||
|| platforms.get(fallback_target).map_or(
|
|| {
|
||||||
Err(Error::TargetsNotFound(target.to_string(), fallback_target.to_string())),
|
platforms.get(fallback_target).map_or(
|
||||||
|
Err(Error::TargetsNotFound(
|
||||||
|
target.to_string(),
|
||||||
|
fallback_target.to_string(),
|
||||||
|
)),
|
||||||
|p| Ok(&p.url),
|
|p| Ok(&p.url),
|
||||||
),
|
)
|
||||||
|
},
|
||||||
|p| Ok(&p.url),
|
|p| Ok(&p.url),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user