rant/stdlib/
convert.rs

1use super::*;
2
3pub fn to_int(vm: &mut VM, value: RantValue) -> RantStdResult {
4  vm.cur_frame_mut().write(value.into_int_value());
5  Ok(())
6}
7
8pub fn to_float(vm: &mut VM, value: RantValue) -> RantStdResult {
9  vm.cur_frame_mut().write(value.into_float_value());
10  Ok(())
11}
12
13pub fn to_string(vm: &mut VM, value: RantValue) -> RantStdResult {
14  vm.cur_frame_mut().write(value.into_string_value());
15  Ok(())
16}
17
18pub fn to_bool(vm: &mut VM, value: RantValue) -> RantStdResult {
19  vm.cur_frame_mut().write(value.into_bool_value());
20  Ok(())
21}
22
23pub fn to_list(vm: &mut VM, collection: RantValue) -> RantStdResult {
24  vm.cur_frame_mut().write(collection.into_list_value());
25  Ok(())
26}
27
28pub fn to_tuple(vm: &mut VM, collection: RantValue) -> RantStdResult {
29  vm.cur_frame_mut().write(collection.into_tuple_value());
30  Ok(())
31}