Attribute Macro ty
#[ty]Expand description
Makes a native Rust type usable as a Typst type.
This implements NativeType for the given type.
ⓘ
/// A sequence of codepoints.
#[ty(scope, title = "String")]
struct Str(EcoString);
#[scope]
impl Str {
...
}§Properties
You can customize some properties of the resulting type:
scope: Indicates that the type has an associated scope defined by the#[scope]macrocast: Indicates that the type has a customcast!implementation. The macro will then not autogenerate one.name: The type’s normal name (e.g.str), as exposed to Typst. Defaults to the Rust name in kebab-case.title: The type’s title case name (e.g.String). Defaults to the normal name in title case.