pub unsafe extern "C" fn pm_parser_constant_at(
parser: *const pm_parser_t,
index: usize,
) -> *const pm_constant_tExpand description
Returns the constant at the given index in the constant pool associated with the given parser. Together with pm_constant_id_index, this lets a caller build a cache with one entry per constant and then find the entry for any constant id, as in:
size_t size = pm_parser_constants_size(parser);
for (size_t index = 0; index < size; index++) {
cache[index] = convert(pm_parser_constant_at(parser, index));
}
value = cache[pm_constant_id_index(constant_id)];For any constant id, pm_parser_constant_at(parser, pm_constant_id_index(constant_id)) is pm_parser_constant(parser, constant_id).
@param parser the parser whose constant pool we want to look up from @param index the index of the constant, which must be less than pm_parser_constants_size(parser) @returns a pointer to the constant at the given index