-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: Add async builders for view_*
functions
#218
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntoFuture stuff looks correct to me.
What caught my eye is that we are enduring some pain (and even causing the users paint) to be generic over &str
vs String
. Did we measured that using &str
gives us a measurable performance improvements? If we did not, I suggest sticking with owned String
and clone, and removing extra generics from the API.
This adds the async builder
Query
which allows doing view calls into contract state, account, access keys, code, the view function call, and block. This usesIntoFuture
to allow calling into.await
at any point in the builder. Note, thatQuery
builder takes a generic<T>
for the method likeViewState
since we can define custom builder functions per method type by doingimpl Query<ViewState> { ... }
cc @matklad if you want to review my use of
IntoFuture
since you initially suggested it