Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Break] Make control::property::Info::value_type return & instead of clone #217

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Mar 6, 2025

It seems odd for this to return an owned value, when ::name() doesn't. And it is useful to get a reference to the ValueType, so ValueType::convert_value can be used and just use the lifetime of the Info instead of the cloned ValueType.

I assume there's no reason not to do this, since callers can still clone as needed.

As a small API break, I think this should be merged whenever the next semver bump to the crate happens to be.

It seems odd for this to return an owned value, when `::name()` doesn't.
And it is useful to get a reference to the `ValueType`, so
`ValueType::convert_value` can be used and just use the lifetime of the
`Info` instead of the cloned `ValueType.`

I assume there's no reason not to do this, since callers can still clone
as needed.
@MarijnS95
Copy link
Contributor

It was probably intended as a cheap Copy type, except that the presence of EnumValues (with Vecs) no longer makes that cheaply possible?

@ids1024
Copy link
Member Author

ids1024 commented Mar 6, 2025

Yeah, I was wondering about that, but haven't check the history. If it were a Copy type the current API would be good, but not now that it contains a couple Vecs (if it's an enum), and Value<'_> holds a reference to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants