MCPcopy Create free account
hub / github.com/cretz/stackparam / utf8_const

Function utf8_const

src/manip.rs:236–250  ·  view source on GitHub ↗
(class_file: &mut Classfile, str: &str)

Source from the content-addressed store, hash-verified

234}
235
236fn utf8_const(class_file: &mut Classfile, str: &str) -> usize {
237 for i in 0..class_file.constant_pool.constants.len() {
238 match class_file.constant_pool.constants[i] {
239 Constant::Utf8(ref bytes) => {
240 if bytes.as_slice() == str.as_bytes() {
241 return i;
242 }
243 },
244 _ => ()
245 }
246 }
247 let ret = class_file.constant_pool.constants.len();
248 class_file.constant_pool.constants.push(Constant::Utf8(str.as_bytes().to_vec()));
249 return ret;
250}
251
252#[allow(dead_code)]
253fn str_const(class_file: &mut Classfile, str: &str) -> usize {

Callers 9

add_param_info_fieldFunction · 0.85
replace_elem_to_stringFunction · 0.85
add_stack_params_fieldFunction · 0.85
update_fill_methodFunction · 0.85
replace_our_trace_methodFunction · 0.85
str_constFunction · 0.85
class_constFunction · 0.85
name_and_type_constFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected