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.
Motivation
Most of the Namespace paths are now
Str
. It allows to avoid lifetime issue and reduce allocations. To match the use ofStr
in the codebase we can also switch from aHashmap<Cow<'static, str>, Namespace>
to aHashmap<Str, Namespace>
. Thanks to that there is not only no copying when using'static str
(this was already the case) but also when using ownedString
. 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.