klingtnet / rosc

An OSC library for Rust.
Apache License 2.0
173 stars 25 forks source link

Store owned address in OscAddress #37

Closed DrLuke closed 2 years ago

DrLuke commented 2 years ago

A little lifetime oversight of mine: The OscAddress needs to store the address as a string otherwise it doesn't own it, thus the string passed to new must live at least as long as the OscAddress 😄

klingtnet commented 2 years ago

@DrLuke Thanks again for the patch! I'm going to have a second look on it today or tomorrow, but I think we can merge this without any further modifications.

klingtnet commented 2 years ago

Please excuse my late reply again, I should block an hour or something a week for reviewing PRs on my open source repos.

klingtnet commented 2 years ago

I think using a String here is fine, even though it involves some allocation. Otherwise a user might end up with lifetime problems, because you already said:

... it doesn't own it, thus the string passed to new must live at least as long as the OscAddress.

klingtnet commented 2 years ago

I'll merge this and publish a bugfix release. Thanks for the fix!

klingtnet commented 2 years ago

Might be better to do a minor release since the API changed slightly.

DrLuke commented 2 years ago

I agree. Thanks for reviewing and merging!