(&self, seq: S)
| 95 | { |
| 96 | #[inline] |
| 97 | pub fn get<S>(&self, seq: S) -> Option<Index> |
| 98 | where |
| 99 | S: AsRef<[T]>, |
| 100 | { |
| 101 | let seq = seq.as_ref(); |
| 102 | let Self { |
| 103 | dedup, |
| 104 | hasher, |
| 105 | ends, |
| 106 | buffer, |
| 107 | marker: _, |
| 108 | } = self; |
| 109 | let hash = make_hash(hasher, seq); |
| 110 | dedup |
| 111 | .raw_entry() |
| 112 | .from_hash(hash, |index| { |
| 113 | // SAFETY: This is safe because we only operate on indices that |
| 114 | // we receive from our backend making them valid. |
| 115 | let (from, to) = unsafe { index_to_span_unchecked(ends, index.to_usize()) }; |
| 116 | seq == &buffer[from..to] |
| 117 | }) |
| 118 | .map(|(&index, &())| index) |
| 119 | } |
| 120 | |
| 121 | #[inline] |
| 122 | pub fn get_or_intern<S>(&mut self, seq: S) -> Index |
no test coverage detected