From c03957c2db8ff6c57f154cb27077bbb36e8cca43 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 5 Jun 2025 12:31:02 -0400 Subject: Fix and add code docs regarding FileMetadata view types vs view names --- rust/src/file_metadata.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'rust/src') diff --git a/rust/src/file_metadata.rs b/rust/src/file_metadata.rs index ed859775..6d123373 100644 --- a/rust/src/file_metadata.rs +++ b/rust/src/file_metadata.rs @@ -200,6 +200,15 @@ impl FileMetadata { unsafe { BNGetCurrentOffset(self.handle) } } + /// Navigate to an offset for a specific view. + /// + /// # Example + /// + /// ```no_run + /// use binaryninja::file_metadata::FileMetadata; + /// # let file: FileMetadata = unimplemented!(); + /// file.navigate_to("Linear:Raw", 0x0).expect("Linear:Raw should always be present"); + /// ``` pub fn navigate_to(&self, view: &str, offset: u64) -> Result<(), ()> { let view = view.to_cstr(); @@ -212,6 +221,15 @@ impl FileMetadata { } } + /// Get the [`BinaryView`] for the view type. + /// + /// # Example + /// + /// ```no_run + /// use binaryninja::file_metadata::FileMetadata; + /// # let file: FileMetadata = unimplemented!(); + /// file.view_of_type("Raw").expect("Raw type should always be present"); + /// ``` pub fn view_of_type(&self, view: &str) -> Option> { let view = view.to_cstr(); -- cgit v1.3.1