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§

source

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 the as_type.
  • The as_type does not match the type of the value variant.

Implementors§