Understanding the Live DSL type system helps with writing and debugging Live code effectively.
These special variants in LiveValue represent the types supported in Live DSL:
Here are explanations of some key types:
Str(&'static str)
: Static string reference, determined at compile time, stored in program binaryString(Arc<str>)
: Dynamic string, wrapped in Arc smart pointer for shared ownershipInlineString
: Short string optimization, stored inline without heap allocationThe compiler automatically selects the most appropriate string representation based on context and usage scenario.
Root
: Represents the root node of Live document, includes id_resolve for identifier resolutionClass
: Used for component class definition, includes:
Close
: Indicates the end of a block, used with Object/ArrayObject
: Indicates the start of an objectArray
: Indicates the start of an arrayDSL
: Used for embedding Domain Specific Languages, such as shader code
use
: Used for importing other modules, contains import informationpub
: Used for exporting public components, contains export informationClone
: Copies an existing component, includes:
Deref
: Dereferences a component reference, includes:
Makepad Live values go through serialization and deserialization at runtime. For this, Makepad uses CBOR (Concise Binary Object Representation) format.
CBOR
has several key features that make it particularly suitable for Makepad:
In summary, CBOR provides Makepad with: