pub struct CallbackClosure<M>where
M: ManagedTypeApi + ErrorApi,{ /* private fields */ }
Expand description
Object that encodes full async callback data.
Should not be created manually, we have auto-generated call proxies that will create this object in a type-safe manner.
How it functions:
- With the old async call mechanism, this data is serialized to storage.
- With the new promises framework, the VM handles this data.
In both cases the framework hides all the magic, the developer shouldn’t worry about it.
Implementations§
Source§impl<M: ManagedTypeApi + ErrorApi> CallbackClosure<M>
impl<M: ManagedTypeApi + ErrorApi> CallbackClosure<M>
pub fn new(callback_name: &'static str) -> Self
pub fn push_endpoint_arg<T: TopEncodeMulti>(&mut self, endpoint_arg: &T)
pub fn save_to_storage<A: BlockchainApi + StorageWriteApi>(&self)
Trait Implementations§
Source§impl<M> TopEncode for CallbackClosure<M>where
M: ManagedTypeApi + ErrorApi,
impl<M> TopEncode for CallbackClosure<M>where
M: ManagedTypeApi + ErrorApi,
Source§fn top_encode_or_handle_err<O, H>(
&self,
output: O,
__h__: H,
) -> Result<(), H::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
__h__: H,
) -> Result<(), H::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Version of
top_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
Attempt to serialize the value to ouput.
Source§impl<Api> TxAsyncCallCallback<Api> for CallbackClosure<Api>where
Api: CallTypeApi + StorageWriteApi,
impl<Api> TxAsyncCallCallback<Api> for CallbackClosure<Api>where
Api: CallTypeApi + StorageWriteApi,
fn save_callback_closure_to_storage(&self)
Source§impl<Api> TxPromisesCallback<Api> for CallbackClosure<Api>where
Api: CallTypeApi,
impl<Api> TxPromisesCallback<Api> for CallbackClosure<Api>where
Api: CallTypeApi,
fn callback_name(&self) -> &'static str
fn overwrite_with_serialized_args( &self, cb_closure_args_serialized: &mut ManagedBuffer<Api>, )
fn gas_for_callback(&self) -> u64
Source§impl<Api> TxResultHandler<TxScEnv<Api>> for CallbackClosure<Api>where
Api: CallTypeApi,
impl<Api> TxResultHandler<TxScEnv<Api>> for CallbackClosure<Api>where
Api: CallTypeApi,
type OriginalResult = ()
Auto Trait Implementations§
impl<M> Freeze for CallbackClosure<M>
impl<M> RefUnwindSafe for CallbackClosure<M>
impl<M> Send for CallbackClosure<M>
impl<M> Sync for CallbackClosure<M>
impl<M> Unpin for CallbackClosure<M>
impl<M> UnwindSafe for CallbackClosure<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> SCCodec for Twhere
T: TopEncode,
impl<T> SCCodec for Twhere
T: TopEncode,
fn fmt<F>(&self, f: &mut F)where
F: FormatByteReceiver,
Source§impl<T> TopEncodeMulti for Twhere
T: TopEncode,
impl<T> TopEncodeMulti for Twhere
T: TopEncode,
Source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
Version of
top_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
Attempt to serialize the value to ouput.