pub struct TupleOpSignature {
pub name: String,
pub shape: Vec<TypeId>,
pub tuple_operand_index: usize,
pub operand_type_ids: Vec<TypeId>,
pub op_fn: OpFn,
}Expand description
A signature for an operator/function whose selected operand is a tuple.
Matches when the operand at tuple_operand_index (0-based, in the same
stack order [DynSegment::peek_stack_infos] returns) is a tuple whose
element TypeIds equal shape, in order, and every other peeked operand’s
flat TypeId equals the corresponding entry in operand_type_ids (the
entry at tuple_operand_index in operand_type_ids is never read).
operand_type_ids must have an entry for every non-tuple operand
position: a missing entry (out of bounds, including an entirely empty
vector when there are non-tuple operands) simply never matches, rather
than panicking — it is only safe to omit the whole vector when
tuple_operand_index is the only operand position.
shape is flat: an element position that is itself a nested tuple can
only be recorded as a flat tuple TypeId, which matches any nested
tuple at that position regardless of its inner arity or element types.
Two registrations that would only differ by that inner shape are not
distinguishable — do not rely on nested-tuple precision at this level.
Fields§
§name: StringOperator/function name this signature is registered under.
shape: Vec<TypeId>Expected element TypeIds, in order, for the tuple-shaped operand.
See the struct-level note on nested tuples.
tuple_operand_index: usizeWhich peeked operand position must be the tuple.
operand_type_ids: Vec<TypeId>Flat TypeIds expected for the non-tuple operands, in stack order
(the tuple_operand_index entry is ignored).
op_fn: OpFnFunction that pushes the operation onto the segment.