shockham/caper

Don't require owned string in get_render_item_by_name

TedDriggs opened this issue · 1 comments

get_render_item_by_name doesn't seem to need ownership of the passed-in string, so having it accept &str would avoid unnecessary allocations and improve the ergonomics of using it with static strings.

In the same fix, it'd probably make sense to change the impl of that method to be more idiomatic:

self.render_items.iter_mut().find(|item| item.name == name)

Nice suggestion, thanks! Just went ahead and commited this as wanted to test with some projects I am using it for.