From 76a6cd34a9b6c197926773afa53b7657cc08576d Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Fri, 10 May 2024 18:51:58 +0800 Subject: [PATCH] Update library inline docs descriptions (#5984) ## Description While reviewing the [std-lib docs](https://fuellabs.github.io/sway/master/std/), it was noted that some of the libraries and modules do not have docs or are outdated. These have been updated. ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: K1-R1 <77465250+K1-R1@users.noreply.github.com> --- sway-lib-std/src/address.sw | 2 +- sway-lib-std/src/alias.sw | 1 + sway-lib-std/src/asset_id.sw | 1 + sway-lib-std/src/b512.sw | 3 +-- sway-lib-std/src/constants.sw | 2 +- sway-lib-std/src/contract_id.sw | 2 +- sway-lib-std/src/execution.sw | 1 + sway-lib-std/src/iterator.sw | 1 + sway-lib-std/src/string.sw | 1 + 9 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index e075421d4a1..065f6fca627 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -1,4 +1,4 @@ -//! A wrapper around the `b256` type to help enhance type-safety. +//! The `Address` type used for interacting with addresses on the fuel network. library; use ::convert::From; diff --git a/sway-lib-std/src/alias.sw b/sway-lib-std/src/alias.sw index 53066566465..7739dea432b 100644 --- a/sway-lib-std/src/alias.sw +++ b/sway-lib-std/src/alias.sw @@ -1,3 +1,4 @@ +//! Aliases for various types in Sway. library; /// The `SubId` type is simply an alias for `b256` that represents the sub identifier of a native asset. diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index 0f712a3bdfb..67dfa16c650 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -1,3 +1,4 @@ +//! The `AssetId` type used for interacting with an asset on the fuel network. library; use ::alias::SubId; diff --git a/sway-lib-std/src/b512.sw b/sway-lib-std/src/b512.sw index b5669c89a61..6a6e8c6f15c 100644 --- a/sway-lib-std/src/b512.sw +++ b/sway-lib-std/src/b512.sw @@ -1,5 +1,4 @@ -//! A wrapper around two `b256` types to support the usage of 64-byte values in Sway, -//! which are needed when working with public keys and signatures. +//! The `B512` type supports the usage of 64-byte values in Sway which are needed when working with public keys and signatures. library; use ::constants::ZERO_B256; diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index 6aad443ef20..f8d9725facd 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -1,4 +1,4 @@ -//! Base asset and zero address constants. +//! Definitions for constant values in Sway. library; /// A b256 of zero value. diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index fbd0e566003..5fcfab302db 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -1,4 +1,4 @@ -//! A wrapper around the `b256` type to help enhance type-safety. +//! The `ContractId` type used for interacting with contracts on the fuel network. library; use ::convert::From; diff --git a/sway-lib-std/src/execution.sw b/sway-lib-std/src/execution.sw index b35ffe7eb41..f5a03395793 100644 --- a/sway-lib-std/src/execution.sw +++ b/sway-lib-std/src/execution.sw @@ -1,3 +1,4 @@ +//! Helper functions to load and run external contract code. library; use ::contract_id::ContractId; diff --git a/sway-lib-std/src/iterator.sw b/sway-lib-std/src/iterator.sw index f53165647d6..51bfcb0d430 100644 --- a/sway-lib-std/src/iterator.sw +++ b/sway-lib-std/src/iterator.sw @@ -1,3 +1,4 @@ +//! The iterator trait to iterate over elements. library; use ::option::Option::{self, *}; diff --git a/sway-lib-std/src/string.sw b/sway-lib-std/src/string.sw index 719a3233ca0..a8432ee4869 100644 --- a/sway-lib-std/src/string.sw +++ b/sway-lib-std/src/string.sw @@ -1,3 +1,4 @@ +//! A UTF-8 encoded growable string. library; use ::assert::assert;