dev: Felt252DictTrait::get
could return a @T
rather than T
for more polivalence
#5668
Labels
enhancement
New feature or request
Problem
Returning
T
requires adding a+Copy<T>
constraint which forces the user to go callentry
andfinalize
fornon-copy
types, which is a painful DevX.Solution
Returning a snapshot of the value, rather than the value itself.
The caller has one more degree of liberty, he can decide to never
desnap
it if he has no reason to pay this price.Related code
Rust Slice::get returns a reference to the value, not the value itself.
Same for HashMap::get
Will I create a PR?
Here is a draft PR that does exactly that: #5667
I wrote it to make sure there were no huge blockers down the road. It looks like it works perfectly.
Tell me if you wish to merge it.
The text was updated successfully, but these errors were encountered: