binaryninja::file_metadata

Struct FileMetadata

source
pub struct FileMetadata { /* private fields */ }

Implementations§

source§

impl FileMetadata

source

pub fn new() -> Ref<Self>

source

pub fn with_filename(name: &str) -> Ref<Self>

source

pub fn close(&self)

source

pub fn session_id(&self) -> usize

source

pub fn filename(&self) -> String

source

pub fn set_filename(&self, name: &str)

source

pub fn modified(&self) -> bool

source

pub fn mark_modified(&self)

source

pub fn mark_saved(&self)

source

pub fn is_analysis_changed(&self) -> bool

source

pub fn is_database_backed(&self) -> bool

source

pub fn is_database_backed_for_view_type(&self, view_type: &str) -> bool

source

pub fn run_undoable_transaction<F: FnOnce() -> Result<T, E>, T, E>( &self, func: F, ) -> Result<T, E>

Runs a failable function where the failure state will revert any undo actions that occurred during the time of the function’s execution.

NOTE: This will commit or undo any actions that occurred on any thread as this state is not thread local.

NOTE: This is NOT thread safe, if you are holding any locks that might be held by both the main thread and the thread executing this function, you can deadlock. You should also never call this function on multiple threads at a time. See the following issues:

source

pub fn begin_undo_actions(&self, anonymous_allowed: bool) -> String

Creates a new undo entry, any undo actions after this will be added to this entry.

NOTE: This is NOT thread safe, if you are holding any locks that might be held by both the main thread and the thread executing this function, you can deadlock. You should also never call this function on multiple threads at a time. See the following issues:

source

pub fn commit_undo_actions(&self, id: &str)

Commits the undo entry with the id to the undo buffer.

NOTE: This is NOT thread safe, if you are holding any locks that might be held by both the main thread and the thread executing this function, you can deadlock. You should also never call this function on multiple threads at a time. See the following issues:

source

pub fn revert_undo_actions(&self, id: &str)

Reverts the undo actions committed in the undo entry.

NOTE: This is NOT thread safe, if you are holding any locks that might be held by both the main thread and the thread executing this function, you can deadlock. You should also never call this function on multiple threads at a time. See the following issues:

source

pub fn undo(&self)

source

pub fn redo(&self)

source

pub fn current_view(&self) -> String

source

pub fn current_offset(&self) -> u64

source

pub fn navigate_to(&self, view: &str, offset: u64) -> Result<(), ()>

Navigate to an offset for a specific view.

§Example
use binaryninja::file_metadata::FileMetadata;
file.navigate_to("Linear:Raw", 0x0).expect("Linear:Raw should always be present");
source

pub fn view_of_type(&self, view: &str) -> Option<Ref<BinaryView>>

Get the BinaryView for the view type.

§Example
use binaryninja::file_metadata::FileMetadata;
file.view_of_type("Raw").expect("Raw type should always be present");
source

pub fn view_types(&self) -> Array<BnString>

source

pub fn project_file(&self) -> Option<Ref<ProjectFile>>

Get the ProjectFile for the FileMetadata.

source

pub fn create_database(&self, file_path: impl AsRef<Path>) -> bool

source

pub fn create_database_with_progress<P: ProgressCallback>( &self, file_path: impl AsRef<Path>, progress: P, ) -> bool

source

pub fn save_auto_snapshot(&self) -> bool

source

pub fn open_database_for_configuration( &self, file: &Path, ) -> Result<Ref<BinaryView>, ()>

source

pub fn open_database(&self, file: &Path) -> Result<Ref<BinaryView>, ()>

source

pub fn open_database_with_progress<P: ProgressCallback>( &self, file: &Path, progress: P, ) -> Result<Ref<BinaryView>, ()>

source

pub fn database(&self) -> Option<Ref<Database>>

Get the current database

Trait Implementations§

source§

impl Debug for FileMetadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for FileMetadata

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for FileMetadata

source§

fn eq(&self, other: &FileMetadata) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToOwned for FileMetadata

source§

type Owned = Ref<FileMetadata>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for FileMetadata

source§

impl Send for FileMetadata

source§

impl StructuralPartialEq for FileMetadata

source§

impl Sync for FileMetadata

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.