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

move key instead of borrowing #78

Open
wants to merge 4 commits into
base: match-cw-storage-plus-map-support-borrowed-key
Choose a base branch
from

Conversation

eshelB
Copy link
Contributor

@eshelB eshelB commented Feb 19, 2023

now you call keymap.insert("key") instead of keymap.insert(&"key")

@eshelB eshelB changed the base branch from master to match-cw-storage-plus-map-support-borrowed-key February 19, 2023 15:00
@eshelB eshelB added the match cw-storage-plus Issue aims to cause api to conform to cw-storage-plus' types label Feb 19, 2023
/// Our int keys are simply the big-endian representation bytes for unsigned ints,
/// but "sign-flipped" (xored msb) big-endian bytes for signed ints.
///
/// So that the representation of signed integers is in the right lexicographical order.
Copy link
Member

Choose a reason for hiding this comment

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

That's a cool trick, but irrelevant for Secret (since we don't have iterators)
I wonder if that's needed

assert_eq!(x.next().unwrap()?, key1);

assert_eq!(x.next().unwrap()?, key2);
// slice types convert to owned types when iterating over keys
Copy link
Member

Choose a reason for hiding this comment

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

That's because

pub trait KeyDeserialize {
    type Output: ... + DeserializeOwned + ...;
    ...
}

right?

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