Skip to content

Commit 819c0cb

Browse files
committed
[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.
1 parent 8c73aa7 commit 819c0cb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

rust/src/binary_view.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,15 @@ pub trait BinaryViewExt: BinaryViewBase {
235235
}
236236

237237
/// Search the view using the query options.
238+
///
239+
/// In the `on_match` callback return `false` to stop searching.
238240
fn search<C: FnMut(u64, &DataBuffer) -> bool>(&self, query: &SearchQuery, on_match: C) -> bool {
239241
self.search_with_progress(query, on_match, NoProgressCallback)
240242
}
241243

242244
/// Search the view using the query options.
245+
///
246+
/// In the `on_match` callback return `false` to stop searching.
243247
fn search_with_progress<P: ProgressCallback, C: FnMut(u64, &DataBuffer) -> bool>(
244248
&self,
245249
query: &SearchQuery,

rust/src/progress.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ use std::ffi::c_void;
22

33
pub trait ProgressCallback: Sized {
44
type SplitProgressType: SplitProgressBuilder;
5+
6+
/// Caller function will call this to report progress.
7+
///
8+
/// Return `false` to tell the caller to stop.
59
fn progress(&mut self, progress: usize, total: usize) -> bool;
610

711
unsafe extern "C" fn cb_progress_callback(

0 commit comments

Comments
 (0)