pub struct TransactionPayloadDecoder<'a> { /* private fields */ }
Expand description
Decoder for transaction payload created using TransactionPayloadBuilder
.
Implementations§
Source§impl<'a> TransactionPayloadDecoder<'a>
impl<'a> TransactionPayloadDecoder<'a>
Sourcepub fn new(
payload: &'a [u128],
external_args_buffer: &'a mut [*mut c_void],
output_buffer: &'a mut [MaybeUninit<u128>],
output_buffer_offsets: &'a mut [MaybeUninit<(u32, u32)>],
map_context: fn(TransactionMethodContext) -> MethodContext,
) -> Self
pub fn new( payload: &'a [u128], external_args_buffer: &'a mut [*mut c_void], output_buffer: &'a mut [MaybeUninit<u128>], output_buffer_offsets: &'a mut [MaybeUninit<(u32, u32)>], map_context: fn(TransactionMethodContext) -> MethodContext, ) -> Self
Create new instance.
The size of external_args_buffer
defines max number of bytes allocated for ExternalArgs
,
which impacts the number of arguments that can be represented by ExternalArgs
. The size is
specified in pointers with #[slot]
argument using one pointer, #[input]
two pointers and
#[output]
three pointers each.
The size of output_buffer
defines how big the total size of #[output]
and return values
could be in all methods of the payload together.
The size of output_buffer_offsets
defines how many #[output]
arguments and return values
could exist in all methods of the payload together.
Source§impl<'a> TransactionPayloadDecoder<'a>
impl<'a> TransactionPayloadDecoder<'a>
Sourcepub fn decode_next_method(
&mut self,
) -> Result<Option<PreparedMethod<'_>>, TransactionPayloadDecoderError>
pub fn decode_next_method( &mut self, ) -> Result<Option<PreparedMethod<'_>>, TransactionPayloadDecoderError>
Decode the next method (if any) in the payload
Sourcepub unsafe fn decode_next_method_unchecked(
&mut self,
) -> Option<PreparedMethod<'_>>
pub unsafe fn decode_next_method_unchecked( &mut self, ) -> Option<PreparedMethod<'_>>
Decode the next method (if any) in the payload without checking size.
§Safety
Must be used with trusted input created using TransactionPayloadBuilder
or pre-verified
using Self::decode_next_method()
earlier.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TransactionPayloadDecoder<'a>
impl<'a> RefUnwindSafe for TransactionPayloadDecoder<'a>
impl<'a> !Send for TransactionPayloadDecoder<'a>
impl<'a> !Sync for TransactionPayloadDecoder<'a>
impl<'a> Unpin for TransactionPayloadDecoder<'a>
impl<'a> !UnwindSafe for TransactionPayloadDecoder<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more