Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SDK-1950
Description
For maintainable better user experience, this PR made some fundamental changes to the inter-canister call API (
call.rs
).Constructors
Replaced
Call::new()
withCall::bounded_wait()
andCall::unbounded_wait()
.Execution
impl IntoFuture for Call
. So that aCall
can be.await
directly instead of invoking thecall*
method. No awkwardCall::new().call()
syntax.Replaced the oneway execution with the shorter and clearer
Call::oneway()
method.After a
Call
is executed byawait
, acandid()
/candid_tuple()
method can be chained to decode the response.Errors
Error
: The top-level error type encapsulating all possible errors.CallFailed
: Errors related to the execution of the call itself.CallRejected
: Errors when an inter-canister call is rejected.CallPerformFailed
: Errors when theic0.call_perform
operation fails.CandidDecodeFailed
: Errors when the response cannot be decoded as Candid.Also a
CallErrorExt
trait is added and implemented for all error types above.The trait has two methods:
is_clean_reject()
is_immediately_retryable()
Note
The
CallErrorExt
trait must be explicitly imported to access its methods.How Has This Been Tested?
e2e tests:
call.rs
Checklist: