Skip to content

Commit

Permalink
Merge pull request imgui-rs#222 from AlexEne/master
Browse files Browse the repository at this point in the history
Allow &[&ImString]  as well as &[&ImStr] in combo and list_box
  • Loading branch information
Gekkio authored Jun 3, 2019
2 parents 41d6ccc + a9a1c38 commit 762cf22
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,14 +1256,14 @@ impl<'ui> Ui<'ui> {

// Widgets: Combos
impl<'ui> Ui<'ui> {
pub fn combo<'p>(
pub fn combo<'p, StringType: AsRef<ImStr> + ?Sized>(
&self,
label: &'p ImStr,
current_item: &mut i32,
items: &'p [&'p ImStr],
items: &'p [&'p StringType],
height_in_items: i32,
) -> bool {
let items_inner: Vec<*const c_char> = items.into_iter().map(|item| item.as_ptr()).collect();
let items_inner: Vec<*const c_char> = items.into_iter().map(|item| item.as_ref().as_ptr()).collect();
unsafe {
sys::igCombo(
label.as_ptr(),
Expand All @@ -1278,14 +1278,14 @@ impl<'ui> Ui<'ui> {

// Widgets: ListBox
impl<'ui> Ui<'ui> {
pub fn list_box<'p>(
pub fn list_box<'p, StringType: AsRef<ImStr> + ?Sized>(
&self,
label: &'p ImStr,
current_item: &mut i32,
items: &'p [&'p ImStr],
items: &'p [&'p StringType],
height_in_items: i32,
) -> bool {
let items_inner: Vec<*const c_char> = items.into_iter().map(|item| item.as_ptr()).collect();
let items_inner: Vec<*const c_char> = items.into_iter().map(|item| item.as_ref().as_ptr()).collect();
unsafe {
sys::igListBoxStr_arr(
label.as_ptr(),
Expand Down

0 comments on commit 762cf22

Please sign in to comment.