diff --git a/src/pages/storey/containers/map.mdx b/src/pages/storey/containers/map.mdx index 57f08dc9..742f3021 100644 --- a/src/pages/storey/containers/map.mdx +++ b/src/pages/storey/containers/map.mdx @@ -39,16 +39,16 @@ assert_eq!(access.entry("alice").get().unwrap(), Some(Uint128::new(1000))); the keys in the underlying storage backend. - _line 8:_ The [`access`] method returns a [`MapAccess`] entity, which allows manipulating the map. - _line 10:_ Here we try to access the balance of `alice`. Since she doesn't have one yet, it - returns `None`. The [`entry`] method returns an [`ItemAccess`] entity, which allows manipulating the - item stored under the key `alice`. + returns `None`. The [`entry`] method returns an [`ItemAccess`] entity, which allows manipulating + the item stored under the key `alice`. - _line 12:_ Here we set Alice's balance to `1000`. - _line 14:_ We check that the balance is now `1000`. #### Iterating over the balances Iterating over the balances is pretty straightforward. The [`keys`] method returns an iterator over -the keys, the [`values`] method returns an iterator over the values, and the [`pairs`] method returns an -iterator over both. +the keys, the [`values`] method returns an iterator over the values, and the [`pairs`] method +returns an iterator over both. ```rust template="storage" showLineNumbers {4, 17, 19} use cw_storey::containers::{Item, Map}; @@ -121,8 +121,8 @@ assert_eq!( Here we used the [`bounded_pairs`] method to iterate over some key-value pairs. Other bounded methods are also available: [`bounded_keys`] and [`bounded_values`]. -The bounds are provided as arguments to the methods. Currently, the bounds are inclusive on the lower -bound and exclusive on the upper bound. In a future release (soon!) this will be configurable. +The bounds are provided as arguments to the methods. Currently, the bounds are inclusive on the +lower bound and exclusive on the upper bound. In a future release (soon!) this will be configurable. ### Keeping balances with composition @@ -151,8 +151,8 @@ This example is similar to the previous one, but this time we have an extra leve First of all, our type is `Map>>`. The outer map maps user addresses to inner maps. The inner map maps token denominations to actual balances. -When we access the stuff, the first [`entry`]/[`entry_mut`] call accesses a record in the outer map, and -the second one accesses a record in the inner map. +When we access the stuff, the first [`entry`]/[`entry_mut`] call accesses a record in the outer map, +and the second one accesses a record in the inner map. In [`cw-storage-plus`], you can achieve the same @@ -196,7 +196,8 @@ assert_eq!( ); ``` -Here we iterated twice, but each time we got a different view of the data. Each iteration was at a different level. +Here we iterated twice, but each time we got a different view of the data. Each iteration was at a +different level. - _line 18:_ We call `pairs` on the outer map, which gives us all the entries. - _line 27:_ We call `pairs` on the inner map under the key `alice`, which gives us all of Alice's @@ -215,20 +216,26 @@ Bounded or sensibly ordered iteration is not possible when both of the following - The key is dynamically sized (e.g. `String`, `Vec`, etc.). - The value type is a collection (`Map`, `Column`, etc.) rather than something like `Item`. -This is why, in the example above, bounded iteration (and a sensible order) is only possible for -the inner map. +This is why, in the example above, bounded iteration (and a sensible order) is only possible for the +inner map. + [`cw-storage-plus`]: /cw-storage-plus/containers/map -[`bounded_pairs`]: https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_pairs -[`bounded_keys`]: https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_keys -[`bounded_values`]: https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_values +[`bounded_pairs`]: + https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_pairs +[`bounded_keys`]: + https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_keys +[`bounded_values`]: + https://docs.rs/storey/latest/storey/containers/trait.BoundedIterableAccessor.html#method.bounded_values [`access`]: https://docs.rs/storey/latest/storey/containers/map/struct.Map.html#method.access [`entry`]: https://docs.rs/storey/latest/storey/containers/map/struct.MapAccess.html#method.entry -[`entry_mut`]: https://docs.rs/storey/latest/storey/containers/map/struct.MapAccess.html#method.entry_mut +[`entry_mut`]: + https://docs.rs/storey/latest/storey/containers/map/struct.MapAccess.html#method.entry_mut [`keys`]: https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html#method.keys -[`values`]: https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html#method.values +[`values`]: + https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html#method.values [`pairs`]: https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html#method.pairs [`ItemAccess`]: https://docs.rs/storey/latest/storey/containers/struct.ItemAccess.html [`MapAccess`]: https://docs.rs/storey/latest/storey/containers/map/struct.MapAccess.html -[`IterableAccessor`]: https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html \ No newline at end of file +[`IterableAccessor`]: https://docs.rs/storey/latest/storey/containers/trait.IterableAccessor.html