mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-17 03:40:23 +03:00
fix(core): make tauri::Error
sync again (#8777)
* fix(core): make `tauri::Error` sync again closes #8754 * add unit test --------- Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
19fb5f0b20
commit
2e6db908d7
5
.changes/tauri-error-sync.md
Normal file
5
.changes/tauri-error-sync.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'tauri': 'patch:bug'
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix regression in `tauri::Error` not being `Sync`.
|
5
.changes/tauri-scope-object-error-sync.md
Normal file
5
.changes/tauri-scope-object-error-sync.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'tauri': 'patch:breaking'
|
||||||
|
---
|
||||||
|
|
||||||
|
Require `ScopeObject::Error` to be `Sync` as well.
|
@ -147,8 +147,17 @@ pub enum Error {
|
|||||||
UnstableFeatureNotSupported,
|
UnstableFeatureNotSupported,
|
||||||
/// Failed to deserialize scope object.
|
/// Failed to deserialize scope object.
|
||||||
#[error("error deserializing scope: {0}")]
|
#[error("error deserializing scope: {0}")]
|
||||||
CannotDeserializeScope(Box<dyn std::error::Error + Send>),
|
CannotDeserializeScope(Box<dyn std::error::Error + Send + Sync>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `Result<T, ::tauri::Error>`
|
/// `Result<T, ::tauri::Error>`
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn error_is_send_sync() {
|
||||||
|
crate::test_utils::assert_send::<super::Error>();
|
||||||
|
crate::test_utils::assert_sync::<super::Error>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -363,7 +363,7 @@ pub struct ScopeManager {
|
|||||||
/// though this is useful if you need to do some initialization logic on the type itself.
|
/// though this is useful if you need to do some initialization logic on the type itself.
|
||||||
pub trait ScopeObject: Sized + Send + Sync + Debug + 'static {
|
pub trait ScopeObject: Sized + Send + Sync + Debug + 'static {
|
||||||
/// The error type.
|
/// The error type.
|
||||||
type Error: std::error::Error + Send;
|
type Error: std::error::Error + Send + Sync;
|
||||||
/// Deserialize the raw scope value.
|
/// Deserialize the raw scope value.
|
||||||
fn deserialize<R: Runtime>(app: &AppHandle<R>, raw: Value) -> Result<Self, Self::Error>;
|
fn deserialize<R: Runtime>(app: &AppHandle<R>, raw: Value) -> Result<Self, Self::Error>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user