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

source

pub fn new() -> Self

source

pub fn push_argument_bytes(&mut self, arg_bytes: &[u8])

source

pub fn num_args(&self) -> usize

source

pub fn arg_lengths_bytes_ptr(&self) -> *const u8

source

pub fn arg_data_ptr(&self) -> *const u8

source

pub fn arg_data(&self) -> &[u8]

returns the raw arg data

source

pub fn arg_lengths(&self) -> &[usize]

returns the raw arg data lengths

source

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.

source

pub fn is_empty(&self) -> bool

source

pub fn concat(self, other: ArgBuffer) -> Self

Concatenates 2 ArgBuffer. Consumes both arguments in the process.

Trait Implementations§

source§

impl Clone for ArgBuffer

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for ArgBuffer

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&[BoxedBytes]> for ArgBuffer

source§

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,

source§

fn from(arg_buffer: &ArgBuffer) -> Self

Converts to this type from the input type.
source§

impl<M> From<&ManagedArgBuffer<M>> for ArgBuffer
where M: ManagedTypeApi + 'static,

source§

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,

source§

fn from(arg_buffer: ArgBuffer) -> Self

Converts to this type from the input type.
source§

impl TopEncodeOutput for &mut ArgBuffer

§

type NestedBuffer = Vec<u8>

Type of NestedEncodeOutput that can be spawned to gather serializations of children.
source§

fn set_slice_u8(self, bytes: &[u8])

source§

fn start_nested_encode(&self) -> Self::NestedBuffer

source§

fn finalize_nested_encode(self, nb: Self::NestedBuffer)

source§

fn set_u64(self, value: u64)

source§

fn set_i64(self, value: i64)

source§

fn supports_specialized_type<T>() -> bool
where T: TryStaticCast,

source§

fn set_specialized<T, H>( self, _value: &T, h: H ) -> Result<(), <H as EncodeErrorHandler>::HandledErr>

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§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.