summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-07-25 23:13:39 -0400
committerMason Reed <mason@vector35.com>2025-07-28 20:33:56 -0400
commit819c0cbedcc6c7f0f8aba628a7a2875b7181e3f7 (patch)
treec25ab3716f6d6bba6fbb446773f952d99df07b58 /rust/src
parent8c73aa7dbbf053d024ce37c2ac5b7e1edb91913b (diff)
[Rust] Add docs for what the boolean return value does for some specific "progress" like callbacks
Still need to add more, consider changing the boolean to an enum that describes it better, so we do not need to copy paste docs around.
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/binary_view.rs4
-rw-r--r--rust/src/progress.rs4
2 files changed, 8 insertions, 0 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs
index a07ace7f..76efc40e 100644
--- a/rust/src/binary_view.rs
+++ b/rust/src/binary_view.rs
@@ -235,11 +235,15 @@ pub trait BinaryViewExt: BinaryViewBase {
}
/// Search the view using the query options.
+ ///
+ /// In the `on_match` callback return `false` to stop searching.
fn search<C: FnMut(u64, &DataBuffer) -> bool>(&self, query: &SearchQuery, on_match: C) -> bool {
self.search_with_progress(query, on_match, NoProgressCallback)
}
/// Search the view using the query options.
+ ///
+ /// In the `on_match` callback return `false` to stop searching.
fn search_with_progress<P: ProgressCallback, C: FnMut(u64, &DataBuffer) -> bool>(
&self,
query: &SearchQuery,
diff --git a/rust/src/progress.rs b/rust/src/progress.rs
index 5ebf8273..e6897e68 100644
--- a/rust/src/progress.rs
+++ b/rust/src/progress.rs
@@ -2,6 +2,10 @@ use std::ffi::c_void;
pub trait ProgressCallback: Sized {
type SplitProgressType: SplitProgressBuilder;
+
+ /// Caller function will call this to report progress.
+ ///
+ /// Return `false` to tell the caller to stop.
fn progress(&mut self, progress: usize, total: usize) -> bool;
unsafe extern "C" fn cb_progress_callback(