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

storey: Containers section #105

Merged
merged 2 commits into from
Jul 19, 2024
Merged

storey: Containers section #105

merged 2 commits into from
Jul 19, 2024

Conversation

uint
Copy link
Contributor

@uint uint commented Jul 18, 2024

No description provided.

@uint uint added the storey label Jul 18, 2024
Copy link

vercel bot commented Jul 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cosmwasm-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 3:51pm

use cw_storey::containers::{Map, Item};
use cw_storey::CwStorage;

let map: Map<String, Map<String, Item<u32>>> = Map::new(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice composition! One question I have: Why is the Item necessary here?

Copy link
Contributor Author

@uint uint Jul 19, 2024

Choose a reason for hiding this comment

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

I should probably make a callout about that.

Basically, Map is designed to take another container. It could maybe be redesigned to either take a container OR some serializable type, but it's tricky to do without specialization.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see. That's probably good to mention on the Map docs when those are written.
I think it's fine as is, as long as it's explained somewhere and shown like that in the examples.

@uint uint merged commit 98ed344 into main Jul 19, 2024
5 checks passed
@uint uint deleted the storey-containers branch July 19, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants