-
Notifications
You must be signed in to change notification settings - Fork 380
Description
Is your feature request related to a problem? Please describe.
Currently the only way to use dynamically sized payloads in drag and drop is to use begin_payload_unchecked (unsafe) or use begin_payload with a Copy id, and manage memory on the user's side. This is inconvenient and a little tricky to get correct without wasting memory.
Describe the solution you'd like
Add a method:
pub fn begin_payload_buffer<'ui>(
self,
ui: &Ui<'ui>,
payload: &[u8]
) -> Option<DragDropSourceToolTip<'ui>>
I believe imgui is able to support this. This will allow a dynamically sized payload and should cover the majority of use cases (other dynamically sized types can usually be converted to a u8 slice).
Describe alternatives you've considered
The argument could be generic &[P]
where P: Copy + 'static
. This isn't necessary for my use case and I'm not sure how that impacts safety.
Additional context
I'm guessing that this isn't already supported because you want to discourage large payloads. In my use case, the payload is small but it's inconvenient to set a hardcoded size limit.