rune::runtime

Function to_const_value

Source
pub fn to_const_value(
    value: impl ToConstValue,
) -> Result<ConstValue, RuntimeError>
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);