-
Notifications
You must be signed in to change notification settings - Fork 104
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
Type ProviderError
is not public
#184
Comments
Type exported in #185. |
You are not supposed to be able to use private type in declaration of public function. Rust is designed to prevent you to do this. You should reexport everything public in your The current implementation feels like an anti-pattern to me. |
I think you need to think this ahead and do a bit of global refactoring in your code exports archi. Not just export this one because I asked you. |
If you open a wider issue, listing all your sub-modules that need such a refacto, I can help by doing some contribution. |
The sequencer provider will be replaced with the JSON-RPC client eventually so I don't plan to make big changes on this part of the codebase. I believe it's common practice in Rust to selectively export types to rename stuff for the public API. But as always, you can fork the library and maintain your own version given the permissive licenses. |
It's a common practice to rename during export. I believe if you made this mistake once there, you probably did it somewhere else in the repo.
Your call |
I would certainly love to have this issue solved once and for all. But using the pattern as advised (uses |
The lint hasn't been implemented yet: |
@tdelabro Appreciate the suggestion but I feel like that isn't the most optimal solution... This library is modeled extensively after |
If the tradeoff is having something that works vs having long names it's a no-brainer for me. |
I just checked again and it seems the The thing is Rust does not consider this to be a "private" type since it's declared with |
In starknet-providers there is a
ProviderError
type being defined:It is not reexporte in
lib.rs
So I cannot use it in my code:
The return type of this expression is
Result<CallContractResult, ProviderError>
but I cannot do anything with it because it is not exported.I cannot wrap it in my own error type, neither can I write a
From
implementation, nor return it directly.What should be done ?
Probably export it too, or make the submodules public instead of keeping them private
The text was updated successfully, but these errors were encountered: