Never crash: UI and app shells (ui-egui, vectorcraft, vectorcraft-web, cli perf)
Removes the remaining production unwraps in the UI (fit view, save, macOS shortcut labels, layers rows, swatch rows) and the CLI perf budget runner (errors are reported instead of expect), and adds the deny attribute to ui-egui, the desktop app and the web app. vectorcraft-cli's main.rs is left without the attribute because an open PR (#13) edits that file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc514957f5
commit
edccc14470
9 files changed
+39
-8
No files matched your search
@@ -43,7 +43,9 @@ pub fn synthetic(n: usize) -> Document {
|
||||
if i % 3 == 1 {
|
||||
node.opacity = 0.8;
|
||||
}
|
||||
d.insert(Some(l), usize::MAX, node).expect("insert");
|
||||
if d.insert(Some(l), usize::MAX, node).is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
d
|
||||
}
|
||||
@@ -122,8 +124,17 @@ pub fn run(args: &[String]) -> Result<(), String> {
|
||||
rows.push(("hit test (per click)", hits, 2.0));
|
||||
|
||||
let mut bytes = vec![];
|
||||
let mut failed: Option<String> = None;
|
||||
rows.push(("save .vectorcraft", median_ms(3, || bytes = vectorcraft_format::save_file(&doc)), 300.0));
|
||||
rows.push(("open .vectorcraft", median_ms(3, || drop(vectorcraft_format::load(&bytes).expect("load"))), 300.0));
|
||||
rows.push((
|
||||
"open .vectorcraft",
|
||||
median_ms(3, || {
|
||||
if let Err(e) = vectorcraft_format::load(&bytes) {
|
||||
failed = Some(format!("open .vectorcraft: {e}"));
|
||||
}
|
||||
}),
|
||||
300.0,
|
||||
));
|
||||
let svg_opts = vectorcraft_svg::ExportOptions::default();
|
||||
rows.push(("export SVG", median_ms(3, || drop(vectorcraft_svg::export(&doc, &svg_opts))), 500.0));
|
||||
|
||||
@@ -131,10 +142,14 @@ pub fn run(args: &[String]) -> Result<(), String> {
|
||||
let unite = median_ms(3, || {
|
||||
let mut s = vectorcraft_engine::Session::new();
|
||||
s.add_document(synthetic(1000), None);
|
||||
s.execute("select.all", &json!({})).expect("select");
|
||||
s.execute("object.pathfinder.unite", &json!({})).expect("unite");
|
||||
if let Err(e) = s.execute("select.all", &json!({})).and_then(|_| s.execute("object.pathfinder.unite", &json!({}))) {
|
||||
failed = Some(format!("Pathfinder Unite: {e}"));
|
||||
}
|
||||
});
|
||||
rows.push(("Pathfinder Unite, 1,000 paths", unite, 150.0));
|
||||
if let Some(e) = failed {
|
||||
return Err(e);
|
||||
}
|
||||
|
||||
let mut over = 0;
|
||||
println!(" {:<40} {:>10} {:>10}", "", "measured", "budget");
|
||||
|
||||
Reference in new issue
Block a user