Skip to content

Commit 92faa86

Browse files
committed
[Rust] Misc docs
1 parent 83c9737 commit 92faa86

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

rust/src/background_task.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ impl BackgroundTask {
7070
Self { handle }
7171
}
7272

73+
/// Begin the [`BackgroundTask`], you must manually finish the task by calling [`BackgroundTask::finish`].
74+
///
75+
/// If you wish to automatically finish the task when leaving the scope, use [`BackgroundTask::enter`].
7376
pub fn new(initial_text: &str, can_cancel: bool) -> Ref<Self> {
7477
let text = initial_text.to_cstr();
7578
let handle = unsafe { BNBeginBackgroundTask(text.as_ptr(), can_cancel) };

rust/src/database.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl Database {
3030
Ref::new(Self { handle })
3131
}
3232

33-
/// Get a snapshot by its id, or None if no snapshot with that id exists
33+
/// Get a [`Snapshot`] by its `id`, or `None` if no snapshot with that `id` exists.
3434
pub fn snapshot_by_id(&self, id: SnapshotId) -> Option<Ref<Snapshot>> {
3535
let result = unsafe { BNGetDatabaseSnapshot(self.handle.as_ptr(), id.0) };
3636
NonNull::new(result).map(|handle| unsafe { Snapshot::ref_from_raw(handle) })
@@ -113,8 +113,9 @@ impl Database {
113113
SnapshotId(new_id)
114114
}
115115

116-
/// Trim a snapshot's contents in the database by id, but leave the parent/child
117-
/// hierarchy intact. Future references to this snapshot will return False for has_contents
116+
/// Trim a snapshot's contents in the database but leave the parent/child hierarchy intact.
117+
///
118+
/// NOTE: Future references to this snapshot will return `false` for [`Database::snapshot_has_data`]
118119
pub fn trim_snapshot(&self, id: SnapshotId) -> Result<(), ()> {
119120
if unsafe { BNTrimDatabaseSnapshot(self.handle.as_ptr(), id.0) } {
120121
Ok(())
@@ -193,6 +194,7 @@ impl Database {
193194
unsafe { KeyValueStore::ref_from_raw(NonNull::new(result).unwrap()) }
194195
}
195196

197+
/// Closes then reopens the database.
196198
pub fn reload_connection(&self) {
197199
unsafe { BNDatabaseReloadConnection(self.handle.as_ptr()) }
198200
}

rust/src/file_metadata.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ impl FileMetadata {
583583

584584
/// Get the database attached to this file.
585585
///
586-
/// Only available if this file is a database, or has called [`FileMetadata::create_database`].
586+
/// Only available if this file is a database, or [`FileMetadata::create_database`] has previously
587+
/// been called on this file.
587588
pub fn database(&self) -> Option<Ref<Database>> {
588589
let result = unsafe { BNGetFileMetadataDatabase(self.handle) };
589590
NonNull::new(result).map(|handle| unsafe { Database::ref_from_raw(handle) })

rust/src/platform.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! Contains all information related to the execution environment of the binary, mainly the calling conventions used
15+
//! A [`Platform`] models the information related to the execution environment of the binary.
1616
1717
use crate::{
1818
architecture::{Architecture, CoreArchitecture},
@@ -29,6 +29,8 @@ use std::fmt::Debug;
2929
use std::ptr::NonNull;
3030
use std::{borrow::Borrow, ffi, ptr};
3131

32+
/// A platform describes the target [`CoreArchitecture`] and platform-specific information such as
33+
/// the calling conventions and generic types (think `HRESULT` on Windows).
3234
#[derive(PartialEq, Eq, Hash)]
3335
pub struct Platform {
3436
pub(crate) handle: *mut BNPlatform,

0 commit comments

Comments
 (0)