Struct multiversx_sc_snippets::imports::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() -> ArgBuffer
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>(&self, f: F)
pub fn for_each_arg<F>(&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]) -> ArgBuffer
fn from(raw_args: &[BoxedBytes]) -> ArgBuffer
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§fn from(arg_buffer: &ArgBuffer) -> ManagedArgBuffer<M>
fn from(arg_buffer: &ArgBuffer) -> ManagedArgBuffer<M>
Converts to this type from the input type.
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>) -> ArgBuffer
fn from(managed_arg_buffer: &ManagedArgBuffer<M>) -> ArgBuffer
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§fn from(arg_buffer: ArgBuffer) -> ManagedArgBuffer<M>
fn from(arg_buffer: ArgBuffer) -> ManagedArgBuffer<M>
Converts to this type from the input type.
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 ) -> <&mut ArgBuffer as TopEncodeOutput>::NestedBuffer
fn finalize_nested_encode( self, nb: <&mut ArgBuffer as TopEncodeOutput>::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.impl<M> TypeAbiFrom<ManagedArgBuffer<M>> for ArgBufferwhere
M: ManagedTypeApi,
Auto Trait Implementations§
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> InterpretableFrom<&T> for Twhere
T: Clone,
impl<T> InterpretableFrom<&T> for Twhere
T: Clone,
fn interpret_from(from: &T, _context: &InterpreterContext) -> T
source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> 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>
Converts
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>
Converts
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