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
Source§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.Source§impl TypeAbi for ArgBuffer
impl TypeAbi for ArgBuffer
type Unmanaged = ArgBuffer
fn type_name_rust() -> String
fn type_names() -> TypeNames
Source§fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
A type can provide more than its own name.
For instance, a struct can also provide the descriptions of the type of its fields.
TypeAbi doesn’t care for the exact accumulator type,
which is abstracted by the TypeDescriptionContainer trait.
impl TypeAbiFrom<ArgBuffer> for ArgBuffer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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