MCPcopy Create free account
hub / github.com/hashintel/hash / interval_value

Function interval_value

libs/@local/hashql/eval/tests/orchestrator/inputs.rs:51–67  ·  view source on GitHub ↗

Constructs `Opaque(Interval, {end: .., start: ..})`. Field order in `push` calls does not matter; [`StructBuilder::finish`] sorts fields lexicographically.

(
    heap: &'heap Heap,
    symbols: &InternSet<'heap, [Symbol<'heap>]>,
    start: Value<'heap, &'heap Heap>,
    end: Value<'heap, &'heap Heap>,
)

Source from the content-addressed store, hash-verified

49/// Field order in `push` calls does not matter; [`StructBuilder::finish`]
50/// sorts fields lexicographically.
51fn interval_value<'heap>(
52 heap: &'heap Heap,
53 symbols: &InternSet<'heap, [Symbol<'heap>]>,
54 start: Value<'heap, &'heap Heap>,
55 end: Value<'heap, &'heap Heap>,
56) -> Value<'heap, &'heap Heap> {
57 let mut builder = StructBuilder::<_, 2>::new();
58 builder.push(sym::end, end);
59 builder.push(sym::start, start);
60
61 let inner = builder.finish(symbols, heap);
62
63 Value::Opaque(value::Opaque::new(
64 sym::path::Interval,
65 Rc::new_in(Value::Struct(inner), heap),
66 ))
67}
68
69/// Converts an [`AxisInterval`] to a `Value` representing a temporal
70/// interval: `Opaque(Interval, {start: <bound>, end: <bound>})`.

Callers 1

axis_interval_to_valueFunction · 0.85

Calls 4

pushMethod · 0.65
OpaqueClass · 0.50
StructClass · 0.50
finishMethod · 0.45

Tested by

no test coverage detected