-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deque changes #76
base: match-cw-storage-plus-base
Are you sure you want to change the base?
Deque changes #76
Conversation
…stead of StdResult<T>, get_at() was renamed to get() and now returns StdResult<Option<T>> too.
return Err(StdError::generic_err("deque_store access out of bounds")); | ||
return Ok(None) | ||
} | ||
self.get_at_unchecked(storage, pos).map(Some) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hipstery, why no Some(...)
?
// 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); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Seems like we return None
in next()
anyway
} | ||
|
||
#[test] | ||
fn test_cw_storage_plus_readme() -> StdResult<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readme? wdym?
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.