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

Method find_ut8_index

src/bytecode/classfile.rs:101–113  ·  view source on GitHub ↗
(&self, utf8: &'static str)

Source from the content-addressed store, hash-verified

99 }
100
101 pub fn find_ut8_index(&self, utf8: &'static str) -> Option<usize> {
102 for i in 0..self.constants.len() {
103 match self.constants[i] {
104 Constant::Utf8(ref bytes) => {
105 if bytes.as_slice() == utf8.as_bytes() {
106 return Some(i);
107 }
108 },
109 _ => ()
110 }
111 }
112 None
113 }
114
115 pub fn get_utf8_index(&self, utf8: &'static str) -> usize {
116 self.find_ut8_index(utf8).unwrap_or(0)

Callers 1

get_utf8_indexMethod · 0.80

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected