Replace Mapping::insert_return_size with Mapping::insert#1463
Replace Mapping::insert_return_size with Mapping::insert#1463
Mapping::insert_return_size with Mapping::insert#1463Conversation
Please give more context in the PR description e.g. "we added a new method to make it non-breaking, now we are doing 4.0 so we can make the breaking change" (it's what I assume the reasoning to be). Also links to relevant PRs are useful #1224 |
Codecov Report
@@ Coverage Diff @@
## master #1463 +/- ##
===========================================
+ Coverage 46.97% 63.96% +16.98%
===========================================
Files 201 201
Lines 6210 6210
===========================================
+ Hits 2917 3972 +1055
+ Misses 3293 2238 -1055
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ascjones
left a comment
There was a problem hiding this comment.
LGTM, Please add this to the Unreleased section of CHANGELOG.md before merging
CHANGELOG.md
Outdated
|
|
||
| ### Removed | ||
| - Remove `ink_env::random` function ‒ [#1442](https://github.com/paritytech/ink/pull/1442) | ||
| - Remove previous insert `Mapping::insert(key, val)` method and replace by `Mapping::insert_return_size(key, val)` behaviour but under the same method name insert - [#1463](https://github.com/paritytech/ink/pull/1463) |
There was a problem hiding this comment.
Can you wrap this to ~100 chars?
| /// Returns the size of the pre-existing value at the specified key if any. | ||
| #[inline] | ||
| pub fn insert_return_size<Q, R>(&mut self, key: Q, value: &R) -> Option<u32> | ||
| pub fn insert<Q, R>(&mut self, key: Q, value: &R) -> Option<u32> |
There was a problem hiding this comment.
In the docs can you also specify the returned size is in bytes?
Mapping::insert_return_size with Mapping::insert
In the wake of this last change #1224 (comment) where Mapping::insert_return_size was added to make it non-breaking, this method would replace the current insert one for the release 4.0.
More precisely, the method
fn Mapping::insert_return_size(key, val) -> Option<u32>;was merged into the methodfn Mapping::insert(key, val);