hara-native 0.1.13

HAL-free native host runtime and package launcher for Hara
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//! Decoding of typed VM constant-pool operands.

use super::Program;
use crate::core::Value;

/// Reads a string constant (the global-name operands).
pub(super) fn constant_string(program: &Program, index: u32) -> Option<&str> {
    match program.constants.get(index as usize) {
        Some(Value::String(value)) => Some(value.as_str()),
        _ => None,
    }
}