Skip to content

Commit

Permalink
feat: derive Clone for PathResolver (#12529)
Browse files Browse the repository at this point in the history
closes #12528
  • Loading branch information
amrbashir authored Jan 26, 2025
1 parent abdd558 commit e9c9c4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/path-resolver-clone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": "patch:enhance"
---

Derive `Clone` for `PathResolver` struct.
6 changes: 6 additions & 0 deletions crates/tauri/src/path/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use std::path::PathBuf;
/// A helper class to access the mobile path APIs.
pub struct PathResolver<R: Runtime>(pub(crate) PluginHandle<R>);

impl<R: Runtime> Clone for PathResolver<R> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}

#[derive(serde::Deserialize)]
struct PathResponse {
path: PathBuf,
Expand Down
6 changes: 6 additions & 0 deletions crates/tauri/src/path/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use std::path::PathBuf;
/// The path resolver is a helper class for general and application-specific path APIs.
pub struct PathResolver<R: Runtime>(pub(crate) AppHandle<R>);

impl<R: Runtime> Clone for PathResolver<R> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}

impl<R: Runtime> PathResolver<R> {
/// Returns the path to the user's audio directory.
///
Expand Down

0 comments on commit e9c9c4d

Please sign in to comment.