Skip to content

Have Client::list_all_identities() return 'static lifetimed value#51

Merged
nresare merged 1 commit intomainfrom
make_list_all_keys_use_static_lifetime
Jul 29, 2025
Merged

Have Client::list_all_identities() return 'static lifetimed value#51
nresare merged 1 commit intomainfrom
make_list_all_keys_use_static_lifetime

Conversation

@nresare
Copy link
Owner

@nresare nresare commented Jul 29, 2025

Since list_all_identities() takes a &mut self reference, previously that meant that the mutable borrow would need to live for as long as the returned values lived. Since the implementation of list_all_identities() only returns the Cow::Owned variant and as such don't even hold borrowed values, this was a bit frustrating.

It seems like the received wisdom is that if the value returned has the 'static lifetime, this resolves the problem.

Since list_all_identities() takes a &mut self reference, previously
that meant that the mutable borrow would need to live for as long
as the returned values lived. Since the implementation of
list_all_identities() only returns the Cow::Owned variant and as
such don't even hold borrowed values, this was a bit frustrating.

It seems like the received wisdom is that if the value returned
has the 'static lifetime, this resolves the problem.
@nresare nresare merged commit 5c1fea8 into main Jul 29, 2025
2 checks passed
@nresare nresare deleted the make_list_all_keys_use_static_lifetime branch October 14, 2025 20: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.

1 participant