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

Method from_raw

core/src/mem.rs:185–200  ·  view source on GitHub ↗

Decodes a raw register `value` of `etype` into a constant datum.

(
        value: u64,
        etype: ExprType,
        constants: &[ConstantDatum],
        heap: &Heap,
    )

Source from the content-addressed store, hash-verified

183
184 /// Decodes a raw register `value` of `etype` into a constant datum.
185 pub(crate) fn from_raw(
186 value: u64,
187 etype: ExprType,
188 constants: &[ConstantDatum],
189 heap: &Heap,
190 ) -> Self {
191 match etype {
192 ExprType::Boolean => Self::Boolean(value != 0),
193 ExprType::Double => Self::Double(f64::from_bits(value)),
194 ExprType::Integer => Self::Integer(value as i32),
195 ExprType::Text => {
196 let ptr = DatumPtr::from(value);
197 Self::Text(ptr.resolve_string(constants, heap).to_owned())
198 }
199 }
200 }
201}
202
203/// A heap-allocated value used at runtime.

Callers

nothing calls this directly

Calls 1

resolve_stringMethod · 0.80

Tested by

no test coverage detected