MCPcopy Create free account
hub / github.com/endbasic/endbasic / deref_string

Function deref_string

core/src/callable.rs:739–749  ·  view source on GitHub ↗

Reads a string from the register at `index`, asserting that `vtype` is `Text`.

(
    regs: &[u64],
    index: usize,
    vtype: ExprType,
    constants: &'a [ConstantDatum],
    heap: &'a Heap,
)

Source from the content-addressed store, hash-verified

737
738/// Reads a string from the register at `index`, asserting that `vtype` is `Text`.
739fn deref_string<'a>(
740 regs: &[u64],
741 index: usize,
742 vtype: ExprType,
743 constants: &'a [ConstantDatum],
744 heap: &'a Heap,
745) -> &'a str {
746 assert_eq!(ExprType::Text, vtype);
747 let ptr = DatumPtr::from(regs[index]);
748 ptr.resolve_string(constants, heap)
749}
750
751/// Dereferences this register reference as an array and returns its contents.
752fn array_data<'a>(regs: &'a [u64], index: usize, heap: &'a Heap) -> &'a ArrayData {

Callers 1

deref_stringMethod · 0.85

Calls 1

resolve_stringMethod · 0.80

Tested by

no test coverage detected