Skip to main content

Module codegen

Module codegen 

Source
Expand description

Typst code generation and type conversion.

Provides bidirectional conversion between Rust/JSON and Typst types.

§Modules

  • [serialize] - Typst → JSON conversion
  • [deserialize] - JSON → Typst conversion
  • [lookup] - Function lookup utilities
  • [source] - Rust → Typst source code generation
  • [builder] - Dict/Array construction helpers
  • [inputs] - sys.inputs builder from JSON
  • [error] - Error types

Structs§

DictBuilder
Builder for Typst dictionary literals.
Inputs
Opaque inputs type for sys.inputs injection.

Enums§

ConvertError
Error during JSON to Typst conversion.

Traits§

ToTypst
Convert a Rust value to Typst source code.

Functions§

array
Build a Typst array from items.
array_raw
Build a Typst array from raw code items.
content_to_json
Serialize Content to JSON.
dict
Build a Typst dictionary from entries.
dict_raw
Build a Typst dictionary from raw code entries.
dict_sparse
Build a Typst dictionary with optional values.
format_array
Format items as Typst array literal.
json_to_content
Convert JSON to Typst Content.
json_to_simple_text
Simplify JSON by extracting text from Content objects.
json_to_simple_value
Convert JSON value to Typst Value (simple, without Content reconstruction).
json_to_value
Convert JSON to Typst Value.
parse_angle
Parse an angle literal.
parse_color
Parse a color literal.
parse_length
Parse a length literal.
parse_ratio
Parse a ratio literal.
parse_typst_literal
Try to parse a string as a Typst literal value.
value_to_json
Serialize Value to JSON.