summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-03-13 12:19:41 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-03-24 18:46:48 -0700
commit938e9506996df13b3f08419854aa73c7d24f2d44 (patch)
treefe86a80be40e2ae2db4e4f34eebfeccd1672bd8b /rust
parent61e4e7e772b9c427bf190f8557afc466d0488848 (diff)
[Rust] Misc docs
Diffstat (limited to 'rust')
-rw-r--r--rust/src/background_task.rs3
-rw-r--r--rust/src/database.rs8
-rw-r--r--rust/src/file_metadata.rs3
-rw-r--r--rust/src/platform.rs4
4 files changed, 13 insertions, 5 deletions
diff --git a/rust/src/background_task.rs b/rust/src/background_task.rs
index 79aec683..1d902c3a 100644
--- a/rust/src/background_task.rs
+++ b/rust/src/background_task.rs
@@ -70,6 +70,9 @@ impl BackgroundTask {
Self { handle }
}
+ /// Begin the [`BackgroundTask`], you must manually finish the task by calling [`BackgroundTask::finish`].
+ ///
+ /// If you wish to automatically finish the task when leaving the scope, use [`BackgroundTask::enter`].
pub fn new(initial_text: &str, can_cancel: bool) -> Ref<Self> {
let text = initial_text.to_cstr();
let handle = unsafe { BNBeginBackgroundTask(text.as_ptr(), can_cancel) };
diff --git a/rust/src/database.rs b/rust/src/database.rs
index 4f2b3f6a..f0627306 100644
--- a/rust/src/database.rs
+++ b/rust/src/database.rs
@@ -30,7 +30,7 @@ impl Database {
Ref::new(Self { handle })
}
- /// Get a snapshot by its id, or None if no snapshot with that id exists
+ /// Get a [`Snapshot`] by its `id`, or `None` if no snapshot with that `id` exists.
pub fn snapshot_by_id(&self, id: SnapshotId) -> Option<Ref<Snapshot>> {
let result = unsafe { BNGetDatabaseSnapshot(self.handle.as_ptr(), id.0) };
NonNull::new(result).map(|handle| unsafe { Snapshot::ref_from_raw(handle) })
@@ -113,8 +113,9 @@ impl Database {
SnapshotId(new_id)
}
- /// Trim a snapshot's contents in the database by id, but leave the parent/child
- /// hierarchy intact. Future references to this snapshot will return False for has_contents
+ /// Trim a snapshot's contents in the database but leave the parent/child hierarchy intact.
+ ///
+ /// NOTE: Future references to this snapshot will return `false` for [`Database::snapshot_has_data`]
pub fn trim_snapshot(&self, id: SnapshotId) -> Result<(), ()> {
if unsafe { BNTrimDatabaseSnapshot(self.handle.as_ptr(), id.0) } {
Ok(())
@@ -193,6 +194,7 @@ impl Database {
unsafe { KeyValueStore::ref_from_raw(NonNull::new(result).unwrap()) }
}
+ /// Closes then reopens the database.
pub fn reload_connection(&self) {
unsafe { BNDatabaseReloadConnection(self.handle.as_ptr()) }
}
diff --git a/rust/src/file_metadata.rs b/rust/src/file_metadata.rs
index 5862647f..ce320dc5 100644
--- a/rust/src/file_metadata.rs
+++ b/rust/src/file_metadata.rs
@@ -583,7 +583,8 @@ impl FileMetadata {
/// Get the database attached to this file.
///
- /// Only available if this file is a database, or has called [`FileMetadata::create_database`].
+ /// Only available if this file is a database, or [`FileMetadata::create_database`] has previously
+ /// been called on this file.
pub fn database(&self) -> Option<Ref<Database>> {
let result = unsafe { BNGetFileMetadataDatabase(self.handle) };
NonNull::new(result).map(|handle| unsafe { Database::ref_from_raw(handle) })
diff --git a/rust/src/platform.rs b/rust/src/platform.rs
index 46129b81..bf135fae 100644
--- a/rust/src/platform.rs
+++ b/rust/src/platform.rs
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-//! Contains all information related to the execution environment of the binary, mainly the calling conventions used
+//! A [`Platform`] models the information related to the execution environment of the binary.
use crate::{
architecture::{Architecture, CoreArchitecture},
@@ -29,6 +29,8 @@ use std::fmt::Debug;
use std::ptr::NonNull;
use std::{borrow::Borrow, ffi, ptr};
+/// A platform describes the target [`CoreArchitecture`] and platform-specific information such as
+/// the calling conventions and generic types (think `HRESULT` on Windows).
#[derive(PartialEq, Eq, Hash)]
pub struct Platform {
pub(crate) handle: *mut BNPlatform,