pub enum DefKind {
TypeAlias,
Interface,
Class,
Enum,
Namespace,
}Expand description
Kind of type definition.
Affects evaluation and subtype checking behavior:
| Kind | Expansion | Nominal | Example |
|---|---|---|---|
| TypeAlias | Always expand | No | type Foo = number |
| Interface | Lazy expand | No | interface Point { x: number } |
| Class | Lazy expand | Yes (with brand) | class Foo {} |
| Enum | Special handling | Yes | enum Color { Red, Green } |
| Namespace | Export lookup | No | namespace NS { export type T = number } |
Variants§
TypeAlias
Type alias: always expand (transparent).
type Foo<T> = T | null
Interface
Interface: keep opaque until needed.
interface Point { x: number; y: number }
Class
Class: opaque with nominal brand.
class User { constructor(public name: string) {} }
Enum
Enum: special handling for member access.
enum Direction { Up, Down, Left, Right }
Namespace
Namespace/Module: container for exported types and values.
namespace NS { export type T = number }
Trait Implementations§
impl Copy for DefKind
impl Eq for DefKind
impl StructuralPartialEq for DefKind
Auto Trait Implementations§
impl Freeze for DefKind
impl RefUnwindSafe for DefKind
impl Send for DefKind
impl Sync for DefKind
impl Unpin for DefKind
impl UnsafeUnpin for DefKind
impl UnwindSafe for DefKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.