Skip to content
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

Open
wants to merge 6 commits into
base: match-cw-storage-plus-base
Choose a base branch
from

Conversation

eshelB
Copy link
Contributor

@eshelB eshelB commented Feb 14, 2023

  1. get_at() => get(), get_len() => len().
  2. get(), pop_front(), pop_back() now returns StdResult<Option<T>> instead of StdResult<T>.
  3. iter() improvement.
  4. added: front() back(), return first and last element without removing it.

@eshelB eshelB added the match cw-storage-plus Issue aims to cause api to conform to cw-storage-plus' types label Feb 14, 2023
return Err(StdError::generic_err("deque_store access out of bounds"));
return Ok(None)
}
self.get_at_unchecked(storage, pos).map(Some)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hipstery, why no 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);
}
Copy link
Member

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<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readme? wdym?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
match cw-storage-plus Issue aims to cause api to conform to cw-storage-plus' types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants