Struct casper_types::RuntimeArgs
source · pub struct RuntimeArgs(/* private fields */);
Expand description
Represents a collection of arguments passed to a smart contract.
Implementations§
source§impl RuntimeArgs
impl RuntimeArgs
sourcepub fn new() -> RuntimeArgs
pub fn new() -> RuntimeArgs
Create an empty RuntimeArgs
instance.
sourcepub fn try_new<F>(func: F) -> Result<RuntimeArgs, CLValueError>
pub fn try_new<F>(func: F) -> Result<RuntimeArgs, CLValueError>
A wrapper that lets you easily and safely create runtime arguments.
This method is useful when you have to construct a RuntimeArgs
with multiple entries,
but error handling at given call site would require to have a match statement for each
RuntimeArgs::insert
call. With this method you can use ? operator inside the closure and
then handle single result. When try_block
will be stabilized this method could be
deprecated in favor of using those blocks.
sourcepub fn insert<K, V>(&mut self, key: K, value: V) -> Result<(), CLValueError>
pub fn insert<K, V>(&mut self, key: K, value: V) -> Result<(), CLValueError>
Inserts a new named argument into the collection.
sourcepub fn insert_cl_value<K>(&mut self, key: K, cl_value: CLValue)
pub fn insert_cl_value<K>(&mut self, key: K, cl_value: CLValue)
Inserts a new named argument into the collection.
sourcepub fn named_args(&self) -> impl Iterator<Item = &NamedArg>
pub fn named_args(&self) -> impl Iterator<Item = &NamedArg>
Returns an iterator of references over all arguments in insertion order.
sourcepub fn named_args_mut(&mut self) -> impl Iterator<Item = &mut NamedArg>
pub fn named_args_mut(&mut self) -> impl Iterator<Item = &mut NamedArg>
Returns an iterator of mutable references over all arguments in insertion order.
sourcepub fn try_get_number(&self, name: &str) -> Result<U512, CLValueError>
pub fn try_get_number(&self, name: &str) -> Result<U512, CLValueError>
Returns the numeric value of name
arg from the runtime arguments or defaults to
0 if that arg doesn’t exist or is not an integer type.
Supported CLType
s for numeric conversions are U64, and U512.
Returns an error if parsing the arg fails.
Trait Implementations§
source§impl Clone for RuntimeArgs
impl Clone for RuntimeArgs
source§fn clone(&self) -> RuntimeArgs
fn clone(&self) -> RuntimeArgs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RuntimeArgs
impl Debug for RuntimeArgs
source§impl Default for RuntimeArgs
impl Default for RuntimeArgs
source§fn default() -> RuntimeArgs
fn default() -> RuntimeArgs
source§impl<'de> Deserialize<'de> for RuntimeArgs
impl<'de> Deserialize<'de> for RuntimeArgs
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl FromBytes for RuntimeArgs
impl FromBytes for RuntimeArgs
source§impl Hash for RuntimeArgs
impl Hash for RuntimeArgs
source§impl Ord for RuntimeArgs
impl Ord for RuntimeArgs
source§fn cmp(&self, other: &RuntimeArgs) -> Ordering
fn cmp(&self, other: &RuntimeArgs) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for RuntimeArgs
impl PartialEq for RuntimeArgs
source§impl PartialOrd for RuntimeArgs
impl PartialOrd for RuntimeArgs
source§impl Serialize for RuntimeArgs
impl Serialize for RuntimeArgs
source§impl ToBytes for RuntimeArgs
impl ToBytes for RuntimeArgs
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Eq for RuntimeArgs
impl StructuralPartialEq for RuntimeArgs
Auto Trait Implementations§
impl Freeze for RuntimeArgs
impl RefUnwindSafe for RuntimeArgs
impl Send for RuntimeArgs
impl Sync for RuntimeArgs
impl Unpin for RuntimeArgs
impl UnwindSafe for RuntimeArgs
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)