(&self, utf8: &'static str)
| 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) |