skir_client/type_descriptor
Types
pub type EnumDescriptor {
EnumDescriptor(
name: String,
qualified_name: String,
module_path: String,
doc: String,
removed_numbers: List(Int),
variants: List(EnumVariant),
)
}
Constructors
-
EnumDescriptor( name: String, qualified_name: String, module_path: String, doc: String, removed_numbers: List(Int), variants: List(EnumVariant), )
pub type EnumVariant {
ConstantVariant(name: String, number: Int, doc: String)
WrapperVariant(
name: String,
number: Int,
variant_type: TypeSignature,
doc: String,
)
}
Constructors
-
ConstantVariant(name: String, number: Int, doc: String) -
WrapperVariant( name: String, number: Int, variant_type: TypeSignature, doc: String, )
pub type PrimitiveType {
Bool
Int32
Int64
Hash64
Float32
Float64
Timestamp
StringType
Bytes
}
Constructors
-
Bool -
Int32 -
Int64 -
Hash64 -
Float32 -
Float64 -
Timestamp -
StringType -
Bytes
A record definition: either a struct or an enum.
pub type RecordDescriptor {
StructRecord(StructDescriptor)
EnumRecord(EnumDescriptor)
}
Constructors
-
StructRecord(StructDescriptor) -
EnumRecord(EnumDescriptor)
pub type StructDescriptor {
StructDescriptor(
name: String,
qualified_name: String,
module_path: String,
doc: String,
removed_numbers: List(Int),
fields: List(StructField),
)
}
Constructors
-
StructDescriptor( name: String, qualified_name: String, module_path: String, doc: String, removed_numbers: List(Int), fields: List(StructField), )
pub type StructField {
StructField(
name: String,
number: Int,
field_type: TypeSignature,
doc: String,
)
}
Constructors
-
StructField( name: String, number: Int, field_type: TypeSignature, doc: String, )
A self-describing Skir type that carries both a type signature and all
record definitions (structs and enums) it references, keyed by their
"<module_path>:<qualified_name>" ID.
pub type TypeDescriptor {
TypeDescriptor(
type_sig: TypeSignature,
records: dict.Dict(String, RecordDescriptor),
)
}
Constructors
-
TypeDescriptor( type_sig: TypeSignature, records: dict.Dict(String, RecordDescriptor), )
The shape of a Skir type. Records (structs and enums) are represented
as a Record(id) where id is the record’s fully-qualified ID string
"<module_path>:<qualified_name>". The actual record definitions live in
the TypeDescriptor.records map.
pub type TypeSignature {
Primitive(PrimitiveType)
Optional(TypeSignature)
Array(item_type: TypeSignature, key_extractor: String)
Record(String)
}
Constructors
-
Primitive(PrimitiveType) -
Optional(TypeSignature) -
Array(item_type: TypeSignature, key_extractor: String) -
Record(String)
Values
pub fn type_descriptor_from_json(
json: String,
) -> Result(TypeDescriptor, String)
Parses a TypeDescriptor from a JSON string produced by this module, or by the equivalent Go or Rust skir client implementations.
pub fn type_descriptor_to_json(td: TypeDescriptor) -> String
Serializes a TypeDescriptor to a pretty-printed JSON string. The format is compatible with the Go and Rust skir client implementations.