pub enum KtClassKind {
Class {
modifier: Option<KtClassModifier>,
ctor: Vec<KtCtorParam>,
},
Data {
ctor: Vec<KtCtorParam>,
},
Value {
field: Box<KtCtorParam>,
},
Enum {
ctor: Vec<KtCtorParam>,
entries: Vec<KtEnumEntry>,
},
Object,
Interface,
SealedInterface,
DataObject,
}Expand description
The kind of class-like declaration, carrying whatever that kind — and only that kind — can hold.
Primary-constructor parameters live here rather than on KtClass so the
shapes Kotlin rejects cannot be built at all: an object has no field to
put them in, a value class holds exactly one, and a data class is
constructed with at least one.
Variants§
Class
class / abstract class / open class / sealed class.
Data
data class — Kotlin requires at least one constructor property, which
KtClass::data takes.
Fields
ctor: Vec<KtCtorParam>Value
@JvmInline value class (the annotation is added by the renderer) —
exactly one property.
Fields
field: Box<KtCtorParam>Enum
enum class with its entries and an optional primary constructor the
entries pass arguments to.
Object
Interface
A plain interface — members with no body render as abstract
signatures.
SealedInterface
A sealed interface — an exhaustive set of alternatives whose
implementations are nested inside it as Self::Data classes and
Self::DataObjects.
DataObject
A data object — the singleton counterpart of a data class, for an
alternative that carries no payload.
Implementations§
Source§impl KtClassKind
impl KtClassKind
Sourcepub fn ctor_params(&self) -> &[KtCtorParam]
pub fn ctor_params(&self) -> &[KtCtorParam]
The primary-constructor parameters this kind carries — empty for the kinds that have no primary constructor.
Sourcepub fn entries(&self) -> &[KtEnumEntry]
pub fn entries(&self) -> &[KtEnumEntry]
The entries of an enum class; empty for every other kind.
Trait Implementations§
Source§impl Clone for KtClassKind
impl Clone for KtClassKind
Source§fn clone(&self) -> KtClassKind
fn clone(&self) -> KtClassKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more