Resolves this pointer and returns the string it points to. Panics if the pointed-to datum is not a `Text` value.
(
&self,
constants: &'b [ConstantDatum],
heap: &'b Heap,
)
| 311 | /// |
| 312 | /// Panics if the pointed-to datum is not a `Text` value. |
| 313 | pub(crate) fn resolve_string<'b>( |
| 314 | &self, |
| 315 | constants: &'b [ConstantDatum], |
| 316 | heap: &'b Heap, |
| 317 | ) -> &'b str { |
| 318 | match self { |
| 319 | DatumPtr::Constant(index) => match &constants[unchecked_u24_as_usize(*index)] { |
| 320 | ConstantDatum::Text(s) => s, |
| 321 | _ => panic!("Constant pointer does not point to a Text value"), |
| 322 | }, |
| 323 | DatumPtr::Heap(index) => match heap.get(unchecked_u24_as_usize(*index)) { |
| 324 | HeapDatum::Text(s) => s, |
| 325 | _ => panic!("Heap pointer does not point to a Text value"), |
| 326 | }, |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /// Extracts the heap index from this pointer. |
| 331 | /// |
no test coverage detected