Expand description
Foundational types and functions.
Re-exports§
pub use self::repr::Repr;
Modules§
- calc
- Calculations and processing of numeric values.
- ops
- Operations on values.
- repr
- Debug representation of values.
- sys
- System-related things.
Macros§
- array
- Create a new
Array
from values. - cast
- Implements
Reflect
,FromValue
, andIntoValue
for a type. - dict
- Create a new
Dict
from key-value pairs. - format_
str - Create a new
Str
from a format string. - select_
where - A helper macro to create a field selector used in
Selector::Elem
Structs§
- Arg
- An argument to a function call:
12
ordraw: 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.
- Context
- Data that is contextually made available to code.
- Context
Elem - Executes a
context
block. - Decimal
- A fixed-point decimal number type.
- 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.
- Func
- A mapping from argument values to a return value.
- Label
- A label for an element.
- Links
- An iterator over the links of a style chain.
- Locatable
Selector - A selector that can be used with
query
. - Module
- An module of definitions.
- Native
Element Data - Defines a native element.
- Native
Func Data - Defines a native function.
- 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.
- 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.
- Scope
- A map from binding names to values.
- Scopes
- A stack of scopes.
- Sequence
Elem - A sequence of content.
- Showable
Selector - A selector that can be used with show rules.
- 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.
- Target
Elem - This element exists solely to host the
target
style 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.
- 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.
- Value
- A computational value.
- Version
Components - One or multiple version components.
Traits§
- Alternative
Fold - A variant of fold for foldable optional (
Option<T>
) values where an innerNone
value isn’t respected (contrary toOption
’s usualFold
implementation, with which folding with an innerNone
always returnsNone
). Instead, when either of theOption
objects isNone
, the other one is necessarily returned byfold_or
. Normal folding still occurs when both values areSome
, usingT
’sFold
implementation. - Capable
- Used to cast an element to a trait object for a trait it implements.
- Chainable
- Things that can be attached to a style chain.
- Construct
- An element’s constructor function.
- Container
- A container for an argument.
- Fields
- Defines how fields of an element are accessed.
- Fold
- A property that is folded to determine its final value.
- From
Value - Try to cast a Typst
Value
into 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.
- Reflect
- Determine details of a type.
- Resolve
- A property that is resolved with other properties from the style chain.
- Set
- An element’s set rule.
- Show
- Defines a built-in show rule for an element.
- ShowSet
- Defines built-in show set rules for an element.
- Synthesize
- Synthesize fields on an element. This happens before execution of any show rule.
- 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.
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
, andIntoValue
for an enum.