Expand description
Foundational types and functions.
Modules§
- calc
- Calculations and processing of numeric values.
- ops
- Operations on values.
- repr
- Debug representation of values.
- sys
- System-related things.
Macros§
- cast
- Implements
Reflect,FromValue, andIntoValuefor a type. - eco_
format - Create a new
EcoStringfrom a format string. - eco_vec
- Create a new
EcoVecwith the given elements.
Structs§
- Arg
- An argument to a function call:
12ordraw: false. - Args
- Captured arguments to a function.
- Array
- A sequence of values.
- Auto
Value - A value that indicates a smart default.
- Binding
- A bound value with metadata.
- Bytes
- A sequence of bytes.
- Closure
- A user-defined closure.
- Content
- A piece of document content.
- Content
Vtable - A vtable for performing element-specific actions on type-erased content. Also contains general metadata for the specific element.
- Context
- Data that is contextually made available to code.
- Context
Elem - Executes a
contextblock. - Decimal
- A fixed-point decimal number type.
- Deprecation
- Information about a deprecated binding.
- Depth
- A type that accumulates depth when folded.
- Derived
- A type that contains a user-visible source portion and something that is derived from it, but not user-visible.
- Dict
- A map from string keys to values.
- Display
Pattern - A format in which a datetime can be displayed.
- Duration
- Represents a positive or negative span of time.
- Dynamic
- A value that is not part of the built-in enum.
- Element
- A document element.
- Entries
- An iterator over the entries in a style chain.
- External
Field Data - Metadata for an
ExternalField. - Field
- An accessor for the
I-th field of the elementE. Values of this type are generated for each field of an element can be used to interact with this field programmatically, for example to access the style chain, as instyles.get(TextElem::size). - Field
Vtable - A vtable for performing field-specific actions on type-erased content. Also contains general metadata for the specific field.
- Func
- A mapping from argument values to a return value.
- Index
Map - A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
- Label
- A label for an element.
- Lazy
Element Store - Lazily initialized data for an element.
- Links
- An iterator over the links of a style chain.
- Locatable
Selector - A selector that can be used with
query. - Module
- A collection of variables and functions that are commonly related to a single theme.
- Native
Func Data - Defines a native function.
- Native
Func Ptr - A pointer to a native function’s implementation.
- Native
Rule Map - Holds native show rules.
- Native
Show Rule - The show rule for a native element.
- Native
Type Data - Defines a native type.
- None
Value - A value that indicates the absence of any other value.
- OneOr
Multiple - One element, or multiple provided as an array.
- Packed
- A packed element of a static type.
- Param
Info - Describes a function parameter.
- Plugin
Func - A function loaded from a WebAssembly plugin.
- Positive
F64 - A floating-point number that must be positive (strictly larger than zero).
- Property
- A style property originating from a set rule or constructor.
- Recipe
- A show rule recipe.
- Recipe
Index - Identifies a show rule recipe from the top of the chain.
- Regex
- A regular expression.
- Required
Field Data - Metadata and routines for a
RequiredField. - Scope
- A map from binding names to values.
- Scopes
- A stack of scopes.
- Sequence
Elem - A sequence of content.
- Settable
- A settable field of an element.
- Settable
Field Data - Metadata and routines for a
SettableField. - Settable
Property Data - Metadata and routines for a
SettableProperty. - Showable
Selector - A selector that can be used with show rules.
- Small
Vec - A
Vec-like container that can store a small number of elements inline. - Str
- A sequence of Unicode codepoints.
- Style
Chain - A chain of styles, similar to a linked list.
- Styled
Elem - Content alongside styles.
- Styles
- A list of style properties.
- Symbol
- A Unicode symbol.
- Symbol
Elem - A single character.
- Symbol
Variant - A value that can be cast to a symbol.
- Synthesized
Field Data - Metadata and routines for a
SynthesizedField. - Target
Elem - This element exists solely to host the
targetstyle chain field. It is never constructed and not visible to users. - ToArray
- A value that can be cast to bytes.
- ToBytes
- A value that can be cast to bytes.
- ToDict
- A value that can be cast to dictionary.
- ToFloat
- A value that can be cast to a float.
- ToInt
- A value that can be cast to an integer.
- Type
- Describes a kind of value.
- Version
- A version with an arbitrary number of components.
Enums§
- Argument
Key - A key that can be used to get an argument: either the index of a positional argument, or the name of a named argument.
- Capturer
- What the variable was captured by.
- Cast
Info - Describes a possible value for a cast.
- Closure
Node - Distinguishes between variants of closures.
- Datetime
- Represents a date, a time, or a combination of both.
- Endianness
- Represents the byte order used for converting integers and floats to bytes and vice versa.
- Field
Access Error - An error arising when trying to access a field of content.
- Never
- An uninhabitable type.
- Replacement
- A replacement for a matched
Str - Selector
- A filter for selecting elements within the document.
- Smart
- A value that can be automatically determined.
- StrPattern
- A pattern which can be searched for in a string.
- StrSide
- A side of a string.
- Style
- A single style property or recipe.
- Target
- The export target.
- ToDecimal
- A value that can be cast to a decimal.
- ToStr
- A value that can be cast to a string.
- Transformation
- A show rule transformation that can be applied to a match.
- Unicode
Normal Form - A Unicode normalization form.
- Value
- A computational value.
- Version
Components - One or multiple version components.
Constants§
Traits§
- Alternative
Fold - A variant of fold for foldable optional (
Option<T>) values where an innerNonevalue isn’t respected (contrary toOption’s usualFoldimplementation, with which folding with an innerNonealways returnsNone). Instead, when either of theOptionobjects isNone, the other one is necessarily returned byfold_or. Normal folding still occurs when both values areSome, usingT’sFoldimplementation. - Chainable
- Things that can be attached to a style chain.
- Construct
- An element’s constructor function.
- Container
- A container for an argument.
- External
Field - A field that is not actually there. It’s only visible in the docs.
- Fold
- A property that is folded to determine its final value.
- From
Value - Try to cast a Typst
Valueinto a Rust type. - Into
Args - Things that can be used as arguments.
- Into
Result - Cast a Rust type or result into a
SourceResult<Value>. - Into
Value - Cast a Rust type into a Typst
Value. - Native
Element - A Typst element that is defined by a native Rust type.
- Native
Func - A Typst function that is defined by a native Rust type that shadows a native Rust function.
- Native
Scope - Defines the associated scope of a Rust type.
- Native
Type - A Typst type that is defined by a native Rust type.
- Plain
Text - Tries to extract the plain-text representation of the element.
- Refable
Property - A settable property that can be accessed by reference (because it is not folded).
- Reflect
- Determine details of a type.
- Repr
- A trait that defines the
reprof a Typst value. - Required
Field - A field that is present on every instance of the element.
- Resolve
- A property that is resolved with other properties from the style chain.
- Set
- An element’s set rule.
- Settable
Field - A field that has a default value and can be configured via a set rule, but can also present on elements and be present in the constructor.
- Settable
Property - A field that has a default value and can be configured via a set rule, but is never present on elements.
- ShowSet
- Defines built-in show set rules for an element.
- Synthesize
- Synthesize fields on an element. This happens before execution of any show rule.
- Synthesized
Field - A field that is initially unset, but may be set through a
Synthesizeimplementation. - Unlabellable
- Indicates that an element cannot be labelled.
Functions§
- assert
- Ensures that a condition is fulfilled.
- convert_
float_ to_ int - eval
- Evaluates a string as Typst code.
- fields_
on - List the available fields for a type.
- panic
- Fails with an error.
- plugin
- Loads a WebAssembly module.
- target
- Returns the current export target.
Type Aliases§
Attribute Macros§
- elem
- Makes a native Rust type usable as a Typst element.
- func
- Makes a native Rust function usable as a Typst function.
- scope
- Provides an associated scope to a native function, type, or element.
- ty
- Makes a native Rust type usable as a Typst type.
Derive Macros§
- Cast
- Implements
Reflect,FromValue, andIntoValuefor an enum.