rust/ui: comment on the fact that the strings are copied in C
Which means that the buffer in Rust can be safely dropped afterwards.
@@ -104,7 +104,7 @@ where
let component = unsafe {
bitbox02_sys::trinary_input_string_create_password(
- crate::str_to_cstr_force!(title, MAX_LABEL_SIZE).as_ptr(),
+ crate::str_to_cstr_force!(title, MAX_LABEL_SIZE).as_ptr(), // copied in C
special_chars,
Some(c_confirm_callback::<F>),
// passed to c_confirm_callback as `param`.
@@ -185,7 +185,7 @@ where
let component = unsafe {
bitbox02_sys::status_create(
- crate::str_to_cstr_force!(text, MAX_LABEL_SIZE).as_ptr(),
+ crate::str_to_cstr_force!(text, MAX_LABEL_SIZE).as_ptr(), // copied in C
status_success,
Some(c_callback::<F>),
Box::into_raw(Box::new(callback)) as *mut _, // passed to c_callback as `param`.
@@ -287,6 +287,7 @@ pub fn menu_create(params: MenuParams<'_>) -> Component<'_> {
select_word_cb,
select_word_cb_param,
words.len() as _,
+ // copied in C
title.map_or_else(|| core::ptr::null(), |title| title.as_ptr()),
continue_on_last_cb,
continue_on_last_cb_param,
