Open agraven opened 3 years ago
Sorry for the delay, I'll try to take a look at it all soon. I'm not ignoring you :)
No worries, I've been quite busy myself as well :)
Looking for the support of that as well :)
I've just started extensively using this crate, and the ergonomics of the API are difficult around these borrowed structs. Since there's no public way to copy/clone them, we can only read them during the closures, and that makes it very difficult to consume...
For those curious, my workaround was to copy all of the structs, or create wrappers for some of them, and then inside the closures create instances of my struct copies. This isn't nice at all - if this crate changes anything then it'll break my structs, but it works for me for now.
I'm all for something like #43 - but instead of using a fork of this project with that addition (or just straight up duplicating the structs themselves), can we instead make some changes here? :pray:
The types listed in the title all share the issue that when you receive them in callbacks passed to methods like
get_sink_info_by_name
, you can't use those types outside of the callbacks due to lifetime constraints.I first tried to address the issue by deriving
Clone
for the relevant structs, but I realized that won't solve the problem since cloning aCow::Borrowed
just produces a copy of the reference it contains. I next tried to see if the derive-into-owned crate would work, but the derive seems to fail on some types, for exampleSinkInfo
.