Allow fetch_and_update/update_and_fetch to store the existing value without data copies
Use Case:
Currently fetch_and_update and update_and_fetch use a &[u8] parameter in the callback. In the event that someone is writing a callback where they wish for the value to be unchanged, you must return the existing value. My understanding of reading through the IVec code is that because the type of the parameter is a slice, the IVec operations that can convert from it will copy the data rather than clone the reference of the original data.
Proposed Change:
By updating the type signature of the callback to &IVec the callback can use clone() which is a lightweight clone instead of a full data copy.
Who Benefits From The Change(s)?
Users who are returning the existing value in these APIs.
Alternative Approaches
Users who want this functionality can write their own versions of these functions -- these APIs are very simple under the hood.