#[repr(C)]pub struct TupleSchema {
pub descriptors: &'static [*const TypeDescriptor],
}Expand description
The static shape of a tuple: an ordered list of element descriptors (positional,
no names). Leaked to &'static once per distinct shape by the codegen.
A slot may be null, meaning the compiler had no static type for that
element — the same honest encoding a Vec’s element descriptor already uses
(var m = Map() generalizes at the var, so a program that never inspects
the elements leaves them unresolved). The arity is still exact, so nothing
is lost; the value’s own descriptor answers for a null slot, and it is
read from the object’s header, so it is never wrong.
Fields§
§descriptors: &'static [*const TypeDescriptor]Implementations§
Source§impl TupleSchema
impl TupleSchema
Sourcepub fn same_shape(&self, other: &TupleSchema) -> bool
pub fn same_shape(&self, other: &TupleSchema) -> bool
Whether two schemas describe the same tuple shape: equal arity and the same element descriptor in every slot.
Shape, not allocation identity. Schemas are interned per shape within
a producer, but there are three producers — the codegen’s
tuple_schema_for cache, the runtime’s point_schema, and the input
parser — so two of them minting an (Int, Int) must still yield tuples
that compare equal. Descriptors are static, so slot comparison is
pointer comparison (ADR-038).
A null slot is unknown, not a fourth type: it agrees with whatever
the other side says, and the values decide (see tuple_equals, which
compares the two objects’ own descriptors for such a slot).