You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cloning is not required for the core functionality of micromap as well as for HashMap, and this restriction can be removed from the many implementation blocks. The Clone constraint can be added separately for functions that really need it. E.g. that's how remove_entry's declaration may look like:
It's only function in the main block that need Clone, but I believe it's possible to remove it from there too although this is not necessary.
Impl blocks like IntoIterator for &Map and Clone for Map must declare its own constraint if it needed. They actually do it anyway and there is no need to change anything there.
If K or V not deriving Clone then it will not be possible to call into_iter() and clone() but all other methods shoud work.
In fact, standard HashMap are not required Clone for into_iter() neither it to be called by reference nor by value and it is the difference between it and the micromap. IntoIterator for &HashMap returns references to its elements and IntoIterator for HashMap just comsumes a map so it's not accessible anymore.
The text was updated successfully, but these errors were encountered:
Zefick
added a commit
to Zefick/micromap
that referenced
this issue
Apr 30, 2023
Cloning is not required for the core functionality of
micromap
as well as forHashMap
, and this restriction can be removed from the many implementation blocks. TheClone
constraint can be added separately for functions that really need it. E.g. that's how remove_entry's declaration may look like:It's only function in the main block that need
Clone
, but I believe it's possible to remove it from there too although this is not necessary.Impl blocks like
IntoIterator for &Map
andClone for Map
must declare its own constraint if it needed. They actually do it anyway and there is no need to change anything there.If K or V not deriving
Clone
then it will not be possible to callinto_iter()
andclone()
but all other methods shoud work.In fact, standard
HashMap
are not requiredClone
forinto_iter()
neither it to be called by reference nor by value and it is the difference between it and themicromap
.IntoIterator
for&HashMap
returns references to its elements andIntoIterator
forHashMap
just comsumes a map so it's not accessible anymore.The text was updated successfully, but these errors were encountered: