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

feat: Namespace key in map as Str #343

Merged
merged 2 commits into from
Jun 26, 2024
Merged

feat: Namespace key in map as Str #343

merged 2 commits into from
Jun 26, 2024

Conversation

Totodore
Copy link
Owner

Motivation

Most of the Namespace paths are now Str. It allows to avoid lifetime issue and reduce allocations. To match the use of Str in the codebase we can also switch from a Hashmap<Cow<'static, str>, Namespace> to a Hashmap<Str, Namespace>. Thanks to that there is not only no copying when using 'static str (this was already the case) but also when using owned String. For example with dynamic namespaces or when the user provide owned strings.

Fixes also a minor memory leak where namespaces created from dynamic namespaces were keeping a ref to the namespace path in the connect packet. Thus never freeing the packet.

@Totodore Totodore merged commit e8a85e0 into main Jun 26, 2024
13 checks passed
@Totodore Totodore deleted the feat-ns-key-in-map-as-str branch June 29, 2024 18:52
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.

None yet

1 participant