Skip to content

Commit 3ab4cb0

Browse files
committed
add documentation to rust data notification
1 parent 98bd09b commit 3ab4cb0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

rust/src/data_notification.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ macro_rules! trait_handler {
3737
) $(-> $ret_type:ty)?
3838
),* $(,)?
3939
) => {
40+
/// Used to describe which call should be triggered by BinaryNinja.
41+
/// By default all calls are disabled.
42+
///
43+
/// Used by [CustomDataNotification::register]
4044
#[derive(Default)]
4145
pub struct DataNotificationTriggers {
4246
$($fun_name: bool,)*
@@ -75,7 +79,7 @@ macro_rules! trait_handler {
7579
handle.$fun_name($($value_calculated),*)
7680
}
7781
)*
78-
pub fn register_data_notification<'a, H: CustomDataNotification + 'a>(
82+
fn register_data_notification<'a, H: CustomDataNotification + 'a>(
7983
view: &BinaryView,
8084
notify: H,
8185
triggers: DataNotificationTriggers,
@@ -94,6 +98,20 @@ macro_rules! trait_handler {
9498
}
9599
}
96100

101+
/// Implement closures that will be called by BinaryNinja on the event of
102+
/// data modification.
103+
///
104+
/// example:
105+
/// ```no_run
106+
/// # use binaryninja::data_notification::DataNotificationClosure;
107+
/// # use binaryninja::function::Function;
108+
/// # use binaryninja::binary_view::BinaryView;
109+
/// # let bv: BinaryView = todo!();
110+
/// let custom = DataNotificationClosure::default()
111+
/// .function_updated(|_bv: &BinaryView, _func: &Function| todo!() )
112+
/// // other calls should be added here
113+
/// .register(&bv);
114+
/// ```
97115
pub struct DataNotificationClosure<'a> {
98116
$(
99117
$fun_name: Option<Box<

0 commit comments

Comments
 (0)