forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding documentation for the standard library (FuelLabs#3314)
This PR aims to add documentation aswell as examples for more std library functions Example documentation ``` /// Inserts a key-value pair into the map. /// /// # Arguments /// /// * `key` - The key to which the value is paired /// * `value` - The value to be stored /// /// # Examples /// /// ``` /// storage { /// map: StorageMap = StorageMap {} /// } /// /// fn foo() { /// let key = 5_u64; /// let value = true; /// storage.map.insert(key, value); /// let retrieved_value = storage.map.get(key); /// assert(value == retrieved_value); /// } /// ``` #[storage(write)] fn insert(self, key: K, value: V) { let key = sha256((key, __get_storage_key())); store::<V>(key, value); } ``` closes FuelLabs#3313 Co-authored-by: Mohammad Fawaz <[email protected]> Co-authored-by: Anton Trunov <[email protected]>
- Loading branch information
1 parent
7a389dd
commit 7a8ab39
Showing
8 changed files
with
834 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.