feat: implement robust format identification, plugin availability checks, and automatic conversion path rerouting on failure
Release / check-release (push) Successful in 16s
Release / build_gnu (push) Skipped
Release / build_musl (push) Skipped
Release / build_windows (push) Skipped
Release / package_gnu (deb) (push) Skipped
Release / package_gnu (rpm) (push) Skipped
Release / package_musl (deb) (push) Skipped
Release / package_musl (rpm) (push) Skipped
Release / publish-release (push) Skipped
CI / Test (push) Successful in 1m52s
CI / Build Linux (push) Successful in 2m0s
Release / check-release (push) Successful in 16s
Release / build_gnu (push) Skipped
Release / build_musl (push) Skipped
Release / build_windows (push) Skipped
Release / package_gnu (deb) (push) Skipped
Release / package_gnu (rpm) (push) Skipped
Release / package_musl (deb) (push) Skipped
Release / package_musl (rpm) (push) Skipped
Release / publish-release (push) Skipped
CI / Test (push) Successful in 1m52s
CI / Build Linux (push) Successful in 2m0s
This commit is contained in:
1 parent
a372937854
commit
d3b7d7a18f
8 files changed
+244
-97
No files matched your search
+9
-5
@@ -45,9 +45,13 @@ pub fn find_best_path<'a>(
|
||||
from_format: &'a str,
|
||||
to_format: &str,
|
||||
priority: &str,
|
||||
banned_plugins: &[&str],
|
||||
) -> Option<Vec<(&'a dyn Plugin, &'a str, &'a str)>> {
|
||||
let mut adj_list: HashMap<&str, Vec<&'a dyn Plugin>> = HashMap::new();
|
||||
for p in plugins {
|
||||
if banned_plugins.contains(&p.name()) || !p.is_available() {
|
||||
continue;
|
||||
}
|
||||
for &from in &p.from_formats() {
|
||||
adj_list.entry(from).or_default().push(p.as_ref());
|
||||
}
|
||||
@@ -243,7 +247,7 @@ mod tests {
|
||||
}),
|
||||
];
|
||||
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "fqs").unwrap();
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "fqs", &[]).unwrap();
|
||||
assert_eq!(path.len(), 1);
|
||||
assert_eq!(path[0].0.name(), "A");
|
||||
}
|
||||
@@ -269,10 +273,10 @@ mod tests {
|
||||
}),
|
||||
];
|
||||
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "fqs").unwrap();
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "fqs", &[]).unwrap();
|
||||
assert_eq!(path[0].0.name(), "B");
|
||||
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "qfs").unwrap();
|
||||
let path = find_best_path(&plugins, "jpeg", "png", "qfs", &[]).unwrap();
|
||||
assert_eq!(path[0].0.name(), "A");
|
||||
}
|
||||
|
||||
@@ -339,7 +343,7 @@ mod tests {
|
||||
}),
|
||||
];
|
||||
|
||||
let path = find_best_path(&plugins, $from, $to, $priority);
|
||||
let path = find_best_path(&plugins, $from, $to, $priority, &[]);
|
||||
if $expected_len == 0 {
|
||||
assert!(path.is_none());
|
||||
} else {
|
||||
@@ -408,7 +412,7 @@ mod tests {
|
||||
s: 10,
|
||||
}),
|
||||
];
|
||||
let path = find_best_path(&plugins, $from, $to, $priority);
|
||||
let path = find_best_path(&plugins, $from, $to, $priority, &[]);
|
||||
if $expected_len == 0 {
|
||||
assert!(path.is_none());
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user