Skip to main content

TypeKind

Enum TypeKind 

Source
pub enum TypeKind {
    Interface {
        generics: Vec<String>,
        methods: BTreeMap<String, MethodSig>,
        properties: BTreeMap<String, PropertySig>,
        index: Option<IndexSignature>,
        dispatch: Dispatch,
        doc: Option<DocComment>,
    },
    NumberEnum {
        variants: Vec<(String, f64)>,
        doc: Option<DocComment>,
    },
    StringEnum {
        variants: Vec<(String, String)>,
        doc: Option<DocComment>,
    },
    Alias {
        generics: Vec<String>,
        ty: Type,
        doc: Option<DocComment>,
    },
    Class {
Show 14 fields generics: Vec<String>, fields: BTreeMap<String, FieldSig>, narrowing_checks: BTreeMap<String, FieldNarrowingCheck>, methods: BTreeMap<String, MethodSig>, method_visibility: BTreeMap<String, Visibility>, accessors: Vec<AccessorSig>, constructor: Vec<Param>, constructor_visibility: Visibility, statics: BTreeMap<String, MethodSig>, static_visibility: BTreeMap<String, Visibility>, static_fields: BTreeMap<String, FieldSig>, extends: Option<ClassExtends>, implements: Vec<MangledName>, doc: Option<DocComment>,
}, }

Variants§

§

Interface

Single declaration site per name — no reopening, no extends in v1. Codegen has no Wasm representation for the interface itself; it only drives method dispatch.

Fields

§generics: Vec<String>
§properties: BTreeMap<String, PropertySig>

Read via expr.name (not expr.name()). Writable unless the declaration carries a readonly modifier (PropertySig.readonly).

§dispatch: Dispatch
§

NumberEnum

Auto-numbered at bind time (source AST stores None; bound form holds the resolved value).

Fields

§variants: Vec<(String, f64)>
§

StringEnum

Every variant must have an explicit initializer; auto-numbering doesn’t apply.

Fields

§variants: Vec<(String, String)>
§

Alias

Stored ty is the fully resolved alias body. At use sites the inferer wraps the result in Type::Alias { name, args, ty } so the alias label flows through Display.

Fields

§generics: Vec<String>
§ty: Type
§

Class

A class declaration. Nominal (Type::ClassRef keys on the symbol’s mangled name). Single inheritance via extends; implements is structural conformance only. Privacy is enforced at the access site (module-scoped), not by stripping here. Methods are always vtable-dispatched (overrides slot into the inherited index), so there is no per-class dispatch — unlike Interface, where the prelude opts into direct/static dispatch.

Fields

§generics: Vec<String>

Class-level type parameters, erased at codegen (every T-typed slot is a boxed value slot). Substituted at use sites from the ClassRef’s args.

§narrowing_checks: BTreeMap<String, FieldNarrowingCheck>

Runtime read guards for fields whose declaration narrows an inherited slot. Carried across packages because the consumer reconstructs the class layout and emits its reads independently.

§method_visibility: BTreeMap<String, Visibility>

Per-method visibility, keyed alongside methods (kept separate so MethodSig stays shared with interfaces, which have no visibility).

§accessors: Vec<AccessorSig>

Accessor functions (get/set) — one entry each, mirroring the typed AST. A property’s read type (getter) and write type (setter) are independent; the property itself is also in fields (its read type) for the type system. Carries the setter’s parameter name + type so the public surface (docs, .d.ts) renders the full signature.

§constructor: Vec<Param>

Constructor parameter signature (no return type).

§constructor_visibility: Visibility

A private constructor may be called, and the class extended, only in the module that declares the class.

§statics: BTreeMap<String, MethodSig>

Static methods — self-less functions dispatched by name on the class object (Class#static#name), never through the vtable. Inherited down the extends chain by name resolution at the use site.

§static_visibility: BTreeMap<String, Visibility>

Per-static-method visibility, mirroring method_visibility.

§static_fields: BTreeMap<String, FieldSig>

Static fields, backed by module globals (Class#static#name). readonly is declaration-driven; a mutable one is writable through the class name.

§extends: Option<ClassExtends>

Resolved parent class, if any.

§implements: Vec<MangledName>

Resolved interfaces this class declares it implements.

Trait Implementations§

Source§

impl Clone for TypeKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TypeKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TypeKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TypeKind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more