Open
Conversation
…stead of StdResult<T>, get_at() was renamed to get() and now returns StdResult<Option<T>> too.
toml01
reviewed
Feb 23, 2023
| return Err(StdError::generic_err("deque_store access out of bounds")); | ||
| return Ok(None) | ||
| } | ||
| self.get_at_unchecked(storage, pos).map(Some) |
Comment on lines
+525
to
+531
| // make sure that we don't skip past the end | ||
| if calc_len(self.start, self.end) < n as u32 { | ||
| // mark as empty | ||
| self.start = self.end; | ||
| } else { | ||
| self.start = self.start.saturating_add(n as u32); | ||
| } |
Member
There was a problem hiding this comment.
Why is this needed? Seems like we return None in next() anyway
| } | ||
|
|
||
| #[test] | ||
| fn test_cw_storage_plus_readme() -> StdResult<()> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_at()=>get(),get_len()=>len().get(),pop_front(),pop_back()now returnsStdResult<Option<T>>instead ofStdResult<T>.iter()improvement.front()back(), return first and last element without removing it.