FuelLabs/sway

Add a section which documents storage interaction in libraries

オープン

#2,872 opened on 2022/09/27

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (5,421 件のフォーク)batch import
The Sway Bookgood first issue

Repository metrics

Stars
 (61,702 個のスター)
PR merge metrics
 (平均マージ 22h 6m) (30d で 16 merged PRs)

説明

The current documentation does not state whether storage can be "used" inside a library. The cause for concern is that there are cases that work and some that do not therefore it's unclear how to proceed.

The book should have content detailing how a library may or may not interact with storage. This could be added to the "workarounds" section.

For example:

  1. Can a library have a storage {} block?
  2. Can a function inside of a library take an argument directly from storage e.g. fn name(var: storage) where var might be a StorageMap etc.
  3. Can a library simply refer to storage without it being declared anywhere e.g. fn() { storage.thing = 1; }?
  4. Can a library use storage manually via the get and store functions?

コントリビューターガイド