Skip to main content

RecordSchema

Struct RecordSchema 

Source
#[repr(C)]
pub struct RecordSchema { pub identity: SchemaIdentity, pub fields: &'static [RecordField], }
Expand description

The static shape of a record: what type it is, plus an ordered list of named fields, each with its value descriptor. Allocated in the JIT generation that built it (or, for parser templates, in the runtime’s schema registry).

Fields§

§identity: SchemaIdentity§fields: &'static [RecordField]

Implementations§

Source§

impl RecordSchema

Source

pub fn arity(&self) -> usize

The number of fields in this record shape.

Source

pub fn same_type(&self, other: &RecordSchema) -> bool

Whether two schemas describe the same record type — the same identity and the same field shape.

Type identity, not allocation identity. Schemas are interned per def within a generation, and there are three producers — every JIT generation, the runtime’s parser registry, and test fixtures — so a pa.schema != pb.schema test would call two records of one type unequal as soon as they came from different compiles. The debugger depends on this directly: p evaluates in its own module, and its result is compared against program values.

The shape is compared even for a Nominal pair, which the name alone would settle. It costs an arity check and a slice walk, and it is what keeps two instantiations of a generic record (one name, different field descriptors) apart, and what stops a debugger session that reloaded a changed definition from comparing old values field-wise through new descriptors.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.