Trait eos_rs::api::script_vars::UnwrapScriptVariableValueAs
source · pub trait UnwrapScriptVariableValueAs<T> {
// Required method
fn unwrap_as(self, as_type: ScriptVariableValueType) -> T;
}
Expand description
This trait can be used to simply convert script variable values to their
primitive types. See ScriptVariableRead::value
for an example.
Required Methods§
sourcefn unwrap_as(self, as_type: ScriptVariableValueType) -> T
fn unwrap_as(self, as_type: ScriptVariableValueType) -> T
Force cast the variable into the given type.
This will panic if:
- The type
T
does not match the type represented by theas_type
. - The
as_type
does not match the type of the value variant.