diff options
| author | Mason Reed <mason@vector35.com> | 2025-06-22 18:58:10 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-07-02 01:56:54 -0400 |
| commit | 619376a90c644e264c7b2930593b6116b0ed25a2 (patch) | |
| tree | 24a4628d18bebbc1d61b74e40009d19aa7c5a660 /rust/src | |
| parent | e39ce55e4cc232d0d73b20d490c69bb6dd9a88a3 (diff) | |
[Rust] Add some additional impls for ergonomics
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/background_task.rs | 12 | ||||
| -rw-r--r-- | rust/src/project/file.rs | 3 | ||||
| -rw-r--r-- | rust/src/project/folder.rs | 9 |
3 files changed, 24 insertions, 0 deletions
diff --git a/rust/src/background_task.rs b/rust/src/background_task.rs index ea1e3b0d..4899df8c 100644 --- a/rust/src/background_task.rs +++ b/rust/src/background_task.rs @@ -15,6 +15,7 @@ //! Background tasks provide plugins the ability to inform the core of long-running background tasks. use binaryninjacore_sys::*; +use std::fmt::Debug; use std::result; @@ -89,6 +90,17 @@ impl BackgroundTask { } } +impl Debug for BackgroundTask { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("BackgroundTask") + .field("progress_text", &self.progress_text()) + .field("can_cancel", &self.can_cancel()) + .field("is_cancelled", &self.is_cancelled()) + .field("is_finished", &self.is_finished()) + .finish() + } +} + unsafe impl RefCountable for BackgroundTask { unsafe fn inc_ref(handle: &Self) -> Ref<Self> { Ref::new(Self { diff --git a/rust/src/project/file.rs b/rust/src/project/file.rs index c06057d2..2d75cb24 100644 --- a/rust/src/project/file.rs +++ b/rust/src/project/file.rs @@ -119,6 +119,9 @@ impl Debug for ProjectFile { } } +unsafe impl Send for ProjectFile {} +unsafe impl Sync for ProjectFile {} + impl ToOwned for ProjectFile { type Owned = Ref<Self>; diff --git a/rust/src/project/folder.rs b/rust/src/project/folder.rs index d5d95e76..1ab33bc8 100644 --- a/rust/src/project/folder.rs +++ b/rust/src/project/folder.rs @@ -102,6 +102,12 @@ impl ProjectFolder { } } +impl PartialEq for ProjectFolder { + fn eq(&self, other: &Self) -> bool { + self.id() == other.id() + } +} + impl Debug for ProjectFolder { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("ProjectFolder") @@ -112,6 +118,9 @@ impl Debug for ProjectFolder { } } +unsafe impl Send for ProjectFolder {} +unsafe impl Sync for ProjectFolder {} + impl ToOwned for ProjectFolder { type Owned = Ref<Self>; |
