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

Fix Value & related API and make them more consistent #513

Merged
merged 9 commits into from
Nov 28, 2023

Conversation

zeenix
Copy link
Contributor

@zeenix zeenix commented Nov 28, 2023

Fixes #263.

This would fail if cherry-picked to 3.0 branch. Some commit along the
way has fixed this though so it work on main branch. Let's keep the test
case anyway so we don't regress.
instead of Option<T>. We require `TryFrom` anyway so there is no reason
to eat that and return `None` instead of an error. Let's give back user
their error.
This will allows us to fix Value::downcast_ref signature w/o reducing
functionality.
…ce to it

This change makes this API a lot more practical as the only types that
can transfrom an `&Value` to an `&T` are the ones that are contained
inside the `Value` itself. Other types will need to create a new value
and they can't return only the reference to it.
This allows for faster retrieval of entries by key, among other things.
This is supposed to be a map type anyway.
This makes it consistent with Dict::get and Maybe::get. The previous
impelmentation that gives you a `&[Value]` is now available as `inner`
method.

Fixes dbus2#263.
This makes all `get` methods in zvariant consistent with each other.
@zeenix zeenix force-pushed the array-get-concrete-type branch from 45f004d to 6643ffc Compare November 28, 2023 14:49
@zeenix zeenix enabled auto-merge November 28, 2023 14:50
@zeenix zeenix merged commit 633102b into dbus2:main Nov 28, 2023
7 checks passed
@zeenix zeenix deleted the array-get-concrete-type branch November 28, 2023 14:54
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.

Array should provide concrete-type element getters
1 participant