You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our library is defined in other.sw, however we have some helper functions in other/lib.sw we would like to keep private. This currently results in the following error:
With the following project structure this does not occur:
library;
modlib; // Not a public libraryuselib::PrivateStruct; // Error occurs here// Public functionpubfnfoo() {
letmy_struct=PrivateStruct { val:0 };
}
Example other/lib.sw:
library;
pubstructPrivateStruct {
pubval:u64,
}
The text was updated successfully, but these errors were encountered:
bitzoic
added
bug
Something isn't working
compiler
General compiler. Should eventually become more specific as the issue is triaged
labels
Mar 25, 2024
## Type of change
<!--Delete points that do not apply-->
- Improvement (refactoring, restructuring repository, cleaning tech
debt, ...)
## Changes
The following changes have been made:
- All imports have changed from multiple imports to a single imports
using the following:
```sway
libraries = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.4.0" }
```
From there your desired library may be imported:
```sway
use libraries::ownership::only_owner;
```
- Many of the primary functions have been moved out of the library's
folder. The documentation for this will be moved into a book in a follow
up PR.
- There are a number of private modules that are now exposed until
FuelLabs/sway#5765 is resolved.
## Notes
- This should get `forc doc` to produce a single document containing all
libraries rather than multiple documents for each library.
## Related Issues
<!--Delete everything after the "#" symbol and replace it with a number.
No spaces between hash and number-->
Closes#141
When creating a folder structure for libraries, we have the following example:
Our library is defined in
other.sw
, however we have some helper functions inother/lib.sw
we would like to keep private. This currently results in the following error:With the following project structure this does not occur:
Example
main.sw
:Example
other.sw
:Example
other/lib.sw
:The text was updated successfully, but these errors were encountered: