pub struct CallDef { /* private fields */ }Expand description
Represents a call definition, which includes the method name, runtime arguments, attached value, and mutability flag.
Implementations§
Source§impl CallDef
impl CallDef
Sourcepub fn new<T: ToString>(method: T, is_mut: bool, args: RuntimeArgs) -> Self
pub fn new<T: ToString>(method: T, is_mut: bool, args: RuntimeArgs) -> Self
Creates a new CallDef instance with the given method name and runtime arguments.
§Arguments
method- The method name.is_mut- Indicates if the call is mutable.args- The runtime arguments.
§Example
let method = "my_method";
let args = RuntimeArgs::new();
let call_def = CallDef::new(method, false, args);Sourcepub fn with_amount(self, amount: U512) -> Self
pub fn with_amount(self, amount: U512) -> Self
Sourcepub fn entry_point(&self) -> &str
pub fn entry_point(&self) -> &str
Returns a reference to the entry point name of the CallDef instance.
Sourcepub fn args(&self) -> &RuntimeArgs
pub fn args(&self) -> &RuntimeArgs
Returns a reference to the runtime arguments of the CallDef instance.
Sourcepub fn get<T: CLTyped + FromBytes>(&self, name: &str) -> Option<T>
pub fn get<T: CLTyped + FromBytes>(&self, name: &str) -> Option<T>
Retrieves a value from the runtime arguments of the CallDef instance.
§Arguments
name- The name of the value to retrieve.
§Returns
An Option containing the retrieved value, or None if the value does not exist or cannot be converted to the specified type.
§Example
let call_def = CallDef::new("my_method", false, RuntimeArgs::new());
let value: Option<u32> = call_def.get("my_value");Trait Implementations§
Source§impl<'de> Deserialize<'de> for CallDef
impl<'de> Deserialize<'de> for CallDef
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CallDef
impl StructuralPartialEq for CallDef
Auto Trait Implementations§
impl Freeze for CallDef
impl RefUnwindSafe for CallDef
impl Send for CallDef
impl Sync for CallDef
impl Unpin for CallDef
impl UnwindSafe for CallDef
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> 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> 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