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

Adapt docs to hidden lazy and collections #42

Closed
cmichi opened this issue Feb 8, 2022 · 0 comments · Fixed by #44
Closed

Adapt docs to hidden lazy and collections #42

cmichi opened this issue Feb 8, 2022 · 0 comments · Fixed by #44
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cmichi
Copy link
Collaborator

cmichi commented Feb 8, 2022

In use-ink/ink#1111 the collection and lazy module were hidden.

One effect is that the CI of ink-docs is currently broken due to a number of dead links detected:

https://github.com/paritytech/ink-docs/runs/5104398596?check_suite_focus=true (search for Status: 404).

The effect is that no changes committed to this repo will be published to GitHub pages currently (so the version tag in the substrate-contracts-version installation instructions is still the old one, even though I've pushed a commit which updates it).

The ink-docs still contain a lot of mentions of e.g. Lazy:

$ rg Lazy
docs/datastructures/spread-packed.md
32:    b: ink_storage::Lazy<i32>,
52:    b: ink_storage::Lazy<i32>,
69:    b: ink_storage::Lazy<i32>,
96:    b: ink_storage::Lazy<i32>,

docs/datastructures/opting-out.md
14:    b: ink_storage::Lazy<i32>,

docs/datastructures/overview.md
31:The `ink_storage::Lazy` type caches their entities and acts lazily on the storage.
60:In order to prevent this eager loading of storage contents we can make use of `ink_storage::Lazy` or other lazy data structures defined in that crate:
65:    a: ink_storage::Lazy<i32>,
66:    b: ink_storage::Lazy<i32>,
73:            true  => Lazy::set(&self.a, self.offset + new_value),
74:            false => Lazy::set(&self.b, self.offset + new_value),
80:Note that `offset` remained `i32` since it is always needed and could spare the minor overhead of the `ink_storage::Lazy` wrapper.

docs/faq/faq.md
208:### When to use `Lazy<T>` over just `T` for a contract field?
210:The `ink_storage::Lazy` type caches their entities and acts lazily on the storage.

docs/basics/cross-contract-calling.md
23:use ink_storage::Lazy;
30:    other_contract: Lazy<OtherContract>,

docs/basics/mutating-values.md
30:## Lazy Storage Values
32:There is [a `Lazy` type](https://paritytech.github.io/ink/ink_storage/struct.Lazy.html) that can be
34:examples do not require the use of `Lazy` values. Since there is
35:some overhead associated with `Lazy` values, they should only be used where required.
37:This is an example of using the `Lazy` type:
43:    my_number: ink_storage::Lazy<u32>,
50:            my_number: ink_storage::Lazy::<u32>::new(init_value),
56:        ink_storage::Lazy::<u32>::set(&mut self.my_number, new_value);
62:        let cur = ink_storage::Lazy::<u32>::get(my_number);
63:        ink_storage::Lazy::<u32>::set(my_number, cur + add_value);

For collections it will probably be similar.

@cmichi cmichi added bug Something isn't working help wanted Extra attention is needed labels Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant