Struct multiversx_sc::types::heap::ArgBuffer
source · pub struct ArgBuffer { /* private fields */ }
Expand description
Helper structure for providing arguments to all SC call functions other than async_call_raw. It keeps argument lengths separately from the argument data itself. Argument data is concatenated into a single byte buffer.
Implementations§
source§impl ArgBuffer
impl ArgBuffer
pub fn new() -> Self
pub fn push_argument_bytes(&mut self, arg_bytes: &[u8])
pub fn num_args(&self) -> usize
pub fn arg_lengths_bytes_ptr(&self) -> *const u8
pub fn arg_data_ptr(&self) -> *const u8
sourcepub fn arg_lengths(&self) -> &[usize]
pub fn arg_lengths(&self) -> &[usize]
returns the raw arg data lengths
sourcepub fn for_each_arg<F: FnMut(&[u8])>(&self, f: F)
pub fn for_each_arg<F: FnMut(&[u8])>(&self, f: F)
Quick for-each using closures. TODO: also write an Iterator at some point, but beware of wasm bloat.
pub fn is_empty(&self) -> bool
Trait Implementations§
source§impl From<&[BoxedBytes]> for ArgBuffer
impl From<&[BoxedBytes]> for ArgBuffer
source§fn from(raw_args: &[BoxedBytes]) -> Self
fn from(raw_args: &[BoxedBytes]) -> Self
Converts to this type from the input type.
source§impl<M> From<&ArgBuffer> for ManagedArgBuffer<M>where
M: ManagedTypeApi,
impl<M> From<&ArgBuffer> for ManagedArgBuffer<M>where
M: ManagedTypeApi,
source§impl<M> From<&ManagedArgBuffer<M>> for ArgBufferwhere
M: ManagedTypeApi + 'static,
impl<M> From<&ManagedArgBuffer<M>> for ArgBufferwhere
M: ManagedTypeApi + 'static,
source§fn from(managed_arg_buffer: &ManagedArgBuffer<M>) -> Self
fn from(managed_arg_buffer: &ManagedArgBuffer<M>) -> Self
Converts to this type from the input type.
source§impl<M> From<ArgBuffer> for ManagedArgBuffer<M>where
M: ManagedTypeApi,
impl<M> From<ArgBuffer> for ManagedArgBuffer<M>where
M: ManagedTypeApi,
source§impl TopEncodeOutput for &mut ArgBuffer
impl TopEncodeOutput for &mut ArgBuffer
§type NestedBuffer = Vec<u8>
type NestedBuffer = Vec<u8>
Type of
NestedEncodeOutput
that can be spawned to gather serializations of children.fn set_slice_u8(self, bytes: &[u8])
fn start_nested_encode(&self) -> Self::NestedBuffer
fn finalize_nested_encode(self, nb: Self::NestedBuffer)
fn set_u64(self, value: u64)
fn set_i64(self, value: i64)
fn supports_specialized_type<T>() -> boolwhere
T: TryStaticCast,
source§fn set_specialized<T, H>(
self,
_value: &T,
h: H
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
T: TryStaticCast,
H: EncodeErrorHandler,
fn set_specialized<T, H>(
self,
_value: &T,
h: H
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
T: TryStaticCast,
H: EncodeErrorHandler,
Allows special handling of special types.
Also requires an alternative serialization, in case the special handling is not covered.
The alternative serialization,
else_serialization
is only called when necessary and
is normally compiled out via monomorphization.Auto Trait Implementations§
impl CodecFromSelf for ArgBuffer
impl Freeze for ArgBuffer
impl RefUnwindSafe for ArgBuffer
impl Send for ArgBuffer
impl Sync for ArgBuffer
impl Unpin for ArgBuffer
impl UnwindSafe for ArgBuffer
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