Skip to content

Commit 6215e87

Browse files
committed
Clean up in code documentation
1 parent 4d5d49f commit 6215e87

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

datadog-crashtracker-ffi/src/runtime_callback.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ use datadog_crashtracker::{
1515
pub use datadog_crashtracker::CallbackType as ddog_CallbackType;
1616
pub use datadog_crashtracker::RuntimeType as ddog_RuntimeType;
1717

18-
#[cfg(test)]
19-
use datadog_crashtracker::clear_runtime_callback;
20-
use std::ffi::c_char;
18+
pub use datadog_crashtracker::RuntimeStackFrame as ddog_RuntimeStackFrame;
2119

2220
/// Result type for runtime callback registration
2321
#[repr(C)]
@@ -60,7 +58,7 @@ impl From<CallbackError> for CallbackResult {
6058
/// static void my_runtime_callback(
6159
/// void (*emit_frame)(const ddog_RuntimeStackFrame*),
6260
/// void (*emit_stacktrace_string)(const char*),
63-
/// void* context
61+
/// void* writer_ctx
6462
/// ) {
6563
/// // Collect runtime frames and call emit_frame for each one
6664
/// ddog_RuntimeStackFrame frame = {
@@ -71,7 +69,7 @@ impl From<CallbackError> for CallbackResult {
7169
/// .class_name = "MyClass",
7270
/// .module_name = NULL
7371
/// };
74-
/// emit_frame(&frame);
72+
/// emit_frame(writer_ctx, &frame);
7573
/// }
7674
///
7775
///
@@ -131,7 +129,7 @@ pub extern "C" fn ddog_crasht_is_runtime_callback_registered() -> bool {
131129
/// - The caller should not free the returned pointer
132130
/// - The returned string should be copied if it needs to persist beyond callback lifetime
133131
#[no_mangle]
134-
pub unsafe extern "C" fn ddog_crasht_get_registered_runtime_type() -> *const c_char {
132+
pub unsafe extern "C" fn ddog_crasht_get_registered_runtime_type() -> *const std::ffi::c_char {
135133
get_registered_runtime_type_ptr()
136134
}
137135

@@ -145,19 +143,15 @@ pub unsafe extern "C" fn ddog_crasht_get_registered_runtime_type() -> *const c_c
145143
/// - The caller should not free the returned pointer
146144
/// - The returned string should be copied if it needs to persist beyond callback lifetime
147145
#[no_mangle]
148-
pub unsafe extern "C" fn ddog_crasht_get_registered_callback_type() -> *const c_char {
146+
pub unsafe extern "C" fn ddog_crasht_get_registered_callback_type() -> *const std::ffi::c_char {
149147
get_registered_callback_type_ptr()
150148
}
151149

152-
// Re-export the core RuntimeStackFrame for C interop; consumers need to create RuntimeStackFrame
153-
pub use datadog_crashtracker::RuntimeStackFrame as ddog_RuntimeStackFrame;
154-
155150
#[cfg(test)]
156151
mod tests {
157152
use super::*;
158-
use datadog_crashtracker::RuntimeStackFrame;
159-
use std::ffi::c_void;
160-
use std::ffi::CString;
153+
use datadog_crashtracker::{clear_runtime_callback, RuntimeStackFrame};
154+
use std::ffi::{c_char, c_void, CString};
161155
use std::ptr;
162156
use std::sync::Mutex;
163157

0 commit comments

Comments
 (0)