Skip to content

Commit 27e476b

Browse files
committed
[Rust] Misc documentation cleanup
1 parent 634b67c commit 27e476b

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

rust/src/file_metadata.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ impl FileMetadata {
122122
///
123123
/// It may not be present if the BNDB was saved without it or cleared via [`FileMetadata::clear_original_file_path`].
124124
///
125+
/// If this [`FileMetadata`] is a database within a project, it may not have a "consumable" original
126+
/// file path. Instead, this might return the path to the on disk file path of the project file that
127+
/// this database was created from, for projects you should query through [`FileMetadata::project_file`].
128+
///
125129
/// Only prefer this over [`FileMetadata::file_path`] if you require the original binary location.
126130
pub fn original_file_path(&self) -> Option<PathBuf> {
127131
let raw_name = unsafe {

rust/src/types/library.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use std::ptr::NonNull;
1717
// Used for doc comments
1818
#[allow(unused_imports)]
1919
use crate::binary_view::BinaryView;
20+
#[allow(unused_imports)]
21+
use crate::binary_view::BinaryViewExt;
2022

2123
// TODO: Introduce a FinalizedTypeLibrary that cannot be mutated, so we do not have APIs that are unusable.
2224

@@ -255,7 +257,7 @@ impl TypeLibrary {
255257
/// Referenced types will not automatically be added, so make sure to add referenced types to the
256258
/// library or use [`TypeLibrary::add_type_source`] to mark the references originating source.
257259
///
258-
/// To add objects from a binary view, prefer using [`BinaryView::export_object_to_library`] which
260+
/// To add objects from a binary view, prefer using [`BinaryViewExt::export_object_to_library`] which
259261
/// will automatically pull in all referenced types and record additional dependencies as needed.
260262
pub fn add_named_object(&self, name: QualifiedName, type_: &Type) {
261263
let mut raw_name = QualifiedName::into_raw(name);
@@ -274,7 +276,7 @@ impl TypeLibrary {
274276
/// Referenced types will not automatically be added, so make sure to add referenced types to the
275277
/// library or use [`TypeLibrary::add_type_source`] to mark the references originating source.
276278
///
277-
/// To add types from a binary view, prefer using [`BinaryView::export_type_to_library`] which
279+
/// To add types from a binary view, prefer using [`BinaryViewExt::export_type_to_library`] which
278280
/// will automatically pull in all referenced types and record additional dependencies as needed.
279281
pub fn add_named_type(&self, name: QualifiedName, type_: &Type) {
280282
let mut raw_name = QualifiedName::into_raw(name);
@@ -314,7 +316,7 @@ impl TypeLibrary {
314316

315317
/// Get the object (function) associated with the given name, if any.
316318
///
317-
/// Prefer [`BinaryView::import_type_library_object`] as it will recursively import types required.
319+
/// Prefer [`BinaryViewExt::import_type_library_object`] as it will recursively import types required.
318320
pub fn get_named_object(&self, name: QualifiedName) -> Option<Ref<Type>> {
319321
let mut raw_name = QualifiedName::into_raw(name);
320322
let t = unsafe { BNGetTypeLibraryNamedObject(self.as_raw(), &mut raw_name) };
@@ -324,7 +326,7 @@ impl TypeLibrary {
324326

325327
/// Get the type associated with the given name, if any.
326328
///
327-
/// Prefer [`BinaryView::import_type_library_type`] as it will recursively import types required.
329+
/// Prefer [`BinaryViewExt::import_type_library_type`] as it will recursively import types required.
328330
pub fn get_named_type(&self, name: QualifiedName) -> Option<Ref<Type>> {
329331
let mut raw_name = QualifiedName::into_raw(name);
330332
let t = unsafe { BNGetTypeLibraryNamedType(self.as_raw(), &mut raw_name) };

0 commit comments

Comments
 (0)