tinymist_analysis::ty

Trait TypeInterface

Source
pub trait TypeInterface {
    // Required methods
    fn bone(&self) -> &Interned<NameBone>;
    fn interface(&self) -> impl Iterator<Item = (&Interned<str>, &Ty)>;
    fn field_by_bone_offset(&self, idx: usize) -> Option<&Ty>;

    // Provided method
    fn field_by_name(&self, name: &Interned<str>) -> Option<&Ty> { ... }
}
Expand description

A common type kinds for those types that has fields (Abstracted record type).

Required Methods§

Source

fn bone(&self) -> &Interned<NameBone>

Get the bone of a record. See NameBone for more details.

Source

fn interface(&self) -> impl Iterator<Item = (&Interned<str>, &Ty)>

Iterate over the fields of a record.

Source

fn field_by_bone_offset(&self, idx: usize) -> Option<&Ty>

Get the field by bone offset.

Provided Methods§

Source

fn field_by_name(&self, name: &Interned<str>) -> Option<&Ty>

Get the field by name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§