&str -> imgui::ImStr?

How do we do &str -> imgui::ImStr ?

It appears theredused to be a im_str macro that is now gone.

According to the changelog im_str is no longer needed imgui-rs/CHANGELOG.markdown at main · imgui-rs/imgui-rs · GitHub

What do you need ImStr for?

2 Likes

The changelog also contains the following line:

ui.button(&im_str!("My age is {}", 100)) becomes ui.button!(format!("My age is {}", 100))

Is the ui.button! a typo or some associated macro syntax I haven't heard of?

It's a typo. The deprecation said

all functions take AsRef now -- use inline strings or format instead

So they meant

ui.button(format!("My age is {}", 100))
1 Like