rune::runtime

Function from_const_value

Source
pub fn from_const_value<T>(
    value: impl IntoConstValue,
) -> Result<T, RuntimeError>
where T: FromConstValue,
Expand description

Convert something into a ConstValue.

ยงExamples

let value = rune::to_const_value((i32::MIN, u64::MAX))?;
let (a, b) = rune::from_const_value::<(i32, u64)>(value)?;

assert_eq!(a, i32::MIN);
assert_eq!(b, u64::MAX);