Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Refactor import and error handling in screenshot_editor.rs
Richie McIlroyeafc7d9b6fe3
diff --git a/apps/desktop/src-tauri/src/screenshot_editor.rs b/apps/desktop/src-tauri/src/screenshot_editor.rsindex 3a278d560..13d93f6e0 100644--- a/apps/desktop/src-tauri/src/screenshot_editor.rs+++ b/apps/desktop/src-tauri/src/screenshot_editor.rs@@ -14,7 +14,10 @@ use serde::Serialize;use specta::Type;use std::str::FromStr;use std::{collections::HashMap, ops::Deref, path::PathBuf, sync::Arc};-use tauri::{Manager, Runtime, Window, ipc::CommandArg};+use tauri::{+ Manager, Runtime, Window,+ ipc::{CommandArg, InvokeError},+};use tokio::sync::{RwLock, watch};use tokio_util::sync::CancellationToken;@@ -51,9 +54,7 @@ impl Deref for WindowScreenshotEditorInstance {}impl<'de, R: Runtime> CommandArg<'de, R> for WindowScreenshotEditorInstance {- fn from_command(- command: tauri::ipc::CommandItem<'de, R>,- ) -> Result<Self, tauri::ipc::InvokeError> {+ fn from_command(command: tauri::ipc::CommandItem<'de, R>) -> Result<Self, InvokeError> {let window = Window::from_command(command)?;let instances = window.state::<ScreenshotEditorInstances>();@@ -62,7 +63,7 @@ impl<'de, R: Runtime> CommandArg<'de, R> for WindowScreenshotEditorInstance {if let Some(instance) = instance.get(window.label()).cloned() {Ok(Self(instance))} else {- Err(tauri::InvokeError::from(format!(+ Err(InvokeError::from(format!("no ScreenshotEditor instance for window '{}'",window.label(),)))