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
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) -> 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.Source§impl TypeAbi for ArgBuffer
impl TypeAbi for ArgBuffer
type Unmanaged = ArgBuffer
fn type_name_rust() -> TypeName
fn type_names() -> TypeNames
Source§fn provide_type_descriptions<TDC: TypeDescriptionContainer>(
accumulator: &mut TDC,
)
fn provide_type_descriptions<TDC: TypeDescriptionContainer>( accumulator: &mut TDC, )
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